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()) ); } }
void KMixDockWidget::contextMenuAboutToShow( KPopupMenu* /* menu */ ) { KAction* showAction = actionCollection()->action("minimizeRestore"); if ( parentWidget() && showAction ) { if ( parentWidget()->isVisible() ) { showAction->setText( i18n("Hide Mixer Window") ); } else { showAction->setText( i18n("Show Mixer Window") ); } } // Enable/Disable "Muted" menu item MixDevice *md = 0; if ( _dockAreaPopup != 0 ) { md = _dockAreaPopup->dockDevice(); KToggleAction *dockMuteAction = static_cast<KToggleAction*>(actionCollection()->action("dock_mute")); //kdDebug(67100) << "---> md=" << md << "dockMuteAction=" << dockMuteAction << "isMuted=" << md->isMuted() << endl; if ( md != 0 && dockMuteAction != 0 ) { dockMuteAction->setChecked( md->isMuted() ); } } }
void SimonView::setupActions() { connectAction = new KAction(this); connectAction->setText(i18n("Connect")); connectAction->setCheckable(true); connectAction->setIcon(KIcon("network-disconnect")); connect(connectAction, SIGNAL(triggered(bool)), this, SLOT(toggleConnection())); actionCollection()->addAction("connect", connectAction); this->trayManager->addAction("connect", connectAction); activateAction = new KAction(this); activateAction->setText(i18n("Activate")); activateAction->setIcon(KIcon("media-playback-start")); activateAction->setCheckable(true); connect(activateAction, SIGNAL(triggered(bool)), this, SLOT(toggleActivation())); this->trayManager->addAction("activate", activateAction); activateAction->setEnabled(false); actionCollection()->addAction("activate", activateAction); //must be set after addAction() because of the unique name set in addAction(name,...) // deactivated because of KDE bug #307225 //activateAction->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::Key_Pause)); disconnectAction = new KAction(this); disconnectAction->setText(i18n("Disconnect")); disconnectAction->setIcon(KIcon("network-disconnect")); connect(disconnectAction, SIGNAL(triggered(bool)), control, SLOT(disconnectFromServer())); KToolBarPopupAction* connectActivate = new KToolBarPopupAction(KIcon("network-disconnect"), i18n("Connect"), this); connectActivate->setCheckable(true); connectActivate->setShortcut(Qt::CTRL + Qt::Key_C); actionCollection()->addAction("connectActivate", connectActivate); connect(connectActivate, SIGNAL(triggered(bool)), this, SLOT(toggleConnection())); KAction* recompile = new KAction(this); recompile->setEnabled(control->getStatus() != SimonControl::Disconnected); recompile->setText(i18n("Synchronize")); recompile->setIcon(KIcon("view-refresh")); recompile->setShortcut(Qt::CTRL + Qt::Key_F5); actionCollection()->addAction("compileModel", recompile); connect(recompile, SIGNAL(triggered(bool)), control, SLOT(compileModel())); KAction* sendSampleShareAction = new KAction(this); sendSampleShareAction->setText(i18n("Contribute samples")); sendSampleShareAction->setIcon(KIcon("repository")); actionCollection()->addAction("sampleShare", sendSampleShareAction); connect(sendSampleShareAction, SIGNAL(triggered(bool)),this, SLOT(showSampleShare())); actionCollection()->addAction(KStandardAction::Preferences, "configuration", this, SLOT(showSystemDialog())); KStandardAction::quit(this, SLOT(closeSimon()), actionCollection()); }
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(); }
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())); }
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(); }
void KSystemTray::mousePressEvent(QMouseEvent *e) { if(!rect().contains(e->pos())) return; switch(e->button()) { case LeftButton: toggleActive(); break; case MidButton: // fall through case RightButton: if(parentWidget()) { KAction *action = d->actionCollection->action("minimizeRestore"); if(parentWidget()->isVisible()) action->setText(i18n("&Minimize")); else action->setText(i18n("&Restore")); } contextMenuAboutToShow(menu); menu->popup(e->globalPos()); break; default: // nothing break; } }
void MainWindow::setupActions() { KStandardAction::quit(KApplication::instance(), SLOT(quit()), actionCollection()); // commit KAction *commitAction = actionCollection()->addAction("commit", ui->stageWidget, SLOT(commit())); commitAction->setText(i18n("Commit")); commitAction->setIcon(KIcon("git-commit")); commitAction->setShortcut(Qt::CTRL + Qt::Key_Return); KAction *stageFileAction = actionCollection()->addAction("file_stage", ui->stageWidget, SLOT(stageFile())); stageFileAction->setText(i18n("Stage File to Commit")); stageFileAction->setIcon(KIcon("git-file-stage")); stageFileAction->setShortcut(Qt::CTRL + Qt::Key_S); KAction *unstageFileAction = actionCollection()->addAction("file_unstage", ui->stageWidget, SLOT(unstageFile())); unstageFileAction->setText(i18n("Unstage File from Commit")); unstageFileAction->setIcon(KIcon("git-file-unstage")); unstageFileAction->setShortcut(Qt::CTRL + Qt::Key_U); // repository KAction *openRepoAction = actionCollection()->addAction("repository_open", this, SLOT(open())); openRepoAction->setText(i18n("Open repository")); openRepoAction->setIcon(KIcon("git-repo-open")); openRepoAction->setShortcut(Qt::CTRL + Qt::Key_O); KAction *reloadRepoAction = actionCollection()->addAction("repository_reload", this, SLOT(reload())); reloadRepoAction->setText(i18n("Reload repository")); reloadRepoAction->setIcon(KIcon("git-repo-reload")); reloadRepoAction->setShortcut(Qt::Key_F5); }
void soundKonverter::setupActions() { KStandardAction::quit( this, SLOT(close()), actionCollection() ); KStandardAction::preferences( this, SLOT(showConfigDialog()), actionCollection() ); KAction *logviewer = actionCollection()->addAction("logviewer"); logviewer->setText(i18n("View logs...")); logviewer->setIcon(KIcon("view-list-text")); connect( logviewer, SIGNAL(triggered()), this, SLOT(showLogViewer()) ); KAction *replaygainscanner = actionCollection()->addAction("replaygainscanner"); replaygainscanner->setText(i18n("Replay Gain tool...")); replaygainscanner->setIcon(KIcon("soundkonverter-replaygain")); connect( replaygainscanner, SIGNAL(triggered()), this, SLOT(showReplayGainScanner()) ); KAction *aboutplugins = actionCollection()->addAction("aboutplugins"); aboutplugins->setText(i18n("About plugins...")); aboutplugins->setIcon(KIcon("preferences-plugin")); connect( aboutplugins, SIGNAL(triggered()), this, SLOT(showAboutPlugins()) ); KAction *add_files = actionCollection()->addAction("add_files"); add_files->setText(i18n("Add files...")); add_files->setIcon(KIcon("audio-x-generic")); connect( add_files, SIGNAL(triggered()), m_view, SLOT(showFileDialog()) ); KAction *add_folder = actionCollection()->addAction("add_folder"); add_folder->setText(i18n("Add folder...")); add_folder->setIcon(KIcon("folder")); connect( add_folder, SIGNAL(triggered()), m_view, SLOT(showDirDialog()) ); KAction *add_audiocd = actionCollection()->addAction("add_audiocd"); add_audiocd->setText(i18n("Add CD tracks...")); add_audiocd->setIcon(KIcon("media-optical-audio")); connect( add_audiocd, SIGNAL(triggered()), m_view, SLOT(showCdDialog()) ); KAction *add_url = actionCollection()->addAction("add_url"); add_url->setText(i18n("Add url...")); add_url->setIcon(KIcon("network-workgroup")); connect( add_url, SIGNAL(triggered()), m_view, SLOT(showUrlDialog()) ); KAction *add_playlist = actionCollection()->addAction("add_playlist"); add_playlist->setText(i18n("Add playlist...")); add_playlist->setIcon(KIcon("view-media-playlist")); connect( add_playlist, SIGNAL(triggered()), m_view, SLOT(showPlaylistDialog()) ); KAction *load = actionCollection()->addAction("load"); load->setText(i18n("Load file list")); load->setIcon(KIcon("document-open")); connect( load, SIGNAL(triggered()), m_view, SLOT(loadFileList()) ); KAction *save = actionCollection()->addAction("save"); save->setText(i18n("Save file list")); save->setIcon(KIcon("document-save")); connect( save, SIGNAL(triggered()), m_view, SLOT(saveFileList()) ); actionCollection()->addAction("start", m_view->start()); actionCollection()->addAction("stop_menu", m_view->stopMenu()); }
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__ << ")"; }
App::App() : KUniqueApplication() ,m_networkAccessManager(new NetworkAccessManager(this)) ,m_oauth(new QOAuth::Interface(this)) ,m_parser(new QJson::Parser) ,m_mainWindow(0) ,m_controller(0) ,m_tray(0) { qmlRegisterType<QDeclarativePropertyMap>(); m_controller = new Controller; m_mainWindow = new MainWindow; m_tray = new KStatusNotifierItem(m_mainWindow); m_tray->setIconByName("kmoefm"); m_tray->setTitle(i18n("Moe FM")); m_tray->setToolTipIconByName("kmoefm"); m_tray->setToolTipTitle(i18n("KMoeFM")); m_tray->setToolTipSubTitle(i18n("Moe FM")); KAction* action; action = m_tray->actionCollection()->addAction(QLatin1String("relogin"), this, SLOT(relogin())); action->setText(i18n("Relogin")); m_tray->contextMenu()->addAction(action); m_tray->setAssociatedWidget(m_mainWindow); connect(m_controller, SIGNAL(infoChanged()), this, SLOT(updateInfo())); m_oauth->setConsumerKey(CONSUMER_KEY); m_oauth->setConsumerSecret(CONSUMER_SECRET); readSettings(); connect(this, SIGNAL(checkCredentialFinished(bool)), SLOT(firstRunCheck(bool))); QTimer::singleShot(0, this, SLOT(checkCredential())); }
void FileBrowserWidget::setupToolbar() { KActionCollection *coll = m_dirOperator->actionCollection(); m_toolbar->addAction(coll->action("back")); m_toolbar->addAction(coll->action("forward")); KAction *action = new KAction(this); action->setIcon(SmallIcon("document-open")); action->setText(i18n("Open selected")); connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal())); m_toolbar->addAction(action); // section for settings menu KActionMenu *optionsMenu = new KActionMenu(KIcon("configure"), i18n("Options"), this); optionsMenu->setDelayed(false); optionsMenu->addAction(m_dirOperator->actionCollection()->action("short view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("tree view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed tree view")); optionsMenu->addSeparator(); optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden")); m_toolbar->addSeparator(); m_toolbar->addAction(optionsMenu); }
void Katapult::initAccel(QWidget *parent) { globalAccel = new KGlobalAccel(parent); globalAccel->insert("show_katapult", i18n("Show Launcher"), i18n("Shows the Katapult launcher"), ALT+Key_Space, ALT+Key_Space, this, SLOT(showLauncher())); globalAccel->readSettings(); globalAccel->updateConnections(); actions = new KActionCollection(parent); actionCollection()->clear(); contextMenu()->clear(); new KAction(i18n("Execute"), "exec", Key_Return, this, SLOT(execute()), actions, "execute"); new KAction(i18n("Clear"), "editclear", Key_Left, this, SLOT(clearQuery()), actions, "clear"); new KAction(i18n("Close"), "fileclose", Key_Escape, this, SLOT(hideLauncher()), actions, "close"); new KAction(i18n("Complete Query"), "next", Key_Right, this, SLOT(completeQuery()), actions, "complete_query"); new KAction(i18n("Show Context Menu"), "menu", CTRL+Key_C, this, SLOT(showContextMenu()), actions, "show_menu"); KAction *actGlobAccel = KStdAction::keyBindings(this, SLOT(showGlobalShortcutsDialog()), actions); actGlobAccel->setText(i18n("Configure &Global Shortcuts...")); actGlobAccel->plug((QWidget *) contextMenu()); KStdAction::keyBindings(this, SLOT(showShortcutsDialog()), actions)->plug((QWidget *) contextMenu()); KStdAction::preferences(settings, SLOT(configure()), actions)->plug((QWidget *) contextMenu()); contextMenu()->insertSeparator(); KStdAction::aboutApp(this, SLOT(showAboutDialog()), actions)->plug((QWidget *) contextMenu()); contextMenu()->insertSeparator(); KStdAction::quit(this, SLOT(close()), actions)->plug((QWidget *) contextMenu()); actions->readShortcutSettings(); }
void MainWindow::setupActions() { actQuit = KStandardAction::quit(this, SLOT(quit()), actionCollection()); KAction *a = NULL; a = actionCollection()->addAction("minimizeRestore", this, SLOT(minimizeRestore())); a->setText(i18n("Minimize")); a->setIcon(KIcon("")); a->setShortcut(0); /** Settings : ************************************************************/ // m_actShowToolbar = KStandardAction::showToolbar( this, SLOT(toggleToolBar()), actionCollection()); m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection()); // m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) ); (void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection()); (void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection()); //KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() ); //actCfgNotifs->setEnabled(false); // Not yet implemented ! actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection()); }
KAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent) { KAction *pAction = 0; const Info* pInfo = infoPtr(id); if (pInfo) { pAction = new KAction(parent); pAction->setObjectName(pInfo->psName); KShortcut cut(pInfo->shortcut); if (!cut.isEmpty()) pAction->setShortcut(cut); pAction->setText(i18n(pInfo->psText)); pAction->setToolTip(i18n(pInfo->psToolTip)); pAction->setWhatsThis(i18n(pInfo->psWhatsThis)); if (pInfo->psIconName) pAction->setIcon(KIcon(QLatin1String(pInfo->psIconName))); } if (recvr && slot) QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot); if (pAction) { KActionCollection *collection = qobject_cast<KActionCollection *>(parent); if (collection) collection->addAction(pAction->objectName(), pAction); } return pAction; }
void TransfersView::populateHeaderActions() { m_headerMenu->clear(); m_headerMenu->addTitle(i18n("Select columns")); QSignalMapper *columnMapper = new QSignalMapper(this); connect(columnMapper, SIGNAL(mapped(int)), SLOT(slotHideSection(int))); //Create for each column an action with the column-header as name QVector<KAction*> orderedMenuItems(header()->count()); for (int i = 0; i < header()->count(); ++i) { KAction *action = new KAction(this); action->setText(model()->headerData(i, Qt::Horizontal).toString()); action->setCheckable(true); action->setChecked(!header()->isSectionHidden(i)); orderedMenuItems[header()->visualIndex(i)] = action; connect(action, SIGNAL(toggled(bool)), columnMapper, SLOT(map())); columnMapper->setMapping(action, i); } //append the sorted actions for (int i = 0; i < orderedMenuItems.count(); ++i) { m_headerMenu->addAction(orderedMenuItems[i]); } }
void ActionManagerImpl::initArticleListView(ArticleListView* articleList) { if (d->articleList) return; else d->articleList = articleList; KAction *action = actionCollection()->addAction("go_previous_article"); action->setText(i18n("&Previous Article")); connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotPreviousArticle())); action->setShortcuts(KShortcut( "Left" )); action = actionCollection()->addAction("go_next_article"); action->setText(i18n("&Next Article")); connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotNextArticle())); action->setShortcuts(KShortcut( "Right" )); }
WindowGeometry::WindowGeometry() { iAmActivated = true; iAmActive = false; myResizeWindow = 0L; #define myResizeString "Window geometry display, %1 and %2 are the new size," \ " %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \ "Width: %1 (%3)\nHeight: %2 (%4)" #define myCoordString_0 "Window geometry display, %1 and %2 are the cartesian x and y coordinates" \ " - avoid reformatting or suffixes like 'px'", \ "X: %1\nY: %2" #define myCoordString_1 "Window geometry display, %1 and %2 are the cartesian x and y coordinates," \ " %3 and %4 are the resp. increments - avoid reformatting or suffixes like 'px'", \ "X: %1 (%3)\nY: %2 (%4)" reconfigure(ReconfigureAll); QFont fnt; fnt.setBold(true); fnt.setPointSize(12); for (int i = 0; i < 3; ++i) { myMeasure[i] = effects->effectFrame(EffectFrameUnstyled, false); myMeasure[i]->setFont(fnt); } myMeasure[0]->setAlignment(Qt::AlignLeft | Qt::AlignTop); myMeasure[1]->setAlignment(Qt::AlignCenter); myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom); KActionCollection* actionCollection = new KActionCollection(this); KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry")); a->setText(i18n("Toggle window geometry display (effect only)")); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle())); connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect))); }
QAction* PopupMenuGUIClient::addEmbeddingService( int idx, const QString &name, const KService::Ptr &service ) { KAction *act = m_actionCollection.addAction( QByteArray::number( idx ) ); act->setText( name ); act->setIcon( KIcon(service->icon()) ); QObject::connect(act, SIGNAL(triggered(bool)), this, SLOT(slotOpenEmbedded())); return act; }
MouseMarkEffect::MouseMarkEffect() { KActionCollection* actionCollection = new KActionCollection(this); KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks")); a->setText(i18n("Clear All Mouse Marks")); a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11)); connect(a, SIGNAL(triggered(bool)), this, SLOT(clear())); a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark")); a->setText(i18n("Clear Last Mouse Mark")); a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12)); connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast())); connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); reconfigure(ReconfigureAll); arrow_start = NULL_POINT; effects->startMousePolling(); // We require it to detect activation as well }
KAction* Player::setupKAction(const char *icon, QString text, QString help_text, const char *name) { KAction* action = new KAction(this); action->setIcon(KIcon(icon)); action->setText(text); action->setHelpText(help_text); actionCollection()->addAction(name, action); return action; }
void KateViewManager::setupActions () { KAction *a; /** * view splitting */ a = m_mainWindow->actionCollection()->addAction("view_split_vert"); a->setIcon( KIcon("view-split-left-right") ); a->setText( i18n("Split Ve&rtical") ); a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_L ); connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert())); a->setWhatsThis(i18n("Split the currently active view vertically into two views.")); a = m_mainWindow->actionCollection()->addAction("view_split_horiz"); a->setIcon( KIcon("view-split-top-bottom") ); a->setText( i18n("Split &Horizontal") ); a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_T ); connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz())); a->setWhatsThis(i18n("Split the currently active view horizontally into two views.")); m_closeView = m_mainWindow->actionCollection()->addAction("view_close_current_space"); m_closeView->setIcon( KIcon("view-close") ); m_closeView->setText( i18n("Cl&ose Current View") ); m_closeView->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_R ); connect(m_closeView, SIGNAL(triggered()), this, SLOT(slotCloseCurrentViewSpace())); m_closeView->setWhatsThis(i18n("Close the currently active splitted view")); goNext = m_mainWindow->actionCollection()->addAction( "go_next_split_view" ); goNext->setText( i18n("Next Split View") ); goNext->setShortcut( Qt::Key_F8 ); connect(goNext, SIGNAL(triggered()), this, SLOT(activateNextView())); goNext->setWhatsThis(i18n("Make the next split view the active one.")); goPrev = m_mainWindow->actionCollection()->addAction( "go_prev_split_view" ); goPrev->setText( i18n("Previous Split View") ); goPrev->setShortcut( Qt::SHIFT + Qt::Key_F8 ); connect(goPrev, SIGNAL(triggered()), this, SLOT(activatePrevView())); goPrev->setWhatsThis(i18n("Make the previous split view the active one.")); }
MainWindow::MainWindow(QWidget *parent) : KXmlGuiWindow(parent) { setWindowTitle(i18n("Silence")); controller = Controller::create(); // ContentView contentview = new ContentView; setCentralWidget(contentview); controller->setContentView(contentview); nodepropertywidget = new NodePropertyWidget(i18n("Properties"), this); nodepropertywidget->hide(); controller->setNodePropertyWidget(nodepropertywidget); // the treeview on the left side treeview = new TreeView(i18n("Nodes"), actionCollection(), this); controller->setTreeView(treeview); // search sidebar searchnodesidebar = new SearchNodeSidebar(i18n("Search Nodes"), this); controller->setSearchNodeSidebar(searchnodesidebar); // navigation sidebar navigationsidebar = new NavigationSidebar(i18n("Navigation"), this); controller->setNavigationSidebar(navigationsidebar); // information sidebar to show the meta-infos infosidebar = new InfoSidebar(i18n("Info"), this); controller->setInfoSidebar(infosidebar); // docking the widgets addDockWidget(Qt::RightDockWidgetArea, navigationsidebar); addDockWidget(Qt::RightDockWidgetArea, infosidebar); addDockWidget(Qt::LeftDockWidgetArea, treeview); addDockWidget(Qt::LeftDockWidgetArea, treeview); tabifyDockWidget(treeview, searchnodesidebar); addDockWidget(Qt::LeftDockWidgetArea, nodepropertywidget); statusbar = new SiStatusBar; setStatusBar(statusbar); controller->setStatusBar(statusbar); controller->setActionCollection(actionCollection()); controller->getTextEdit()->setVisible(false); controller->getRichTextEdit()->setVisible(false); viewmenu = new ViewMenu(actionCollection()); KAction *action = actionCollection()->addAction("exit"); action->setText(i18n("&Exit")); action->setIcon(KIcon("application-exit")); connect(action, SIGNAL(triggered()), qApp, SLOT(quit())); setupGUI(QSize(1100, 600), Keys | StatusBar | Save | Create); }
GenHash::GenHash( QObject* parent, const QVariantList & ) : KParts::Plugin( parent ) { KAction *action = actionCollection()->addAction("generatehash"); action->setText(i18n( "&Generate MD5 Hash..." )); connect(action, SIGNAL(triggered(bool)), SLOT(calcGenHash())); }
ThumbnailAsideEffect::ThumbnailAsideEffect() { KActionCollection* actionCollection = new KActionCollection( this ); KAction* a = (KAction*)actionCollection->addAction( "ToggleCurrentThumbnail" ); a->setText( i18n("Toggle Thumbnail for Current Window" )); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail())); reconfigure( ReconfigureAll ); }
void KUI_project::setupActions() { KAction *action = new KAction(this); action->setIcon(KIcon("edit-delete")); action->setText(i18n("&Aim")); collection->addAction("aim", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(aimSlot())); action = new KAction(this); action->setIcon(KIcon("media-record")); action->setText(i18n("&Record")); connect(action, SIGNAL(triggered(bool)), this, SLOT(recordSlot())); collection->addAction("record", action); action = new KAction(this); action->setIcon(KIcon("media-playback-start")); action->setText(i18n("&Play")); connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this , SLOT(playSlot())); collection->addAction("play",action); action = new KAction(this); action->setIcon(KIcon("media-playback-pause")); action->setText(i18n("&Pause")); connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this , SLOT(pauseSlot())); collection->addAction("pause",action); action = new KAction(this); action->setIcon(KIcon("media-playback-stop")); action->setText(i18n("&Stop")); connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this , SLOT(stopSlot())); collection->addAction("stop",action); action = new KAction(this); action->setIcon(KIcon("media-playback-start")); action->setText(i18n("&Play")); connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this , SLOT(playAfterPauseSlot())); collection->addAction("playAfterPause",action); action = new KAction(this); action->setIcon(KIcon("list-add")); action->setText(i18n("&Add")); connect(action, SIGNAL(triggered(bool)), this, SLOT(addSlot())); collection->addAction("add", action); action = new KAction(this); action->setIcon(KIcon("list-remove")); action->setText(i18n("&Remove")); connect(action, SIGNAL(triggered(bool)), this, SLOT(removeSlot())); collection->addAction("remove", action); }
VideoRecordEffect::VideoRecordEffect() : client( NULL ) { KActionCollection* actionCollection = new KActionCollection( this ); KAction* a = static_cast< KAction* >( actionCollection->addAction( "VideoRecord" )); a->setText( i18n("Toggle Video Recording" )); a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_V )); connect( a, SIGNAL( triggered( bool )), this, SLOT( toggleRecording())); area = QRect( 0, 0, displayWidth(), displayHeight()); }
QAction* DebuggerMainWnd::createAction(const QString& text, int shortcut, const QObject* receiver, const char* slot, const char* name) { KAction* a = actionCollection()->addAction(name); a->setText(text); if (shortcut) a->setShortcut(KShortcut(shortcut)); connect(a, SIGNAL(triggered()), receiver, slot); return a; }
KShellCmdPlugin::KShellCmdPlugin( QObject* parent, const QVariantList & ) : KParts::Plugin( parent ) { if (!KAuthorized::authorizeKAction("shell_access")) return; KAction *action = actionCollection()->addAction("executeshellcommand"); action->setIcon(KIcon("system-run")); action->setText(i18n( "&Execute Shell Command..." )); connect(action, SIGNAL(triggered(bool)), SLOT( slotExecuteShellCommand() )); action->setShortcut(Qt::CTRL+Qt::Key_E); }
void KMarkNote::setupAction() { KStandardAction::openNew(this, SLOT(newNote()), actionCollection()); KStandardAction::close(this, SLOT(close()), actionCollection()); KAction* oneColAction = actionCollection()->addAction("win_onecol", m_view, SLOT(oneColView())); KAction* twoColAction = actionCollection()->addAction("win_twocol", m_view, SLOT(twoColView())); KAction* threeColAction = actionCollection()->addAction("win_threecol", m_view, SLOT(threeColView())); oneColAction->setText(i18n("One Column View")); twoColAction->setText(i18n("Two Column View")); threeColAction->setText(i18n("Three Column View")); oneColAction->setIcon(KIcon("view-split-top-bottom")); twoColAction->setIcon(KIcon("view-split-left-right")); threeColAction->setIcon(KIcon("view-file-columns")); KAction* terminalAction = actionCollection()->addAction("toggle_terminal", m_view, SLOT(toggleTerminal())); KShortcut terminalShortcut = terminalAction->shortcut(); terminalShortcut.setPrimary(QKeySequence("F4")); terminalAction->setShortcut(terminalShortcut); }