HMENU TtrayIcon::createMenu(void) { HMENU hm=CreatePopupMenu(); int ord=0; int len; deci->get_numPresets(&len); char actPreset[1024]; deci->get_activePresetName(actPreset,1023); for (int i=0;i<len;i++) { char preset[1024]; deci->get_presetName(i,preset,1023); insertMenuItem(hm,ord,IDC_FIRST_PRESET+i,preset,strcmp(preset,actPreset)==0); } insertSeparator(hm,ord); insertMenuItem(hm,ord,IDC_CHB_GLOBAL_POSTPROC,"Postprocessing",IDFF_isPostproc); // insertSubmenu(hm,ord,"Postprocessing settings",createPostProcMenu()); // insertSeparator(hm,ord); insertMenuItem(hm,ord,IDC_CHB_GLOBAL_PICTPROP,"Picture properties",IDFF_isPictProp); // insertSeparator(hm,ord); insertMenuItem(hm,ord,IDC_CHB_GLOBAL_NOISE,"Noise",IDFF_isNoise); // insertSeparator(hm,ord); insertMenuItem(hm,ord,IDC_CHB_GLOBAL_SHARPEN,"Sharpen",IDFF_isSharpen); insertMenuItem(hm,ord,IDC_CHB_FLIP,"Flip",IDFF_flip); insertMenuItem(hm,ord,IDC_CHB_SUBTITLES,"Subtitles",IDFF_isSubtitles); return hm; }
void TToolbarEditor::setActiveActions(const QStringList& actions) { active_actions_table->clearContents(); QString action_name; bool ns, fs; int row = 0; for(int i = 0; i < actions.count(); i++) { stringToAction(actions[i], action_name, ns, fs); if (action_name == "separator") { insertSeparator(row, ns, fs); row++; } else { QAction* action = findAction(action_name, *all_actions); if (action) { insertRowFromAction(row, action, ns, fs); row++; } } } if (active_actions_table->rowCount() > 0) { active_actions_table->setCurrentCell(0, COL_DESC); } }
void PanelRemoveButtonMenu::slotAboutToShow() { clear(); containers.clear(); addToContainers("URLButton"); addToContainers("ServiceButton"); addToContainers("ServiceMenuButton"); addToContainers("ExecButton"); int id = 0; QValueList<PanelMenuItemInfo> items; for (BaseContainer::Iterator it = containers.begin(); it != containers.end(); ++it) { items.append(PanelMenuItemInfo((*it)->icon(), (*it)->visibleName(), id)); id++; } qHeapSort(items); for (QValueList<PanelMenuItemInfo>::iterator it = items.begin(); it != items.end(); ++it) { (*it).plug(this); } if (containers.count() > 1) { insertSeparator(); insertItem(i18n("All"), this, SLOT(slotRemoveAll()), 0, id); } }
void ApplicationComboBoxWidget::indexChanged(int index) { if (index == (count() - 1)) { disconnect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int))); setCurrentIndex(m_previousIndex); const QString path = QFileDialog::getOpenFileName(this, tr("Select Application"), QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()); if (!path.isEmpty()) { if (count() == 3) { insertSeparator(2); } m_previousIndex = (count() - 2); insertItem(m_previousIndex, QFileInfo(path).baseName(), path); setCurrentIndex(m_previousIndex); } connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int))); }
/* Populates the blend mode combo box, and sets up mapping for * blend modes to combo box indexes */ void QgsBlendModeComboBox::updateModes() { blockSignals( true ); clear(); QStringList myBlendModesList = blendModesList(); QStringList::const_iterator blendModeIt = myBlendModesList.constBegin(); mBlendModeToListIndex.resize( myBlendModesList.count() ); mListIndexToBlendMode.resize( myBlendModesList.count() ); // Loop through blend modes int index = 0; int blendModeIndex = 0; for ( ; blendModeIt != myBlendModesList.constEnd(); ++blendModeIt ) { if ( *blendModeIt == "-" ) { // Add separator insertSeparator( index ); } else { // Not a separator, so store indexes for translation // between blend modes and combo box item index addItem( *blendModeIt ); mListIndexToBlendMode[ index ] = blendModeIndex; mBlendModeToListIndex[ blendModeIndex ] = index; blendModeIndex++; } index++; } blockSignals( false ); }
ColorSelect::ColorSelect(QWidget *parent, bool showByLayer, bool showByBlock) : QComboBox(parent) { qIconSize = QSize(32, 32); setIconSize(qIconSize); setMaximumHeight(32); if(showByLayer) { addItem(BY_LAYER); } if(showByBlock) { addItem(BY_BLOCK); } addItem(CUSTOM); insertSeparator(count()); for(auto color : QColor::colorNames()){ QPixmap pixmap(qIconSize); pixmap.fill(color); addItem(QIcon(pixmap), color); } connect(this, SIGNAL(activated(const QString&)), this, SLOT(onActivated(const QString&))); }
void MainMenubar::createMenus () { fileMenu = new QMenu(); actions[Exit]->addTo(fileMenu); editMenu = new QMenu(); actions[NewIndicator]->addTo(editMenu); actions[Options]->addTo(editMenu); viewMenu = new QMenu(); viewMenu->setCheckable(true); actions[Grid]->addTo(viewMenu); actions[ScaleToScreen]->addTo(viewMenu); actions[SidePanel]->addTo(viewMenu); actions[Crosshairs]->addTo(viewMenu); actions[DrawMode]->addTo(viewMenu); actions[PaperTrade]->addTo(viewMenu); toolMenu = new QMenu(); actions[DataWindow]->addTo(toolMenu); actions[IndicatorSummary]->addTo(toolMenu); actions[Quotes]->addTo(toolMenu); helpMenu = new QMenu(); actions[Help]->addTo(helpMenu); actions[About]->addTo(helpMenu); insertItem(tr("&File"), fileMenu); insertItem(tr("&Edit"), editMenu); insertItem(tr("&View"), viewMenu); insertItem(tr("&Tools"), toolMenu); insertSeparator(); insertItem(tr("&Help"), helpMenu); }
void MenuBar::dropEvent(QDropEvent *event) { const MimeDataObject *mimeData = qobject_cast<const MimeDataObject *>(event->mimeData()); QAction *aAction = qobject_cast<QAction *>(mimeData->object()); if (aAction && isEdited()) { if (activeAction()) if (activeAction()->menu()) activeAction()->menu()->close(); if (aAction->menu()) if (aAction->objectName() == "actionNewMenu") { Menu *menu = new Menu(aAction->text()); menu->setEdited(true); aAction = menu->menuAction(); } QAction *eAction = this->actionAt(event->pos()); QRect rect = actionGeometry(eAction); eAction = this->actionAt(QPoint(event->pos().x()+rect.width()/2, event->pos().y())); if (eAction) { if (aAction->isSeparator()) insertSeparator(eAction); else insertAction(eAction,aAction); } else { if (aAction->isSeparator()) addSeparator(); else addAction(aAction); } event->acceptProposedAction(); } }
void TToolbarEditor::onSeperatorButtonClicked() { //logger()->debug("onSeperatorButtonClicked"); int row = active_actions_table->currentRow(); if (row < 0) row = 0; insertSeparator(row, true, true); }
KOEventPopupMenu::KOEventPopupMenu() { mCurrentIncidence = 0; mCurrentDate = QDate(); mHasAdditionalItems = false; insertItem(i18n("&Show"), this, SLOT(popupShow())); mEditOnlyItems.append( insertItem(i18n("&Edit..."), this, SLOT(popupEdit()))); #ifndef KORG_NOPRINTER insertItem(KOGlobals::self()->smallIcon("printer1"), i18n("&Print..."), this, SLOT(print())); #endif //------------------------------------------------------------------------ mEditOnlyItems.append(insertSeparator()); mEditOnlyItems.append( insertItem(KOGlobals::self()->smallIcon("editcut"), i18n("&Cut"), this, SLOT(popupCut()))); mEditOnlyItems.append( insertItem(KOGlobals::self()->smallIcon("editcopy"), i18n("&Copy"), this, SLOT(popupCopy()))); // paste is always possible insertItem(KOGlobals::self()->smallIcon("editpaste"), i18n("&Paste"), this, SLOT(popupPaste())); mEditOnlyItems.append( insertItem(KOGlobals::self()->smallIcon("editdelete"), i18n("&Delete"), this, SLOT(popupDelete()))); //------------------------------------------------------------------------ mEditOnlyItems.append(insertSeparator()); mEditOnlyItems.append( insertItem(KOGlobals::self()->smallIcon("bell"), i18n("&Toggle Reminder"), this, SLOT(popupAlarm()))); //------------------------------------------------------------------------ mRecurrenceItems.append(insertSeparator()); mRecurrenceItems.append( insertItem(i18n("&Dissociate This Occurrence"), this, SLOT(dissociateOccurrence()))); mRecurrenceItems.append( insertItem(i18n("&Dissociate Future Occurrences"), this, SLOT(dissociateFutureOccurrence()))); insertSeparator(); insertItem(KOGlobals::self()->smallIcon("mail_forward"), i18n("Send as iCalendar..."), this, SLOT(forward())); }
HMENU TtrayIcon::createPostProcMenu(void) { HMENU hm=CreatePopupMenu(); int ord=0; insertMenuItem(hm,ord,IDC_RBT_PPPRESETS,"Presets",IDFF_ppIsCustom,-1); insertMenuItem(hm,ord,IDC_CHB_AUTOQ,"Automatic quality control",IDFF_autoq); insertSeparator(hm,ord); insertMenuItem(hm,ord,IDC_RBT_PPCUSTOM,"Custom",IDFF_ppIsCustom); return hm; }
ApplicationComboBoxWidget::ApplicationComboBoxWidget(QWidget *parent) : QComboBox(parent), m_previousIndex(0), m_alwaysShowDefaultApplication(false) { addItem(tr("Default Application")); insertSeparator(1); addItem(tr("Other…")); connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int))); }
CodePageComboBox::CodePageComboBox(QWidget *parent) { addItem(tr("Auto detect", "Codepage auto detection"), CODEC_AUTODETECT); insertSeparator(9999); addCodecName(tr("Unicode (UTF-8)"), "UTF-8"); addCodecName(tr("Unicode (UTF-16LE)"), "UTF-16LE"); addCodecName(tr("Unicode (UTF-16BE)"), "UTF-16BE"); insertSeparator(9999); addCodecName(tr("Cyrillic (Win-1251)"), "windows-1251"); addCodecName(tr("Cyrillic (CP-866)"), "IBM866"); insertSeparator(9999); addCodecName(tr("Latin-1 (ISO-8859-1)"), "ISO-8859-1"); addCodecName(tr("Latin-2 (ISO-8859-2)"), "ISO-8859-2"); addCodecName(tr("Latin-3 (ISO-8859-3)"), "ISO-8859-3"); addCodecName(tr("Latin-4 (ISO-8859-4)"), "ISO-8859-4"); addCodecName(tr("Latin-5 (ISO-8859-5)"), "ISO-8859-5"); addCodecName(tr("Latin-6 (ISO-8859-6)"), "ISO-8859-6"); addCodecName(tr("Latin-7 (ISO-8859-7)"), "ISO-8859-7"); addCodecName(tr("Latin-8 (ISO-8859-8)"), "ISO-8859-8"); addCodecName(tr("Latin-9 (ISO-8859-9)"), "ISO-8859-9"); addCodecName(tr("Latin-10 (ISO-8859-10)"), "ISO-8859-10"); addCodecName(tr("Latin-13 (ISO-8859-13)"), "ISO-8859-13"); addCodecName(tr("Latin-14 (ISO-8859-14)"), "ISO-8859-14"); addCodecName(tr("Latin-15 (ISO-8859-15)"), "ISO-8859-15"); addCodecName(tr("Latin-16 (ISO-8859-16)"), "ISO-8859-16"); insertSeparator(9999); addCodecName(tr("Windows 1250"), "windows-1250"); addCodecName(tr("Windows 1252"), "windows-1252"); addCodecName(tr("Windows 1253"), "windows-1253"); addCodecName(tr("Windows 1254"), "windows-1254"); addCodecName(tr("Windows 1255"), "windows-1255"); addCodecName(tr("Windows 1256"), "windows-1256"); addCodecName(tr("Windows 1257"), "windows-1257"); addCodecName(tr("Windows 1258"), "windows-1258"); }
// update the session list and rebuild the menu void KateSessionMenu::initialize() { if ( initialized() ) { return; } m_sessions.clear(); int id = 0; // no session - exec 'kate' insertItem( SmallIconSet("kate"), i18n("Start Kate (no arguments)"), id++ ); // new session - prompt for a name and exec 'kate --start NAME' insertItem( SmallIconSet("new"), i18n("New Kate Session"), id++ ); // new anonymous session, 'kate --start ""' insertItem( SmallIconSet("new"), i18n("New Anonymous Session"), id++ ); insertSeparator(); QStringList list = KGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", false, true); for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { KSimpleConfig config( *it, true ); config.setGroup( "General" ); m_sessions.append( config.readEntry( "Name" ) ); } m_sessions.sort(); for ( QStringList::ConstIterator it1 = m_sessions.begin(); it1 != m_sessions.end(); ++it1 ) { insertItem( *it1, id++ ); } // means for updating, to let the user manually update if he/she added new sessions. insertSeparator(); insertItem( SmallIconSet("reload"), i18n("Reload Session List"), this, SLOT(reinitialize()) ); }
void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon, const QString &text, const QObject *receiver, const char *member, bool editOnly) { if(!mHasAdditionalItems) { mHasAdditionalItems = true; insertSeparator(); } int id = insertItem(icon, text, receiver, member); if(editOnly) mEditOnlyItems.append(id); }
// create and fill "recent" section at first void PanelKMenu::createRecentMenuItems() { RecentlyLaunchedApps::self().init(); RecentlyLaunchedApps::self().m_nNumMenuItems = 0; QStringList RecentApps; RecentlyLaunchedApps::self().getRecentApps(RecentApps); if (RecentApps.count() > 0) { bool bSeparator = KickerSettings::showMenuTitles(); int nId = serviceMenuEndId() + 1; int nIndex = KickerSettings::showMenuTitles() ? 1 : 0; for (QList<QString>::iterator it = RecentApps.fromLast(); /*nop*/; --it) { KService::Ptr s = KService::serviceByDesktopPath(*it); if (!s) { RecentlyLaunchedApps::self().removeItem(*it); } else { if (bSeparator) { bSeparator = false; /* FIXME: no more titles! int id = insertTitle( RecentlyLaunchedApps::self().caption(), serviceMenuEndId(), 0); setItemEnabled( id, false ); */ addSeparator(); } insertMenuItem(s, nId++, nIndex); RecentlyLaunchedApps::self().m_nNumMenuItems++; } if (it == RecentApps.begin()) { break; } } if (!KickerSettings::showMenuTitles()) { insertSeparator(RecentlyLaunchedApps::self().m_nNumMenuItems); } } }
HMENU TffdshowPageEnc::createPresetsSubmenu(int cmd, bool save) { HMENU hm = CreatePopupMenu(); int ord = 0; for (TpresetsEnc::const_iterator p = presets->begin(); p != presets->end(); p++) { insertMenuItem(hm, ord, cmd++, p->name, false); } if (save) { insertSeparator(hm, ord); insertMenuItem(hm, ord, (cmd / 1000) * 1000 + 999, _(-IDD_FFDSHOWENC, _l("Save as...")), false); } return hm; }
// a context menu action was selected void UserMenuTree::slotPopupActivated(int id) { KILE_DEBUG() << "popup activated with id: " << id; switch (id ) { case POPUP_INSERT_ABOVE: insertMenuItem (m_popupItem, false); break; case POPUP_INSERT_BELOW: insertMenuItem (m_popupItem, true); break; case POPUP_SEPARATOR_ABOVE: insertSeparator(m_popupItem, false); break; case POPUP_SEPARATOR_BELOW: insertSeparator(m_popupItem, true); break; case POPUP_SUBMENU_ABOVE: insertSubmenu (m_popupItem, false); break; case POPUP_SUBMENU_BELOW: insertSubmenu (m_popupItem, true); break; case POPUP_INTO_SUBMENU: insertIntoSubmenu(m_popupItem, UserMenuData::Text); break; case POPUP_SEPARATOR_INTO_SUBMENU: insertIntoSubmenu(m_popupItem, UserMenuData::Separator); break; case POPUP_SUBMENU_INTO_SUBMENU: insertIntoSubmenu(m_popupItem, UserMenuData::Submenu); break; case POPUP_DELETE_ITEM: itemDelete(m_popupItem); break; case POPUP_DELETE_TREE: deleteMenuTree(); break; case POPUP_COLLAPSE_ITEM: m_popupItem->setExpanded(false); break; case POPUP_EXPAND_ITEM: m_popupItem->setExpanded(true); break; case POPUP_COLLAPSE_TREE: collapseAll(); break; case POPUP_EXPAND_TREE: expandAll(); break; case POPUP_ITEM_INFO: itemInfo(m_popupItem); break; } }
ComboBoxBase & LanguageComboBox::setup(bool withEmpty, QString const &emptyTitle) { ComboBoxBase::setup(withEmpty, emptyTitle); auto separatorOffset = 0; if (withEmpty) { addItem(emptyTitle, Q("")); ++separatorOffset; } for (auto const &language : App::iso639Languages()) { if (language.second != Q("und")) continue; addItem(language.first, language.second); insertSeparator(1 + separatorOffset); separatorOffset += 2; break; } auto &commonLanguages = App::commonIso639Languages(); if (!commonLanguages.empty()) { for (auto const &language : commonLanguages) addItem(language.first, language.second); insertSeparator(commonLanguages.size() + separatorOffset); } for (auto const &language : App::iso639Languages()) addItem(language.first, language.second); view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); Util::fixComboBoxViewWidth(*this); return *this; }
CountrySelector::CountrySelector(QWidget* parent) : KComboBox(parent), d(new Private) { for (Private::CountryCodeMap::Iterator it = d->countryCodeMap.begin(); it != d->countryCodeMap.end(); ++it) { addItem(QString("%1 - %2").arg(it.key()).arg(it.value())); } model()->sort(0); insertSeparator(count()); addItem(i18nc("Unknown country", "Unknown")); }
void RemoteMenu::initialize() { int id = 0; if (KickerSettings::showMenuTitles()) { insertTitle(i18n("Network Folders")); } id = insertItem(SmallIcon("wizard"), i18n("Add Network Folder")); connectItem(id, this, SLOT(startWizard())); id = insertItem(SmallIcon("kfm"), i18n("Manage Network Folders")); connectItem(id, this, SLOT(openRemoteDir())); insertSeparator(); m_desktopMap.clear(); QStringList names_found; QStringList dirList = KGlobal::dirs()->resourceDirs("remote_entries"); QStringList::ConstIterator dirpath = dirList.begin(); QStringList::ConstIterator end = dirList.end(); for(; dirpath!=end; ++dirpath) { QDir dir = *dirpath; if (!dir.exists()) continue; QStringList filenames = dir.entryList( QDir::Files | QDir::Readable ); QStringList::ConstIterator name = filenames.begin(); QStringList::ConstIterator endf = filenames.end(); for(; name!=endf; ++name) { if (!names_found.contains(*name)) { names_found.append(*name); QString filename = *dirpath+*name; KDesktopFile desktop(filename); id = insertItem(SmallIcon(desktop.readIcon()), desktop.readName()); m_desktopMap[id] = filename; } } } }
ColorDropDown::ColorDropDown(const Map* map, const MapColor* initial_color, bool spot_colors_only, QWidget* parent) : QComboBox(parent) { addItem(tr("- none -"), QVariant::fromValue<const MapColor*>(NULL)); int icon_size = style()->pixelMetric(QStyle::PM_SmallIconSize); QPixmap pixmap(icon_size, icon_size); int initial_index = 0; int num_colors = map->getNumColors(); for (int i = 0; i < num_colors; ++i) { const MapColor* color = map->getColor(i); if (spot_colors_only && color->getSpotColorMethod() != MapColor::SpotColor) continue; if (initial_color == color) initial_index = count(); pixmap.fill(*color); QString name = spot_colors_only ? color->getSpotColorName() : color->getName(); addItem(QIcon(pixmap), name, QVariant::fromValue(color)); } if (!spot_colors_only) { const int count = this->count(); if (count > 0) { insertSeparator(count); } const MapColor* color = Map::getRegistrationColor(); pixmap.fill(*color); addItem(QIcon(pixmap), color->getName(), QVariant::fromValue(color)); } setCurrentIndex(initial_index); if (!spot_colors_only) { // FIXME: these methods will not work when the box contains only spot colors connect(map, SIGNAL(colorAdded(int, const MapColor*)), this, SLOT(colorAdded(int, const MapColor*))); connect(map, SIGNAL(colorChanged(int, const MapColor*)), this, SLOT(colorChanged(int, const MapColor*))); connect(map, SIGNAL(colorDeleted(int, const MapColor*)), this, SLOT(colorDeleted(int, const MapColor*))); }
void PanelRemoveAppletMenu::slotAboutToShow() { int id = 0; clear(); m_containers = m_containerArea->containers("Applet") + m_containerArea->containers("Special Button"); QValueList<PanelMenuItemInfo> items; for (BaseContainer::List::const_iterator it = m_containers.constBegin(); it != m_containers.constEnd();) { BaseContainer* container = *it; if (container->isImmutable()) { ++it; m_containers.remove(container); continue; } items.append(PanelMenuItemInfo(container->icon(), container->visibleName().replace("&", "&&"), id)); ++id; ++it; } qHeapSort(items); for (QValueList<PanelMenuItemInfo>::iterator it = items.begin(); it != items.end(); ++it) { (*it).plug(this); } if (m_containers.count() > 1) { insertSeparator(); insertItem(i18n("All"), this, SLOT(slotRemoveAll()), 0, id); } }
ToolBarEditor::ToolBarEditor(QWidget *parent) : QWidget(parent), m_ui(new Ui::ToolBarEditor) { m_ui->setupUi(this); // Create connections. connect(m_ui->m_btnInsertSeparator, SIGNAL(clicked()), this, SLOT(insertSeparator())); connect(m_ui->m_btnInsertSpacer, SIGNAL(clicked()), this, SLOT(insertSpacer())); connect(m_ui->m_btnAddSelectedAction, SIGNAL(clicked()), this, SLOT(addSelectedAction())); connect(m_ui->m_btnDeleteAllActions, SIGNAL(clicked()), this, SLOT(deleteAllActions())); connect(m_ui->m_btnDeleteSelectedAction, SIGNAL(clicked()), this, SLOT(deleteSelectedAction())); connect(m_ui->m_btnMoveActionUp, SIGNAL(clicked()), this, SLOT(moveActionUp())); connect(m_ui->m_btnMoveActionDown, SIGNAL(clicked()), this, SLOT(moveActionDown())); connect(m_ui->m_listAvailableActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability())); connect(m_ui->m_listActivatedActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability())); connect(m_ui->m_listActivatedActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(deleteSelectedAction())); connect(m_ui->m_listAvailableActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addSelectedAction())); m_ui->m_listActivatedActions->installEventFilter(this); }
ComboBoxBase & CountryComboBox::setup(bool withEmpty, QString const &emptyTitle) { ComboBoxBase::setup(withEmpty, emptyTitle); if (withEmpty) addItem(emptyTitle, Q("")); auto &commonCountries = App::commonIso3166_1Alpha2Countries(); if (!commonCountries.empty()) { for (auto const &country : commonCountries) addItem(country.first, country.second); insertSeparator(commonCountries.size() + (withEmpty ? 1 : 0)); } for (auto const &country : App::iso3166_1Alpha2Countries()) addItem(country.first, country.second); view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); return *this; }
SpawnListMenu::SpawnListMenu(SEQListView* spawnlist, SEQWindow* spawnlistWindow, FilterMgr* filterMgr, CategoryMgr* categoryMgr, QWidget* parent, const char* name) : m_spawnlist(spawnlist), m_spawnlistWindow(spawnlistWindow), m_filterMgr(filterMgr), m_categoryMgr(categoryMgr) { // Show Columns QPopupMenu* spawnListColMenu = new QPopupMenu; insertItem( "Show &Column", spawnListColMenu); spawnListColMenu->setCheckable(true); m_id_spawnList_Cols[tSpawnColName] = spawnListColMenu->insertItem("&Name"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColName], tSpawnColName); m_id_spawnList_Cols[tSpawnColLevel] = spawnListColMenu->insertItem("&Level"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColLevel], tSpawnColLevel); m_id_spawnList_Cols[tSpawnColHP] = spawnListColMenu->insertItem("&HP"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColHP], tSpawnColHP); m_id_spawnList_Cols[tSpawnColMaxHP] = spawnListColMenu->insertItem("&Max HP"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColMaxHP], tSpawnColMaxHP); m_id_spawnList_Cols[tSpawnColXPos] = spawnListColMenu->insertItem("Coord &1"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColXPos], tSpawnColXPos); m_id_spawnList_Cols[tSpawnColYPos] = spawnListColMenu->insertItem("Coord &2"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColYPos], tSpawnColYPos); m_id_spawnList_Cols[tSpawnColZPos] = spawnListColMenu->insertItem("Coord &3"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColZPos], tSpawnColZPos); m_id_spawnList_Cols[tSpawnColID] = spawnListColMenu->insertItem("I&D"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColID], tSpawnColID); m_id_spawnList_Cols[tSpawnColDist] = spawnListColMenu->insertItem("&Dist"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColDist], tSpawnColDist); m_id_spawnList_Cols[tSpawnColRace] = spawnListColMenu->insertItem("&Race"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColRace], tSpawnColRace); m_id_spawnList_Cols[tSpawnColClass] = spawnListColMenu->insertItem("&Class"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColClass], tSpawnColClass); m_id_spawnList_Cols[tSpawnColInfo] = spawnListColMenu->insertItem("&Info"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColInfo], tSpawnColInfo); m_id_spawnList_Cols[tSpawnColSpawnTime] = spawnListColMenu->insertItem("Spawn &Time"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColSpawnTime], tSpawnColSpawnTime); m_id_spawnList_Cols[tSpawnColDeity] = spawnListColMenu->insertItem("&Deity"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColDeity], tSpawnColDeity); m_id_spawnList_Cols[tSpawnColBodyType] = spawnListColMenu->insertItem("&Body Type"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColBodyType], tSpawnColBodyType); m_id_spawnList_Cols[tSpawnColGuildID] = spawnListColMenu->insertItem("Guild Tag"); spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColGuildID], tSpawnColGuildID); connect (spawnListColMenu, SIGNAL(activated(int)), this, SLOT(toggle_spawnListCol(int))); int x; QPopupMenu* filterMenu = new QPopupMenu; m_id_filterMenu = insertItem("Add &Filter", filterMenu); setItemEnabled(m_id_filterMenu, false); x = filterMenu->insertItem("&Hunt..."); filterMenu->setItemParameter(x, HUNT_FILTER); x = filterMenu->insertItem("&Caution..."); filterMenu->setItemParameter(x, CAUTION_FILTER); x = filterMenu->insertItem("&Danger..."); filterMenu->setItemParameter(x, DANGER_FILTER); x = filterMenu->insertItem("&Locate..."); filterMenu->setItemParameter(x, LOCATE_FILTER); x = filterMenu->insertItem("&Alert..."); filterMenu->setItemParameter(x, ALERT_FILTER); x = filterMenu->insertItem("&Filtered..."); filterMenu->setItemParameter(x, FILTERED_FILTER); x = filterMenu->insertItem("&Tracer..."); filterMenu->setItemParameter(x, TRACER_FILTER); connect (filterMenu, SIGNAL(activated(int)), this, SLOT(add_filter(int))); QPopupMenu* zoneFilterMenu = new QPopupMenu; m_id_zoneFilterMenu = insertItem("Add &Zone Filter", zoneFilterMenu); setItemEnabled(m_id_zoneFilterMenu, false); x = zoneFilterMenu->insertItem("&Hunt..."); zoneFilterMenu->setItemParameter(x, HUNT_FILTER); x = zoneFilterMenu->insertItem("&Caution..."); zoneFilterMenu->setItemParameter(x, CAUTION_FILTER); x = zoneFilterMenu->insertItem("&Danger..."); zoneFilterMenu->setItemParameter(x, DANGER_FILTER); x = zoneFilterMenu->insertItem("&Locate..."); zoneFilterMenu->setItemParameter(x, LOCATE_FILTER); x = zoneFilterMenu->insertItem("&Alert..."); zoneFilterMenu->setItemParameter(x, ALERT_FILTER); x = zoneFilterMenu->insertItem("&Filtered..."); zoneFilterMenu->setItemParameter(x, FILTERED_FILTER); x = zoneFilterMenu->insertItem("&Tracer..."); zoneFilterMenu->setItemParameter(x, TRACER_FILTER); connect (zoneFilterMenu, SIGNAL(activated(int)), this, SLOT(add_zoneFilter(int))); insertSeparator(-1); x = insertItem("&Add Category...", this, SLOT(add_category(int))); m_id_edit_category = insertItem("&Edit Category...", this, SLOT(edit_category(int))); m_id_delete_category = insertItem("&Delete Category...", this, SLOT(delete_category(int))); insertItem("&Reload Categories", this, SLOT(reload_categories(int))); insertSeparator(-1); insertItem("&Font...", this, SLOT(set_font(int))); insertItem("&Caption...", this, SLOT(set_caption(int))); connect(this, SIGNAL(aboutToShow()), this, SLOT(init_Menu())); }
void PanelKMenu::updateRecent() { if (!RecentlyLaunchedApps::self().m_bNeedToUpdate) { return; } RecentlyLaunchedApps::self().m_bNeedToUpdate = false; int nId = serviceMenuEndId() + 1; // remove previous items if (RecentlyLaunchedApps::self().m_nNumMenuItems > 0) { // -1 --> menu title int i = KickerSettings::showMenuTitles() ? -1 : 0; for (; i < RecentlyLaunchedApps::self().m_nNumMenuItems; i++) { removeItem(nId + i); entryMap_.remove(nId + i); } RecentlyLaunchedApps::self().m_nNumMenuItems = 0; if (!KickerSettings::showMenuTitles()) { removeItemAt(0); } } // insert new items QStringList RecentApps; RecentlyLaunchedApps::self().getRecentApps(RecentApps); if (RecentApps.count() > 0) { bool bNeedSeparator = KickerSettings::showMenuTitles(); for (QList<QString>::iterator it = RecentApps.fromLast(); /*nop*/; --it) { KService::Ptr s = KService::serviceByDesktopPath(*it); if (!s) { RecentlyLaunchedApps::self().removeItem(*it); } else { if (bNeedSeparator) { bNeedSeparator = false; addSeparator(); /* FIXME: no more titles! int id = insertTitle( RecentlyLaunchedApps::self().caption(), nId - 1, 0); setItemEnabled( id, false ); */ } insertMenuItem(s, nId++, KickerSettings::showMenuTitles() ? 1 : 0); RecentlyLaunchedApps::self().m_nNumMenuItems++; } if (it == RecentApps.begin()) break; } if (!KickerSettings::showMenuTitles()) { insertSeparator(RecentlyLaunchedApps::self().m_nNumMenuItems); } } }
QAction* LauncherContextualMenu::insertSeparatorBeforeTitle() { return insertSeparator(m_titleAction); }
void KWindowListMenu::init() { int i, d; i = 0; int nd = twin_module->numberOfDesktops(); int cd = twin_module->currentDesktop(); WId active_window = twin_module->activeWindow(); // Make sure the popup is not too wide, otherwise clicking in the middle of kdesktop // wouldn't leave any place for the popup, and release would activate some menu entry. int maxwidth = kapp->desktop()->screenGeometry( this ).width() / 2 - 100; clear(); map.clear(); int unclutter = insertItem( i18n("Unclutter Windows"), this, TQT_SLOT( slotUnclutterWindows() ) ); int cascade = insertItem( i18n("Cascade Windows"), this, TQT_SLOT( slotCascadeWindows() ) ); // if we only have one desktop we won't be showing titles, so put a separator in if (nd == 1) { insertSeparator(); } TQValueList<KWin::WindowInfo> windows; for (TQValueList<WId>::ConstIterator it = twin_module->windows().begin(); it != twin_module->windows().end(); ++it) { windows.append( KWin::windowInfo( *it, NET::WMDesktop )); } bool show_all_desktops_group = ( nd > 1 ); for (d = 1; d <= nd + (show_all_desktops_group ? 1 : 0); d++) { bool on_all_desktops = ( d > nd ); int items = 0; if (!active_window && d == cd) setItemChecked(1000 + d, true); NameSortedInfoList list; list.setAutoDelete(true); for (TQValueList<KWin::WindowInfo>::ConstIterator it = windows.begin(); it != windows.end(); ++it) { if (((*it).desktop() == d) || (on_all_desktops && (*it).onAllDesktops()) || (!show_all_desktops_group && (*it).onAllDesktops())) { list.inSort(new KWin::WindowInfo( (*it).win(), NET::WMVisibleName | NET::WMState | NET::XAWMState | NET::WMWindowType, NET::WM2GroupLeader | NET::WM2TransientFor )); } } for (KWin::WindowInfo* info = list.first(); info; info = list.next(), ++i) { TQString itemText = KStringHandler::cPixelSqueeze(info->visibleNameWithState(), fontMetrics(), maxwidth); NET::WindowType windowType = info->windowType( NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask ); if ( (windowType == NET::Normal || windowType == NET::Unknown || (windowType == NET::Dialog && standaloneDialog( info, list ))) && !(info->state() & NET::SkipTaskbar) ) { TQPixmap pm = KWin::icon(info->win(), 16, 16, true ); items++; // ok, we have items on this desktop, let's show the title if ( items == 1 && nd > 1 ) { if( !on_all_desktops ) insertTitle(twin_module->desktopName( d ), 1000 + d); else insertTitle(i18n("On All Desktops"), 2000 ); } // Avoid creating unwanted accelerators. itemText.replace('&', TQString::fromLatin1("&&")); insertItem( pm, itemText, i); map.insert(i, info->win()); if (info->win() == active_window) setItemChecked(i, true); } } if (d == cd) { setItemEnabled(unclutter, items > 0); setItemEnabled(cascade, items > 0); } } // no windows? if (i == 0) { if (nd > 1) { // because we don't have any titles, nor a separator insertSeparator(); } setItemEnabled(insertItem(i18n("No Windows")), false); } }
void pCheckComboBox::addSeparator() { insertSeparator( count() ); }