SearchToolBar::SearchToolBar(KMainWindow* parent, QObject* receiver, const char* slot, const char* name) : KToolBar(parent, DockTop, false, name, true) { // support for clearing the search KAction *clearAction = new KAction(i18n("Clear"), QString::fromLatin1("locationbar_erase"), 0, this, SLOT(clear()), new KActionCollection(this), "clear" ); clearAction->plug(this); // display label QLabel* label = new QLabel(i18n("Search:") + QString::fromLatin1(" "), this); insertWidget(-1, -1, label); // the editable combo box m_combo = new KComboBox(this); m_combo->setEditable(true); m_combo->setInsertionPolicy(QComboBox::AtTop); insertWidget(-1, -1, m_combo); connect(m_combo, SIGNAL(activated(const QString& )), this, SIGNAL(find(const QString& ))); connect(m_combo, SIGNAL(returnPressed()), m_combo->lineEdit(), SLOT(selectAll())); setStretchableWidget(m_combo); m_combo->setFocus(); QWhatsThis::add( m_combo, i18n( "Enter word to conjugate here" ) ); // extra, a button to do the search KAction *findAction = new KAction(i18n("Find"), QString::fromLatin1("find"), 0, this, SLOT( find() ), new KActionCollection(this), "find"); findAction->plug(this); // connect the arguments connect(this, SIGNAL(find(const QString& )), receiver, slot); }
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); } }
KActionMenu* WPAccount::actionMenu() { kdDebug(14170) << "WPAccount::actionMenu()" << endl; /// How to remove an action from Kopete::Account::actionMenu()? GF KActionMenu *theActionMenu = new KActionMenu(accountId() , myself()->onlineStatus().iconFor(this), this); theActionMenu->popupMenu()->insertTitle(myself()->onlineStatus().iconFor(this), i18n("WinPopup (%1)").arg(accountId())); if (mProtocol) { KAction *goOnline = new KAction("Online", QIconSet(mProtocol->WPOnline.iconFor(this)), 0, this, SLOT(connect()), theActionMenu, "actionGoAvailable"); goOnline->setEnabled(isConnected() && isAway()); theActionMenu->insert(goOnline); KAction *goAway = new KAction("Away", QIconSet(mProtocol->WPAway.iconFor(this)), 0, this, SLOT(goAway()), theActionMenu, "actionGoAway"); goAway->setEnabled(isConnected() && !isAway()); theActionMenu->insert(goAway); /// One can not really go offline manually - appears online as long as samba server is running. GF theActionMenu->popupMenu()->insertSeparator(); theActionMenu->insert(new KAction(i18n("Properties"), 0, this, SLOT(editAccount()), theActionMenu, "actionAccountProperties")); } return theActionMenu; }
void MainWindow::setupActions() { actQuit = KStandardAction::quit(this, SLOT(quit()), actionCollection()); KAction *a = NULL; a = actionCollection()->addAction("minimizeRestore", this, SLOT(minimizeRestore())); a->setText(i18n("Minimize")); a->setIcon(KIcon("")); a->setShortcut(0); /** Settings : ************************************************************/ // m_actShowToolbar = KStandardAction::showToolbar( this, SLOT(toggleToolBar()), actionCollection()); m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection()); // m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) ); (void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection()); (void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection()); //KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() ); //actCfgNotifs->setEnabled(false); // Not yet implemented ! actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection()); }
KexiReportDesignView::KexiReportDesignView(QWidget *parent, ReportEntitySelector* r) : KexiView(parent) { scr = new QScrollArea(this); layout()->addWidget(scr); res = r; _rd = 0; editCutAction = new KAction(KIcon("edit-cut"), i18n("Cut"), this); editCutAction->setObjectName("editcut"); editCopyAction = new KAction(KIcon("edit-copy"), i18n("Copy"), this); editCopyAction->setObjectName("editcopy"); editPasteAction = new KAction(KIcon("edit-paste"), i18n("Paste"), this); editPasteAction->setObjectName("editpaste"); editDeleteAction = new KAction(KIcon("edit-delete"), i18n("Delete"), this); editDeleteAction->setObjectName("editdelete"); sectionEdit = new KAction(i18n("Section Editor"), this); sectionEdit->setObjectName("sectionedit"); itemRaiseAction = new KAction(KIcon("arrow-up"), i18n("Raise"), this); itemRaiseAction->setObjectName("itemraise"); itemLowerAction = new KAction(KIcon("arrow-down"), i18n("Lower"), this); itemLowerAction->setObjectName("itemlower"); //parameterEdit = new KAction ( i18n ( "Parameter Editor" ), this ); //parameterEdit->setObjectName("parameteredit"); QList<QAction*> al; KAction *sep = new KAction("", this); sep->setSeparator(true); al << editCutAction << editCopyAction << editPasteAction << editDeleteAction << sep << sectionEdit << sep << itemLowerAction << itemRaiseAction; setViewActions(al); }
App::App() : KUniqueApplication() ,m_networkAccessManager(new NetworkAccessManager(this)) ,m_oauth(new QOAuth::Interface(this)) ,m_parser(new QJson::Parser) ,m_mainWindow(0) ,m_controller(0) ,m_tray(0) { qmlRegisterType<QDeclarativePropertyMap>(); m_controller = new Controller; m_mainWindow = new MainWindow; m_tray = new KStatusNotifierItem(m_mainWindow); m_tray->setIconByName("kmoefm"); m_tray->setTitle(i18n("Moe FM")); m_tray->setToolTipIconByName("kmoefm"); m_tray->setToolTipTitle(i18n("KMoeFM")); m_tray->setToolTipSubTitle(i18n("Moe FM")); KAction* action; action = m_tray->actionCollection()->addAction(QLatin1String("relogin"), this, SLOT(relogin())); action->setText(i18n("Relogin")); m_tray->contextMenu()->addAction(action); m_tray->setAssociatedWidget(m_mainWindow); connect(m_controller, SIGNAL(infoChanged()), this, SLOT(updateInfo())); m_oauth->setConsumerKey(CONSUMER_KEY); m_oauth->setConsumerSecret(CONSUMER_SECRET); readSettings(); connect(this, SIGNAL(checkCredentialFinished(bool)), SLOT(firstRunCheck(bool))); QTimer::singleShot(0, this, SLOT(checkCredential())); }
void KNotesApp::updateNoteActions() { unplugActionList( "notes" ); m_noteActions.clear(); for ( QDictIterator<KNote> it( m_noteList ); it.current(); ++it ) { KAction *action = new KAction( it.current()->name().replace("&", "&&"), KShortcut(), this, SLOT(slotShowNote()), (QObject *)0, it.current()->noteId().utf8() ); KIconEffect effect; QPixmap icon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1, it.current()->paletteBackgroundColor(), false ); action->setIconSet( icon ); m_noteActions.append( action ); } m_noteActions.sort(); if ( m_noteActions.isEmpty() ) { KAction *action = new KAction( i18n("No Notes") ); m_noteActions.append( action ); } plugActionList( "notes", m_noteActions ); }
MakeViewPart::MakeViewPart(QObject *parent, const char *name, const QStringList &) : KDevMakeFrontend(&data, parent, name) { setInstance(MakeViewFactory::instance()); setXMLFile("kdevmakeview.rc"); m_dcop = new KDevMakeFrontendIface(this); m_widget = new MakeWidget(this); m_widget->setIcon( SmallIcon("exec") ); m_widget->setCaption(i18n("Messages Output")); QWhatsThis::add(m_widget, i18n("<b>Messages output</b><p>" "The messages window shows the output of the compiler and " "used build tools like make, ant, uic, dcopidl etc. " "For compiler error messages, click on the error message. " "This will automatically open the source file and set the " "cursor to the line that caused the compiler error/warning.")); mainWindow()->embedOutputView(m_widget, i18n("Messages"), i18n("Compiler output messages")); KAction *action; action = new KAction( i18n("&Next Error"), Key_F4, m_widget, SLOT(nextError()), actionCollection(), "view_next_error"); action->setToolTip( i18n("Go to the next error") ); action->setWhatsThis(i18n("<b>Next error</b><p>Switches to the file and line where the next error was reported from.")); action = new KAction( i18n("&Previous Error"), SHIFT+Key_F4, m_widget, SLOT(prevError()), actionCollection(), "view_previous_error"); action->setToolTip( i18n("Go to the previous error") ); action->setWhatsThis(i18n("<b>Previous error</b><p>Switches to the file and line where the previous error was reported from.")); connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)), this, SLOT(slotStopButtonClicked(KDevPlugin*)) ); }
void Core::setupShourtcutTips(KXMLGUIClient * client) { QPtrList<KXMLGUIClient> clients; if (client != 0) clients.append(client); else clients = TopLevel::getInstance()->main()->guiFactory()->clients(); for( QPtrListIterator<KXMLGUIClient> it(clients); it.current(); ++it ) { KActionCollection *actionCollection = (*it)->actionCollection(); for (int i = 0; i < actionCollection->count(); i++) { KAction *action = actionCollection->action(i); QString tooltip = action->toolTip(); if (tooltip.isEmpty()) tooltip = action->text().remove('&'); else { int i = tooltip.findRev('('); if (i > 0) tooltip = tooltip.left(i).stripWhiteSpace(); } QString shortcut = action->shortcutText(); if (!shortcut.isEmpty()) tooltip += " (" + shortcut + ")"; action->setToolTip(tooltip); } } }
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 ActionManagerImpl::initFrameManager(FrameManager* frameManager) { if (d->frameManager) return; d->frameManager = frameManager; bool isRTL = QApplication::isRightToLeft(); KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon(isRTL ? "go-previous" : "go-next"), i18nc("Go forward in browser history", "Forward"), this); d->actionCollection->addAction("browser_forward", forward); forward->setShortcuts(KShortcut(isRTL ? "Alt+Left" : "Alt+Right")); connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward())); connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow())); KToolBarPopupAction* back = new KToolBarPopupAction(KIcon(isRTL ? "go-next" : "go-previous"), i18nc("Go back in browser history", "Back"), this); d->actionCollection->addAction("browser_back", back); back->setShortcuts(KShortcut(isRTL ? "Alt+Right" : "Alt+Left")); connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack())); connect(back->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserBackAboutToShow())); KAction *action = d->actionCollection->addAction("browser_reload"); action->setIcon(KIcon("view-refresh")); action->setText(i18nc("Reload current page", "Reload")); connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserReload())); action = d->actionCollection->addAction("browser_stop"); action->setIcon(KIcon("process-stop")); action->setText(i18n("Stop")); connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserStop())); }
amaroK::TrayIcon::TrayIcon( QWidget *playerWidget ) : KSystemTray( playerWidget ) , EngineObserver( EngineController::instance() ) , trackLength( 0 ) , mergeLevel( -1 ) , overlay( 0 ) , blinkTimerID( 0 ) , overlayVisible( false ) { KActionCollection* const ac = amaroK::actionCollection(); setAcceptDrops( true ); ac->action( "prev" )->plug( contextMenu() ); ac->action( "play_pause" )->plug( contextMenu() ); ac->action( "stop" )->plug( contextMenu() ); ac->action( "next" )->plug( contextMenu() ); //seems to be necessary KAction *quit = actionCollection()->action( "file_quit" ); quit->disconnect(); connect( quit, SIGNAL(activated()), kapp, SLOT(quit()) ); baseIcon = KSystemTray::loadIcon( "amarok" ); playOverlay = amaroK::loadOverlay( "play" ); pauseOverlay = amaroK::loadOverlay( "pause" ); overlayVisible = false; //paintIcon(); setPixmap( baseIcon ); }
WindowGeometry::WindowGeometry() { iAmActivated = true; iAmActive = false; myResizeWindow = 0L; #define myResizeString "Window geometry display, %1 and %2 are the new size," \ " %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \ "Width: %1 (%3)\nHeight: %2 (%4)" #define myCoordString_0 "Window geometry display, %1 and %2 are the cartesian x and y coordinates" \ " - avoid reformatting or suffixes like 'px'", \ "X: %1\nY: %2" #define myCoordString_1 "Window geometry display, %1 and %2 are the cartesian x and y coordinates," \ " %3 and %4 are the resp. increments - avoid reformatting or suffixes like 'px'", \ "X: %1 (%3)\nY: %2 (%4)" reconfigure(ReconfigureAll); QFont fnt; fnt.setBold(true); fnt.setPointSize(12); for (int i = 0; i < 3; ++i) { myMeasure[i] = effects->effectFrame(EffectFrameUnstyled, false); myMeasure[i]->setFont(fnt); } myMeasure[0]->setAlignment(Qt::AlignLeft | Qt::AlignTop); myMeasure[1]->setAlignment(Qt::AlignCenter); myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom); KActionCollection* actionCollection = new KActionCollection(this); KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry")); a->setText(i18n("Toggle window geometry display (effect only)")); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle())); connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect))); }
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; }
void FileBrowserWidget::setupToolbar() { KActionCollection *coll = m_dirOperator->actionCollection(); m_toolbar->addAction(coll->action("back")); m_toolbar->addAction(coll->action("forward")); KAction *action = new KAction(this); action->setIcon(SmallIcon("document-open")); action->setText(i18n("Open selected")); connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal())); m_toolbar->addAction(action); // section for settings menu KActionMenu *optionsMenu = new KActionMenu(KIcon("configure"), i18n("Options"), this); optionsMenu->setDelayed(false); optionsMenu->addAction(m_dirOperator->actionCollection()->action("short view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("tree view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed tree view")); optionsMenu->addSeparator(); optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden")); m_toolbar->addSeparator(); m_toolbar->addAction(optionsMenu); }
void KRunnerApp::singleRunnerModeActionTriggered() { KAction * action = qobject_cast<KAction*>(sender()); if (action) { displaySingleRunner(action->objectName()); } }
void KUI_project::setupMenuFile() { KMenu *fileMenu = new KMenu(i18n("&File"),this); KAction *action = KStandardAction::openNew(this, SLOT(newProjectDialogSlot()), collection); fileMenu->addAction(collection->addAction("new_file", action)); fileMenu->addSeparator(); action = KStandardAction::open(this, SLOT(openFileSlot()), collection); fileMenu->addAction(collection->addAction("open_file", action)); action = KStandardAction::save(this, SLOT(saveFileSlot()), collection); action->setEnabled(false); //fileMenu->addAction(collection->addAction("save_file", action)); action = KStandardAction::saveAs(this, SLOT(saveAsFileSlot()), collection); action->setEnabled(false); //fileMenu->addAction(collection->addAction("save_as_file", action)); fileMenu->addSeparator(); action = KStandardAction::quit(this, SLOT(close()), collection); fileMenu->addAction(collection->addAction("quit", action)); menuBar->addMenu(fileMenu); }
void WicdApplet::setupActions() { KAction* preferencesAction = new KAction(KIcon("preferences-system-network"), i18n("Wicd Configuration"), this); preferencesAction->setShortcuts(KShortcut("Ctrl+P")); addAction("configure_wicd", preferencesAction); connect(preferencesAction, SIGNAL(triggered()), this, SLOT(showPreferences())); KAction* connectInfoAction = new KAction(KIcon("help-about"), i18n("Connection information"), this); addAction("connection_info", connectInfoAction); connect(connectInfoAction, SIGNAL(triggered()), this, SLOT(connectionInfoRequested())); KAction* createadhocAction = new KAction(KIcon("list-add"), i18n("Create an ad-hoc network"), this); createadhocAction->setShortcuts(KShortcut("Ctrl+A")); addAction("createadhoc", createadhocAction); connect(createadhocAction, SIGNAL(triggered()), this, SLOT(createAdhocDialog())); KAction* findnetworkAction = new KAction(KIcon("edit-find"), i18n("Find a hidden network"), this); findnetworkAction->setShortcuts(KShortcut("Ctrl+F")); addAction("findnetwork", findnetworkAction); connect(findnetworkAction, SIGNAL(triggered()), this, SLOT(findHiddenDialog())); KAction* rfkillAction = new KAction(i18n("RfKill"), this); rfkillAction->setShortcuts(KShortcut("Ctrl+K")); addAction("rfkill", rfkillAction); connect(rfkillAction, SIGNAL(triggered()), this, SLOT(rfkill())); KAction* reloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this); reloadAction->setShortcuts(KShortcut("Ctrl+R")); addAction("reload", reloadAction); connect(reloadAction, SIGNAL(triggered()), this, SLOT(scan())); }
void KNotesApp::slotConfigureAccels() { KNotesKeyDialog keys( m_globalAccel, this ); QDictIterator<KNote> notes( m_noteList ); if ( !m_noteList.isEmpty() ) keys.insert( (*notes)->actionCollection() ); keys.configure(); m_globalAccel->writeSettings(); updateGlobalAccels(); // update GUI doc for new notes m_noteGUI.setContent( KXMLGUIFactory::readConfigFile( instance()->instanceName() + "ui.rc", instance() ) ); if ( m_noteList.isEmpty() ) return; notes.toFirst(); QValueList<KAction *> list = (*notes)->actionCollection()->actions(); for ( QValueList<KAction *>::iterator it = list.begin(); it != list.end(); ++it ) { notes.toFirst(); for ( ++notes; *notes; ++notes ) { KAction *toChange = (*notes)->actionCollection()->action( (*it)->name() ); if ( toChange->shortcut() != (*it)->shortcut() ) toChange->setShortcut( (*it)->shortcut() ); } } }
KexiFindDialog::KexiFindDialog(QWidget* parent) : QDialog(parent, Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::Tool) , d(new Private()) { setObjectName("KexiFindDialog"); setupUi(this); m_search->setCurrentIndex( (int)KexiSearchAndReplaceViewInterface::Options::SearchDown); layout()->setMargin(KDialog::marginHint()); layout()->setSpacing(KDialog::spacingHint()); KAction *a = KStandardAction::findNext(0, 0, 0); m_btnFind->setText(a->text()); m_btnFind->setIcon(KIcon(a->icon())); delete a; m_btnClose->setText(KStandardGuiItem::close().text()); m_btnClose->setIcon(KStandardGuiItem::close().icon()); connect(m_btnFind, SIGNAL(clicked()), this, SIGNAL(findNext())); connect(m_btnClose, SIGNAL(clicked()), this, SLOT(slotCloseClicked())); connect(m_btnReplace, SIGNAL(clicked()), this, SIGNAL(replaceNext())); connect(m_btnReplaceAll, SIGNAL(clicked()), this, SIGNAL(replaceAll())); // clear message after the text is changed connect(m_textToFind, SIGNAL(editTextChanged(const QString&)), this, SLOT(updateMessage(const QString&))); connect(m_textToReplace, SIGNAL(editTextChanged(const QString&)), this, SLOT(updateMessage(const QString&))); d->replaceMode = true; //to force updating by setReplaceMode() setReplaceMode(false); setLookInColumnList(QStringList(), QStringList()); }
void KNotesApp::updateGlobalAccels() { if ( m_globalAccel->isEnabled() ) { KAction *action = actionCollection()->action( "new_note" ); if ( action ) action->setShortcut( m_globalAccel->shortcut( "global_new_note" ) ); action = actionCollection()->action( "new_note_clipboard" ); if ( action ) action->setShortcut( m_globalAccel->shortcut( "global_new_note_clipboard" ) ); action = actionCollection()->action( "hide_all_notes" ); if ( action ) action->setShortcut( m_globalAccel->shortcut( "global_hide_all_notes" ) ); action = actionCollection()->action( "show_all_notes" ); if ( action ) action->setShortcut( m_globalAccel->shortcut( "global_show_all_notes" ) ); m_globalAccel->updateConnections(); } else { KAction *action = actionCollection()->action( "new_note" ); if ( action ) action->setShortcut( 0 ); action = actionCollection()->action( "new_note_clipboard" ); if ( action ) action->setShortcut( 0 ); action = actionCollection()->action( "hide_all_notes" ); if ( action ) action->setShortcut( 0 ); action = actionCollection()->action( "show_all_notes" ); if ( action ) action->setShortcut( 0 ); } }
QWidget* AssistantPopup::widgetForAction(const IAssistantAction::Ptr& action, int& mnemonic) { KAction* realAction = action ? action->toKAction() : 0; RichTextToolButton* button = new RichTextToolButton; if (action && !realAction) { // non-executable "label" actions button->setHtml(action->description()); button->setEnabled(false); return button; } QString buttonText; int index = m_assistantActions.indexOf(action); if (index == -1) { realAction = new KAction(button); buttonText = i18n("Hide"); } else { realAction = action->toKAction(); buttonText = action->description(); } realAction->setParent(button); connect(realAction, SIGNAL(triggered(bool)), SLOT(executeHideAction())); button->setDefaultAction(realAction); button->setText(QString("&%1").arg(mnemonic)); // Let the button care about the shortcut button->setHtml(QString("<u>%1</u> - ").arg(mnemonic) + buttonText); mnemonic++; return button; }
void KSystemTray::mousePressEvent(QMouseEvent *e) { if(!rect().contains(e->pos())) return; switch(e->button()) { case LeftButton: toggleActive(); break; case MidButton: // fall through case RightButton: if(parentWidget()) { KAction *action = d->actionCollection->action("minimizeRestore"); if(parentWidget()->isVisible()) action->setText(i18n("&Minimize")); else action->setText(i18n("&Restore")); } contextMenuAboutToShow(menu); menu->popup(e->globalPos()); break; default: // nothing break; } }
void KMJobViewer::loadPluginActions() { int mpopindex(7), toolbarindex(!m_standalone?7:8), menuindex(7); QMenuData *menu(0); if (m_standalone) { // standalone window, insert actions into main menubar KAction *act = actionCollection()->action("job_restart"); for (int i=0; i<act->containerCount(); i++) { if (menuBar()->findItem(act->itemId(i), &menu)) { menuindex = mpopindex = menu->indexOf(act->itemId(i))+1; break; } } } QValueList<KAction*> acts = m_manager->createPluginActions(actionCollection()); for (QValueListIterator<KAction*> it=acts.begin(); it!=acts.end(); ++it) { // connect the action to this connect((*it), SIGNAL(activated(int)), SLOT(pluginActionActivated(int))); // should add it to the toolbar and menubar (*it)->plug(toolBar(), toolbarindex++); if (m_pop) (*it)->plug(m_pop, mpopindex++); if (menu) (*it)->plug(static_cast<QPopupMenu*>(menu), menuindex++); } }
ReplacePart::ReplacePart(QObject *parent, const char *name, const QStringList& ) : KDevPlugin( &data, parent, name ? name : "ReplacePart" ) { setInstance(ReplaceFactory::instance()); setXMLFile("kdevpart_replace.rc"); m_widget = new ReplaceWidget(this); m_widget->setIcon( SmallIcon("filefind") ); m_widget->setCaption(i18n("Replace")); QWhatsThis::add (m_widget, i18n("<b>Replace</b><p>" "This window shows a preview of a string replace " "operation. Uncheck a line to exclude that replacement. " "Uncheck a file to exclude the whole file from the " "operation. " "Clicking on a line in the list will automatically " "open the corresponding source file and set the " "cursor to the line with the match." )); mainWindow()->embedOutputView( m_widget, i18n("Replace"), i18n("Project wide string replacement") ); mainWindow()->setViewAvailable( m_widget, false ); KAction * action = new KAction(i18n("Find-Select-Replace..."), 0, CTRL+SHIFT+Key_R, this, SLOT(slotReplace()), actionCollection(), "edit_replace_across"); action->setToolTip( i18n("Project wide string replacement") ); action->setWhatsThis( i18n("<b>Find-Select-Replace</b><p>" "Opens the project wide string replacement dialog. There you " "can enter a string or a regular expression which is then " "searched for within all files in the locations " "you specify. Matches will be displayed in the <b>Replace</b> window, you " "can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") ); connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); }
KTextEditor::View* HtmlEditor::createView( QWidget* parent ) { KTextEditor::Document *document = mEditor->createDocument( parent ); bool result = document->setHighlightingMode( "html" ); if ( result ) { kDebug() << "Syntax highlighting enabled"; } KTextEditor::View *view = document->createView( parent ); QMenu *menu = view->defaultContextMenu(); KTextEditor::ConfigInterface *interface = qobject_cast< KTextEditor::ConfigInterface* >( view ); if ( interface ) { KAction *actWordWrap = new KAction( i18n( "Dynamic Word Wrap" ), view ); actWordWrap->setCheckable( true ); connect( actWordWrap, SIGNAL(triggered(bool)), this, SLOT(toggleWordWrap()) ); KAction *actLineNumber = new KAction( i18n("Show line numbers"), view ); actLineNumber->setCheckable( true ); connect( actLineNumber, SIGNAL(triggered(bool)), this, SLOT(toggleLineNumber()) ); QMenu *options = new QMenu( i18n( "Options" ), qobject_cast< QWidget* >( view ) ); options->addAction( actWordWrap ); options->addAction( actLineNumber ); menu->addSeparator(); menu->addMenu( options ); interface->setConfigValue( "dynamic-word-wrap", true ); actWordWrap->setChecked( true ); } view->setContextMenu( menu ); return view; }
void KXMLGUIClient::stateChanged(const QString &newstate, KXMLGUIClient::ReverseStateChange reverse) { StateChange stateChange = getActionsToChangeForState(newstate); bool setTrue = (reverse == StateNoReverse); bool setFalse = !setTrue; // Enable actions which need to be enabled... // for ( QStringList::Iterator it = stateChange.actionsToEnable.begin(); it != stateChange.actionsToEnable.end(); ++it ) { KAction *action = actionCollection()->action((*it).latin1()); if (action) action->setEnabled(setTrue); } // and disable actions which need to be disabled... // for ( QStringList::Iterator it = stateChange.actionsToDisable.begin(); it != stateChange.actionsToDisable.end(); ++it ) { KAction *action = actionCollection()->action((*it).latin1()); if (action) action->setEnabled(setFalse); } }
MyMainWindow::MyMainWindow() : KMainWindow(0) { text = new QLabel(i18n("<h1>Hello, World!</h1>"), this); setCentralWidget(text); QPopupMenu *filePopup = new QPopupMenu(this); KAction *quitAction = KStdAction::quit(this, SLOT(fileQuit()), actionCollection()); clearAction = new KAction(i18n("&Clear"), "stop", Qt::CTRL + Qt::Key_X, this, SLOT(fileClear()), actionCollection(), "file_clear"); KToggleAction *toolbarAction = new KToggleAction(i18n("Show &Toolbar"), 0, actionCollection(), "settings_show_toolbar"); toolbarAction->setChecked(true); connect(toolbarAction, SIGNAL(toggled(bool)), this, SLOT(toggleToolBar(bool))); QPopupMenu *settingsMenu = new QPopupMenu(); toolbarAction->plug(settingsMenu); clearAction->plug(filePopup); clearAction->plug(toolBar()); quitAction->plug(filePopup); quitAction->plug(toolBar()); menuBar()->insertItem(i18n("&File"), filePopup); menuBar()->insertSeparator(); menuBar()->insertItem("&Settings", settingsMenu); menuBar()->insertSeparator(); menuBar()->insertItem(i18n("&Help"), helpMenu()); }
void KMixDockWidget::contextMenuAboutToShow( KPopupMenu* /* menu */ ) { KAction* showAction = actionCollection()->action("minimizeRestore"); if ( parentWidget() && showAction ) { if ( parentWidget()->isVisible() ) { showAction->setText( i18n("Hide Mixer Window") ); } else { showAction->setText( i18n("Show Mixer Window") ); } } // Enable/Disable "Muted" menu item MixDevice *md = 0; if ( _dockAreaPopup != 0 ) { md = _dockAreaPopup->dockDevice(); KToggleAction *dockMuteAction = static_cast<KToggleAction*>(actionCollection()->action("dock_mute")); //kdDebug(67100) << "---> md=" << md << "dockMuteAction=" << dockMuteAction << "isMuted=" << md->isMuted() << endl; if ( md != 0 && dockMuteAction != 0 ) { dockMuteAction->setChecked( md->isMuted() ); } } }
MyMainWindow::MyMainWindow() : KMainWindow(0) { text = new QLabel(i18n("<h1>Hello, World!</h1>"), this); setCentralWidget(text); QPopupMenu *filePopup = new QPopupMenu(this); KAction *quitAction = KStdAction::quit(this, SLOT(fileQuit()), actionCollection()); clearAction = new KAction(i18n("&Clear"), "stop", Qt::CTRL + Qt::Key_X, this, SLOT(fileClear()), actionCollection(), "file_clear"); clearAction->plug(filePopup); clearAction->plug(toolBar()); quitAction->plug(filePopup); quitAction->plug(toolBar()); menuBar()->insertItem(i18n("&File"), filePopup); menuBar()->insertSeparator(); menuBar()->insertItem(i18n("&Help"), helpMenu()); statusBar()->insertItem("Line xxx", 1); statusBar()->insertItem("Column xxx", 2); statusBar()->insertItem("Zoom: 100%", 3); //statusBar()->message("Ready..."); falls Statuszeile nur aus einem Feld besteht //statusBar()->message("Ready...", 2000); zeige Nachricht fuer 2000 Millisekunden }