void dnd::contextMenuEvent ( QContextMenuEvent * ) { QString path = INSTALLDIR"images/"; QString snewtask = path + "add.png"; QString soptions = path + "preferences.png"; QString sabout = path + "about.png"; QString sexit = path + "exit.png"; QPixmap pix_newtask(snewtask); QPixmap pix_options(soptions); QPixmap pix_about(sabout); QPixmap pix_exit(sexit); QPopupMenu* contextMenu = new QPopupMenu( this ); Q_CHECK_PTR( contextMenu ); QLabel *caption = new QLabel(tr("<font color=darkblue><u><b>wdget</b></u></font>"), this ); caption->setAlignment( Qt::AlignCenter ); contextMenu->insertSeparator(); contextMenu->insertItem( caption ); contextMenu->insertSeparator(); contextMenu->insertItem(pix_newtask, tr("New task"), dmw, SLOT(fileNewUrl()) ); contextMenu->insertItem(pix_options, tr("Setting..."), dmw, SLOT(filePref()) ); contextMenu->insertItem(pix_about, tr("About..."), dmw, SLOT(helpAbout()) ); contextMenu->insertItem(pix_exit, tr("Quit"), dmw, SLOT(fileExit()) ); contextMenu->exec( QCursor::pos() ); delete contextMenu; }
void CoverageView::context(QListViewItem* i, const QPoint & p, int c) { QPopupMenu popup; TraceFunction* f = 0; if (i) { f = _showCallers ? ((CallerCoverageItem*)i)->function() : ((CalleeCoverageItem*)i)->function(); } if (f) { QString name = f->name(); if ((int)name.length()>Configuration::maxSymbolLength()) name = name.left(Configuration::maxSymbolLength()) + "..."; popup.insertItem(i18n("Go to '%1'").arg(name), 93); popup.insertSeparator(); } if ((c == 0) || (!_showCallers && c == 1)) { addCostMenu(&popup, false); popup.insertSeparator(); } addGoMenu(&popup); int r = popup.exec(p); if (r == 93) activated(f); }
void KonqSidebarBookmarkModule::showPopupMenu() { KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() ); if (!bi) return; bool tabSupported = tree()->tabSupport(); QPopupMenu *menu = new QPopupMenu; if (bi->bookmark().isGroup()) { if (tabSupported) { m_collection->action("folder_open_tabs")->plug(menu); menu->insertSeparator(); } m_collection->action("create_folder")->plug(menu); m_collection->action("delete_folder")->plug(menu); } else { m_collection->action("open_window")->plug(menu); if (tabSupported) m_collection->action("open_tab")->plug(menu); m_collection->action("copy_location")->plug(menu); menu->insertSeparator(); m_collection->action("create_folder")->plug(menu); m_collection->action("delete_bookmark")->plug(menu); } menu->insertSeparator(); m_collection->action("item_properties")->plug(menu); menu->exec( QCursor::pos() ); delete menu; }
void VMemo::mousePressEvent( QMouseEvent *me ) { if(!recording) { QPopupMenu * menu = new QPopupMenu( this ); menu->insertItem( tr( "Start recording" ), 0 ); menu->insertSeparator(); menu->insertItem( tr( "Settings..." ), 1 ); QPoint p = mapToGlobal( QPoint( 0, 0 ) ); QSize s = menu->sizeHint(); int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); if ( opt == 0 ) { if(!startRecording() ){ QMessageBox::critical(0, tr("vmemo"), tr("Recording aborted")); } } else if ( opt == 1 ) { // Show vmemo settings QCopEnvelope e("QPE/Application/sound", "raise()" ); } delete menu; } else { stopRecording(); } }
void SourceView::context(QListViewItem* i, const QPoint & p, int c) { QPopupMenu popup; // Menu entry: TraceLineCall* lc = i ? ((SourceItem*) i)->lineCall() : 0; TraceLineJump* lj = i ? ((SourceItem*) i)->lineJump() : 0; TraceFunction* f = lc ? lc->call()->called() : 0; TraceLine* line = lj ? lj->lineTo() : 0; if (f) { QString name = f->name(); if ((int)name.length()>Configuration::maxSymbolLength()) name = name.left(Configuration::maxSymbolLength()) + "..."; popup.insertItem(i18n("Go to '%1'").arg(name), 93); popup.insertSeparator(); } else if (line) { popup.insertItem(i18n("Go to Line %1").arg(line->name()), 93); popup.insertSeparator(); } if ((c == 1) || (c == 2)) { addCostMenu(&popup); popup.insertSeparator(); } addGoMenu(&popup); int r = popup.exec(p); if (r == 93) { if (f) activated(f); if (line) activated(line); } }
void CTableFieldChooserListView::displayMenu( QListViewItem *, const QPoint &pos, int ) { QPopupMenu *menu = new QPopupMenu(); menu->insertItem(getPixmapIcon("checkedIcon"), tr("Check All"), 1); menu->insertItem(getPixmapIcon("uncheckedIcon"), tr("Clear All"), 2); menu->insertSeparator(); menu->insertItem(getPixmapIcon("refreshTablesIcon"), "Refresh", MENU_REFRESH); int res = menu->exec(pos); delete menu; bool b = false; switch (res) { case 1: b = true; break; case 2: b = false; break; case MENU_REFRESH: refresh(); break; } if (res != MENU_REFRESH) { QListViewItemIterator it(this); for ( ; it.current(); ++it) ((CTableFieldChooserListItem *)it.current())->setOn(b); } }
void VCFrame::invokeMenu(QPoint point) { QPopupMenu* menu = VCWidget::createMenu(); // Add menu QPopupMenu* addMenu = new QPopupMenu(menu); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/button.png")), "&Button", KVCMenuAddButton); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/slider.png")), "&Slider", KVCMenuAddSlider); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frame.png")), "&Frame", KVCMenuAddFrame); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/xypad.png")), "&XY-Pad", KVCMenuAddXYPad); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/label.png")), "L&abel", KVCMenuAddLabel); menu->insertSeparator(); menu->insertItem("Add", addMenu); connect(addMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); menu->exec(point); delete menu; }
void KonqSidebarHistoryModule::showPopupMenu( int which, const QPoint& pos ) { QPopupMenu *sortMenu = new QPopupMenu; m_collection->action("byName")->plug( sortMenu ); m_collection->action("byDate")->plug( sortMenu ); QPopupMenu *menu = new QPopupMenu; if ( which & EntryContextMenu ) { m_collection->action("open_new")->plug( menu ); menu->insertSeparator(); m_collection->action("remove")->plug( menu ); } m_collection->action("clear")->plug( menu ); menu->insertSeparator(); menu->insertItem( i18n("Sort"), sortMenu ); menu->insertSeparator(); m_collection->action("preferences")->plug( menu ); menu->exec( pos ); delete menu; delete sortMenu; }
void K3bIsoImageWritingDialog::slotContextMenu( KListView*, QListViewItem*, const QPoint& pos ) { if( !d->haveMd5Sum ) return; QPopupMenu popup; int copyItem = popup.insertItem( i18n("Copy checksum to clipboard") ); int compareItem = popup.insertItem( i18n("Compare checksum...") ); int r = popup.exec( pos ); if( r == compareItem ) { bool ok; QString md5sumToCompare = KInputDialog::getText( i18n("MD5 Sum Check"), i18n("Please insert the MD5 Sum to compare:"), QString::null, &ok, this ); if( ok ) { if( md5sumToCompare.lower().utf8() == m_md5Job->hexDigest().lower() ) KMessageBox::information( this, i18n("The MD5 Sum of %1 equals the specified.").arg(imagePath()), i18n("MD5 Sums Equal") ); else KMessageBox::sorry( this, i18n("The MD5 Sum of %1 differs from the specified.").arg(imagePath()), i18n("MD5 Sums Differ") ); } } else if( r == copyItem ) { QApplication::clipboard()->setText( m_md5Job->hexDigest().lower(), QClipboard::Clipboard ); } }
/** * Set a value to a min/max/reverse column using a context menu */ void VCXYPadProperties::slotContextMenuRequested(QListViewItem* item, const QPoint &point, int column) { int result; QString s; if (column == KColumnLo) { result = invokeDMXValueMenu(point); if (result <= KChannelValueMax && result >= KChannelValueMin) { s.sprintf("%.3d", result); item->setText(KColumnLo, s); slotSelectionXChanged(m_listX->currentItem()); slotSelectionYChanged(m_listY->currentItem()); } } else if (column == KColumnHi) { result = invokeDMXValueMenu(point); if (result <= KChannelValueMax && result >= KChannelValueMin) { s.sprintf("%.3d", result); item->setText(KColumnHi, s); slotSelectionXChanged(m_listX->currentItem()); slotSelectionYChanged(m_listY->currentItem()); } } else if (column == KColumnReverse) { QPopupMenu* menu = new QPopupMenu(); menu->insertItem("Reverse", KNoID); menu->insertSeparator(); menu->insertItem(Settings::trueValue(), KComboItemReverse); menu->insertItem(Settings::falseValue(), KComboItemNormal); result = menu->exec(point); if (result == KComboItemNormal) { item->setText(KColumnReverse, Settings::falseValue()); } else if (result == KComboItemReverse) { item->setText(KColumnReverse, Settings::trueValue()); } slotSelectionXChanged(m_listX->currentItem()); slotSelectionYChanged(m_listY->currentItem()); delete menu; } }
// // Invoke a menu at given point // void VCDockSlider::invokeMenu(QPoint point) { if (m_static) { QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; QPopupMenu menu; menu.insertItem(QPixmap(dir + "/settings.xpm"), QString("&Properties..."), KVCMenuEditProperties); if (menu.exec(point) == KVCMenuEditProperties) { bool ok = false; QString current; current.sprintf("%d-%d", m_busLowLimit, m_busHighLimit); QString text = QInputDialog::getText(KApplicationNameShort, "Slider value range (e.g. 0-10) in seconds:", QLineEdit::Normal, current, &ok, this); if (ok && !text.isEmpty()) { int dash = text.find('-'); QString min = text.left(dash); QString max = text.mid(dash + 1); if (min.toInt() >= max.toInt()) { QMessageBox::warning(this, KApplicationNameShort, "Minimum value cannot be bigger than or equal to the maximum value"); } else { setBusRange(min.toInt(), max.toInt()); setMode(Speed); if (m_busID == KBusIDDefaultFade) { _app->settings()->set(KEY_DEFAULT_FADE_MIN, min.toInt()); _app->settings()->set(KEY_DEFAULT_FADE_MAX, max.toInt()); } else { _app->settings()->set(KEY_DEFAULT_HOLD_MIN, min.toInt()); _app->settings()->set(KEY_DEFAULT_HOLD_MAX, max.toInt()); } } } } } else { _app->virtualConsole()->editMenu()->exec(point); } }
void QTodoLists::contextMenuSectionItem(QListViewItem*, const QPoint& pos, int) { QPopupMenu* menu = new QPopupMenu(this); menu->insertItem(tr("GoTo"),MNID_GOTO_SECTION); connect(menu,SIGNAL(activated(int)),this,SLOT(sectionMenuActivated(int))); menu->exec(pos); delete menu; }
void KonqSidebarTree::showToplevelContextMenu() { KonqSidebarTreeTopLevelItem *item = 0; KonqSidebarTreeItem *treeItem = currentItem(); if (treeItem && treeItem->isTopLevelItem()) item = static_cast<KonqSidebarTreeTopLevelItem *>(treeItem); if (!m_collection) { m_collection = new KActionCollection( this, "bookmark actions" ); (void) new KAction( i18n("&Create New Folder..."), "folder_new", 0, this, SLOT( slotCreateFolder() ), m_collection, "create_folder"); (void) new KAction( i18n("Delete Folder"), "editdelete", 0, this, SLOT( slotDelete() ), m_collection, "delete_folder"); (void) new KAction( i18n("Rename"), 0, this, SLOT( slotRename() ), m_collection, "rename"); (void) new KAction( i18n("Delete Link"), "editdelete", 0, this, SLOT( slotDelete() ), m_collection, "delete_link"); (void) new KAction( i18n("Properties"), "edit", 0, this, SLOT( slotProperties() ), m_collection, "item_properties"); (void) new KAction( i18n("Open in New Window"), "window_new", 0, this, SLOT( slotOpenNewWindow() ), m_collection, "open_window"); (void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this, SLOT( slotOpenTab() ), m_collection, "open_tab"); (void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this, SLOT( slotCopyLocation() ), m_collection, "copy_location"); } QPopupMenu *menu = new QPopupMenu; if (item) { if (item->isTopLevelGroup()) { m_collection->action("rename")->plug(menu); m_collection->action("delete_folder")->plug(menu); menu->insertSeparator(); m_collection->action("create_folder")->plug(menu); } else { if (tabSupport()) m_collection->action("open_tab")->plug(menu); m_collection->action("open_window")->plug(menu); m_collection->action("copy_location")->plug(menu); menu->insertSeparator(); m_collection->action("rename")->plug(menu); m_collection->action("delete_link")->plug(menu); } menu->insertSeparator(); m_collection->action("item_properties")->plug(menu); } else { m_collection->action("create_folder")->plug(menu); } m_currentTopLevelItem = item; menu->exec( QCursor::pos() ); delete menu; m_currentTopLevelItem = 0; }
void KURLBar::slotContextMenuRequested(QListBoxItem *_item, const QPoint &pos) { if(m_isImmutable) return; KURLBarItem *item = dynamic_cast< KURLBarItem * >(_item); static const int IconSize = 10; static const int AddItem = 20; static const int EditItem = 30; static const int RemoveItem = 40; KURL lastURL = m_activeItem ? m_activeItem->url() : KURL(); bool smallIcons = m_iconSize < KIcon::SizeMedium; QPopupMenu *popup = new QPopupMenu(); popup->insertItem(smallIcons ? i18n("&Large Icons") : i18n("&Small Icons"), IconSize); popup->insertSeparator(); if(item != 0L && item->isPersistent()) { popup->insertItem(SmallIconSet("edit"), i18n("&Edit Entry..."), EditItem); popup->insertSeparator(); } popup->insertItem(SmallIconSet("filenew"), i18n("&Add Entry..."), AddItem); if(item != 0L && item->isPersistent()) { popup->insertItem(SmallIconSet("editdelete"), i18n("&Remove Entry"), RemoveItem); } int result = popup->exec(pos); switch(result) { case IconSize: setIconSize(smallIcons ? KIcon::SizeMedium : KIcon::SizeSmallMedium); m_listBox->triggerUpdate(true); break; case AddItem: addNewItem(); break; case EditItem: editItem(static_cast< KURLBarItem * >(item)); break; case RemoveItem: delete item; m_isModified = true; break; default: // abort break; } // reset current item m_activeItem = 0L; setCurrentItem(lastURL); }
void QTodoLists::contextMenuListItem(QListViewItem*, const QPoint & pos, int) { return; //FIXME QPopupMenu* menu = new QPopupMenu(this); menu->insertItem(tr("Add section"),MNID_ADD_SECTION); connect(menu,SIGNAL(activated(int)),this,SLOT(listMenuActivated(int))); menu->exec(pos); delete menu; }
void KateFileList::slotMenu ( QListViewItem *item, const QPoint &p, int /*col*/ ) { if (!item) return; QPopupMenu *menu = (QPopupMenu*) ((viewManager->mainWindow())->factory()->container("filelist_popup", viewManager->mainWindow())); if (menu) menu->exec(p); }
void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) { if (mouse == 2) { QPopupMenu m; m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); m.insertSeparator(); m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle())); m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle())); m.exec( QCursor::pos() ); } }
void RKConsolePart::showPopupMenu (const QPoint &pos) { RK_TRACE (APP); QPopupMenu *menu = static_cast<QPopupMenu *> (factory ()->container ("rkconsole_context_menu", this)); if (!menu) { RK_ASSERT (false); return; } menu->exec (pos); }
void VCFrame::invokeMenu(QPoint point) { // // Add menu // QPopupMenu* addMenu = new QPopupMenu(); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/button.xpm")), "&Button", KVCMenuAddButton); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/slider.xpm")), "&Slider", KVCMenuAddSlider); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frame.xpm")), "&Frame", KVCMenuAddFrame); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/xypad.xpm")), "&XY-Pad", KVCMenuAddXYPad); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/label.xpm")), "L&abel", KVCMenuAddLabel); QPopupMenu* menu = new QPopupMenu(); // Insert common stuff from virtual console (100% dirty hack) menu->insertItem("Edit", _app->virtualConsole()->editMenu()); // Insert the add menu menu->insertItem("Add", addMenu); switch(menu->exec(point)) { case KVCMenuAddButton: slotAddButton(mapFromGlobal(point)); break; case KVCMenuAddSlider: slotAddSlider(mapFromGlobal(point)); break; case KVCMenuAddFrame: slotAddFrame(mapFromGlobal(point)); break; case KVCMenuAddXYPad: slotAddXYPad(mapFromGlobal(point)); break; case KVCMenuAddLabel: slotAddLabel(mapFromGlobal(point)); break; default: break; } delete addMenu; delete menu; }
//вызов контекстного меню для таблицы void MainForm::contextMenuEvent(QContextMenuEvent *event) { if(topicTable->currentSelection() != -1) { QPopupMenu *contextMenu = new QPopupMenu(this); addTopicAct->addTo(contextMenu); editTopicAct->addTo(contextMenu); removeTopicAct->addTo(contextMenu); contextMenu->exec(event->globalPos()); delete contextMenu; } }
void DiffWidget::contextMenuEvent( QContextMenuEvent* /* e */ ) { QPopupMenu* popup = new QPopupMenu( this ); if ( !te->isVisible() ) { popup->insertItem( i18n("Display &Raw Output"), this, SLOT(showTextEdit()) ); popup->insertSeparator(); popup->insertItem( i18n("Hide view"), this, SLOT(hideView()) ); } popup->exec( QCursor::pos() ); delete popup; }
void Monitor::mousePressEvent(QMouseEvent* e) { if (e->button() & RightButton) { QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; QPopupMenu* menu; menu = new QPopupMenu; menu->setCheckable(false); QPopupMenu* displayMenu; displayMenu = new QPopupMenu(); displayMenu->setCheckable(true); displayMenu->insertItem("&Absolute", ID_ABSOLUTE); displayMenu->insertItem("&Relative to Device", ID_RELATIVE); displayMenu->setItemChecked(s_displayStyle, true); QPopupMenu* speedMenu; speedMenu = new QPopupMenu(); speedMenu->setCheckable(true); speedMenu->insertItem("16Hz", ID_16HZ); speedMenu->insertItem("32Hz", ID_32HZ); speedMenu->insertItem("64Hz", ID_64HZ); speedMenu->setItemChecked(s_updateFrequency, true); menu->insertItem(QPixmap(dir + "/monitor.xpm"), "Channel &Display", displayMenu); menu->insertItem(QPixmap(dir + "/clock.xpm"), "&Update Speed", speedMenu); menu->insertSeparator(); menu->insertItem(QPixmap(dir + "/move.xpm"), "&Resize to Default", ID_RESIZE_SQUARE); menu->insertItem(QPixmap(dir + "/rename.xpm"), "Choose &Font", ID_CHOOSE_FONT); connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(displayMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(speedMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); menu->exec(mapToGlobal(e->pos())); delete displayMenu; delete speedMenu; delete menu; }
void PatternWidgetClass::mousePressEvent(QMouseEvent* event) { // left button // if (event->button() == LeftButton) { // are we in the addTransitionMode ? // if (getView().isAddTransitionMode()) { getView().endAddTransition(this); } // else, save the click position for a possible move // else { pickedPos = event->pos(); } } // right button -> popup menu // else if (event->button() == RightButton) { // popup menu // QPopupMenu menu; menuAddBehaviour_ = new QPopupMenu(&menu); menu.insertItem("Start pattern", this, SLOT(onSetStart())); menu.insertSeparator(); menu.insertItem("Add behaviour", menuAddBehaviour_); menu.insertItem("Add transition", this, SLOT(onAddTransition())); menu.insertSeparator(); menu.insertItem("Rename pattern", this, SLOT(onRenamePattern())); menu.insertItem("Rename transition", this, SLOT(onRenameTransition())); menu.insertItem("Delete pattern", this, SLOT(onDelete())); // submenu: add all behaviour names // Generator::GroupMap::const_iterator first, last; PolicyConfigClass::instance()->description().getGroupedClasses("behaviour", first, last); for (; first != last; ++first) { if (first->second.isFinal() && !getDocument().hasBehaviour(patternName, first->second.name())) { menuAddBehaviour_->insertItem(first->second.name()); } } connect(menuAddBehaviour_, SIGNAL(activated(int)), this, SLOT(onAddBehaviour(int))); // show popup menu menu.exec(QCursor::pos()); }
void VCButton::invokeMenu(QPoint point) { QPopupMenu* menu = NULL; /* First, create the common widget menu and insert a separator to it */ menu = VCWidget::createMenu(); menu->insertSeparator(); /* Insert a menu item for attaching a function to this button */ menu->insertItem(QPixmap(QString(PIXMAPS) + QString("/attach.png")), "Set Function...", KVCMenuEditAttach); menu->exec(point); delete menu; }
// // Right mouse button has been pressed in the listview // void DeviceManagerView::slotRightButtonClicked(QListViewItem* item, const QPoint& point, int col) { QPopupMenu* menu = new QPopupMenu(); menu->setCheckable(false); QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; menu->insertItem(QPixmap(dir + "/addoutputdevice.xpm"), "Add...", KMenuItemAdd); menu->insertItem(QPixmap(dir + "/editcopy.xpm"), "Clone...", KMenuItemClone); menu->insertItem(QPixmap(dir + "/remove.xpm"), "Remove", KMenuItemRemove); menu->insertItem(QPixmap(dir + "/settings.xpm"), "Properties...", KMenuItemProperties); menu->insertSeparator(); menu->insertItem(QPixmap(dir + "/monitor.xpm"), "View Monitor...", KMenuItemMonitor); menu->insertItem(QPixmap(dir + "/console.xpm"), "View Console...", KMenuItemConsole); if (_app->mode() == App::Operate) { // Operate mode, remove and edit impossible menu->setItemEnabled(KMenuItemAdd, false); menu->setItemEnabled(KMenuItemRemove, false); menu->setItemEnabled(KMenuItemProperties, false); menu->setItemEnabled(KMenuItemClone, false); } // No item selected, unable to do other things either if (!item) { menu->setItemEnabled(KMenuItemRemove, false); menu->setItemEnabled(KMenuItemConsole, false); menu->setItemEnabled(KMenuItemMonitor, false); menu->setItemEnabled(KMenuItemProperties, false); menu->setItemEnabled(KMenuItemClone, false); } connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuCallBack(int))); menu->exec(point, 0); delete menu; }
void CShowTableProperties::ContextMenuRequested(int, int, const QPoint &pos) { #ifdef DEBUG qDebug("CShowTableProperties::ContextMenuRequested()"); #endif if (current_item != 0) { QPopupMenu *m = new QPopupMenu(); m->insertItem(getPixmapIcon("designIcon"), tr("&Edit Table"), MENU_EDIT); m->insertSeparator(); m->insertItem(getPixmapIcon("refreshTablesIcon"), tr("&Refresh Fields"), MENU_REFRESH); connect(m, SIGNAL(activated(int)), current_item, SLOT(processMenu(int))); m->exec(pos); delete m; } }
bool KonqSidebarBookmarkModule::handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *, const QPoint& ) { QPopupMenu *menu = new QPopupMenu; if (tree()->tabSupport()) { m_collection->action("folder_open_tabs")->plug(menu); menu->insertSeparator(); } m_collection->action("create_folder")->plug(menu); menu->insertSeparator(); m_collection->action("edit_bookmarks")->plug(menu); menu->exec( QCursor::pos() ); delete menu; return true; }
void KMMimePartTree::itemRightClicked( QListViewItem* item, const QPoint& point ) { // TODO: remove this member var? mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item ); if ( 0 == mCurrentContextMenuItem ) { kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl; } else { kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl; QPopupMenu* popup = new QPopupMenu; if ( mCurrentContextMenuItem->node()->nodeId() > 2 && mCurrentContextMenuItem->node()->typeString() != "Multipart" ) { popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) ); popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) ); popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) ); } popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) ); /* * FIXME mkae optional? popup->insertItem( i18n( "Save as &Encoded..." ), this, SLOT( slotSaveAsEncoded() ) ); */ popup->insertItem( i18n( "Save All Attachments..." ), this, SLOT( slotSaveAll() ) ); // edit + delete only for attachments if ( mCurrentContextMenuItem->node()->nodeId() > 2 && mCurrentContextMenuItem->node()->typeString() != "Multipart" ) { popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) ); if ( GlobalSettings::self()->allowAttachmentDeletion() ) popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ), this, SLOT( slotDelete() ) ); if ( GlobalSettings::self()->allowAttachmentEditing() ) popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ), this, SLOT( slotEdit() ) ); } if ( mCurrentContextMenuItem->node()->nodeId() > 0 ) popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) ); popup->exec( point ); delete popup; mCurrentContextMenuItem = 0; } }
void KOEditorFreeBusy::showAttendeeStatusMenu() { if ( mGanttView->mapFromGlobal( QCursor::pos() ).x() > 22 ) return; QPopupMenu popup; popup.insertItem( SmallIcon( "help" ), Attendee::statusName( Attendee::NeedsAction ), Attendee::NeedsAction ); popup.insertItem( KOGlobals::self()->smallIcon( "ok" ), Attendee::statusName( Attendee::Accepted ), Attendee::Accepted ); popup.insertItem( KOGlobals::self()->smallIcon( "no" ), Attendee::statusName( Attendee::Declined ), Attendee::Declined ); popup.insertItem( KOGlobals::self()->smallIcon( "apply" ), Attendee::statusName( Attendee::Tentative ), Attendee::Tentative ); popup.insertItem( KOGlobals::self()->smallIcon( "mail_forward" ), Attendee::statusName( Attendee::Delegated ), Attendee::Delegated ); popup.insertItem( Attendee::statusName( Attendee::Completed ), Attendee::Completed ); popup.insertItem( KOGlobals::self()->smallIcon( "help" ), Attendee::statusName( Attendee::InProcess ), Attendee::InProcess ); popup.setItemChecked( currentAttendee()->status(), true ); int status = popup.exec( QCursor::pos() ); if ( status >= 0 ) { currentAttendee()->setStatus( (Attendee::PartStat)status ); updateCurrentItem(); updateAttendeeInput(); } }
/** * Display a DMX value menu, divided into submenus of 16 values */ int VCXYPadProperties::invokeDMXValueMenu(const QPoint &point) { int result; QPopupMenu* menu = new QPopupMenu; QPtrList <QPopupMenu> deleteList; menu->insertItem("Value", KNoID); menu->insertSeparator(); menu->insertItem(QString::number(KChannelValueMin), KChannelValueMin); menu->insertItem(QString::number(KChannelValueMax), KChannelValueMax); for (t_value i = 0; i != KChannelValueMax; i += 15) { QPopupMenu* sub = new QPopupMenu(); deleteList.append(sub); QString top; top.sprintf("%d - %d", i+1, i + 15); for (t_value j = 1; j < 16; j++) { QString num; num.setNum(i + j); sub->insertItem(num, i + j); } menu->insertItem(top, sub); } result = menu->exec(point); while (deleteList.isEmpty() == false) { delete deleteList.take(0); } delete menu; return result; }