void MainWindow::setupActions() { //file menu KStdAction::openNew(this, SLOT(slotNewFile()), actionCollection()); KStdAction::open(this, SLOT(slotOpenFile()), actionCollection()); m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection()); m_actionRecent->loadEntries(kapp->config());//,"Recent Files"); KStdAction::save(this, SLOT(slotSaveCurrentFile()), actionCollection()); KStdAction::saveAs(this, SLOT(slotSaveCurrentFileAs()), actionCollection()); KStdAction::close(this, SLOT(slotCloseFile()), actionCollection()); (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all"); KStdAction::quit(this, SLOT(slotQuit()), actionCollection()); KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection()); KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection()); KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_gpteditor"); (void)new KAction(i18n("Compile"), "make_kdevelop", "F10", m_debugger_manager, SLOT(slotCompileApplication()), actionCollection(), "compile_application"); (void)new KAction(i18n("Run"), "gear", "F9", m_debugger_manager, SLOT(slotRunApplication()), actionCollection(), "run_application"); (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager, SLOT(slotDebugStart()), actionCollection(), "debug_start"); (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager, SLOT(slotDebugStop()), actionCollection(), "debug_stop"); (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager, SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over"); (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager, SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into"); (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager, SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out"); // (void)new KAction(i18n("Profile (DBG only)"), "math_sum", "Alt+P", m_debugger_manager, // SLOT(slotProfile()), actionCollection(), "script_profile"); (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager, SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp"); // (void)new KAction("", "math_brace", 0, m_tabEditor, // SLOT(slotAddWatch()), actionCollection(), "editor_add_watch"); // Editor default action setStandardToolBarMenuEnabled(true); }
void MainWindow::setupActions() { //file menu KStdAction::open(this, SLOT(slotOpenFile()), actionCollection()); m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection()); m_actionRecent->loadEntries(kapp->config());//,"Recent Files"); KStdAction::close(this, SLOT(slotCloseFile()), actionCollection()); (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all"); KStdAction::quit(this, SLOT(slotQuit()), actionCollection()); KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection()); KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection()); KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_protoeditor"); m_siteAction = new KSelectAction("Site", 0, actionCollection(), "site_selection"); connect(m_siteAction, SIGNAL(activated(const QString&)), ProtoeditorSettings::self(), SLOT(slotCurrentSiteChanged(const QString&))); m_defaultScriptAction = new KSelectAction("Default script", 0, actionCollection(), "default_script"); QStringList l; l << "Site Script" << "Active Script"; m_defaultScriptAction->setItems(l); m_defaultScriptAction->setCurrentItem(0); // connect(m_defaultScriptAction, SIGNAL(activated(int)), // this, SLOT(slotDefaultScriptChanged(int))); // (void)new KAction(i18n("&Run"), "gear", "F9", m_debugger_manager, // SLOT(slotDebugStart()), actionCollection(), "script_run_current_script"); (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager, SLOT(slotDebugStart()), actionCollection(), "debug_start"); (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager, SLOT(slotDebugStop()), actionCollection(), "debug_stop"); (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager, SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over"); (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager, SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into"); (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager, SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out"); (void)new KAction(i18n("Profile"), "math_sum", "Alt+P", m_debugger_manager, SLOT(slotProfile()), actionCollection(), "script_profile"); (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager, SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp"); (void)new KAction("", "math_brace", 0, m_tabEditor, SLOT(slotAddWatch()), actionCollection(), "editor_add_watch"); setStandardToolBarMenuEnabled(true); }
void KTNEFMain::setupActions() { KStandardAction::quit( this, SLOT(close()), actionCollection() ); KAction *action = KStandardAction::keyBindings( this, SLOT(slotConfigureKeys()), actionCollection() ); action->setWhatsThis( i18nc( "@info:whatsthis", "You will be presented with a dialog where you can configure " "the application-wide shortcuts." ) ); KStandardAction::configureToolbars( this, SLOT(slotEditToolbars()), actionCollection() ); // File menu KStandardAction::open( this, SLOT(openFile()), actionCollection() ); // Action menu KAction *openAction = actionCollection()->addAction( "view_file" ); openAction->setText( i18nc( "@action:inmenu", "View" ) ); openAction->setIcon( KIcon( "document-open" ) ); connect( openAction, SIGNAL(triggered()), this, SLOT(viewFile()) ); KAction *openAsAction = actionCollection()->addAction( "view_file_as" ); openAsAction->setText( i18nc( "@action:inmenu", "View With..." ) ); connect( openAsAction, SIGNAL(triggered()), this, SLOT(viewFileAs()) ); KAction *extractAction = actionCollection()->addAction( "extract_file" ); extractAction->setText( i18nc( "@action:inmenu", "Extract" ) ); connect( extractAction, SIGNAL(triggered()), this, SLOT(extractFile()) ); KAction *extractToAction = actionCollection()->addAction( "extract_file_to" ); extractToAction->setText( i18nc( "@action:inmenu", "Extract To..." ) ); extractToAction->setIcon( KIcon( "archive-extract" ) ); connect( extractToAction, SIGNAL(triggered()), this, SLOT(extractFileTo()) ); KAction *extractAllToAction = actionCollection()->addAction( "extract_all_files" ); extractAllToAction->setText( i18nc( "@action:inmenu", "Extract All To..." ) ); extractAllToAction->setIcon( KIcon( "archive-extract" ) ); connect( extractAllToAction, SIGNAL(triggered()), this, SLOT(extractAllFiles()) ); KAction *filePropsAction = actionCollection()->addAction( "properties_file" ); filePropsAction->setText( i18nc( "@action:inmenu", "Properties" ) ); filePropsAction->setIcon( KIcon( "document-properties" ) ); connect( filePropsAction, SIGNAL(triggered()), this, SLOT(propertiesFile())); KAction *messPropsAction = actionCollection()->addAction( "msg_properties" ); messPropsAction->setText( i18nc( "@action:inmenu", "Message Properties" ) ); connect( messPropsAction, SIGNAL(triggered()), this, SLOT(slotShowMessageProperties()) ); KAction *messShowAction = actionCollection()->addAction( "msg_text" ); messShowAction->setText( i18nc( "@action:inmenu", "Show Message Text" ) ); messShowAction->setIcon( KIcon( "document-preview-archive" ) ); connect( messShowAction, SIGNAL(triggered()), this, SLOT(slotShowMessageText()) ); KAction *messSaveAction = actionCollection()->addAction( "msg_save" ); messSaveAction->setText( i18nc( "@action:inmenu", "Save Message Text As..." ) ); messSaveAction->setIcon( KIcon( "document-save" ) ); connect( messSaveAction, SIGNAL(triggered()), this, SLOT(slotSaveMessageText()) ); actionCollection()->action( "view_file" )->setEnabled( false ); actionCollection()->action( "view_file_as" )->setEnabled( false ); actionCollection()->action( "extract_file" )->setEnabled( false ); actionCollection()->action( "extract_file_to" )->setEnabled( false ); actionCollection()->action( "extract_all_files" )->setEnabled( false ); actionCollection()->action( "properties_file" )->setEnabled( false ); // Options menu KAction *defFolderAction = actionCollection()->addAction( "options_default_dir" ); defFolderAction->setText( i18nc( "@action:inmenu", "Default Folder..." ) ); defFolderAction->setIcon( KIcon( "folder-open" ) ); connect( defFolderAction, SIGNAL(triggered()), this, SLOT(optionDefaultDir()) ); }
void KateMainWindow::setupActions() { KAction *a; actionCollection()->addAction( KStandardAction::New, "file_new", m_viewManager, SLOT(slotDocumentNew()) ) ->setWhatsThis(i18n("Create a new document")); actionCollection()->addAction( KStandardAction::Open, "file_open", m_viewManager, SLOT(slotDocumentOpen()) ) ->setWhatsThis(i18n("Open an existing document for editing")); fileOpenRecent = KStandardAction::openRecent (m_viewManager, SLOT(openUrl(KUrl)), this); actionCollection()->addAction(fileOpenRecent->objectName(), fileOpenRecent); fileOpenRecent->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again.")); a = actionCollection()->addAction( "file_save_all" ); a->setIcon( KIcon("document-save-all") ); a->setText( i18n("Save A&ll") ); a->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_L) ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(saveAll()) ); a->setWhatsThis(i18n("Save all open, modified documents to disk.")); a = actionCollection()->addAction( "file_reload_all" ); a->setText( i18n("&Reload All") ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(reloadAll()) ); a->setWhatsThis(i18n("Reload all open documents.")); a = actionCollection()->addAction( "file_close_orphaned" ); a->setText( i18n("Close Orphaned") ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(closeOrphaned()) ); a->setWhatsThis(i18n("Close all documents in the file list that could not be reopened, because they are not accessible anymore.")); actionCollection()->addAction( KStandardAction::Close, "file_close", m_viewManager, SLOT(slotDocumentClose()) ) ->setWhatsThis(i18n("Close the current document.")); a = actionCollection()->addAction( "file_close_other" ); a->setText( i18n( "Close Other" ) ); connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()) ); a->setWhatsThis(i18n("Close other open documents.")); a = actionCollection()->addAction( "file_close_all" ); a->setText( i18n( "Clos&e All" ) ); connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseAll()) ); a->setWhatsThis(i18n("Close all open documents.")); a = actionCollection()->addAction( KStandardAction::Quit, "file_quit" ); // Qt::QueuedConnection: delay real shutdown, as we are inside menu action handling (bug #185708) connect( a, SIGNAL(triggered()), this, SLOT(slotFileQuit()), Qt::QueuedConnection ); a->setWhatsThis(i18n("Close this window")); a = actionCollection()->addAction( "view_new_view" ); a->setIcon( KIcon("window-new") ); a->setText( i18n("&New Window") ); connect( a, SIGNAL(triggered()), this, SLOT(newWindow()) ); a->setWhatsThis(i18n("Create a new Kate view (a new window with the same document list).")); KToggleAction* showFullScreenAction = KStandardAction::fullScreen( 0, 0, this, this); actionCollection()->addAction( showFullScreenAction->objectName(), showFullScreenAction ); connect( showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool))); documentOpenWith = new KActionMenu(i18n("Open W&ith"), this); actionCollection()->addAction("file_open_with", documentOpenWith); documentOpenWith->setWhatsThis(i18n("Open the current document using another application registered for its file type, or an application of your choice.")); connect(documentOpenWith->menu(), SIGNAL(aboutToShow()), this, SLOT(mSlotFixOpenWithMenu())); connect(documentOpenWith->menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotOpenWithMenuAction(QAction*))); a = KStandardAction::keyBindings(this, SLOT(editKeys()), actionCollection()); a->setWhatsThis(i18n("Configure the application's keyboard shortcut assignments.")); a = KStandardAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection()); a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s).")); QAction* settingsConfigure = KStandardAction::preferences(this, SLOT(slotConfigure()), actionCollection()); settingsConfigure->setWhatsThis(i18n("Configure various aspects of this application and the editing component.")); // tip of the day :-) actionCollection()->addAction( KStandardAction::TipofDay, this, SLOT(tipOfTheDay()) ) ->setWhatsThis(i18n("This shows useful tips on the use of this application.")); if (KatePluginManager::self()->pluginList().count() > 0) { a = actionCollection()->addAction( "help_plugins_contents" ); a->setText( i18n("&Plugins Handbook") ); connect( a, SIGNAL(triggered()), this, SLOT(pluginHelp()) ); a->setWhatsThis(i18n("This shows help files for various available plugins.")); } a = actionCollection()->addAction( "help_about_editor" ); a->setText( i18n("&About Editor Component") ); connect( a, SIGNAL(triggered()), this, SLOT(aboutEditor()) ); connect(m_viewManager, SIGNAL(viewChanged()), m_mainWindow, SIGNAL(viewChanged())); connect(m_viewManager, SIGNAL(viewCreated(KTextEditor::View*)), m_mainWindow, SIGNAL(viewCreated(KTextEditor::View*))); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotWindowActivated())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateOpenWith())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateBottomViewBar())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateTopViewBar())); slotWindowActivated (); // session actions a = actionCollection()->addAction( "sessions_new" ); a->setIcon( KIcon("document-new") ); a->setText( i18nc("Menu entry Session->New", "&New") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionNew()), Qt::QueuedConnection ); a = actionCollection()->addAction( "sessions_open" ); a->setIcon( KIcon("document-open") ); a->setText( i18n("&Open Session") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionOpen()), Qt::QueuedConnection ); a = actionCollection()->addAction( "sessions_save" ); a->setIcon( KIcon("document-save") ); a->setText( i18n("&Save Session") ); connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSave()) ); a = actionCollection()->addAction( "sessions_save_as" ); a->setIcon( KIcon("document-save-as") ); a->setText( i18n("Save Session &As...") ); connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSaveAs()) ); a = actionCollection()->addAction( "sessions_manage" ); a->setIcon( KIcon("view-choose") ); a->setText( i18n("&Manage Sessions...") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionManage()), Qt::QueuedConnection ); // quick open menu ;) a = new KateSessionsAction (i18n("&Quick Open Session"), this); actionCollection()->addAction("sessions_list", a); }