本文整理汇总了C++中KShortcut函数的典型用法代码示例。如果您正苦于以下问题:C++ KShortcut函数的具体用法?C++ KShortcut怎么用?C++ KShortcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KShortcut函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: KAction
void WicdApplet::setupActions()
{
KAction* preferencesAction = new KAction(KIcon("preferences-system-network"), i18n("Wicd Configuration"), this);
preferencesAction->setShortcuts(KShortcut("Ctrl+P"));
addAction("configure_wicd", preferencesAction);
connect(preferencesAction, SIGNAL(triggered()), this, SLOT(showPreferences()));
KAction* connectInfoAction = new KAction(KIcon("help-about"), i18n("Connection information"), this);
addAction("connection_info", connectInfoAction);
connect(connectInfoAction, SIGNAL(triggered()), this, SLOT(connectionInfoRequested()));
KAction* createadhocAction = new KAction(KIcon("list-add"), i18n("Create an ad-hoc network"), this);
createadhocAction->setShortcuts(KShortcut("Ctrl+A"));
addAction("createadhoc", createadhocAction);
connect(createadhocAction, SIGNAL(triggered()), this, SLOT(createAdhocDialog()));
KAction* findnetworkAction = new KAction(KIcon("edit-find"), i18n("Find a hidden network"), this);
findnetworkAction->setShortcuts(KShortcut("Ctrl+F"));
addAction("findnetwork", findnetworkAction);
connect(findnetworkAction, SIGNAL(triggered()), this, SLOT(findHiddenDialog()));
KAction* rfkillAction = new KAction(i18n("RfKill"), this);
rfkillAction->setShortcuts(KShortcut("Ctrl+K"));
addAction("rfkill", rfkillAction);
connect(rfkillAction, SIGNAL(triggered()), this, SLOT(rfkill()));
KAction* reloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this);
reloadAction->setShortcuts(KShortcut("Ctrl+R"));
addAction("reload", reloadAction);
connect(reloadAction, SIGNAL(triggered()), this, SLOT(scan()));
}
开发者ID:KDE,项目名称:wicd-kde,代码行数:30,代码来源:wicdapplet.cpp
示例2: Q_UNUSED
void KGlobalShortcutTest::setupTest(QString id)
{
if (m_actionA) {
m_actionA->forgetGlobalShortcut();
delete m_actionA;
}
if (m_actionB) {
m_actionB->forgetGlobalShortcut();
delete m_actionB;
}
// Ensure that the previous test did cleanup correctly
KGlobalAccel *kga = KGlobalAccel::self();
Q_UNUSED(kga);
m_actionA = new KAction("Text For Action A", this);
m_actionA->setObjectName("Action A:" + id);
m_actionA->setGlobalShortcut(
KShortcut(sequenceA, sequenceB),
KAction::ActiveShortcut|KAction::DefaultShortcut,
KAction::NoAutoloading);
m_actionB = new KAction("Text For Action B", this);
m_actionB->setObjectName("Action B:" + id);
m_actionB->setGlobalShortcut(
KShortcut(),
KAction::ActiveShortcut|KAction::DefaultShortcut,
KAction::NoAutoloading);
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:31,代码来源:kglobalshortcuttest.cpp
示例3: file
/** Initialize the accelerator @p id by checking if it is overridden
in the configuration file (and if it isn't, use the default).
On X11, if QApplication was initialized with GUI disabled,
the default will always be used.
*/
static void initialize(StandardShortcut id)
{
KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
// All three are needed.
if (info->id!=AccelNone) {
Q_ASSERT(info->description);
Q_ASSERT(info->translation_context);
Q_ASSERT(info->name);
}
KConfigGroup cg(KGlobal::config(), "Shortcuts");
#ifdef Q_WS_X11
// Code within this block breaks if we aren't running in GUI mode.
if(QX11Info::display() && cg.hasKey(info->name))
#else
if(cg.hasKey(info->name))
#endif
{
QString s = cg.readEntry(info->name);
if (s != "none")
info->cut = KShortcut(s);
else
info->cut = KShortcut();
} else {
info->cut = hardcodedDefaultShortcut(id);
}
info->isInitialized = true;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:36,代码来源:kstandardshortcut.cpp
示例4: Plugin
KGet_plug_in::KGet_plug_in( QObject* parent, const char* name )
: Plugin( parent, name )
{
QPixmap pix = KGlobal::iconLoader()->loadIcon("kget",
KIcon::MainToolbar);
KActionMenu *menu = new KActionMenu( i18n("Download Manager"), pix,
actionCollection(), "kget_menu" );
menu->setDelayed( false );
connect( menu->popupMenu(), SIGNAL( aboutToShow() ), SLOT( showPopup() ));
m_paToggleDropTarget=new KToggleAction(i18n("Show Drop Target"),
KShortcut(),
this, SLOT(slotShowDrop()),
actionCollection(), "show_drop" );
menu->insert( m_paToggleDropTarget );
KAction *action = new KAction(i18n("List All Links"), KShortcut(),
this, SLOT( slotShowLinks() ),
actionCollection(), "show_links");
menu->insert( action );
p_dcopServer= new DCOPClient();
p_dcopServer->attach ();
}
开发者ID:woodyplus,项目名称:kde3-kdenetwork,代码行数:25,代码来源:kget_plug_in.cpp
示例5: KCModule
LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new LookingGlassEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
connect(m_ui->radiusSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("LookingGlass");
m_actionCollection->setConfigGlobal(true);
KAction* a;
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
m_ui->editor->addCollection(m_actionCollection);
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:33,代码来源:lookingglass_config.cpp
示例6: KToolBarPopupAction
void ActionManagerImpl::initFrameManager(FrameManager* frameManager)
{
if (d->frameManager)
return;
d->frameManager = frameManager;
bool isRTL = QApplication::isRightToLeft();
KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon(isRTL ? "go-previous" : "go-next"), i18nc("Go forward in browser history", "Forward"), this);
d->actionCollection->addAction("browser_forward", forward);
forward->setShortcuts(KShortcut(isRTL ? "Alt+Left" : "Alt+Right"));
connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward()));
connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow()));
KToolBarPopupAction* back = new KToolBarPopupAction(KIcon(isRTL ? "go-next" : "go-previous"), i18nc("Go back in browser history", "Back"), this);
d->actionCollection->addAction("browser_back", back);
back->setShortcuts(KShortcut(isRTL ? "Alt+Right" : "Alt+Left"));
connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack()));
connect(back->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserBackAboutToShow()));
KAction *action = d->actionCollection->addAction("browser_reload");
action->setIcon(KIcon("view-refresh"));
action->setText(i18nc("Reload current page", "Reload"));
connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserReload()));
action = d->actionCollection->addAction("browser_stop");
action->setIcon(KIcon("process-stop"));
action->setText(i18n("Stop"));
connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserStop()));
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:33,代码来源:actionmanagerimpl.cpp
示例7: KCModule
MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new MouseMarkEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->comboColors, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection( this, KComponentData("kwin") );
KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" ));
a->setText( i18n( "Clear Mouse Marks" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 ));
a = static_cast< KAction* >( m_actionCollection->addAction( "ClearLastMouseMark" ));
a->setText( i18n( "Clear Last Mouse Mark" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F12 ));
m_ui->editor->addCollection(m_actionCollection);
load();
}
开发者ID:lmurray,项目名称:kwin,代码行数:30,代码来源:mousemark_config.cpp
示例8: KCModule
MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new MouseMarkEffectConfigForm(this);
m_ui->kcfg_LineWidth->setSuffix(ki18np(" pixel", " pixels"));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
addConfig(MouseMarkConfig::self(), m_ui);
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast< KAction* >(m_actionCollection->addAction("ClearMouseMarks"));
a->setText(i18n("Clear Mouse Marks"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
a = static_cast< KAction* >(m_actionCollection->addAction("ClearLastMouseMark"));
a->setText(i18n("Clear Last Mouse Mark"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
m_ui->editor->addCollection(m_actionCollection);
load();
}
开发者ID:walac,项目名称:kde-workspace,代码行数:30,代码来源:mousemark_config.cpp
示例9: setupTest
void KGlobalShortcutTest::testSaveRestore()
{
setupTest("testSaveRestore");
//It /would be nice/ to test persistent storage. That is not so easy...
KShortcut cutA = m_actionA->globalShortcut();
// Delete the action
delete m_actionA;
// Recreate it
m_actionA = new KAction("Text For Action A", this);
m_actionA->setObjectName("Action A:testSaveRestore");
// Now it's empty
QVERIFY(m_actionA->globalShortcut().isEmpty());
m_actionA->setGlobalShortcut(KShortcut());
// Now it's restored
QCOMPARE(m_actionA->globalShortcut(), cutA);
// And again
delete m_actionA;
m_actionA = new KAction("Text For Action A", this);
m_actionA->setObjectName("Action A:testSaveRestore");
m_actionA->setGlobalShortcut(KShortcut(QKeySequence(), cutA.primary()));
QCOMPARE(m_actionA->globalShortcut(), cutA);
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:28,代码来源:kglobalshortcuttest.cpp
示例10: actionCollection
void ActionManagerImpl::initTabWidget(TabWidget* tabWidget)
{
if (d->tabWidget)
return;
else
d->tabWidget = tabWidget;
KActionCollection *coll = actionCollection();
KAction *action = coll->addAction("select_next_tab");
action->setText(i18n("Select Next Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotNextTab()));
action->setShortcuts(KShortcut( "Ctrl+Period" ));
action = coll->addAction("select_previous_tab");
action->setText(i18n("Select Previous Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotPreviousTab()));
action->setShortcuts(KShortcut( "Ctrl+Comma" ));
action = coll->addAction("tab_detach");
action->setIcon(KIcon("tab-detach"));
action->setText(i18n("Detach Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotDetachTab()));
action->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_B));
action = coll->addAction("tab_copylinkaddress");
action->setText(i18n("Copy Link Address"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCopyLinkAddress()));
action = coll->addAction("tab_remove");
action->setIcon(KIcon("tab-close"));
action->setText(i18n("Close Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCloseTab()));
action->setShortcuts(KStandardShortcut::close());
action = coll->addAction("inc_font_sizes");
action->setIcon(KIcon("format-font-size-more"));
action->setText(i18n("Enlarge Font"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomIn()));
action->setShortcut( QKeySequence::ZoomIn );
action = coll->addAction("dec_font_sizes");
action->setIcon(KIcon("format-font-size-less"));
action->setText(i18n("Shrink Font"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomOut()));
action->setShortcut( QKeySequence::ZoomOut );
QString actionname;
for (int i=1;i<10;i++) {
actionname.sprintf("activate_tab_%02d", i);
action = new KAction( i18n("Activate Tab %1", i),this );
action->setShortcut( QKeySequence( QString::fromLatin1( "Alt+%1" ).arg( i ) ) );
coll->addAction( actionname, action );
connect( action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotActivateTab()) );
}
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:58,代码来源:actionmanagerimpl.cpp
示例11: KAction
void KSlovar::registerButtons()
{
m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary");
m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection());
m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection());
m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection());
m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection());
m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary");
m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection());
m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection());
m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection());
m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch");
m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch");
m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection());
m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection());
m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase");
m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase");
m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase");
m_listPopup=new QPopupMenu;
m_addPhrase->plug(m_listPopup);
m_editPhrase->plug(m_listPopup);
m_removePhrase->plug(m_listPopup);
m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());
m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion");
m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages");
m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard");
}
开发者ID:BackupTheBerlios,项目名称:kslovar-svn,代码行数:35,代码来源:kslovar.cpp
示例12: setPreferredToolBoxPlugin
void DesktopCorona::init()
{
setPreferredToolBoxPlugin(Plasma::Containment::DesktopContainment, "org.kde.desktoptoolbox");
setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, "org.kde.desktoptoolbox");
setPreferredToolBoxPlugin(Plasma::Containment::PanelContainment, "org.kde.paneltoolbox");
setPreferredToolBoxPlugin(Plasma::Containment::CustomPanelContainment, "org.kde.paneltoolbox");
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init start" << "(line:" << __LINE__ << ")";
Kephal::Screens *screens = Kephal::Screens::self();
connect(screens, SIGNAL(screenAdded(Kephal::Screen*)), SLOT(screenAdded(Kephal::Screen*)));
connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SIGNAL(availableScreenRegionChanged()));
Plasma::ContainmentActionsPluginsConfig desktopPlugins;
desktopPlugins.addPlugin(Qt::NoModifier, Qt::Vertical, "switchdesktop");
desktopPlugins.addPlugin(Qt::NoModifier, Qt::MidButton, "paste");
desktopPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");
Plasma::ContainmentActionsPluginsConfig panelPlugins;
panelPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");
setContainmentActionsDefaults(Plasma::Containment::DesktopContainment, desktopPlugins);
setContainmentActionsDefaults(Plasma::Containment::CustomContainment, desktopPlugins);
setContainmentActionsDefaults(Plasma::Containment::PanelContainment, panelPlugins);
setContainmentActionsDefaults(Plasma::Containment::CustomPanelContainment, panelPlugins);
checkAddPanelAction();
//why do these actions belong to plasmaapp?
//because it makes the keyboard shortcuts work.
KAction *action = new KAction(PlasmaApp::self());
action->setText(i18n("Next Activity"));
action->setObjectName( QLatin1String("Next Activity" )); // NO I18N
action->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Tab));
connect(action, SIGNAL(triggered()), this, SLOT(activateNextActivity()));
action = new KAction(PlasmaApp::self());
action->setText(i18n("Previous Activity"));
action->setObjectName( QLatin1String("Previous Activity" )); // NO I18N
action->setGlobalShortcut(KShortcut(Qt::META + Qt::SHIFT + Qt::Key_Tab));
connect(action, SIGNAL(triggered()), this, SLOT(activatePreviousActivity()));
connect(this, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
this, SLOT(updateImmutability(Plasma::ImmutabilityType)));
connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(checkAddPanelAction(QStringList)));
connect(m_activityController, SIGNAL(currentActivityChanged(QString)), this, SLOT(currentActivityChanged(QString)));
connect(m_activityController, SIGNAL(activityAdded(QString)), this, SLOT(activityAdded(QString)));
connect(m_activityController, SIGNAL(activityRemoved(QString)), this, SLOT(activityRemoved(QString)));
mapAnimation(Plasma::Animator::AppearAnimation, Plasma::Animator::ZoomAnimation);
mapAnimation(Plasma::Animator::DisappearAnimation, Plasma::Animator::ZoomAnimation);
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init end" << "(line:" << __LINE__ << ")";
}
开发者ID:mleduque,项目名称:kwin-tiling,代码行数:52,代码来源:desktopcorona.cpp
示例13: Q_ASSERT
KShortcut KAction::shortcut(ShortcutTypes type) const
{
Q_ASSERT(type);
if (type == DefaultShortcut) {
QList<QKeySequence> shortcuts = property("defaultShortcuts").value<QList<QKeySequence> >();
return KShortcut(shortcuts);
}
QKeySequence primary = shortcuts().value(0);
QKeySequence secondary = shortcuts().value(1);
return KShortcut(primary, secondary);
}
开发者ID:KDE,项目名称:kdelibs4support,代码行数:13,代码来源:kaction.cpp
示例14: KShortcut
void KCompletionBase::useGlobalKeyBindings()
{
if ( d->m_delegate ) {
d->m_delegate->useGlobalKeyBindings();
return;
}
d->m_keyMap.clear();
d->m_keyMap.insert( TextCompletion, KShortcut() );
d->m_keyMap.insert( PrevCompletionMatch, KShortcut() );
d->m_keyMap.insert( NextCompletionMatch, KShortcut() );
d->m_keyMap.insert( SubstringCompletion, KShortcut() );
}
开发者ID:vasi,项目名称:kdelibs,代码行数:13,代码来源:kcompletionbase.cpp
示例15: actionCollection
void GUI::setupActions()
{
KActionCollection* ac = actionCollection();
KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
new_action->setToolTip(i18n("Create a new torrent"));
KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
open_action->setToolTip(i18n("Open a torrent"));
paste_action = KStandardAction::paste(this, SLOT(paste()), ac);
open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this);
open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently()));
ac->addAction("file_open_silently", open_silently_action);
KStandardAction::quit(this, SLOT(quit()), ac);
show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac);
show_status_bar_action->setIcon(KIcon("kt-show-statusbar"));
show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac);
KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);
paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this);
paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P));
connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL()));
ac->addAction("paste_url", paste_url_action);
ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this);
ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I));
connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter()));
ac->addAction("ipfilter_action", ipfilter_action);
import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this);
import_action->setToolTip(i18n("Import a torrent"));
import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I));
connect(import_action, SIGNAL(triggered()), this, SLOT(import()));
ac->addAction("import", import_action);
show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this);
connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide()));
ac->addAction("show_kt", show_kt_action);
show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T));
setStandardToolBarMenuEnabled(true);
}
开发者ID:dreamsxin,项目名称:ktorrent,代码行数:50,代码来源:gui.cpp
示例16: QString
// backward compatibility
void Settings::read_settings_v1(KConfig &cfg_P)
{
int sections = cfg_P.readNumEntry("Num_Sections", 0);
Action_data_group *menuentries = NULL;
for(Action_data_group::Iterator it(actions->first_child()); *it; ++it)
{
Action_data_group *tmp = dynamic_cast< Action_data_group * >(*it);
if(tmp == NULL)
continue;
if(tmp->system_group() == Action_data_group::SYSTEM_MENUENTRIES)
{
menuentries = tmp;
break;
}
}
for(int sect = 1; sect <= sections; ++sect)
{
QString group = QString("Section%1").arg(sect);
if(!cfg_P.hasGroup(group))
continue;
cfg_P.setGroup(group);
QString name = cfg_P.readEntry("Name");
if(name.isNull())
continue;
QString shortcut = cfg_P.readEntry("Shortcut");
if(shortcut.isNull())
continue;
QString run = cfg_P.readEntry("Run");
if(run.isNull())
continue;
bool menuentry = cfg_P.readBoolEntry("MenuEntry", false);
// CHECKME tohle pridavani az pak je trosku HACK
if(menuentry)
{
if(menuentries == NULL)
{
menuentries =
new Action_data_group(actions, i18n(MENU_EDITOR_ENTRIES_GROUP_NAME), i18n("These entries were created using Menu Editor."), NULL,
Action_data_group::SYSTEM_MENUENTRIES, true);
menuentries->set_conditions(new Condition_list("", menuentries));
}
(void)new Menuentry_shortcut_action_data(menuentries, name, "", KShortcut(shortcut), run);
}
else
{
(void)new Command_url_shortcut_action_data(actions, name, "", KShortcut(shortcut), run);
}
}
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:50,代码来源:settings.cpp
示例17: KisColorTransformationFilter
KisHSVAdjustmentFilter::KisHSVAdjustmentFilter()
: KisColorTransformationFilter(id(), categoryAdjust(), i18n("&HSV Adjustment..."))
{
setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)));
setSupportsPainting(true);
setSupportsIncrementalPainting(false);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:7,代码来源:kis_hsv_adjustment_filter.cpp
示例18: SimpleButton
QuickButton::QuickButton(const QString &u, KAction *configAction, QWidget *parent, const char *name)
: SimpleButton(parent, name), m_flashCounter(0), m_sticky(false)
{
installEventFilter(KickerTip::the());
setMouseTracking(true);
_highlight = false;
_oldCursor = cursor();
_qurl = new QuickURL(u);
QToolTip::add(this, _qurl->name());
resize(int(DEFAULT_ICON_DIM), int(DEFAULT_ICON_DIM));
QBrush bgbrush(colorGroup().brush(QColorGroup::Background));
QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu(parent, this, _qurl->url());
_popup = new QPopupMenu(this);
_popup->insertItem(i18n("Add Application"), addAppsMenu);
configAction->plug(_popup);
_popup->insertSeparator();
_popup->insertItem(SmallIcon("remove"), i18n("Remove"), this, SLOT(removeApp()));
m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"), KShortcut(), this);
connect(m_stickyAction, SIGNAL(toggled(bool)), this, SLOT(slotStickyToggled(bool)));
m_stickyAction->plug(_popup, 2);
m_stickyId = _popup->idAt(2);
connect(this, SIGNAL(clicked()), SLOT(launch()));
connect(this, SIGNAL(removeApp(QuickButton *)), parent, SLOT(removeAppManually(QuickButton *)));
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:28,代码来源:quickbutton.cpp
示例19: shortcut
void ShortcutDialog::accept()
{
for(int i = 0;; ++i)
{
KKeySequence seq = shortcut().seq(i);
if(seq.isNull())
break;
if(seq.key(0) == Key_Escape)
{
reject();
return;
}
if(seq.key(0) == Key_Space)
{ // clear
setShortcut(KShortcut());
KShortcutDialog::accept();
return;
}
if(seq.key(0).modFlags() == 0)
{ // no shortcuts without modifiers
KShortcut cut = shortcut();
cut.setSeq(i, KKeySequence());
setShortcut(cut);
return;
}
}
KShortcutDialog::accept();
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:28,代码来源:utils.cpp
示例20: QObject
KScriptAction::KScriptAction( const QString &scriptDesktopFile, QObject *interface, KActionCollection *ac )
: QObject(interface), KScriptClientInterface( )
{
m_interface = 0L;
m_action = 0L;
m_isValid = false;
m_refs = 0;
// Read the desktop file
if(KDesktopFile::isDesktopFile(scriptDesktopFile))
{
KDesktopFile desktop(scriptDesktopFile, true);
QFileInfo scriptPath(scriptDesktopFile);
m_scriptFile = scriptPath.dirPath(true) + "/" + desktop.readEntry("X-KDE-ScriptName", "");
m_scriptName = desktop.readName();
m_scriptType = desktop.readType();
QString scriptTypeQuery = "([X-KDE-Script-Runner] == '" + m_scriptType + "')";
KTrader::OfferList offers = KTrader::self()->query( "KScriptRunner/KScriptRunner", scriptTypeQuery );
if ( !offers.isEmpty() )
{
m_action = new KAction(m_scriptName, KShortcut(), this, SLOT(activate()), ac, "script");
m_isValid = true;
m_timeout = new QTimer(this);
QString icon = desktop.readIcon();
m_action->setStatusText(desktop.readComment());
if( !icon.isEmpty() )
m_action->setIcon(icon);
m_action->setShortcutConfigurable(true);
connect( m_timeout, SIGNAL(timeout()), SLOT(cleanup()) );
}
}
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:32,代码来源:kscriptactionmanager.cpp
注:本文中的KShortcut函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论