WhirlPinchPlugin::WhirlPinchPlugin(QObject *parent, const QVariantList &) { setXMLFile(KStandardDirs::locate("data", "karbon/plugins/WhirlPinchPlugin.rc"), true); QAction *a = new QAction(koIcon("effect_whirl"), i18n("&Whirl/Pinch..."), this); actionCollection()->addAction("path_whirlpinch", a); connect(a, SIGNAL(triggered()), this, SLOT(slotWhirlPinch())); m_whirlPinchDlg = new WhirlPinchDlg(qobject_cast<QWidget*>(parent)); m_whirlPinchDlg->setAngle(180.0); m_whirlPinchDlg->setPinch(0.0); m_whirlPinchDlg->setRadius(100.0); }
QAction* DebuggerMainWnd::createAction(const QString& text, const char* icon, int shortcut, const QObject* receiver, const char* slot, const char* name) { KAction* a = actionCollection()->addAction(name); a->setText(text); a->setIcon(KIcon(icon)); if (shortcut) a->setShortcut(KShortcut(shortcut)); connect(a, SIGNAL(triggered()), receiver, slot); return a; }
void KMJobViewer::reload() { removePluginActions(); loadPluginActions(); // re-add the current printer to the job manager: the job // manager has been destroyed, so the new one doesn't know // which printer it has to list addToManager(); // no refresh needed: view has been cleared before reloading // and the actual refresh will be triggered either by the KControl // module, or by KJobViewerApp using timer. // reload the columns needed: remove the old one for (int c=m_view->columns()-1; c>5; c--) m_view->removeColumn(c); KMFactory::self()->uiManager()->setupJobViewer(m_view); // update the "History" action state actionCollection()->action("view_completed")->setEnabled(m_manager->actions() & KMJob::ShowCompleted); static_cast<KToggleAction*>(actionCollection()->action("view_completed"))->setChecked(false); }
void App::setupActions() { // Game KStandardGameAction::gameNew(this, SIGNAL(invokeNewGame()), actionCollection()); KStandardGameAction::restart(this, SLOT(restartGame()), actionCollection()); KStandardGameAction::pause(this, SLOT(togglePause()), actionCollection()); KStandardGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); KStandardGameAction::quit(this, SLOT(close()), actionCollection()); // Move KStandardGameAction::undo(this, SLOT(undo()), actionCollection()); KStandardGameAction::redo(this, SLOT(redo()), actionCollection()); KStandardGameAction::hint(this, SLOT(hint()), actionCollection()); auto soundAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("speaker")), i18n("Play Sounds"), this); soundAction->setChecked(Prefs::sounds()); actionCollection()->addAction(QStringLiteral("sounds"), soundAction); connect(soundAction, &KToggleAction::triggered, m_board, &Board::setSoundsEnabled); // Settings KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection()); connect(m_board, &Board::cheatStatusChanged, this, &App::updateCheatDisplay); connect(m_board, &Board::changed, this, &App::updateItems); connect(m_board, &Board::tilesDoNotMatch, this, &App::notifyTilesDoNotMatch); connect(m_board, &Board::invalidMove, this, &App::notifyInvalidMove); connect(m_board, &Board::selectATile, this, &App::notifySelectATile); connect(m_board, &Board::selectAMatchingTile, this, &App::notifySelectAMatchingTile); connect(m_board, &Board::selectAMove, this, &App::notifySelectAMove); auto timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &App::updateTimeDisplay); timer->start(1000); connect(m_board, &Board::tileCountChanged, this, &App::updateTileDisplay); connect(m_board, &Board::endOfGame, this, &App::slotEndOfGame); connect(this, &App::invokeNewGame, m_board, &Board::newGame); connect(m_board, &Board::newGameStarted, this, &App::newGame); }
void KInfoCenter::createToolBar() { KStandardAction::quit(this, SLOT(close()), actionCollection()); KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); toolBar()->setMovable(false); m_aboutKcm = actionCollection()->addAction("help_about_module"); m_aboutKcm->setText(i18nc("Information about current module located in about menu","About Current Information Module")); m_aboutKcm->setIcon(KIcon("help")); m_aboutKcm->setEnabled(false); m_exportAction = new KAction(this); m_exportAction->setText(i18nc("Export button label", "Export")); m_exportAction->setIcon(KIcon("document-export")); m_moduleHelpAction = new KAction(this); m_moduleHelpAction->setText(i18nc("Module help button label", "Module Help")); m_moduleHelpAction->setIcon(KIcon("help-contextual")); m_helpAction = new KActionMenu( KIcon("help-contents"), i18nc("Help button label","Help"), this ); m_helpAction->setDelayed( false ); actionCollection()->addAction("export", m_exportAction); actionCollection()->addAction("helpModule", m_moduleHelpAction); actionCollection()->addAction("helpMenu", m_helpAction); }
MainWindow() { // KXMLGUIClient looks in the "data" resource for the .rc files // This line is for test programs only! KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); KVBox* main = new KVBox( this ); setCentralWidget( main ); KSqueezedTextLabel* accel = new KSqueezedTextLabel( "&Really long, long, long and boring text goes here", main ); mainLabel = new KSqueezedTextLabel( "Click me to change Label 1 text", main ); mainLabel->installEventFilter(this); // first constructor label1 = new KToolBarLabelAction( "&Label 1", this ); actionCollection()->addAction("label1", label1); KLineEdit* lineEdit = new KLineEdit( this ); KAction* lineEditAction = new KAction( "Line Edit", this ); actionCollection()->addAction( "lineEdit", lineEditAction ); lineEditAction->setDefaultWidget(lineEdit); // second constructor KToolBarLabelAction *label2 = new KToolBarLabelAction( lineEditAction, "This is the &second label", this ); actionCollection()->addAction( "label2", label2 ); // set buddy for label1 label1->setBuddy( lineEditAction ); // set buddy for accel accel->setBuddy( lineEdit ); // another widget so lineEdit can loose focus and check budyness works new KLineEdit( main ); setupGUI( Default, "ktoolbarlabelactiontestui.rc" ); }
void K3bDataFileView::setupActions() { m_actionCollection = new KActionCollection( this ); m_actionProperties = new KAction( i18n("Properties"), "misc", 0, this, SLOT(slotProperties()), actionCollection(), "properties" ); m_actionNewDir = new KAction( i18n("New Directory..."), "folder_new", CTRL+Key_N, this, SLOT(slotNewDir()), actionCollection(), "new_dir" ); m_actionRemove = new KAction( i18n("Remove"), "editdelete", Key_Delete, this, SLOT(slotRemoveItem()), actionCollection(), "remove" ); KShortcut renameShortCut( Key_F2 ); renameShortCut.append( KShortcut(CTRL+Key_R) ); // backwards compatibility m_actionRename = new KAction( i18n("Rename"), "edit", renameShortCut, this, SLOT(slotRenameItem()), actionCollection(), "rename" ); m_actionParentDir = new KAction( i18n("Parent Directory"), "up", 0, this, SLOT(slotParentDir()), actionCollection(), "parent_dir" ); m_actionOpen = new KAction( i18n("Open"), "fileopen", 0, this, SLOT(slotOpen()), actionCollection(), "open" ); m_popupMenu = new KActionMenu( m_actionCollection, "contextMenu" ); m_popupMenu->insert( m_actionParentDir ); m_popupMenu->insert( new KActionSeparator( this ) ); m_popupMenu->insert( m_actionRename ); m_popupMenu->insert( m_actionRemove ); m_popupMenu->insert( m_actionNewDir ); m_popupMenu->insert( new KActionSeparator( this ) ); m_popupMenu->insert( m_actionOpen ); m_popupMenu->insert( new KActionSeparator( this ) ); m_popupMenu->insert( m_actionProperties ); m_popupMenu->insert( new KActionSeparator( this ) ); m_popupMenu->insert( m_view->actionCollection()->action("project_burn") ); }
void K3bVideoDVDRippingView::initActions() { m_actionCollection = new KActionCollection( this ); KAction* actionSelectAll = new KAction( i18n("Check All"), 0, 0, this, SLOT(slotCheckAll()), actionCollection(), "check_all" ); KAction* actionDeselectAll = new KAction( i18n("Uncheck All"), 0, 0, this, SLOT(slotUncheckAll()), actionCollection(), "uncheck_all" ); KAction* actionSelect = new KAction( i18n("Check Track"), 0, 0, this, SLOT(slotCheck()), actionCollection(), "select_track" ); KAction* actionDeselect = new KAction( i18n("Uncheck Track"), 0, 0, this, SLOT(slotUncheck()), actionCollection(), "deselect_track" ); KAction* actionStartRip = new KAction( i18n("Start Ripping"), "gear", 0, this, SLOT(slotStartRipping()), m_actionCollection, "start_rip" ); actionStartRip->setToolTip( i18n("Open the Video DVD ripping dialog") ); // setup the popup menu m_popupMenu = new KActionMenu( actionCollection(), "popup_menu" ); KAction* separator = new KActionSeparator( actionCollection(), "separator" ); m_popupMenu->insert( actionSelect ); m_popupMenu->insert( actionDeselect ); m_popupMenu->insert( actionSelectAll ); m_popupMenu->insert( actionDeselectAll ); m_popupMenu->insert( separator ); m_popupMenu->insert( actionStartRip ); }
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 DiscoverMainWindow::setupActions() { QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), &QCoreApplication::quit, actionCollection()); actionCollection()->addAction(QStringLiteral("file_quit"), quitAction); if (KAuthorized::authorizeAction(QStringLiteral("help_contents"))) { auto mHandBookAction = KStandardAction::helpContents(this, &DiscoverMainWindow::appHelpActivated, this); actionCollection()->addAction(mHandBookAction->objectName(), mHandBookAction); } if (KAuthorized::authorizeAction(QStringLiteral("help_report_bug")) && !KAboutData::applicationData().bugAddress().isEmpty()) { auto mReportBugAction = KStandardAction::reportBug(this, &DiscoverMainWindow::reportBug, this); actionCollection()->addAction(mReportBugAction->objectName(), mReportBugAction); } if (KAuthorized::authorizeAction(QStringLiteral("switch_application_language"))) { // if (KLocalizedString::availableApplicationTranslations().count() > 1) { auto mSwitchApplicationLanguageAction = KStandardAction::create(KStandardAction::SwitchApplicationLanguage, this, &DiscoverMainWindow::switchApplicationLanguage, this); actionCollection()->addAction(mSwitchApplicationLanguageAction->objectName(), mSwitchApplicationLanguageAction); // } } if (KAuthorized::authorizeAction(QStringLiteral("help_about_app"))) { auto mAboutAppAction = KStandardAction::aboutApp(this, &DiscoverMainWindow::aboutApplication, this); actionCollection()->addAction(mAboutAppAction->objectName(), mAboutAppAction); } auto mKeyBindignsAction = KStandardAction::keyBindings(this, &DiscoverMainWindow::configureShortcuts, this); actionCollection()->addAction(mKeyBindignsAction->objectName(), mKeyBindignsAction); }
K3bAudioView::K3bAudioView( K3bAudioDoc* pDoc, QWidget* parent, const char *name ) : K3bView( pDoc, parent, name ) { m_doc = pDoc; m_songlist = new K3bAudioTrackView( m_doc, this ); setMainWidget( m_songlist ); fillStatusDisplay()->showTime(); // add button for the audio conversion KAction* conversionAction = new KAction( i18n("Convert Tracks"), "redo", 0, this, SLOT(slotAudioConversion()), actionCollection(), "project_audio_convert" ); conversionAction->setToolTip( i18n("Convert audio tracks to other audio formats." ) ); toolBox()->addButton( conversionAction ); toolBox()->addSeparator(); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PLAY ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PAUSE ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_STOP ) ); toolBox()->addSpacing(); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PREV ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_NEXT ) ); toolBox()->addSpacing(); toolBox()->addWidgetAction( static_cast<KWidgetAction*>(m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_SEEK )) ); toolBox()->addSeparator(); #ifdef HAVE_MUSICBRAINZ kdDebug() << "(K3bAudioView) m_songlist->actionCollection()->actions().count() " << m_songlist->actionCollection()->actions().count() << endl; toolBox()->addButton( m_songlist->actionCollection()->action( "project_audio_musicbrainz" ) ); toolBox()->addSeparator(); #endif addPluginButtons( K3bProjectPlugin::AUDIO_CD ); toolBox()->addStretch(); // this is just for testing (or not?) // most likely every project type will have it's rc file in the future // we only add the additional actions since K3bView already added the default actions setXML( "<!DOCTYPE kpartgui SYSTEM \"kpartgui.dtd\">" "<kpartgui name=\"k3bproject\" version=\"1\">" "<MenuBar>" " <Menu name=\"project\"><text>&Project</text>" " <Action name=\"project_audio_convert\"/>" #ifdef HAVE_MUSICBRAINZ " <Action name=\"project_audio_musicbrainz\"/>" #endif " </Menu>" "</MenuBar>" "</kpartgui>", true ); }
void CDisplayWindow::initActions() { BtActionCollection* ac = actionCollection(); CDisplayWindow::insertKeyboardActions(ac); QAction* actn = ac->action(CResMgr::displaywindows::general::search::actionName); Q_ASSERT(actn != 0); QObject::connect(actn, SIGNAL(triggered()), this, SLOT(slotSearchInModules())); CDisplayConnections* conn = displayWidget()->connectionsProxy(); actn = ac->action("openLocation"); Q_ASSERT(actn != 0); QObject::connect(actn, SIGNAL(triggered()), this, SLOT(setFocusKeyChooser())); addAction(actn); actn = ac->action("selectAll"); Q_ASSERT(actn != 0); QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(selectAll())); addAction(actn); actn = ac->action("copySelectedText"); Q_ASSERT(actn != 0); QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(copySelection())); addAction(actn); actn = ac->action("findText"); Q_ASSERT(actn != 0); QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(openFindTextDialog())); addAction(actn); actn = ac->action(CResMgr::displaywindows::general::backInHistory::actionName); Q_ASSERT(actn != 0); bool ok = QObject::connect(actn, SIGNAL(triggered()), keyChooser()->history(), SLOT(back())); Q_ASSERT(ok); addAction(actn); actn = ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName); Q_ASSERT(actn != 0); ok = QObject::connect(actn, SIGNAL(triggered()), keyChooser()->history(), SLOT(fw())); Q_ASSERT(ok); addAction(actn); ac->readShortcuts("Displaywindow shortcuts"); }
void StorageServiceManagerMainWindow::setupActions() { KActionCollection *ac = actionCollection(); KStandardAction::quit(this, &StorageServiceManagerMainWindow::close, ac); mAuthenticate = ac->addAction(QStringLiteral("authenticate"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAuthenticate())); mAuthenticate->setText(i18n("Authenticate...")); mCreateFolder = ac->addAction(QStringLiteral("create_folder"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotCreateFolder())); mCreateFolder->setText(i18n("Create Folder...")); mCreateFolder->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); mRefreshList = ac->addAction(QStringLiteral("refresh_list"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRefreshList())); mRefreshList->setText(i18n("Refresh List")); mRefreshList->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); ac->setDefaultShortcut(mRefreshList, QKeySequence(Qt::Key_F5)); mAccountInfo = ac->addAction(QStringLiteral("account_info"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAccountInfo())); mAccountInfo->setText(i18n("Account Info...")); mUploadFile = ac->addAction(QStringLiteral("upload_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotUploadFile())); mUploadFile->setText(i18n("Upload File...")); mDelete = ac->addAction(QStringLiteral("delete"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDelete())); ac->setDefaultShortcut(mDelete, QKeySequence(Qt::Key_Delete)); mDelete->setText(i18n("Delete...")); mDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); mDownloadFile = ac->addAction(QStringLiteral("download_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDownloadFile())); mDownloadFile->setText(i18n("Download File...")); mDownloadFile->setIcon(QIcon::fromTheme(QStringLiteral("download"))); mShowLog = ac->addAction(QStringLiteral("show_log"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotShowLog())); mShowLog->setText(i18n("Show Log...")); mLogout = ac->addAction(QStringLiteral("logout"), this, SLOT(slotLogout())); mLogout->setText(i18n("Logout")); mShutdownAllServices = ac->addAction(QStringLiteral("shutdown_all_services"), this, SLOT(slotShutdownAllServices())); mShutdownAllServices->setText(i18n("Shutdown All Services")); mRefreshAll = ac->addAction(QStringLiteral("refresh_all"), this, SLOT(slotRefreshAll())); mRefreshAll->setText(i18n("Refresh All")); ac->setDefaultShortcut(mRefreshAll, QKeySequence(Qt::CTRL + Qt::Key_F5)); mRenameItem = ac->addAction(QStringLiteral("rename"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRename())); mRenameItem->setText(i18n("Rename...")); ac->setDefaultShortcut(mRenameItem, QKeySequence(Qt::Key_F2)); KStandardAction::preferences(this, &StorageServiceManagerMainWindow::slotConfigure, ac); KStandardAction::configureNotifications(this, &StorageServiceManagerMainWindow::slotShowNotificationOptions, ac); // options_configure_notifications }
void MainWindow::setupActions() { // TODO #ifndef Q_OS_QNX // Game KAction* abort = actionCollection()->addAction("game_abort"); abort->setText(i18n("Abort game")); connect(abort, SIGNAL(triggered()), m_main, SLOT(abort())); KStandardGameAction::pause(m_main, SLOT(togglePause()), actionCollection()); KStandardGameAction::highscores(this, SLOT(highscores()), actionCollection()); KStandardGameAction::quit(this, SLOT(close()), actionCollection()); KAction* action; action = new KToggleAction(i18n("&Play Sounds"), this); action->setChecked(KollisionConfig::enableSounds()); actionCollection()->addAction("options_sounds", action); connect(action, SIGNAL(triggered(bool)), m_main, SLOT(enableSounds(bool))); setupGUI(Create | Save | Keys | StatusBar); #endif }
void MainWindow::setupTools() { kDebug() << "setup tools..."; m_toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); m_toolsMenu->setDelayed(false); m_toolsMenu->setShortcutConfigurable(true); m_toolsMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_T) ); // adding rekonq_tools to rekonq actionCollection actionCollection()->addAction(QL1S("rekonq_tools"), m_toolsMenu); // Actions are added after the call to setupGUI() to ensure the help menu works }
void MainWindow::browserLoading(bool v) { QAction *stop = actionCollection()->action( QL1S("stop") ); QAction *reload = actionCollection()->action( QL1S("view_redisplay") ); if (v) { disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); m_stopReloadAction->setIcon(KIcon("process-stop")); m_stopReloadAction->setToolTip(i18n("Stop loading the current page")); m_stopReloadAction->setText(i18n("Stop")); connect(m_stopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); } else { disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); m_stopReloadAction->setIcon(KIcon("view-refresh")); m_stopReloadAction->setToolTip(i18n("Reload the current page")); m_stopReloadAction->setText(i18n("Reload")); connect(m_stopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); } }
void KatalogView::initActions() { m_acEditChapter = actionCollection()->addAction( "edit_chapter", this, SLOT( slEditSubChapter() ) ); m_acEditChapter->setText( i18n("Edit Sub chapter") ); m_acEditChapter->setIcon( QIcon::fromTheme("folder-documents")); m_acEditChapter->setStatusTip(i18n("Edit a catalog sub chapter")); m_acEditChapter->setEnabled(true); m_acAddChapter = actionCollection()->addAction( "add_chapter", this, SLOT( slAddSubChapter() ) ); m_acAddChapter->setText( i18n("Add a sub chapter") ); m_acAddChapter->setIcon( QIcon::fromTheme("document-edit")); m_acAddChapter->setStatusTip(i18n("Add a sub chapter below the selected one")); m_acAddChapter->setEnabled(false); m_acRemChapter = actionCollection()->addAction( "remove_chapter", this, SLOT( slRemoveSubChapter() ) ); m_acRemChapter->setText( i18n("Remove a sub chapter") ); m_acRemChapter->setIcon( QIcon::fromTheme("document-edit")); m_acRemChapter->setStatusTip(i18n("Remove a sub chapter")); m_acRemChapter->setEnabled(false); m_acEditItem = actionCollection()->addAction( "edit_template", this, SLOT( slEditTemplate() ) ); m_acEditItem->setText( i18n("Edit template") ); m_acEditItem->setIcon( QIcon::fromTheme("document-edit")); m_acEditItem->setStatusTip(i18n("Opens the editor window for templates to edit the selected one")); m_acEditItem->setEnabled(false); m_acNewItem = actionCollection()->addAction( "new_template", this, SLOT( slNewTemplate() ) ); m_acNewItem->setText( i18n("New template") ); m_acNewItem->setShortcut( QKeySequence::New ); m_acNewItem->setIcon( QIcon::fromTheme("document-new")); m_acNewItem->setStatusTip(i18n("Opens the editor window for templates to enter a new template")); m_acNewItem->setEnabled(true); m_acDeleteItem = actionCollection()->addAction( "delete_template", this, SLOT( slDeleteTemplate() ) ); m_acDeleteItem->setText( i18n("Delete template") ); m_acDeleteItem->setShortcut( QKeySequence::Delete); m_acDeleteItem->setIcon( QIcon::fromTheme("document-delete")); m_acDeleteItem->setStatusTip(i18n("Deletes the template")); m_acDeleteItem->setEnabled(true); m_acExport = actionCollection()->addAction( "export_catalog", this, SLOT( slExport() ) ); m_acExport->setText( i18n("Export catalog") ); m_acExport->setStatusTip(i18n("Export the whole catalog as XML encoded file")); m_acExport->setEnabled(false); // FIXME: Repair XML Export // use the absolute path to your kraftui.rc file for testing purpose in createGUI(); QString prjPath = QString::fromUtf8(qgetenv( "KRAFT_HOME" )); if( !prjPath.isEmpty() ) { createGUI(prjPath + QLatin1String("/src/katalogview.rc")); } else { createGUI("katalogview.rc"); } }
void MainWindow::showHighscores() { //pause game if necessary m_gameState->setState(KDiamond::Paused); if (m_gameState->state() != KDiamond::Finished) actionCollection()->action("game_pause")->setChecked(true); //show dialog QPointer<KScoreDialog> dialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Score, this); dialog->addField(KScoreDialog::Custom1, i18n("Mode"), "mode"); dialog->initFromDifficulty(Kg::difficulty()); dialog->exec(); delete dialog; }
void KMixDockWidget::createActions() { // Put "Mute" selector in context menu (void)new KToggleAction( i18n( "M&ute" ), 0, this, SLOT( dockMute() ), actionCollection(), "dock_mute" ); KAction *a = actionCollection()->action( "dock_mute" ); KPopupMenu *popupMenu = contextMenu(); if ( a ) a->plug( popupMenu ); // Put "Select Master Channel" dialog in context menu if ( m_mixer != 0 ) { (void)new KAction( i18n("Select Master Channel..."), 0, this, SLOT(selectMaster()), actionCollection(), "select_master"); KAction *a2 = actionCollection()->action( "select_master" ); if (a2) a2->plug( popupMenu ); } // Setup volume preview if ( _playBeepOnVolumeChange ) { _audioPlayer = new KAudioPlayer("KDE_Beep_Digital_1.ogg"); } }
PartViewer::PartViewer() { // KXMLGUIClient looks in the "data" resource for the .rc files // This line is for test programs only! KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); setXMLFile( "partviewer_shell.rc" ); KAction * paOpen = new KAction( KIcon("document-open"), "&Open file", this ); actionCollection()->addAction( "file_open", paOpen ); connect( paOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen()) ); KAction * paQuit = new KAction( KIcon("application-exit"), "&Quit", this ); actionCollection()->addAction( "file_quit", paQuit ); connect(paQuit, SIGNAL(triggered()), this, SLOT(close())); m_part = 0; // Set a reasonable size resize( 600, 350 ); slotFileOpen(); }
KDataToolPluginView::KDataToolPluginView( KTextEditor::View *view ) :m_menu(0),m_notAvailable(0) { view->insertChildClient (this); setInstance( KGenericFactory<KDataToolPlugin>::instance() ); m_menu = new KActionMenu(i18n("Data Tools"), actionCollection(), "popup_dataTool"); connect(m_menu->popupMenu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); setXMLFile("ktexteditor_kdatatoolui.rc"); m_view = view; }
KAction *KXMLGUIClient::action( const char *name ) const { KAction* act = actionCollection()->action( name ); if ( !act ) { QPtrListIterator<KXMLGUIClient> childIt( d->m_children ); for (; childIt.current(); ++childIt ) { act = childIt.current()->actionCollection()->action( name ); if ( act ) break; } } return act; }
void CervisiaShell::setupActions() { setStandardToolBarMenuEnabled( true ); QAction *action = KStandardAction::configureToolbars( this, SLOT(slotConfigureToolBars()), actionCollection() ); QString hint = i18n("Allows you to configure the toolbar"); action->setToolTip( hint ); action->setWhatsThis( hint ); action = KStandardAction::keyBindings( this, SLOT(slotConfigureKeys()), actionCollection() ); hint = i18n("Allows you to customize the keybindings"); action->setToolTip( hint ); action->setWhatsThis( hint ); action = KStandardAction::quit( this, SLOT(close()), actionCollection() ); hint = i18n("Exits Cervisia"); action->setToolTip( hint ); action->setWhatsThis( hint ); setHelpMenuEnabled(true); }
KToggleAction* KMyMoneyPlugin::Plugin::toggleAction(const QString& actionName) const { static KToggleAction dummyAction(QString("Dummy"), 0); KToggleAction* p = dynamic_cast<KToggleAction*>(actionCollection()->action(QString(actionName.toLatin1()))); if (!p) { qWarning("Action '%s' is not of type KToggleAction", qPrintable(actionName)); p = &dummyAction; } qWarning("Action with name '%s' not found!", qPrintable(actionName)); return p; }
/** Refresh the settings of this window. */ void CDisplayWindow::reload(CSwordBackend::SetupChangedReason) { //first make sure all used Sword modules are still present QMutableStringListIterator it(m_modules); while (it.hasNext()) { if (!CSwordBackend::instance()->findModuleByName(it.next())) { it.remove(); } } if (m_modules.isEmpty()) { close(); return; } if (keyChooser()) keyChooser()->setModules( modules(), false ); lookup(); actionCollection()->readShortcuts("DisplayWindow shortcuts"); actionCollection()->readShortcuts("Readwindow shortcuts"); emit sigModuleListSet(m_modules); }
MetaListViewPart::MetaListViewPart(QObject *parent) : KParts::Part(parent), m_proxyModel(NULL), m_defaultRow(-1) { m_widget = new MetaListViewWidget; setWidget(m_widget); connect(m_widget, SIGNAL(itemActivated(QModelIndex)), SLOT(slotItemActivated(QModelIndex)) ); connect(m_widget, SIGNAL(selectionChanged(QItemSelection)), SLOT(slotSelectionChanged(QItemSelection)) ); connect(m_widget, SIGNAL(contextMenuRequested(QModelIndex)), SLOT(slotContextMenuRequested(QModelIndex)) ); // Show initial information on the metaBar slotSelectionChanged(QItemSelection()); //populate the listView (later, in order to respect the size of the listView) QMetaObject::invokeMethod(this, "loadModel", Qt::QueuedConnection); /* ACTIONS */ KSelectAction *view_mode = new KSelectAction(i18n("View mode"), this); connect(view_mode, SIGNAL(triggered(int)), SLOT(changeViewMode(int)) ); actionCollection()->addAction("view_mode", view_mode); actionCollection()->addAction("view_mode_list", view_mode->addAction(KIcon("view-list-details"), i18n("List")) ); actionCollection()->addAction("view_mode_icons", view_mode->addAction(KIcon("view-list-icons"), i18n("Icons")) ); KSelectAction *metabar_position = new KSelectAction(i18n("Metabar position"), this); connect(metabar_position, SIGNAL(triggered(int)), SLOT(changeMetaBarPosition(int)) ); actionCollection()->addAction("metabar_position", metabar_position); QString str_left = i18nc("Opposite of right", "Left"); QString str_right = i18nc("Opposite of left", "Right"); if ( QApplication::isLeftToRight() ) { actionCollection()->addAction("metabar_position_left", metabar_position->addAction(str_left)); actionCollection()->addAction("metabar_position_right", metabar_position->addAction(str_right)); } else { actionCollection()->addAction("metabar_position_right", metabar_position->addAction(str_right)); actionCollection()->addAction("metabar_position_left", metabar_position->addAction(str_left)); } actionCollection()->addAction("metabar_position_hidden", metabar_position->addAction(i18n("Hidden")) ); }
/** * Creates the right-click menu */ void KMixDockWidget::createMenuActions() { QMenu *menu = contextMenu(); if (!menu) return; // We do not use a menu shared_ptr<MixDevice> md = Mixer::getGlobalMasterMD(); if ( md.get() != 0 && md->hasMuteSwitch() ) { // Put "Mute" selector in context menu #ifdef X_KMIX_KF5_BUILD KToggleAction *action = new KToggleAction(i18n("M&ute"), this); action->setData("dock_mute"); addAction("dock_mute", action); #else KToggleAction *action = actionCollection()->add<KToggleAction>( "dock_mute" ); action->setText( i18n("M&ute") ); #endif updateDockMuteAction(action); connect(action, SIGNAL(triggered(bool)), SLOT(dockMute())); menu->addAction( action ); } // Put "Select Master Channel" dialog in context menu #ifdef X_KMIX_KF5_BUILD QAction *action = new QAction(i18n("Select Master Channel..."), this); action->setData("select_master"); addAction("select_master", action); #else QAction *action = actionCollection()->addAction( "select_master" ); action->setText( i18n("Select Master Channel...") ); #endif action->setEnabled(Mixer::getGlobalMasterMixer() != 0); connect(action, SIGNAL(triggered(bool)), _kmixMainWindow, SLOT(slotSelectMaster())); menu->addAction( action ); //Context menu entry to access phonon settings menu->addAction(_kmixMainWindow->actionCollection()->action("launch_kdesoundsetup")); }
HistoryGUIClient::HistoryGUIClient ( Kopete::ChatSession *parent ) : QObject ( parent ), KXMLGUIClient ( parent ) { setComponentData ( KGenericFactory<HistoryPlugin>::componentData() ); m_manager = parent; // Refuse to build this client, it is based on wrong parameters if ( !m_manager || m_manager->members().isEmpty() ) deleteLater(); QList<Kopete::Contact*> mb=m_manager->members(); m_logger=new HistoryLogger ( mb.first() , this ); actionLast = new KAction ( KIcon ( "go-last" ), i18n ( "Latest History" ), this ); actionCollection()->addAction ( "historyLast", actionLast ); connect ( actionLast, SIGNAL (triggered(bool)), this, SLOT (slotLast()) ); actionPrev = KStandardAction::back ( this, SLOT (slotPrevious()), this ); actionCollection()->addAction ( "historyPrevious", actionPrev ); actionNext = KStandardAction::forward ( this, SLOT (slotNext()), this ); actionCollection()->addAction ( "historyNext", actionNext ); KAction *viewChatHistory = new KAction( KIcon("view-history"), i18n("View &History" ), this ); actionCollection()->addAction( "viewChatHistory", viewChatHistory ); viewChatHistory->setShortcut(KShortcut (Qt::CTRL + Qt::Key_H)); connect(viewChatHistory, SIGNAL(triggered(bool)), this, SLOT(slotViewHistory())); KAction *actionQuote = new KAction ( KIcon ( "go-last" ),i18n ( "Quote Last Message" ), this ); actionCollection()->addAction ( "historyQuote",actionQuote ); connect ( actionQuote,SIGNAL (triggered(bool)),this,SLOT (slotQuote()) ); // we are generally at last when beginning actionPrev->setEnabled ( true ); actionNext->setEnabled ( false ); actionLast->setEnabled ( false ); setXMLFile ( "historychatui.rc" ); }
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); }
AfarasView::AfarasView(QWidget *parent, Qt::WFlags flags) : KXmlGuiWindow(parent, flags), recorder(0), currentIndex(0) { KGlobal::locale()->insertCatalog("simonlib"); ui.setupUi(this); connect(ui.pbStartReview, SIGNAL(clicked()), this, SLOT(start())); connect(ui.pbBlacklistSample, SIGNAL(toggled(bool)), this, SLOT(blackListSample(bool))); connect(ui.pbPreviousSample, SIGNAL(clicked()), this, SLOT(previousSample())); connect(ui.pbNextSample, SIGNAL(clicked()), this, SLOT(nextSample())); connect(ui.pbBack, SIGNAL(clicked()), this, SLOT(stop())); connect(ui.urInputPrompts, SIGNAL(textChanged(QString)), this, SLOT(inputFilesChanged())); connect(ui.urPathPrefix, SIGNAL(textChanged(QString)), this, SLOT(inputFilesChanged())); connect(ui.urOutputBlacklist, SIGNAL(textChanged(QString)), this, SLOT(inputFilesChanged())); ui.wgRecording->setLayout(new QVBoxLayout()); KStandardAction::quit(this, SLOT(close()), actionCollection()); KStandardAction::preferences(this, SLOT(showConfig()), actionCollection()); setupGUI(); }