void Configuration::setServiceMenu() { KMenu *menu = qobject_cast<KMenu*>(sender()); if (menu->actions().count() > 1) { return; } KServiceGroup::Ptr rootGroup = KServiceGroup::group(menu->actions()[0]->data().toString()); if (!rootGroup || !rootGroup->isValid() || rootGroup->noDisplay()) { return; } KServiceGroup::List list = rootGroup->entries(true, true, true, true); QAction *action = menu->addAction(KIcon("list-add"), i18n("Add This Menu")); action->setData(rootGroup->relPath()); menu->addSeparator(); for (int i = 0; i < list.count(); ++i) { if (list.at(i)->isType(KST_KService)) { const KService::Ptr service = KService::Ptr::staticCast(list.at(i)); action = menu->addAction(KIcon(service->icon()), service->name()); action->setEnabled(false); } else if (list.at(i)->isType(KST_KServiceGroup)) { const KServiceGroup::Ptr group = KServiceGroup::Ptr::staticCast(list.at(i)); if (group->noDisplay() || group->childCount() == 0) { continue; } KMenu *subMenu = new KMenu(menu); QAction *action = subMenu->addAction(QString()); action->setData(group->relPath()); action->setVisible(false); action = menu->addAction(KIcon(group->icon()), group->caption()); action->setMenu(subMenu); connect(subMenu, SIGNAL(aboutToShow()), this, SLOT(setServiceMenu())); } else if (list.at(i)->isType(KST_KServiceSeparator)) { menu->addSeparator(); } } }
void OpmlDirectoryView::contextMenuEvent( QContextMenuEvent *event ) { QModelIndex idx = indexAt( event->pos() ); debug() << idx; event->accept(); QVariant data = model()->data( idx, OpmlDirectoryModel::ActionRole ); QActionList actions = data.value<QActionList>(); if( actions.isEmpty() ) { return; } KMenu menu; foreach( QAction *action, actions ) { if( action ) menu.addAction( action ); } menu.exec( mapToGlobal( event->pos() ) ); //We keep the items that the actions need to be applied to in the actions private data. //Clear the data from all actions now that the context menu has executed. foreach( QAction *action, actions ) action->setData( QVariant() ); }
void ActionWidget::slotContextMenu( K3ListView *, Q3ListViewItem *item, const QPoint& pos ) { if ( !item ) return; KMenu *menu = new KMenu; QAction* addCmd = menu->addAction( i18n("Add Command") ); QAction* rmCmd = menu->addAction( i18n("Remove Command") ); if ( !item->parent() ) {// no "command" item rmCmd->setEnabled( false ); item->setOpen( true ); } QAction* executed = menu->exec( pos ); if ( executed == addCmd ) { Q3ListViewItem *p = item->parent() ? item->parent() : item; Q3ListViewItem *cmdItem = new Q3ListViewItem( p, item, i18n("Click here to set the command to be executed"), i18n("<new command>") ); cmdItem->setPixmap( 0, SmallIcon( "exec" ) ); } else if ( executed == rmCmd ) delete item; delete menu; }
void SystemTray::init() { ActionCollection *coll = QtUi::actionCollection("General"); _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, SLOT(minimizeRestore())); #ifdef HAVE_KDE KMenu *kmenu; _trayMenu = kmenu = new KMenu(); kmenu->addTitle(_activeIcon, "Quassel IRC"); #else _trayMenu = new QMenu(associatedWidget()); #endif _trayMenu->setTitle("Quassel IRC"); #ifndef HAVE_KDE _trayMenu->setAttribute(Qt::WA_Hover); #endif _trayMenu->addAction(coll->action("ConnectCore")); _trayMenu->addAction(coll->action("DisconnectCore")); _trayMenu->addAction(coll->action("CoreInfo")); _trayMenu->addSeparator(); _trayMenu->addAction(_minimizeRestoreAction); _trayMenu->addAction(coll->action("Quit")); connect(_trayMenu, SIGNAL(aboutToShow()), SLOT(trayMenuAboutToShow())); NotificationSettings notificationSettings; notificationSettings.initAndNotify("Systray/Animate", this, SLOT(enableAnimationChanged(QVariant)), true); }
void Amor::slotMouseClicked(const QPoint &pos) { bool restartTimer = mTimer->isActive(); // Stop the animation while the menu is open. if( restartTimer ) { mTimer->stop(); } if( !mMenu ) { KHelpMenu* help = new KHelpMenu( 0, KGlobal::mainComponent().aboutData(), false ); KMenu* helpMenu = help->menu(); #ifdef __GNUC__ #warning the following is kinda dirty and should be done by KHelpMenu::menu() I think. (hermier) #endif helpMenu->setIcon( SmallIcon( QLatin1String( "help-contents" ) ) ); helpMenu->setTitle( i18nc( "@action:inmenu Amor", "&Help" ) ); mMenu = new KMenu( 0 ); mMenu->addTitle( QLatin1String( "Amor" ) ); // I really don't want this i18n'ed mMenu->addAction( SmallIcon( QLatin1String ("configure" ) ), i18nc( "@action:inmenu Amor", "&Configure..." ), this, SLOT(slotConfigure()) ); mMenu->addSeparator(); mMenu->addMenu( helpMenu ); mMenu->addAction( SmallIcon( QLatin1String( "application-exit" ) ), i18nc( "@action:inmenu Amor", "&Quit" ), kapp, SLOT(quit()) ); } mMenu->exec( pos ); if( restartTimer ) { mTimer->setSingleShot( true ); mTimer->start( 1000 ); } }
/****************************************************************************** * Called when the New From Template action is clicked. * Creates a popup menu listing all alarm templates, in sorted name order. */ void TemplateMenuAction::slotInitMenu() { KMenu* m = menu(); m->clear(); mOriginalTexts.clear(); // Compile a sorted list of template names int i, end; QStringList sorted; KAEvent::List templates = KAlarm::templateList(); for (i = 0, end = templates.count(); i < end; ++i) { QString name = templates[i]->templateName(); int j = 0; for (int jend = sorted.count(); j < jend && QString::localeAwareCompare(name, sorted[j]) > 0; ++j) ; sorted.insert(j, name); } for (i = 0, end = sorted.count(); i < end; ++i) { QAction* act = m->addAction(sorted[i]); mOriginalTexts[act] = sorted[i]; // keep original text, since action text has shortcuts added } }
void BlockAnalyzer::contextMenuEvent( QContextMenuEvent * ) { KMenu *menu = new KMenu( this ); menu->setTitle( i18n( "Framerate" ) ); QAction *a = menu->addAction( i18n("50 fps"), this, SLOT( set50fps() ) ); if( timeout() == 50 ) a->setChecked( true ); a = menu->addAction( i18n("33 fps"), this, SLOT( set33fps() ) ); if( timeout() == 33 ) a->setChecked( true ); a = menu->addAction( i18n("25 fps"), this, SLOT( set25fps() ) ); if( timeout() == 25 ) a->setChecked( true ); a = menu->addAction( i18n("20 fps"), this, SLOT( set20fps() ) ); if( timeout() == 20 ) a->setChecked( true ); a = menu->addAction( i18n("10 fps"), this, SLOT( set10fps() ) ); if( timeout() == 10 ) a->setChecked( true ); #if defined HAVE_LIBVISUAL menu->addSeparator(); menu->addAction( Amarok::actionCollection()->action( "visualizations" ) ); #endif menu->exec(); }
ComponentWidget::ComponentWidget(QWidget *parent, Clock *clock) : QWidget(parent), m_clock(clock), m_component(InvalidComponent) { m_componentUi.setupUi(this); KMenu *menu = new KMenu(m_componentUi.componentButton); for (int i = 1; i < LastComponent; ++i) { QAction *action = new QAction(Clock::getComponentName(static_cast<ClockComponent>(i)), this); action->setData(i); menu->addAction(action); } m_componentUi.componentButton->setMenu(menu); m_componentUi.optionsButton->setMenu(new KMenu(m_componentUi.optionsButton)); if (!parent) { m_componentUi.insertButton->hide(); m_componentUi.verticalLayout->addWidget(m_componentUi.previewLabel); } connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(selectComponent(QAction*))); connect(m_componentUi.insertButton, SIGNAL(clicked()), this, SLOT(insertComponent())); }
void PlaylistBrowserNS::PlaylistBrowserView::contextMenuEvent( QContextMenuEvent *event ) { QModelIndex clickedIdx = indexAt( event->pos() ); QModelIndexList indices; if( clickedIdx.isValid() && selectedIndexes().contains( clickedIdx ) ) indices << selectedIndexes(); else if( clickedIdx.isValid() ) indices << clickedIdx; QActionList actions = actionsFor( indices ); if( actions.isEmpty() ) { resetActionTargets(); return; } KMenu menu; foreach( QAction *action, actions ) menu.addAction( action ); menu.exec( mapToGlobal( event->pos() ) ); // We keep the items that the action need to be applied to. // Clear the data from all actions now that the context menu has executed. resetActionTargets(); }
void cMenuManager::unplug (QAction *action) { KMenu *menu = d->actionLocations[action]; if (menu) menu->removeAction (action); d->actionLocations.erase (action); }
void SxEditor::on_editor_contextMenu( QMenu* menu, bool *pbContinue ) { KMenu *pMenu = qobject_cast<KMenu*>(menu); { QAction *action = pMenu->addAction("粗体", this, SLOT(on_common_command_clicked())); action->setObjectName("bold"); } { QAction *action = pMenu->addAction("斜体", this, SLOT(on_common_command_clicked())); action->setObjectName("italic"); } { QAction *action = pMenu->addAction("下划线", this, SLOT(on_common_command_clicked())); action->setObjectName("underline"); } { QAction *action = pMenu->addAction("删除线", this, SLOT(on_common_command_clicked())); action->setObjectName("throughout"); } { QAction *action = menu->addSeparator(); } { QAction *action = menu->addAction("选择全部", this, SLOT(on_common_command_clicked())); action->setObjectName("selectAll"); } { QAction *action = menu->addAction("粘贴", this, SLOT(on_common_command_clicked())); bool bEnable = false; QClipboard *clipboard = QApplication::clipboard(); if(clipboard ) { const QMimeData *mimedata = clipboard->mimeData(); if (mimedata->hasHtml() || mimedata->hasImage() || mimedata->hasText() || mimedata->hasUrls() || mimedata->hasFormat(KTextEditMime)) { bEnable = true; } } action->setEnabled(bEnable && !m_pTextEdit->isReadOnly()); action->setObjectName("paste"); } QTextCursor cursor = m_pTextEdit->textCursor(); bool hasText = !cursor.selection().isEmpty(); { QAction *action = menu->addAction("剪切", this, SLOT(on_common_command_clicked())); action->setEnabled(hasText && !m_pTextEdit->isReadOnly()); action->setObjectName("cut"); } { QAction *action = menu->addAction("复制", this, SLOT(on_common_command_clicked())); action->setEnabled(hasText); action->setObjectName("copy"); } *pbContinue = false; }
void PixmapCollectionEditor::displayMenu(Q3IconViewItem *it, const QPoint &p) { if (!it) return; KMenu *menu = new KMenu(); menu->insertItem(koIcon("edit-rename"), i18n("Rename Item"), this, SLOT(renameItem())); menu->insertItem(koIcon("list-remove"), i18n("Remove Item"), this, SLOT(removeItem())); menu->exec(p); }
DemoWidget() : QWidget() { menu = new KMenu("Popup Menu:"); menu->addAction( "Item1" ); menu->addAction( "Item2" ); menu->addSeparator(); QAction *a = new QAction( "Quit", this ); menu->addAction( a ); connect( a, SIGNAL(triggered()), qApp, SLOT(quit())); }
bool Sidebar::eventFilter(QObject *obj, QEvent *ev) { if (ev->type() == QEvent::ContextMenu) { QContextMenuEvent *e = (QContextMenuEvent *) ev; KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj); if (bt) { //kDebug() << "Request for popup"; m_popupButton = bt->id(); ToolView *w = m_idToWidget[m_popupButton]; if (w) { KMenu *p = new KMenu (this); if (!w->plugin.isNull()) { Kate::PluginConfigPageInterface* pcpi=dynamic_cast<Kate::PluginConfigPageInterface*>(w->plugin.data()); if (pcpi) { if (pcpi->configPages()>0) p->addAction(i18n("Configure ..."))->setData(20); } } p->addTitle(SmallIcon("view_remove"), i18n("Behavior")); p->addAction(w->persistent ? KIcon("view-restore") : KIcon("view-fullscreen"), w->persistent ? i18n("Make Non-Persistent") : i18n("Make Persistent") ) -> setData(10); p->addTitle(SmallIcon("move"), i18n("Move To")); if (position() != 0) p->addAction(KIcon("go-previous"), i18n("Left Sidebar"))->setData(0); if (position() != 1) p->addAction(KIcon("go-next"), i18n("Right Sidebar"))->setData(1); if (position() != 2) p->addAction(KIcon("go-up"), i18n("Top Sidebar"))->setData(2); if (position() != 3) p->addAction(KIcon("go-down"), i18n("Bottom Sidebar"))->setData(3); connect(p, SIGNAL(triggered(QAction*)), this, SLOT(buttonPopupActivate(QAction*))); p->exec(e->globalPos()); delete p; return true; } } }
void HistoryPanel::contextMenuGroup(const QPoint &pos) { KMenu menu; KAction* action; action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this); connect(action, SIGNAL(triggered()), this, SLOT(openAll())); menu.addAction(action); menu.exec(panelTreeView()->mapToGlobal(pos)); }
void KUI_project::setupMenuSettings() { KMenu *settingsMenu = new KMenu(i18n("&Settings"),this); menuBar->addMenu(settingsMenu); KAction *action = KStandardAction::configureToolbars(this, SLOT(), collection); settingsMenu->addAction(collection->addAction("configure_toolbars", action)); action = KStandardAction::preferences(this, SLOT(), collection); settingsMenu->addAction(collection->addAction("configure_kui", action)); }
QAction* addMenuSeparator(long widget, long menu) { Karamba* currTheme = (Karamba*)widget; KMenu* tmp = (KMenu*)menu; QAction *sep = 0; if (menuExists(currTheme, tmp)) { sep = tmp->addSeparator(); } return sep; }
void ServiceCollectionTreeView::contextMenuEvent( QContextMenuEvent * event ) { if ( m_playableTracks ) CollectionTreeView::contextMenuEvent( event ); else { QModelIndexList indices = selectedIndexes(); if( filterModel() ) { QModelIndexList tmp; foreach( const QModelIndex &idx, indices ) { tmp.append( filterModel()->mapToSource( idx ) ); } indices = tmp; } if( !indices.isEmpty() ) { KMenu menu; if( indices.count() == 1 ) { if( indices.first().isValid() && indices.first().internalPointer() ) { Meta::DataPtr data = static_cast<CollectionTreeItem*>( indices.first().internalPointer() )->data(); if( data ) { Meta::CustomActionsCapability *cac = data->create<Meta::CustomActionsCapability>(); if( cac ) { QList<PopupDropperAction*> actions = cac->customActions(); if( actions.count() ) menu.addSeparator(); foreach( PopupDropperAction *action, actions ) menu.addAction( action ); delete cac; } } } } if( menu.actions().count() > 0 ) { (void)menu.exec( event->globalPos() ); QSet<CollectionTreeItem*> items; foreach( const QModelIndex &index, indices ) { if( index.isValid() && index.internalPointer() ) items.insert( static_cast<CollectionTreeItem*>( index.internalPointer() ) ); } }
KMenu * ItemsViewDelegate::InstallMenu(const QToolButton* button, Entry::Status status) const { Q_UNUSED(button) KMenu * installMenu = new KMenu(NULL); QAction * action_install = installMenu->addAction(m_statusicons[Entry::Installed], i18n("Install")); QAction * action_uninstall = installMenu->addAction(m_statusicons[Entry::Deleted], i18n("Uninstall")); action_install->setData(DownloadDialog::kInstall); action_uninstall->setData(DownloadDialog::kUninstall); action_install->setVisible(status != Entry::Installed); action_uninstall->setVisible(status == Entry::Installed); return installMenu; }
KarbonLayerDocker::KarbonLayerDocker() : m_doc(0), m_model(0), m_updateTimer(this) { setWindowTitle(i18n("Layer view")); QWidget *mainWidget = new QWidget(this); QGridLayout* layout = new QGridLayout(mainWidget); layout->addWidget(m_layerView = new KoDocumentSectionView(mainWidget), 0, 0, 1, 6); QButtonGroup *buttonGroup = new QButtonGroup(mainWidget); buttonGroup->setExclusive(false); QPushButton *button = new QPushButton(mainWidget); button->setIcon(koIcon("list-add")); button->setToolTip(i18n("Add a new layer")); buttonGroup->addButton(button, Button_New); layout->addWidget(button, 1, 0); button = new QPushButton(mainWidget); button->setIcon(koIcon("list-remove")); button->setToolTip(i18n("Delete selected objects")); buttonGroup->addButton(button, Button_Delete); layout->addWidget(button, 1, 1); button = new QPushButton(mainWidget); button->setIcon(koIcon("go-up")); button->setToolTip(i18n("Raise selected objects")); buttonGroup->addButton(button, Button_Raise); layout->addWidget(button, 1, 2); button = new QPushButton(mainWidget); button->setIcon(koIcon("go-down")); button->setToolTip(i18n("Lower selected objects")); buttonGroup->addButton(button, Button_Lower); layout->addWidget(button, 1, 3); QToolButton * toolButton = new QToolButton(mainWidget); KMenu * menu = new KMenu(this); QActionGroup *group = new QActionGroup(this); m_viewModeActions.insert(KoDocumentSectionView::MinimalMode, menu->addAction(koIcon("view-list-text"), i18n("Minimal View"), this, SLOT(minimalView()))); m_viewModeActions.insert(KoDocumentSectionView::DetailedMode, menu->addAction(koIcon("view-list-details"), i18n("Detailed View"), this, SLOT(detailedView()))); m_viewModeActions.insert(KoDocumentSectionView::ThumbnailMode, menu->addAction(koIcon("view-preview"), i18n("Thumbnail View"), this, SLOT(thumbnailView()))); foreach(QAction* action, m_viewModeActions) { action->setCheckable(true); action->setActionGroup(group); }
void kMyMoneyCalendar::init(const QDate &dt) { styleControl = new QPushButton(i18n("Select Style"), this); yearForward = new QToolButton(this); yearBackward = new QToolButton(this); monthForward = new QToolButton(this); monthBackward = new QToolButton(this); selectMonth = new QToolButton(this); selectYear = new QToolButton(this); line = new KLineEdit(this); val = new KDateValidator(this); fontsize = 10; d->selectWeek = new QToolButton(this); KMenu* kpopupmenuNew = new KMenu(this); kpopupmenuNew->addAction(i18n("Week"), this, SLOT(slotSetStyleWeekly())); kpopupmenuNew->addAction(i18n("Month"), this, SLOT(slotSetStyleMonthly())); styleControl->setMenu(kpopupmenuNew); styleControl->setToolTip(i18n("Choose Style")); yearForward->setToolTip(i18n("Next year")); yearBackward->setToolTip(i18n("Previous year")); monthForward->setToolTip(i18n("Next month")); monthBackward->setToolTip(i18n("Previous month")); d->selectWeek->setToolTip(i18n("Select a week")); selectMonth->setToolTip(i18n("Select a month")); selectYear->setToolTip(i18n("Select a year")); // ----- setFontSize(10); line->setValidator(val); line->installEventFilter(this); yearForward->setIcon(QIcon(BarIcon("arrow-right-double"))); yearBackward->setIcon(QIcon(BarIcon("arrow-left-double"))); monthForward->setIcon(QIcon(BarIcon("arrow-right"))); monthBackward->setIcon(QIcon(BarIcon("arrow-left"))); setDate(dt); // set button texts connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); connect(d->selectWeek, SIGNAL(clicked()), SLOT(selectWeekClicked())); connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); if (table) table->setFocus(); }
/** class Tray * Reimplementation of the KStatusNotifierItem class */ Tray::Tray(MainWindow * parent) : KStatusNotifierItem(parent) { // set up the context menu KMenu * cm = contextMenu(); cm->addAction( parent->actionCollection()->action("new_download") ); cm->addAction( parent->actionCollection()->action("import_links") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("start_all_download") ); cm->addAction( parent->actionCollection()->action("stop_all_download") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("konqueror_integration") ); cm->addAction( parent->actionCollection()->action("options_configure") ); // Set up basic tray parameters setCategory(ApplicationStatus); setIconByName("kget"); setTitle(i18n("KGet")); setContextMenu(cm); setAssociatedWidget(parent); setToolTipIconByName("kget"); setToolTipTitle(i18n("Download Manager")); // Not of much use atm, but maybe we want to set this later? // setToolTipSubTitle("[..]"); // filter middle mouse clicks to ask scheduler to paste URL connect( this, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(slotActivated()) ); }
void PopupProxy::deleteMoreMenus() { const KMenu* myParent = parent(); if ( myParent != m_proxy_for_menu ) { KMenu* delme = m_proxy_for_menu; m_proxy_for_menu = static_cast<KMenu*>( m_proxy_for_menu->parent() ); while ( m_proxy_for_menu != myParent ) { delme = m_proxy_for_menu; m_proxy_for_menu = static_cast<KMenu*>( m_proxy_for_menu->parent() ); } // We are called probably from within the menus event-handler (triggered=>slotMoveToTop=>changed=>slotHistoryChanged=>deleteMoreMenus) // what can result in a crash if we just delete the menu here (#155196 and #165154) So, delay the delete. delme->deleteLater(); } }
void DockContainer::popupMenu(QPoint p) { KMenu *pm = new KMenu(this); QAction *kill = pm->addAction( i18n("Kill This Applet")); QAction *change = pm->addAction( i18n("Change Command")); QAction *r = pm->exec(p); /* pm is destroyed now .. if it is destroyed later, there is a risk that kill() double-frees it */ delete pm; if (r == kill) this->kill(); if (r == change) askNewCommand(false); }
void cMenuManager::plug (QAction *action, QString position) { // nothing if there's no such position if (!d->positions.count (position)) return; // plug the actual item QAction *before = d->positions[position]; KMenu *menu = d->locations[position]; if (!menu) return; if (before) menu->insertAction (before, action); else menu->addAction (action); d->actionLocations[action] = menu; }
void FileView::contextMenuEvent( QContextMenuEvent *e ) { if( !model() ) return; //trying to do fancy stuff while showing places only leads to tears! if( model()->objectName() == "PLACESMODEL" ) { e->accept(); return; } QModelIndexList indices = selectedIndexes(); // Abort if nothing is selected if( indices.isEmpty() ) return; KMenu menu; foreach( QAction *action, actionsForIndices( indices, PlaylistAction ) ) menu.addAction( action ); menu.addSeparator(); // Create Copy/Move to menu items // ported from old filebrowser QList<Collections::Collection*> writableCollections; QHash<Collections::Collection*, CollectionManager::CollectionStatus> hash = CollectionManager::instance()->collections(); QHash<Collections::Collection*, CollectionManager::CollectionStatus>::const_iterator it = hash.constBegin(); while( it != hash.constEnd() ) { Collections::Collection *coll = it.key(); if( coll && coll->isWritable() ) writableCollections.append( coll ); ++it; } if( !writableCollections.isEmpty() ) { QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu ); copyMenu->setIcon( KIcon( "edit-copy" ) ); foreach( Collections::Collection *coll, writableCollections ) { CollectionAction *copyAction = new CollectionAction( coll, &menu ); connect( copyAction, SIGNAL(triggered()), this, SLOT(slotPrepareCopyTracks()) ); copyMenu->addAction( copyAction ); }
KisPaintOpPresetsChooserPopup::KisPaintOpPresetsChooserPopup(QWidget * parent) : QWidget(parent) , m_d(new Private()) { m_d->uiWdgPaintOpPresets.setupUi(this); KMenu* menu = new KMenu(this); QActionGroup *actionGroup = new QActionGroup(this); KisPresetChooser::ViewMode mode = (KisPresetChooser::ViewMode)KisConfig().presetChooserViewMode(); bool showAll = KisConfig().presetShowAllMode(); QAction* action = menu->addAction(koIcon("view-preview"), i18n("Thumbnails"), this, SLOT(slotThumbnailMode())); action->setCheckable(true); action->setChecked(mode == KisPresetChooser::THUMBNAIL); action->setActionGroup(actionGroup); action = menu->addAction(koIcon("view-list-details"), i18n("Details"), this, SLOT(slotDetailMode())); action->setCheckable(true); action->setChecked(mode == KisPresetChooser::DETAIL); action->setActionGroup(actionGroup); m_d->uiWdgPaintOpPresets.viewModeButton->setIcon(koIcon("view-choose")); m_d->uiWdgPaintOpPresets.viewModeButton->setMenu(menu); m_d->uiWdgPaintOpPresets.viewModeButton->setPopupMode(QToolButton::InstantPopup); m_d->uiWdgPaintOpPresets.wdgPresetChooser->setViewMode(mode); m_d->uiWdgPaintOpPresets.wdgPresetChooser->showTaggingBar(false,true); connect(m_d->uiWdgPaintOpPresets.wdgPresetChooser, SIGNAL(resourceSelected(KoResource*)), this, SIGNAL(resourceSelected(KoResource*))); connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(textChanged(QString)), m_d->uiWdgPaintOpPresets.wdgPresetChooser, SLOT(searchTextChanged(QString))); connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(textChanged(QString)), this, SLOT(setLineEditCompleter(QString))); connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(returnPressed(QString)), this, SLOT(returnKeyPressed(QString))); connect(m_d->uiWdgPaintOpPresets.showAllCheckBox, SIGNAL(toggled(bool)), m_d->uiWdgPaintOpPresets.wdgPresetChooser, SLOT(setShowAll(bool))); m_d->firstShown = true; m_d->uiWdgPaintOpPresets.showAllCheckBox->setChecked(showAll); }
void setupHelpButton(KDialog* dialog, KAboutData* aboutData) { QObject::disconnect(dialog, SIGNAL(helpClicked()), dialog, SLOT(slotHelp())); KHelpMenu* helpMenu = new KHelpMenu(dialog, aboutData, false); KMenu* menu = helpMenu->menu(); menu->removeAction(menu->actions().first()); QAction* openHandbookAction = new QAction(i18n("Handbook"), dialog); QObject::connect(openHandbookAction, SIGNAL(triggered(bool)), dialog, SLOT(slotHelp())); menu->insertAction(menu->actions().first(), openHandbookAction); dialog->button(KDialog::Help)->setMenu(menu); }
void NepomukWidget::showTagContextMenu(const QString& tag) { m_currentTag = tag; KMenu *popup = new KMenu(this); if (m_nepHandler->tags().contains(tag)) { QAction *removeAction = popup->addAction(KIcon("list-remove"), i18n("Remove Tag")); connect(removeAction, SIGNAL(triggered()), SLOT(removeCurrentTag())); popup->popup(QCursor::pos()); } else { QAction *addAction = popup->addAction(KIcon("list-add"), i18n("Add Tag")); connect(addAction, SIGNAL(triggered()), SLOT(addCurrentTag())); popup->popup(QCursor::pos()); } }
void KUI_project::setupMenuWindow() { KMenu *windowMenu = new KMenu(i18n("&Window"),this); KAction *showDesktop = new KAction(i18n("Show &Desktop"),this); showDesktop->setCheckable(true); showDesktop->setChecked(true); //connect(showDesktop, SIGNAL(triggered(bool)), defaultCentral, SLOT(screenVis())); windowMenu->addAction(showDesktop); KAction *showCamera = new KAction(i18n("Show &Camera"),this); showCamera->setCheckable(true); showCamera->setChecked(true); windowMenu->addAction(showCamera); //connect(showCamera, SIGNAL(triggered(bool)), defaultCentral, SLOT(cameraVis())); menuBar->addMenu(windowMenu); }