void KSimBaseIntSpinBox::initRmbMenu(QPopupMenu * popup) { Q_CHECK_PTR(popup); bool ok; int id; KSimBaseInt i = KSimBaseInt::convert(cleanText(), &ok); QPopupMenu * convertPopup = new QPopupMenu(popup, "convertPopup"); Q_CHECK_PTR(convertPopup); id = convertPopup->insertItem(i18n("integer base", "Binary"), this, SLOT(slotConvertToBinary())); convertPopup->setItemEnabled(id, (i.base() != KSimBaseInt::Binary)); id = convertPopup->insertItem(i18n("integer base", "Octal"), this, SLOT(slotConvertToOctal())); convertPopup->setItemEnabled(id, (i.base() != KSimBaseInt::Octal)); id = convertPopup->insertItem(i18n("integer base", "Decimal"), this, SLOT(slotConvertToDecimal())); convertPopup->setItemEnabled(id, (i.base() != KSimBaseInt::Decimal)); id = convertPopup->insertItem(i18n("integer base", "Hexadecimal"), this, SLOT(slotConvertToHexadecimal())); convertPopup->setItemEnabled(id, (i.base() != KSimBaseInt::Hexadecimal)); // popup->insertSeparator(); id = popup->insertItem(i18n("integer base", "Convert into"), convertPopup); popup->setItemEnabled(id, ok); if (m_p->constantList().count()) { QPopupMenu * constantPopup = new QPopupMenu(popup, "constantPopup"); Q_CHECK_PTR(constantPopup); Private::ConstantList::Iterator it(m_p->constantList().begin()); for(; it != m_p->constantList().end(); ++it) { if ((*it).name().isEmpty()) { (*it).setName((*it).value().text()); } id = constantPopup->insertItem((*it).name()); (*it).setIndex(id); } popup->insertSeparator(); popup->insertItem(i18n("integer base", "Constants"), constantPopup); } }
QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p ) { QPopupMenu* popup = QTextEdit::createPopupMenu( p ); if ( !popup ) popup = new QPopupMenu( this ); int i = 0; for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) { popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i ); i++; } if ( !extPartsTranslated.isEmpty() ) popup->insertSeparator( i ); connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) ); popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 ); popup->setItemEnabled( POPUP_BASE - 2, length() > 0 ); popup->insertSeparator( 1 ); popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 ); popup->setItemChecked( POPUP_BASE - 1, _highlight ); popup->insertSeparator( 3 ); popup->insertSeparator(); popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) ); return popup; }
void ResourceView::contextMenuRequested(QListViewItem *i, const QPoint &pos, int) { KCal::CalendarResourceManager *manager = mCalendar->resourceManager(); ResourceItem *item = static_cast<ResourceItem *>(i); QPopupMenu *menu = new QPopupMenu(this); connect(menu, SIGNAL(aboutToHide()), menu, SLOT(deleteLater())); if(item) { int reloadId = menu->insertItem(i18n("Re&load"), this, SLOT(reloadResource())); menu->setItemEnabled(reloadId, item->resource()->isActive()); int saveId = menu->insertItem(i18n("&Save"), this, SLOT(saveResource())); menu->setItemEnabled(saveId, item->resource()->isActive()); menu->insertSeparator(); menu->insertItem(i18n("Show &Info"), this, SLOT(showInfo())); //FIXME: This is better on the resource dialog if(KOPrefs::instance()->agendaViewColors() != KOPrefs::CategoryOnly) { QPopupMenu *assignMenu = new QPopupMenu(menu); assignMenu->insertItem(i18n("&Assign Color"), this, SLOT(assignColor())); if(item->resourceColor().isValid()) assignMenu->insertItem(i18n("&Disable Color"), this, SLOT(disableColor())); menu->insertItem(i18n("Resources Colors"), assignMenu); } menu->insertItem(i18n("&Edit..."), this, SLOT(editResource())); menu->insertItem(i18n("&Remove"), this, SLOT(removeResource())); if(item->resource() != manager->standardResource()) { menu->insertSeparator(); menu->insertItem(i18n("Use as &Default Calendar"), this, SLOT(setStandard())); } menu->insertSeparator(); } menu->insertItem(i18n("&Add..."), this, SLOT(addResource())); menu->popup(pos); }
QPopupMenu* ProtocolView::createPopupMenu(const QPoint &pos) { QPopupMenu* menu = QTextEdit::createPopupMenu(pos); int id = menu->insertItem(i18n("Clear"), this, SLOT( clear() ), 0, -1, 0); if( length() == 0 ) menu->setItemEnabled(id, false); return menu; }
QPopupMenu *CInnoDBStatus::createPopupMenu(const QPoint &) { QPopupMenu *menu = new QPopupMenu(this); int copy_id = menu->insertItem(getPixmapIcon("copyIcon"), tr("&Copy"), this, SLOT(copy())); menu->setItemEnabled(copy_id, hasSelectedText()); menu->insertSeparator(); menu->insertItem(getPixmapIcon("saveIcon"), tr("&Save"), this, SLOT(save())); menu->insertSeparator(); menu->insertItem(getPixmapIcon("refreshIcon"), tr("&Refresh"), this, SLOT(refresh())); return menu; }
QPopupMenu *MultiLineEdit::createPopupMenu() { #if COMPAT_QT_VERSION < 0x030000 QPopupMenu *popup = new QPopupMenu( this ); #ifndef QT_NO_CLIPBOARD popup->insertItem(i18n("Cut"), IdCut); popup->insertItem(i18n("Copy"), IdCopy); popup->insertItem(i18n("Paste"), IdPaste); #endif popup->insertItem(i18n("Clear"), IdClear); #ifndef QT_NO_CLIPBOARD popup->setItemEnabled(IdCut, !isReadOnly() && hasMarkedText() ); popup->setItemEnabled(IdCopy, hasMarkedText() ); popup->setItemEnabled(IdPaste, !isReadOnly() && (bool)QApplication::clipboard()->text().length() ); #endif popup->setItemEnabled(IdClear, !isReadOnly() && (bool)text().length() ); #else QPopupMenu *popup = QMultiLineEdit::createPopupMenu(); connect(popup, SIGNAL(activated(int)), this, SLOT(menuActivated(int))); #endif if (helpList){ popup->insertSeparator(); int id = IdBase; for (const char **p = helpList; *p;){ QString s = *p++; s = s.replace(QRegExp("\\&"), "&&"); QString text = unquoteText(i18n(*p++)); text += " ("; text += s; text += ")"; popup->insertItem(text, id++); } } return popup; }
void DMXMapEditor::slotListViewContextMenuRequested(QListViewItem* item, const QPoint& point, int column) { QStringList::Iterator it; QPopupMenu* pluginMenu = NULL; QPopupMenu* outputMenu = NULL; QString str; QString pluginName; int outputs = 0; int menuid = 0; int i = 0; int universe = 0; if (item == NULL) return; pluginMenu = new QPopupMenu(); connect(pluginMenu, SIGNAL(activated(int)), this, SLOT(slotPluginMenuActivated(int))); str.sprintf("Route universe %s thru...", (const char*) item->text(KColumnUniverse)); pluginMenu->insertItem(str, INT_MAX); pluginMenu->setItemEnabled(INT_MAX, false); pluginMenu->insertSeparator(); for (it = m_pluginList.begin(); it != m_pluginList.end(); ++it) { pluginName = *it; outputs = m_dmxMap->pluginOutputs(pluginName); if (outputs >= 0) { /* Put the plugin's outputs into a sub menu and insert the output menu to the top level menu */ outputMenu = new QPopupMenu(pluginMenu); for (i = 0; i < outputs && i < 100; i++) { str.sprintf("Output %d", i + 1); outputMenu->insertItem(str, menuid + i); } connect(outputMenu, SIGNAL(activated(int)), this, SLOT(slotPluginMenuActivated(int))); pluginMenu->insertItem(pluginName, outputMenu); menuid += 100; } }
// // 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 ConsoleChannel::contextMenuEvent(QContextMenuEvent* e) { QString s; QString t; Capability* c = NULL; Device* device = _app->doc()->device(m_deviceID); assert(device); LogicalChannel* ch = device->deviceClass()->channels()->at(m_channel); QPopupMenu* menu = new QPopupMenu(); menu->insertItem(ch->name(), KMenuTitle); menu->setItemEnabled(KMenuTitle, false); menu->insertSeparator(); QPtrListIterator<Capability> it(*ch->capabilities()); QPopupMenu* valueMenu = NULL; while (it.current()) { c = it.current(); // Set the value range and name as menu item's name s.sprintf("%.3d - %.3d:", c->lo(), c->hi()); s += c->name(); // Create a submenu for ranges that contain more than one value if (c->hi() - c->lo() > 0) { valueMenu = new QPopupMenu(menu); connect(valueMenu, SIGNAL(activated(int)), this, SLOT(slotContextMenuActivated(int))); for (int i = c->lo(); i <= c->hi(); i++) { t.sprintf("%.3d", i); valueMenu->insertItem(t, i); } menu->insertItem(s, valueMenu); } else {
MenuExample::MenuExample( QWidget *parent, const char *name ) : QWidget( parent, name ) { QPixmap p1( p1_xpm ); QPixmap p2( p2_xpm ); QPixmap p3( p3_xpm ); QPopupMenu *print = new QPopupMenu( this ); CHECK_PTR( print ); print->insertTearOffHandle(); print->insertItem( "&Print to printer", this, SLOT(printer()) ); print->insertItem( "Print to &file", this, SLOT(file()) ); print->insertItem( "Print to fa&x", this, SLOT(fax()) ); print->insertSeparator(); print->insertItem( "Printer &Setup", this, SLOT(printerSetup()) ); QPopupMenu *file = new QPopupMenu( this ); CHECK_PTR( file ); file->insertItem( p1, "&Open", this, SLOT(open()), CTRL+Key_O ); file->insertItem( p2, "&New", this, SLOT(news()), CTRL+Key_N ); file->insertItem( p3, "&Save", this, SLOT(save()), CTRL+Key_S ); file->insertItem( "&Close", this, SLOT(closeDoc()), CTRL+Key_W ); file->insertSeparator(); file->insertItem( "&Print", print, CTRL+Key_P ); file->insertSeparator(); file->insertItem( "E&xit", qApp, SLOT(quit()), CTRL+Key_Q ); QPopupMenu *edit = new QPopupMenu( this ); CHECK_PTR( edit ); int undoID = edit->insertItem( "&Undo", this, SLOT(undo()) ); int redoID = edit->insertItem( "&Redo", this, SLOT(redo()) ); edit->setItemEnabled( undoID, FALSE ); edit->setItemEnabled( redoID, FALSE ); QPopupMenu* options = new QPopupMenu( this ); CHECK_PTR( options ); options->insertTearOffHandle(); options->setCaption("Options"); options->insertItem( "&Normal Font", this, SLOT(normal()) ); options->insertSeparator(); options->polish(); // adjust system settings QFont f = options->font(); f.setBold( TRUE ); boldID = options->insertItem( new MyMenuItem( "Bold", f ) ); options->setAccel( CTRL+Key_B, boldID ); options->connectItem( boldID, this, SLOT(bold()) ); f = font(); f.setUnderline( TRUE ); underlineID = options->insertItem( new MyMenuItem( "Underline", f ) ); options->setAccel( CTRL+Key_U, underlineID ); options->connectItem( underlineID, this, SLOT(underline()) ); isBold = FALSE; isUnderline = FALSE; options->setCheckable( TRUE ); QPopupMenu *help = new QPopupMenu( this ); CHECK_PTR( help ); help->insertItem( "&About", this, SLOT(about()), CTRL+Key_H ); help->insertItem( "About &Qt", this, SLOT(aboutQt()) ); menu = new QMenuBar( this ); CHECK_PTR( menu ); menu->insertItem( "&File", file ); menu->insertItem( "&Edit", edit ); menu->insertItem( "&Options", options ); menu->insertSeparator(); menu->insertItem( "&Help", help ); menu->setSeparator( QMenuBar::InWindowsStyle ); label = new QLabel( this ); CHECK_PTR( label ); label->setGeometry( 20, rect().center().y()-20, width()-40, 40 ); label->setFrameStyle( QFrame::Box | QFrame::Raised ); label->setLineWidth( 1 ); label->setAlignment( AlignCenter ); connect( this, SIGNAL(explain(const QString&)), label, SLOT(setText(const QString&)) ); setMinimumSize( 100, 80 ); }
QPopupMenu* VCWidget::createMenu() { // Create edit menu here so that all submenus can be its children /* DO NOT set this as the menu's parent object. Otherwise deleting this thru the menu will crash the whole program. */ QPopupMenu* editMenu = new QPopupMenu(NULL); // Foreground menu QPopupMenu* fgMenu = new QPopupMenu(editMenu); fgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/color.png")), "&Color...", KVCMenuForegroundColor); fgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")), "&Default", KVCMenuForegroundDefault); // Background menu QPopupMenu* bgMenu = new QPopupMenu(editMenu); bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/color.png")), "&Color...", KVCMenuBackgroundColor); bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/image.png")), "&Image...", KVCMenuBackgroundImage); bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")), "&Default", KVCMenuBackgroundDefault); // Font menu QPopupMenu* fontMenu = new QPopupMenu(editMenu); fontMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fonts.png")), "&Font...", KVCMenuFont); fontMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")), "&Default", KVCMenuFontDefault); // Frame menu QPopupMenu* frameMenu = new QPopupMenu(editMenu); frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/framesunken.png")), "&Sunken", KVCMenuFrameSunken); frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frameraised.png")), "&Raised", KVCMenuFrameRaised); frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/framenone.png")), "&None", KVCMenuFrameNone); // Stacking order menu QPopupMenu* stackMenu = new QPopupMenu(editMenu); stackMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/up.png")), "Bring to &Front", KVCMenuStackingRaise); stackMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/down.png")), "Send to &Back", KVCMenuStackingLower); // Edit menu editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editcut.png")), "Cut", KVCMenuEditCut); editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editcopy.png")), "Copy", KVCMenuEditCopy); editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editpaste.png")), "Paste", KVCMenuEditPaste); editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editdelete.png")), "Delete", KVCMenuEditDelete); editMenu->insertSeparator(); editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/configure.png")), "&Properties...", KVCMenuEditProperties); editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editclear.png")), "&Rename...", KVCMenuEditRename); editMenu->setItemEnabled(KVCMenuEditCut, false); editMenu->setItemEnabled(KVCMenuEditCopy, false); editMenu->setItemEnabled(KVCMenuEditPaste, false); editMenu->insertSeparator(); editMenu->insertItem("Background", bgMenu); editMenu->insertItem("Foreground", fgMenu); editMenu->insertItem("Font", fontMenu); editMenu->insertItem("Frame", frameMenu); editMenu->insertItem("Stacking Order", stackMenu); connect(editMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(bgMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(fgMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(fontMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(frameMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); connect(stackMenu, SIGNAL(activated(int)), this, SLOT(slotMenuCallback(int))); return editMenu; }
void ReportManager::showRMBMenu(QListViewItem* lvi, const QPoint& pos, int, bool& errors, bool& showReportTab) { ManagedReportInfo* mr = 0; for (std::list<ManagedReportInfo*>::const_iterator mri = reports.begin(); mri != reports.end(); ++mri) if ((*mri)->getBrowserEntry() == lvi) mr = *mri; // Generate a context popup menu. QPopupMenu menu; if (mr) { menu.insertItem(i18n("&Show Report"), 1); menu.insertItem(i18n("&Generate Report"), 2); menu.insertItem(i18n("&Edit Report Definition"), 3); // The XML reports cannot be be viewed, so we disable the entry. if (strncmp(mr->getProjectReport()->getType(), "XML", 3) == 0) menu.setItemEnabled(1, false); // The interactive reports can not be generated, so we disable the entry. if (strncmp(mr->getProjectReport()->getType(), "Qt", 2) == 0) menu.setItemEnabled(2, false); } menu.insertItem(i18n("E&xpand All"), 4); menu.insertItem(i18n("S&hrink All"), 5); menu.insertItem(i18n("&Generate Sub-Reports"), 6); if (!lvi->firstChild()) { menu.setItemEnabled(4, false); menu.setItemEnabled(5, false); } if (lvi == qtReports || !lvi->firstChild() || (mr && strncmp(mr->getProjectReport()->getType(), "Qt", 2) == 0)) { menu.setItemEnabled(6, false); } switch (menu.exec(pos)) { case 1: { bool dummy; errors = !showReport(lvi, dummy); break; } case 2: errors = !generateReport(lvi); showReportTab = false; break; case 3: editReport(mr->getProjectReport()); showReportTab = false; break; case 4: expandLVI(lvi, true); break; case 5: expandLVI(lvi, false); break; case 6: errors = generateReports(lvi); break; default: break; } }
void CProcessListTable::ContextMenuRequested(int row, int col, const QPoint &pos) { if (isBlocked()) return; QPopupMenu *menu = new QPopupMenu(); menu->insertItem(getPixmapIcon("chooseFieldsIcon"), tr("Choose Fields"), MENU_COLUMNS_WINDOW); menu->insertSeparator(); menu->insertItem(getPixmapIcon("copyIcon"), tr("Copy"), MENU_COPY); menu->insertSeparator(); menu->setItemEnabled(MENU_COPY, numRows() > 0 && numCols() > 0); menu->insertItem(getPixmapIcon("killProcessIcon"), "Kill Process", MENU_KILL_PROCESS); menu->insertSeparator(); menu->insertItem(getPixmapIcon("saveIcon"), "Save", MENU_SAVE); menu->insertSeparator(); menu->insertItem(getPixmapIcon("refreshTablesIcon"), "Refresh", MENU_REFRESH); int res = menu->exec(pos); delete menu; switch (res) { case MENU_COLUMNS_WINDOW: columnsWindow->show(); columnsWindow->raise(); columnsWindow->setFocus(); break; case MENU_COPY: copy(row, col); break; case MENU_REFRESH: refresh(); break; case MENU_SAVE: save(); break; case MENU_KILL_PROCESS: { bool ok = false; for (int current_row = 0; current_row < numRows(); current_row++) { if (!isRowSelected(current_row)) continue; if (mysql()->mysql()->mysqlKill(text(current_row,0).toLong())) { mysql()->messagePanel()->information(tr("Process killed successfully") + " :" + text(current_row,0)); ok = true; } } if (ok) refresh(); } break; } }
void CServerStatusTable::ContextMenuRequested(int row, int col, const QPoint &pos) { if (isBlocked()) return; QPopupMenu *menu = new QPopupMenu(); menu->insertItem(getPixmapIcon("chooseFieldsIcon"), tr("Choose Fields"), MENU_COLUMNS_WINDOW); menu->insertSeparator(); menu->insertItem(getPixmapIcon("copyIcon"), tr("Copy"), MENU_COPY); menu->setItemEnabled(MENU_COPY, numRows() > 0 && numCols() > 0); menu->insertSeparator(); menu->insertItem(getPixmapIcon("saveIcon"), "Save", MENU_SAVE); menu->insertSeparator(); menu->insertItem(getPixmapIcon("refreshTablesIcon"), "Refresh", MENU_REFRESH); menu->insertSeparator(); menu->insertItem(getPixmapIcon("clearGridIcon"), tr("Clear Grid"), MENU_CLEAR_GRID); menu->setItemEnabled (MENU_CLEAR_GRID, !isBlocked()); menu->insertSeparator(); menu->insertItem((const QString&)((is_traditional) ? tr("Horizontal Mode") : tr("Vertical Mode")), MENU_TRADITIONAL); int res = menu->exec(pos); delete menu; switch (res) { case MENU_COLUMNS_WINDOW: columnsWindow->show(); columnsWindow->raise(); columnsWindow->setFocus(); break; case MENU_COPY: copy(row, col); break; case MENU_REFRESH: refresh(); break; case MENU_SAVE: save(); break; case MENU_CLEAR_GRID: is_first = true; reset(); break; case MENU_TRADITIONAL: { is_first = true; is_traditional = !is_traditional; reset(); refresh(); } break; } }
int KAction::plug( QWidget *w, int index ) { //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; if (!w ) { kdWarning(129) << "KAction::plug called with 0 argument\n"; return -1; } // Ellis: print warning if there is a shortcut, but no KAccel available (often due to no widget available in the actioncollection) // David: Well, it doesn't matter much, things still work (e.g. Undo in koffice) via QAccel. // We should probably re-enable the warning for things that only KAccel can do, though - e.g. WIN key (mapped to Meta). #if 0 //ndef NDEBUG KAccel* kaccel = kaccelCurrent(); if( !d->m_cut.isNull() && !kaccel ) { kdDebug(129) << "KAction::plug(): has no KAccel object; this = " << this << " name = " << name() << " parentCollection = " << m_parentCollection << endl; // ellis } #endif // Check if action is permitted if (kapp && !kapp->authorizeKAction(name())) return -1; plugShortcut(); if ( ::qt_cast<QPopupMenu *>( w ) ) { QPopupMenu* menu = static_cast<QPopupMenu*>( w ); int id; // Don't insert shortcut into menu if it's already in a KAccel object. int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); if ( d->hasIcon() ) { KInstance *instance; if ( m_parentCollection ) instance = m_parentCollection->instance(); else instance = KGlobal::instance(); id = menu->insertItem( d->iconSet( KIcon::Small, 0, instance ), d->text(), this,//dsweet SLOT( slotPopupActivated() ), keyQt, -1, index ); } else id = menu->insertItem( d->text(), this, SLOT( slotPopupActivated() ), keyQt, -1, index ); // If the shortcut is already in a KAccel object, then // we need to set the menu item's shortcut text. if ( d->m_kaccelList.count() || d->m_kaccel ) updateShortcut( menu, id ); // call setItemEnabled only if the item really should be disabled, // because that method is slow and the item is per default enabled if ( !d->isEnabled() ) menu->setItemEnabled( id, false ); if ( !d->whatsThis().isEmpty() ) menu->setWhatsThis( id, whatsThisWithIcon() ); addContainer( menu, id ); connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); if ( m_parentCollection ) m_parentCollection->connectHighlight( menu, this ); return d->m_containers.count() - 1; } else if ( ::qt_cast<KToolBar *>( w ) ) { KToolBar *bar = static_cast<KToolBar *>( w ); int id_ = getToolButtonID(); KInstance *instance; if ( m_parentCollection ) instance = m_parentCollection->instance(); else instance = KGlobal::instance(); if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly { bar->insertButton( iconSet().pixmap(), id_, SIGNAL( buttonClicked(int, Qt::ButtonState) ), this, SLOT( slotButtonClicked(int, Qt::ButtonState) ), d->isEnabled(), d->plainText(), index ); } else {