本文整理汇总了C++中KActionMenu::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ KActionMenu::addAction方法的具体用法?C++ KActionMenu::addAction怎么用?C++ KActionMenu::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KActionMenu
的用法示例。
在下文中一共展示了KActionMenu::addAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupToolbar
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);
}
示例2: initToolsMenu
void MainWindow::initToolsMenu()
{
if (!m_toolsMenu)
return;
m_toolsMenu->menu()->clear();
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open)));
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs)));
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print)));
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find)));
QAction *action = actionByName(KStandardAction::name(KStandardAction::Zoom));
action->setCheckable(true);
connect (m_zoomBar, SIGNAL(visibilityChanged(bool)), action, SLOT(setChecked(bool)));
m_toolsMenu->addAction(action);
m_toolsMenu->addAction(actionByName(QL1S("encodings")));
m_toolsMenu->addSeparator();
m_toolsMenu->addAction(actionByName(QL1S("private_browsing")));
m_toolsMenu->addAction(actionByName(QL1S("clear_private_data")));
m_toolsMenu->addSeparator();
KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this);
webMenu->addAction(actionByName(QL1S("web_inspector")));
webMenu->addAction(actionByName(QL1S("page_source")));
webMenu->addAction(actionByName(QL1S("net_analyzer")));
m_toolsMenu->addAction(webMenu);
m_toolsMenu->addSeparator();
action = m_bookmarksBar->toolBar()->toggleViewAction();
action->setText(i18n("Bookmarks Toolbar"));
action->setIcon(KIcon("bookmarks-bar"));
m_toolsMenu->addAction(action);
m_toolsMenu->addAction(actionByName(QL1S("show_history_panel")));
m_toolsMenu->addAction(actionByName(QL1S("show_bookmarks_panel")));
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen)));
m_toolsMenu->addSeparator();
this->setHelpMenuEnabled(true);
helpMenu()->setIcon(KIcon("help-browser"));
m_toolsMenu->addAction(helpMenu()->menuAction());
m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences)));
}
示例3: KActionMenu
KActionMenu *TabBar::setupHistoryActions()
{
MainWindow *w = rApp->mainWindow();
MainView *mv = qobject_cast<MainView *>(parent());
QAction *openLastClosedTabAction = w->actionByName(QL1S("open_last_closed_tab"));
bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0);
openLastClosedTabAction->setEnabled(closedTabsAvailable);
KActionMenu *am = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
am->setDelayed(false);
am->setEnabled(closedTabsAvailable);
if (am->menu())
am->menu()->clear();
if (!closedTabsAvailable)
return am;
for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i)
{
TabHistory item = mv->recentlyClosedTabs().at(i);
KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this);
a->setData(i);
connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
am->addAction(a);
}
return am;
}
示例4: setupHistoryActions
void TabBar::setupHistoryActions()
{
MainWindow *w = Application::instance()->mainWindow();
MainView *mv = qobject_cast<MainView *>(parent());
QAction *openLastClosedTabAction = w->actionByName( QL1S("open_last_closed_tab") );
openLastClosedTabAction->setEnabled( mv->recentlyClosedTabs().size() > 0 );
// update closed tabs menu
KActionMenu *am = qobject_cast<KActionMenu *>( w->actionByName( QL1S("closed_tab_menu") ));
if (!am)
return;
bool isEnabled = ( mv->recentlyClosedTabs().size() > 0 );
am->setEnabled(isEnabled);
if (am->menu())
am->menu()->clear();
if(!isEnabled)
return;
Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs())
{
KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this);
a->setData(item.url);
connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
am->addAction(a);
}
}
示例5: setupToolbar
void FileBrowserWidget::setupToolbar()
{
KActionCollection *coll = m_dirOperator->actionCollection();
m_toolbar->addAction(coll->action("back"));
m_toolbar->addAction(coll->action("forward"));
QAction *action = new QAction(this);
action->setIcon(QIcon::fromTheme("document-open"));
action->setText(i18n("Open selected"));
connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal()));
m_toolbar->addAction(action);
QAction *showOnlyLaTexFilesAction = new QAction(this);
showOnlyLaTexFilesAction->setText(i18n("Show LaTeX Files Only"));
showOnlyLaTexFilesAction->setCheckable(true);
showOnlyLaTexFilesAction->setChecked(KileConfig::showLaTeXFilesOnly());
connect(showOnlyLaTexFilesAction, SIGNAL(triggered(bool)), this, SLOT(toggleShowLaTeXFilesOnly(bool)));
// section for settings menu
KActionMenu *optionsMenu = new KActionMenu(QIcon::fromTheme("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(showOnlyLaTexFilesAction);
optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden"));
m_toolbar->addSeparator();
m_toolbar->addAction(optionsMenu);
}
示例6: createActions
void MainWindow::createActions()
{
KStandardAction::open( this, SLOT(slotFileOpen()), actionCollection() );
KStandardAction::openRecent( this, SLOT(slotFileOpenRecent()), actionCollection() );
KStandardAction::save( this, SLOT(slotFileSave()), actionCollection() );
KStandardAction::saveAs( this, SLOT(slotFileSaveAs()), actionCollection() );
KStandardAction::close( this, SLOT(slotViewClose()), actionCollection() );
KStandardAction::print( this, SLOT(slotFilePrint()), actionCollection() );
KStandardAction::quit( this, SLOT(slotFileQuit()), actionCollection() );
KStandardAction::undo( this, SLOT(slotUndo()), actionCollection() );
KStandardAction::redo( this, SLOT(slotRedo()), actionCollection() );
KStandardAction::cut( this, SLOT(slotCut()), actionCollection() );
KStandardAction::copy( this, SLOT(slotCopy()), actionCollection() );
KStandardAction::paste( this, SLOT(slotPaste()), actionCollection() );
KActionMenu *newActionMenu = new KActionMenu( KIcon("document-new"), i18n("&New"), this );
actionCollection()->addAction( KStandardAction::name(KStandardAction::New), newActionMenu );
connect( newActionMenu, SIGNAL(activated()), this, SLOT(slotFileNew()) );
KAction *action;
action = actionCollection()->addAction( QString("newfile_asm") );
action->setText( i18n("Assembly") );
action->setIcon( KIcon("") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewAssembly()) );
newActionMenu->addAction( action );
action = actionCollection()->addAction( QString("newfile_c") );
action->setText( i18n("C source") );
action->setIcon( KIcon("text-x-csrc") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewC()) );
newActionMenu->addAction( action );
action = actionCollection()->addAction( QString("ktechlab_circuit") );
action->setText( i18n("Circuit") );
action->setIcon( KIcon("ktechlab_circuit") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewCircuit()) );
newActionMenu->addAction( action );
action = actionCollection()->addAction( QString("ktechlab_flowcode") );
action->setText( i18n("FlowCode") );
action->setIcon( KIcon("ktechlab_flowcode") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewFlowCode()) );
newActionMenu->addAction( action );
action = actionCollection()->addAction( QString("ktechlab_mechanics") );
action->setText( i18n("Mechanics") );
action->setIcon( KIcon("") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewMechanics()) );
newActionMenu->addAction( action );
action = actionCollection()->addAction( QString("ktechlab_microbe") );
action->setText( i18n("Microbe") );
action->setIcon( KIcon("ktechlab_microbe") );
connect( action, SIGNAL(triggered()), this, SLOT(slotFileNewMicrobe()) );
newActionMenu->addAction( action );
}
示例7: setupActions
void JuK::setupActions()
{
KActionCollection *collection = ActionCollection::actions();
// Setup KDE standard actions that JuK uses.
KStandardAction::quit(this, SLOT(slotQuit()), collection);
KStandardAction::undo(this, SLOT(slotUndo()), collection);
KStandardAction::cut(collection);
KStandardAction::copy(collection);
KStandardAction::paste(collection);
KAction *clear = KStandardAction::clear(collection);
KStandardAction::selectAll(collection);
KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection);
// Setup the menu which handles the random play options.
KActionMenu *actionMenu = collection->add<KActionMenu>("actionMenu");
actionMenu->setText(i18n("&Random Play"));
actionMenu->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" )));
actionMenu->setDelayed(false);
QActionGroup* randomPlayGroup = new QActionGroup(this);
QAction *act = collection->add<KToggleAction>("disableRandomPlay");
act->setText(i18n("&Disable Random Play"));
act->setIcon(KIcon( QLatin1String( "go-down" )));
act->setActionGroup(randomPlayGroup);
actionMenu->addAction(act);
m_randomPlayAction = collection->add<KToggleAction>("randomPlay");
m_randomPlayAction->setText(i18n("Use &Random Play"));
m_randomPlayAction->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" )));
m_randomPlayAction->setActionGroup(randomPlayGroup);
actionMenu->addAction(m_randomPlayAction);
act = collection->add<KToggleAction>("albumRandomPlay");
act->setText(i18n("Use &Album Random Play"));
act->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" )));
act->setActionGroup(randomPlayGroup);
connect(act, SIGNAL(triggered(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->addAction(act);
act = collection->addAction("removeFromPlaylist", clear, SLOT(clear()));
act->setText(i18n("Remove From Playlist"));
act->setIcon(KIcon( QLatin1String( "list-remove" )));
act = collection->add<KToggleAction>("crossfadeTracks");
act->setText(i18n("Crossfade Between Tracks"));
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(setCrossfadeEnabled(bool)));
act = collection->addAction("play", m_player, SLOT(play()));
act->setText(i18n("&Play"));
act->setIcon(KIcon( QLatin1String( "media-playback-start" )));
act = collection->addAction("pause", m_player, SLOT(pause()));
act->setText(i18n("P&ause"));
act->setIcon(KIcon( QLatin1String( "media-playback-pause" )));
act = collection->addAction("stop", m_player, SLOT(stop()));
act->setText(i18n("&Stop"));
act->setIcon(KIcon( QLatin1String( "media-playback-stop" )));
act = new KToolBarPopupAction(KIcon( QLatin1String( "media-skip-backward") ), i18nc("previous track", "Previous" ), collection);
collection->addAction("back", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(back()));
act = collection->addAction("forward", m_player, SLOT(forward()));
act->setText(i18nc("next track", "&Next"));
act->setIcon(KIcon( QLatin1String( "media-skip-forward" )));
act = collection->addAction("loopPlaylist");
act->setText(i18n("&Loop Playlist"));
act->setCheckable(true);
act = collection->add<KToggleAction>("resizeColumnsManually");
act->setText(i18n("&Resize Playlist Columns Manually"));
// the following are not visible by default
act = collection->addAction("mute", m_player, SLOT(mute()));
act->setText(i18nc("silence playback", "Mute"));
act->setIcon(KIcon( QLatin1String( "audio-volume-muted" )));
act = collection->addAction("volumeUp", m_player, SLOT(volumeUp()));
act->setText(i18n("Volume Up"));
act->setIcon(KIcon( QLatin1String( "audio-volume-high" )));
act = collection->addAction("volumeDown", m_player, SLOT(volumeDown()));
act->setText(i18n("Volume Down"));
act->setIcon(KIcon( QLatin1String( "audio-volume-low" )));
act = collection->addAction("playPause", m_player, SLOT(playPause()));
act->setText(i18n("Play / Pause"));
act->setIcon(KIcon( QLatin1String( "media-playback-start" )));
act = collection->addAction("seekForward", m_player, SLOT(seekForward()));
act->setText(i18n("Seek Forward"));
act->setIcon(KIcon( QLatin1String( "media-seek-forward" )));
//.........这里部分代码省略.........
示例8: initInstanceActions
void KexiFormPart::initInstanceActions()
{
//connect actions provided by widget factories
createSharedAction(Kexi::DesignViewMode, xi18n("Clear Widget Contents"),
koIconName("edit-clear"), QKeySequence(), "formpart_clear_contents");
createSharedAction(Kexi::DesignViewMode, xi18n("Edit Tab Order..."),
koIconName("tab_order"), QKeySequence(), "formpart_taborder");
//! @todo createSharedAction(Kexi::DesignViewMode, xi18n("Edit Pixmap Collection"), koIconName("icons"), 0, "formpart_pixmap_collection");
//! @todo createSharedAction(Kexi::DesignViewMode, xi18n("Edit Form Connections"), koIconName("connections"), 0, "formpart_connections");
createSharedAction(Kexi::DesignViewMode, xi18n("Bring Widget to Front"), koIconName("raise"),
QKeySequence(), "formpart_format_raise");
createSharedAction(Kexi::DesignViewMode, xi18n("Send Widget to Back"), koIconName("lower"),
QKeySequence(), "formpart_format_lower");
#ifdef KEXI_SHOW_UNFINISHED
action = createSharedAction(Kexi::DesignViewMode, futureI18n("Other Widgets"), QString(),
QKeySequence(), "other_widgets_menu", "KActionMenu");
#endif
QAction *action = createSharedAction(Kexi::DesignViewMode, xi18n("Align Widgets Position"),
koIconName("aoleft"), QKeySequence(), "formpart_align_menu", "KActionMenu");
KActionMenu *menu = static_cast<KActionMenu*>(action);
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Left"), koIconName("aoleft"),
QKeySequence(), "formpart_align_to_left"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Right"), koIconName("aoright"),
QKeySequence(), "formpart_align_to_right"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Top"), koIconName("aotop"),
QKeySequence(), "formpart_align_to_top"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Bottom"), koIconName("aobottom"),
QKeySequence(), "formpart_align_to_bottom"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Grid"), koIconName("aopos2grid"),
QKeySequence(), "formpart_align_to_grid"));
action = createSharedAction(Kexi::DesignViewMode, xi18n("Adjust Widgets Size"), koIconName("aogrid"),
QKeySequence(), "formpart_adjust_size_menu", "KActionMenu");
menu = static_cast<KActionMenu*>(action);
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Fit"), koIconName("aofit"),
QKeySequence(), "formpart_adjust_to_fit"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Grid"), koIconName("aogrid"),
QKeySequence(), "formpart_adjust_size_grid"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Shortest"), koIconName("aoshortest"),
QKeySequence(), "formpart_adjust_height_small"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Tallest"), koIconName("aotallest"),
QKeySequence(), "formpart_adjust_height_big"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Narrowest"), koIconName("aonarrowest"),
QKeySequence(), "formpart_adjust_width_small"));
menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Widest"), koIconName("aowidest"),
QKeySequence(), "formpart_adjust_width_big"));
}
示例9: setupActions
void MainWindow::setupActions()
{
KAction *newDownloadAction = actionCollection()->addAction("new_download");
newDownloadAction->setText(i18n("&New Download..."));
newDownloadAction->setIcon(KIcon("document-new"));
newDownloadAction->setShortcuts(KShortcut("Ctrl+N"));
newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the list"));
connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer()));
KAction *openAction = actionCollection()->addAction("import_transfers");
openAction->setText(i18n("&Import Transfers..."));
openAction->setIcon(KIcon("document-open"));
openAction->setShortcuts(KShortcut("Ctrl+I"));
openAction->setHelpText(i18n("Imports a list of transfers"));
connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers()));
KAction *exportAction = actionCollection()->addAction("export_transfers");
exportAction->setText(i18n("&Export Transfers List..."));
exportAction->setIcon(KIcon("document-export"));
exportAction->setShortcuts(KShortcut("Ctrl+E"));
exportAction->setHelpText(i18n("Exports the current transfers into a file"));
connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers()));
KAction *createMetalinkAction = actionCollection()->addAction("create_metalink");
createMetalinkAction->setText(i18n("&Create a Metalink..."));
createMetalinkAction->setIcon(KIcon("journal-new"));
createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves it on disk"));
connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink()));
KAction *priorityTop = actionCollection()->addAction("priority_top");
priorityTop->setText(i18n("Top Priority"));
priorityTop->setIcon(KIcon("arrow-up-double"));
priorityTop->setShortcuts(KShortcut("Ctrl+PgUp"));
priorityTop->setHelpText(i18n("Download selected transfer first"));
connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop()));
KAction *priorityBottom = actionCollection()->addAction("priority_bottom");
priorityBottom->setText(i18n("Least Priority"));
priorityBottom->setIcon(KIcon("arrow-down-double"));
priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown"));
priorityBottom->setHelpText(i18n("Download selected transfer last"));
connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom()));
KAction *priorityUp = actionCollection()->addAction("priority_up");
priorityUp->setText(i18n("Increase Priority"));
priorityUp->setIcon(KIcon("arrow-up"));
priorityUp->setShortcuts(KShortcut("Ctrl+Up"));
priorityUp->setHelpText(i18n("Increase priority for selected transfer"));
connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp()));
KAction *priorityDown = actionCollection()->addAction("priority_down");
priorityDown->setText(i18n("Decrease Priority"));
priorityDown->setIcon(KIcon("arrow-down"));
priorityDown->setShortcuts(KShortcut("Ctrl+Down"));
priorityDown->setHelpText(i18n("Decrease priority for selected transfer"));
connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown()));
//FIXME: Not needed maybe because the normal delete already deletes groups?
KAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
deleteGroupAction->setText(i18n("Delete Group"));
deleteGroupAction->setIcon(KIcon("edit-delete"));
deleteGroupAction->setHelpText(i18n("Delete selected group"));
connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup()));
KAction *renameGroupAction = actionCollection()->addAction("rename_groups");
renameGroupAction->setText(i18n("Rename Group..."));
renameGroupAction->setIcon(KIcon("edit-rename"));
connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup()));
KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups");
setIconGroupAction->setText(i18n("Set Icon..."));
setIconGroupAction->setIcon(KIcon("preferences-desktop-icons"));
setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected group"));
connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup()));
m_autoPasteAction = new KToggleAction(KIcon("edit-paste"),
i18n("Auto-Paste Mode"), actionCollection());
actionCollection()->addAction("auto_paste", m_autoPasteAction);
m_autoPasteAction->setChecked(Settings::autoPaste());
m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode "
"on and off.\nWhen set, KGet will periodically scan "
"the clipboard for URLs and paste them automatically."));
connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste()));
m_konquerorIntegration = new KToggleAction(KIcon("konqueror"),
i18n("Use KGet as Konqueror Download Manager"), actionCollection());
actionCollection()->addAction("konqueror_integration", m_konquerorIntegration);
connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool)));
m_konquerorIntegration->setChecked(Settings::konquerorIntegration());
// local - Destroys all sub-windows and exits
KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
// local - Standard configure actions
KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection());
KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection());
m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection());
m_menubarAction->setChecked(!menuBar()->isHidden());
// Transfer related actions
//.........这里部分代码省略.........
示例10: setupActions
void MainWindow::setupActions()
{
// File menu actions
KStandardAction::quit(qApp, SLOT(quit()), actionCollection());
m_recent = KStandardAction::openRecent(this, SLOT(openScript(QUrl)), 0);
actionCollection()->addAction("openrecentscript", m_recent);
QAction *newQueryTab= new QAction(QIcon::fromTheme("tab-new"), tr("New Query"), this);
actionCollection()->addAction("newquerytab", newQueryTab);
connect(newQueryTab, &QAction::triggered, this, &MainWindow::newQueryTab);
QAction *newScriptTab = new QAction(QIcon::fromTheme("document-new"), tr("New Script"), this);
actionCollection()->addAction("newscripttab", newScriptTab);
connect(newScriptTab, &QAction::triggered, this, &MainWindow::newBlankScriptTab);
QAction *openScript = new QAction(QIcon::fromTheme("document-open"), tr("Open Script..."), this);
actionCollection()->addAction("openscript", openScript);
connect(openScript, &QAction::triggered, this, &MainWindow::openScriptDialog);
QAction *saveScript = new QAction(QIcon::fromTheme("document-save"), tr("Save Script"), this);
actionCollection()->addAction("savescript", saveScript);
connect(saveScript, &QAction::triggered, this, &MainWindow::saveScript);
saveScript->setEnabled(false);
QAction *saveScriptAs = new QAction(QIcon::fromTheme("document-save-as"), tr("Save Script As..."), this);
actionCollection()->addAction("savescriptas", saveScriptAs);
connect(saveScriptAs, &QAction::triggered, this, &MainWindow::saveScriptAs);
saveScriptAs->setEnabled(false);
// Export submenu
KActionMenu *exportmenu = new KActionMenu(QIcon::fromTheme("document-export-table"), tr("Export results"), this);
actionCollection()->addAction("resultexportmenu", exportmenu);
QActionGroup *exportgroup = Exporters::instance().multiTableActions(this);
for(QAction *a : exportgroup->actions())
exportmenu->addAction(a);
connect(exportgroup, SIGNAL(triggered(QAction*)),
this, SLOT(exportResults(QAction*)));
// Edit menu actions
KStandardAction::find(this, SLOT(search()), actionCollection());
KStandardAction::findNext(this, SLOT(findNext()), actionCollection());
KStandardAction::findPrev(this, SLOT(findPrev()), actionCollection());
QAction *clearResultView = new QAction(tr("Clear results"), this);
actionCollection()->addAction("resultsclear", clearResultView);
connect(clearResultView, &QAction::triggered, this, &MainWindow::clearResults);
// Settings menu actions
QAction *showTableDock = new QAction(tr("Show Tables"), this);
showTableDock->setCheckable(true);
actionCollection()->addAction("showtables", showTableDock);
QAction *showDatabaseDock = new QAction(tr("Show Databases"), this);
showDatabaseDock->setCheckable(true);
actionCollection()->addAction("showdatabases", showDatabaseDock);
// Other actions
QAction *newConnection = new QAction(tr("New Connection"), this);
actionCollection()->addAction("newconnection", newConnection);
connect(newConnection, &QAction::triggered, this, &MainWindow::newConnection);
}
示例11: initActions
void KoPAView::initActions()
{
KAction *action = actionCollection()->addAction( KStandardAction::Cut, "edit_cut", 0, 0);
new KoCutController(kopaCanvas(), action);
action = actionCollection()->addAction( KStandardAction::Copy, "edit_copy", 0, 0 );
new KoCopyController(kopaCanvas(), action);
d->editPaste = actionCollection()->addAction( KStandardAction::Paste, "edit_paste", proxyObject, SLOT( editPaste() ) );
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
connect(d->canvas->toolProxy(), SIGNAL(toolChanged(const QString&)), this, SLOT(clipboardDataChanged()));
clipboardDataChanged();
actionCollection()->addAction(KStandardAction::SelectAll, "edit_select_all", this, SLOT(editSelectAll()));
actionCollection()->addAction(KStandardAction::Deselect, "edit_deselect_all", this, SLOT(editDeselectAll()));
d->deleteSelectionAction = new KAction(KIcon("edit-delete"), i18n("D&elete"), this);
actionCollection()->addAction("edit_delete", d->deleteSelectionAction );
d->deleteSelectionAction->setShortcut(QKeySequence("Del"));
d->deleteSelectionAction->setEnabled(false);
connect(d->deleteSelectionAction, SIGNAL(triggered()), this, SLOT(editDeleteSelection()));
connect(d->canvas->toolProxy(), SIGNAL(selectionChanged(bool)),
d->deleteSelectionAction, SLOT(setEnabled(bool)));
KToggleAction *showGrid= d->doc->gridData().gridToggleAction(d->canvas);
actionCollection()->addAction("view_grid", showGrid );
d->actionViewSnapToGrid = new KToggleAction(i18n("Snap to Grid"), this);
d->actionViewSnapToGrid->setChecked(d->doc->gridData().snapToGrid());
actionCollection()->addAction("view_snaptogrid", d->actionViewSnapToGrid);
connect( d->actionViewSnapToGrid, SIGNAL( triggered( bool ) ), this, SLOT (viewSnapToGrid( bool )));
KToggleAction *actionViewShowGuides = KoStandardAction::showGuides(this, SLOT(viewGuides(bool)), this);
actionViewShowGuides->setChecked( d->doc->guidesData().showGuideLines() );
actionCollection()->addAction(KoStandardAction::name(KoStandardAction::ShowGuides),
actionViewShowGuides );
d->actionViewShowMasterPages = new KToggleAction(i18n( "Show Master Pages" ), this );
actionCollection()->addAction( "view_masterpages", d->actionViewShowMasterPages );
connect( d->actionViewShowMasterPages, SIGNAL( triggered( bool ) ), this, SLOT( setMasterMode( bool ) ) );
d->viewRulers = new KToggleAction(i18n("Show Rulers"), this);
actionCollection()->addAction("view_rulers", d->viewRulers );
d->viewRulers->setToolTip(i18n("Show/hide the view's rulers"));
connect(d->viewRulers, SIGNAL(triggered(bool)), proxyObject, SLOT(setShowRulers(bool)));
setShowRulers(d->doc->rulersVisible());
d->actionInsertPage = new KAction( KIcon("document-new"), i18n( "Insert Page" ), this );
actionCollection()->addAction( "page_insertpage", d->actionInsertPage );
d->actionInsertPage->setToolTip( i18n( "Insert a new page after the current one" ) );
d->actionInsertPage->setWhatsThis( i18n( "Insert a new page after the current one" ) );
connect( d->actionInsertPage, SIGNAL( triggered() ), proxyObject, SLOT( insertPage() ) );
d->actionCopyPage = new KAction( i18n( "Copy Page" ), this );
actionCollection()->addAction( "page_copypage", d->actionCopyPage );
d->actionCopyPage->setToolTip( i18n( "Copy the current page" ) );
d->actionCopyPage->setWhatsThis( i18n( "Copy the current page" ) );
connect( d->actionCopyPage, SIGNAL( triggered() ), this, SLOT( copyPage() ) );
d->actionDeletePage = new KAction( i18n( "Delete Page" ), this );
d->actionDeletePage->setEnabled( d->doc->pageCount() > 1 );
actionCollection()->addAction( "page_deletepage", d->actionDeletePage );
d->actionDeletePage->setToolTip( i18n( "Delete the current page" ) );
d->actionDeletePage->setWhatsThis( i18n( "Delete the current page" ) );
connect( d->actionDeletePage, SIGNAL( triggered() ), this, SLOT( deletePage() ) );
d->actionMasterPage = new KAction(i18n("Master Page..."), this);
actionCollection()->addAction("format_masterpage", d->actionMasterPage);
connect(d->actionMasterPage, SIGNAL(triggered()), this, SLOT(formatMasterPage()));
d->actionPageLayout = new KAction( i18n( "Page Layout..." ), this );
actionCollection()->addAction( "format_pagelayout", d->actionPageLayout );
connect( d->actionPageLayout, SIGNAL( triggered() ), this, SLOT( formatPageLayout() ) );
actionCollection()->addAction(KStandardAction::Prior, "page_previous", this, SLOT(goToPreviousPage()));
actionCollection()->addAction(KStandardAction::Next, "page_next", this, SLOT(goToNextPage()));
actionCollection()->addAction(KStandardAction::FirstPage, "page_first", this, SLOT(goToFirstPage()));
actionCollection()->addAction(KStandardAction::LastPage, "page_last", this, SLOT(goToLastPage()));
KActionMenu *actionMenu = new KActionMenu(i18n("Variable"), this);
foreach(QAction *action, d->doc->inlineTextObjectManager()->createInsertVariableActions(d->canvas))
actionMenu->addAction(action);
actionCollection()->addAction("insert_variable", actionMenu);
KAction * am = new KAction(i18n("Import Document..."), this);
actionCollection()->addAction("import_document", am);
connect(am, SIGNAL(triggered()), this, SLOT(importDocument()));
d->actionConfigure = new KAction(KIcon("configure"), i18n("Configure..."), this);
actionCollection()->addAction("configure", d->actionConfigure);
connect(d->actionConfigure, SIGNAL(triggered()), this, SLOT(configure()));
d->find = new KoFind( this, d->canvas->resourceManager(), actionCollection() );
actionCollection()->action( "object_group" )->setShortcut( QKeySequence( "Ctrl+G" ) );
actionCollection()->action( "object_ungroup" )->setShortcut( QKeySequence( "Ctrl+Shift+G" ) );
}
示例12: editableContentActionPopupMenu
void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& partGroupMap)
{
QList<QAction*> editableContentActions;
KActionMenu* menu = new KActionMenu(i18nc("Text direction", "Direction"), this);
QActionGroup* group = new QActionGroup(this);
group->setExclusive(true);
QAction *action = m_actionCollection->addAction(QL1S("text-direction-default"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
action->setText(i18n("Default"));
action->setCheckable(true);
action->setData(QWebPage::SetTextDirectionDefault);
action->setEnabled(pageAction(QWebPage::SetTextDirectionDefault)->isEnabled());
action->setCheckable(pageAction(QWebPage::SetTextDirectionDefault)->isChecked());
action->setActionGroup(group);
menu->addAction(action);
action = m_actionCollection->addAction(QL1S("text-direction-left-to-right"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
action->setText(i18n("Left to right"));
action->setCheckable(true);
action->setData(QWebPage::SetTextDirectionLeftToRight);
action->setEnabled(pageAction(QWebPage::SetTextDirectionLeftToRight)->isEnabled());
action->setChecked(pageAction(QWebPage::SetTextDirectionLeftToRight)->isChecked());
action->setActionGroup(group);
menu->addAction(action);
action = m_actionCollection->addAction(QL1S("text-direction-right-to-left"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
action->setText(i18n("Right to left"));
action->setCheckable(true);
action->setData(QWebPage::SetTextDirectionRightToLeft);
action->setEnabled(pageAction(QWebPage::SetTextDirectionRightToLeft)->isEnabled());
action->setChecked(pageAction(QWebPage::SetTextDirectionRightToLeft)->isChecked());
action->setActionGroup(group);
menu->addAction(action);
editableContentActions.append(menu);
action = new QAction(m_actionCollection);
action->setSeparator(true);
editableContentActions.append(action);
action = m_actionCollection->addAction(KStandardAction::Copy, QL1S("copy"), m_part->browserExtension(), SLOT(copy()));
action->setEnabled(pageAction(QWebPage::Copy)->isEnabled());
editableContentActions.append(action);
action = m_actionCollection->addAction(KStandardAction::Cut, QL1S("cut"), m_part->browserExtension(), SLOT(cut()));
action->setEnabled(pageAction(QWebPage::Cut)->isEnabled());
editableContentActions.append(action);
action = m_actionCollection->addAction(KStandardAction::Paste, QL1S("paste"), m_part->browserExtension(), SLOT(paste()));
action->setEnabled(pageAction(QWebPage::Paste)->isEnabled());
editableContentActions.append(action);
action = new QAction(m_actionCollection);
action->setSeparator(true);
editableContentActions.append(action);
const bool hasContent = (!m_result.element().evaluateJavaScript(QL1S("this.value")).toString().isEmpty());
action = m_actionCollection->addAction(KStandardAction::SelectAll, QL1S("selectall"), m_part->browserExtension(), SLOT(slotSelectAll()));
action->setEnabled((pageAction(QWebPage::SelectAll)->isEnabled() && hasContent));
editableContentActions.append(action);
if (showSpellCheckAction(m_result.element())) {
action = new QAction(m_actionCollection);
action->setSeparator(true);
editableContentActions.append(action);
action = m_actionCollection->addAction(KStandardAction::Spelling, QL1S("spelling"), m_part->browserExtension(), SLOT(slotCheckSpelling()));
action->setText(i18n("Check Spelling..."));
action->setEnabled(hasContent);
editableContentActions.append(action);
const bool hasSelection = (hasContent && m_result.isContentSelected());
action = m_actionCollection->addAction(KStandardAction::Spelling, QL1S("spellcheckSelection"), m_part->browserExtension(), SLOT(slotSpellCheckSelection()));
action->setText(i18n("Spellcheck selection..."));
action->setEnabled(hasSelection);
editableContentActions.append(action);
}
if (settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) {
if (!m_webInspector) {
m_webInspector = new QWebInspector;
m_webInspector->setPage(page());
connect(page(), SIGNAL(destroyed()), m_webInspector, SLOT(deleteLater()));
}
action = new QAction(m_actionCollection);
action->setSeparator(true);
editableContentActions.append(action);
editableContentActions.append(pageAction(QWebPage::InspectElement));
}
partGroupMap.insert("editactions" , editableContentActions);
}
示例13: initMainWidget
void ActionManagerImpl::initMainWidget(MainWidget* mainWidget)
{
if (d->mainWidget)
return;
d->mainWidget = mainWidget;
KActionCollection* coll = actionCollection();
// Feed/Feed Group popup menu
KAction* action = coll->addAction("feed_homepage");
action->setText(i18n("&Open Homepage"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenHomepage()));
action->setShortcuts(KShortcut( "Ctrl+H" ));
action = coll->addAction("reload_all_tabs");
action->setIcon(KIcon("view-refresh"));
action->setText(i18n("Reload All Tabs"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotReloadAllTabs()));
action->setShortcuts(KShortcut( "Shift+F5" ));
action = coll->addAction("feed_add");
action->setIcon(KIcon("feed-subscribe"));
action->setText(i18n("&Add Feed..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAdd()));
action->setShortcuts(KShortcut( "Insert" ));
action = coll->addAction("feed_add_group");
action->setIcon(KIcon("folder-new"));
action->setText(i18n("Ne&w Folder..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAddGroup()));
action->setShortcuts(KShortcut( "Shift+Insert" ));
action = coll->addAction("feed_remove");
action->setIcon(KIcon("edit-delete"));
action->setText(i18n("&Delete Feed"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedRemove()));
action->setShortcuts(KShortcut( "Alt+Delete" ));
action = coll->addAction("feed_modify");
action->setIcon(KIcon("document-properties"));
action->setText(i18n("&Edit Feed..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedModify()));
action->setShortcuts(KShortcut( "F2" ));
// toolbar / View
action = coll->addAction("normal_view");
action->setIcon(KIcon("view-split-top-bottom"));
action->setText(i18n("&Normal View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNormalView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+1" ));
action = coll->addAction("widescreen_view");
action->setIcon(KIcon("view-split-left-right"));
action->setText(i18n("&Widescreen View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotWidescreenView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+2" ));
action = coll->addAction("combined_view");
action->setIcon(KIcon("view-list-text"));
action->setText(i18n("C&ombined View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCombinedView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+3" ));
// toolbar / feed menu
action = coll->addAction("feed_fetch");
action->setIcon(KIcon("go-down"));
action->setText(i18n("&Fetch Feed"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchCurrentFeed()));
action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload));
action = coll->addAction("feed_fetch_all");
action->setIcon(KIcon("go-bottom"));
action->setText(i18n("Fe&tch All Feeds"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchAllFeeds()));
action->setShortcuts(KShortcut( "Ctrl+L" ));
KAction *stopAction = coll->addAction("feed_stop");
stopAction->setIcon(KIcon("process-stop"));
stopAction->setText(i18n("C&ancel Feed Fetches"));
connect(stopAction, SIGNAL(triggered(bool)), Kernel::self()->fetchQueue(), SLOT(slotAbort()));
stopAction->setShortcut(QKeySequence(Qt::Key_Escape));
stopAction->setEnabled(false);
action = coll->addAction("feed_mark_all_as_read");
action->setIcon(KIcon("mail-mark-read"));
action->setText(i18n("&Mark Feed as Read"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllRead()));
action->setShortcuts(KShortcut( "Ctrl+R" ));
action = coll->addAction("feed_mark_all_feeds_as_read");
action->setIcon(KIcon("mail-mark-read"));
action->setText(i18n("Ma&rk All Feeds as Read"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllFeedsRead()));
action->setShortcuts(KShortcut( "Ctrl+Shift+R" ));
// Settings menu
KToggleAction *sqf = coll->add<KToggleAction>("show_quick_filter");
sqf->setText(i18n("Show Quick Filter"));
//.........这里部分代码省略.........
示例14: KexiView
KexiReportView::KexiReportView(QWidget *parent)
: KexiView(parent), m_preRenderer(0), m_reportDocument(0) //! @todo KEXI3, m_kexi(0), m_functions(0)
{
setObjectName("KexiReportDesigner_DataView");
m_reportView = new KReportView(this);
layout()->addWidget(m_reportView);
#ifndef KEXI_MOBILE
m_pageSelector = new KexiRecordNavigator(*m_reportView->scrollArea(), m_reportView);
m_pageSelector->setInsertingButtonVisible(false);
m_pageSelector->setInsertingEnabled(false);
m_pageSelector->setLabelText(xi18nc("Page selector label", "Page:"));
m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonFirst, xi18n("Go to first page"));
m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonFirst, xi18n("Goes to first page"));
m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonPrevious, xi18n("Go to previous page"));
m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonPrevious, xi18n("Goes to previous page"));
m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonNext, xi18n("Go to next page"));
m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonNext, xi18n("Goes to next page"));
m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonLast, xi18n("Go to last page"));
m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonLast, xi18n("Goes to last page"));
m_pageSelector->setNumberFieldToolTips(xi18n("Current page number"), xi18n("Number of pages"));
m_pageSelector->setRecordHandler(this);
#endif
// -- setup local actions
QList<QAction*> viewActions;
QAction* a;
#ifndef KEXI_MOBILE
viewActions << (a = new QAction(koIcon("document-print"), xi18n("Print"), this));
a->setObjectName("print_report");
a->setToolTip(xi18n("Print report"));
a->setWhatsThis(xi18n("Prints the current report."));
connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport()));
KActionMenu *exportMenu = new KActionMenu(koIcon("document-export"), xi18nc("@title:menu","E&xport As"), this);
exportMenu->setObjectName("report_export_as");
exportMenu->setDelayed(false);
#endif
#ifdef KEXI_MOBILE
viewActions << (a = new QAction(xi18n("Export:"), this));
a->setEnabled(false); //!TODO this is a bit of a dirty way to add what looks like a label to the toolbar!
// " ", not "", is said to be needed in maemo, the icon didn't display properly without it
viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), QLatin1String(" "), this));
#else
exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.text"),
xi18nc("open dialog to export as text document", "Text Document..."), this));
#endif
a->setObjectName("export_as_text_document");
a->setToolTip(xi18n("Export the report as a text document (in OpenDocument Text format)"));
a->setWhatsThis(xi18n("Exports the report as a text document (in OpenDocument Text format)."));
a->setEnabled(true);
connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsTextDocument()));
#ifdef KEXI_MOBILE
viewActions << (a = new QAction(koIcon("application-pdf"), QLatin1String(" "), this));
#else
exportMenu->addAction(a = new QAction(koIcon("application-pdf"),
xi18nc("Portable Document Format...", "PDF..."), this));
#endif
a->setObjectName("export_as_pdf");
a->setToolTip(xi18n("Export as PDF"));
a->setWhatsThis(xi18n("Exports the current report as PDF."));
a->setEnabled(true);
connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsPdf()));
#ifdef KEXI_MOBILE
viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), QLatin1String(" "), this));
#else
exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"),
xi18nc("open dialog to export as spreadsheet", "Spreadsheet..."), this));
#endif
a->setObjectName("export_as_spreadsheet");
a->setToolTip(xi18n("Export the report as a spreadsheet (in OpenDocument Spreadsheet format)"));
a->setWhatsThis(xi18n("Exports the report as a spreadsheet (in OpenDocument Spreadsheet format)."));
a->setEnabled(true);
connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsSpreadsheet()));
#ifdef KEXI_MOBILE
viewActions << (a = new QAction(koIcon("text-html"), QLatin1String(" "), this));
#else
exportMenu->addAction(a = new QAction(koIcon("text-html"),
xi18nc("open dialog to export as web page", "Web Page..."), this));
#endif
a->setObjectName("export_as_web_page");
a->setToolTip(xi18n("Export the report as a web page (in HTML format)"));
a->setWhatsThis(xi18n("Exports the report as a web page (in HTML format)."));
a->setEnabled(true);
connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsWebPage()));
setViewActions(viewActions);
#ifndef KEXI_MOBILE
// setup main menu actions
QList<QAction*> mainMenuActions;
mainMenuActions << exportMenu;
//.........这里部分代码省略.........
示例15: initActions
void KPrView::initActions()
{
setComponentName(KPrFactory::componentData().componentName(), KPrFactory::componentData().componentDisplayName());
if (!koDocument()->isReadWrite() )
setXMLFile( "calligrastage_readonly.rc" );
else
setXMLFile( "calligrastage.rc" );
// do special stage stuff here
m_actionExportHtml = new QAction(i18n("Export as HTML..."), this);
actionCollection()->addAction("file_export_html", m_actionExportHtml);
connect(m_actionExportHtml, SIGNAL(triggered()), this, SLOT(exportToHtml()));
m_actionViewModeNormal = new QAction(m_normalMode->name(), this);
m_actionViewModeNormal->setCheckable(true);
m_actionViewModeNormal->setChecked(true);
actionCollection()->setDefaultShortcut(m_actionViewModeNormal, QKeySequence("CTRL+F5"));
actionCollection()->addAction("view_normal", m_actionViewModeNormal);
connect(m_actionViewModeNormal, SIGNAL(triggered()), this, SLOT(showNormal()));
m_actionViewModeNotes = new QAction(m_notesMode->name(), this);
m_actionViewModeNotes->setCheckable(true);
actionCollection()->setDefaultShortcut(m_actionViewModeNotes, QKeySequence("CTRL+F6"));
actionCollection()->addAction("view_notes", m_actionViewModeNotes);
connect(m_actionViewModeNotes, SIGNAL(triggered()), this, SLOT(showNotes()));
m_actionViewModeSlidesSorter = new QAction(m_slidesSorterMode->name(), this);
m_actionViewModeSlidesSorter->setCheckable(true);
actionCollection()->setDefaultShortcut(m_actionViewModeSlidesSorter, QKeySequence("CTRL+F7"));
actionCollection()->addAction("view_slides_sorter", m_actionViewModeSlidesSorter);
connect(m_actionViewModeSlidesSorter, SIGNAL(triggered()), this, SLOT(showSlidesSorter()));
if ( QAction *action = actionCollection()->action("view_masterpages") )
actionCollection()->setDefaultShortcut(action, QKeySequence("CTRL+F8"));
m_actionInsertPictures = new QAction(i18n("Insert Pictures as Slides..."), this);
actionCollection()->addAction("insert_pictures", m_actionInsertPictures);
connect(m_actionInsertPictures, SIGNAL(triggered()), this, SLOT(insertPictures()));
QActionGroup *viewModesGroup = new QActionGroup(this);
viewModesGroup->addAction(m_actionViewModeNormal);
viewModesGroup->addAction(m_actionViewModeNotes);
viewModesGroup->addAction(m_actionViewModeSlidesSorter);
m_actionCreateAnimation = new QAction( i18n( "Create Appear Animation" ), this );
actionCollection()->addAction( "edit_createanimation", m_actionCreateAnimation );
connect( m_actionCreateAnimation, SIGNAL(triggered()), this, SLOT(createAnimation()) );
m_actionEditCustomSlideShows = new QAction( i18n( "Edit Custom Slide Shows..." ), this );
actionCollection()->addAction( "edit_customslideshows", m_actionEditCustomSlideShows );
connect( m_actionEditCustomSlideShows, SIGNAL(triggered()), this, SLOT(editCustomSlideShows()) );
KActionMenu *actionStartPresentation = new KActionMenu(koIcon("view-presentation"), i18n("Start Presentation"), this);
actionCollection()->addAction( "slideshow_start", actionStartPresentation );
connect( actionStartPresentation, SIGNAL(triggered()), this, SLOT(startPresentation()) ); // for the toolbar button
QAction* action = new QAction( i18n( "From Current Slide" ), this );
action->setShortcut(QKeySequence("Shift+F5"));
actionStartPresentation->addAction( action );
connect( action, SIGNAL(triggered()), this, SLOT(startPresentation()) );
action = new QAction( i18n( "From First Slide" ), this );
action->setShortcut(QKeySequence("F5"));
actionStartPresentation->addAction( action );
connect( action, SIGNAL(triggered()), this, SLOT(startPresentationFromBeginning()) );
m_actionStopPresentation = new QAction( i18n( "Stop presentation" ), this );
actionCollection()->addAction( "slideshow_stop", m_actionStopPresentation );
m_actionStopPresentation->setShortcut(Qt::Key_Escape);
connect(m_actionStopPresentation, SIGNAL(triggered()), this, SLOT(stopPresentation()));
m_actionStopPresentation->setEnabled(false);
KToggleAction *showStatusbarAction = new KToggleAction(i18n("Show Status Bar"), this);
showStatusbarAction->setCheckedState(KGuiItem(i18n("Hide Status Bar")));
showStatusbarAction->setToolTip(i18n("Shows or hides the status bar"));
actionCollection()->addAction("showStatusBar", showStatusbarAction);
connect(showStatusbarAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool)));
//Update state of status bar action
if (showStatusbarAction && statusBar()){
showStatusbarAction->setChecked(! statusBar()->isHidden());
}
action = new QAction( i18n( "Configure Slide Show..." ), this );
actionCollection()->addAction( "slideshow_configure", action );
connect( action, SIGNAL(triggered()), this, SLOT(configureSlideShow()) );
action = new QAction( i18n( "Configure Presenter View..." ), this );
actionCollection()->addAction( "slideshow_presenterview", action );
connect( action, SIGNAL(triggered()), this, SLOT(configurePresenterView()) );
m_actionDrawOnPresentation = new QAction( i18n( "Draw on the presentation..." ), this );
actionCollection()->setDefaultShortcut(m_actionDrawOnPresentation, Qt::Key_P);
m_actionDrawOnPresentation->setShortcutContext(Qt::ApplicationShortcut);
actionCollection()->addAction( "draw_on_presentation", m_actionDrawOnPresentation );
connect( m_actionDrawOnPresentation, SIGNAL(triggered()), this, SLOT(drawOnPresentation()) );
m_actionDrawOnPresentation->setEnabled(false);
m_actionHighlightPresentation = new QAction( i18n( "Highlight the presentation..." ), this );
actionCollection()->setDefaultShortcut(m_actionHighlightPresentation, Qt::Key_H);
m_actionHighlightPresentation->setShortcutContext(Qt::ApplicationShortcut);
actionCollection()->addAction( "highlight_presentation", m_actionHighlightPresentation );
//.........这里部分代码省略.........