/** * \param text will be shown on screen, and \param groupName is the * actual group name. Specify true as \param current when group is * currently selected for a contact. */ void addGroup(QString text, QString groupName, bool selected) { QAction* action = new QAction(text, this); addAction(action); action->setCheckable(true); action->setChecked(selected); action->setProperty("groupName", QVariant(groupName)); connect(action, SIGNAL(activated()), SLOT(actionActivated())); }
void StatusMenu::addStatus(XMPP::Status::Type type) { QAction* action = new QAction(status2txt(type), this); action->setCheckable(true); action->setChecked(currentStatus_ == type); action->setIcon(PsiIconset::instance()->status(type).icon()); action->setProperty("type", QVariant(type)); connect(action, SIGNAL(triggered()), SLOT(actionActivated())); addAction(action); }
void KPlayerSubtitleTrackActionList::update (bool show, const QMap<int, QString>& sids, int sid, const QMap<int, QString>& vsids, int vsid, QStringList files, const QString& vobsub, const QString& current) { unplug(); if ( sids.count() > 0 || vsids.count() > 0 || files.count() > 0 ) { KToggleAction* action = new KToggleAction (m_action_group); connect (action, SIGNAL (triggered()), SLOT (actionActivated())); action -> setText (i18n("&None")); action -> setStatusTip (i18n("Turns off subtitle display")); action -> setWhatsThis (i18n("The 'Subtitles -- None' command turns off subtitle display.")); if ( ! show ) action -> setChecked (true); m_actions.append (action); addActions (sids, sid); addActions (vsids, vsid); if ( vsids.isEmpty() ) files << vobsub; QStringList::ConstIterator iterator (files.constBegin()), end (files.constEnd()); while ( iterator != end ) { QString text ((*iterator).section ('/', -1, -1)); #ifdef DEBUG_KPLAYER_ACTIONLIST kdDebugTime() << " Subtitle file '" << text << "' " << *iterator << "\n"; #endif if ( ! text.isEmpty() ) { action = new KToggleAction (m_action_group); connect (action, SIGNAL (triggered()), SLOT (actionActivated())); action -> setText (text); updateAction (action); action -> setText (text); if ( show && sid < 0 && vsid < 0 && *iterator == current ) action -> setChecked (true); m_actions.append (action); } ++ iterator; } } plug(); }
QList<QVariantHash> GnuPG::getButtonParam() { QList<QVariantHash> l; QVariantHash hash; hash["tooltip"] = QVariant(tr("Send GnuPG Public Key")); hash["icon"] = QVariant(QString("gnupg/icon")); hash["reciver"] = qVariantFromValue(qobject_cast<QObject *>(this)); hash["slot"] = QVariant(SLOT(actionActivated())); l << hash; return l; }
/** * Helper function to add resource to the menu. */ void ResourceMenu::addResource(int status, QString name) { QString rname = name; if(rname.isEmpty()) rname = tr("[blank]"); //rname += " (" + status2txt(status) + ")"; QAction* action = new QAction(PsiIconset::instance()->status(status).icon(), rname, this); addAction(action); action->setProperty("resource", QVariant(name)); connect(action, SIGNAL(activated()), SLOT(actionActivated())); }
void KPlayerSimpleActionList::update (void) { #ifdef DEBUG_KPLAYER_ACTIONLIST kdDebugTime() << "KPlayerSimpleActionList::update\n"; #endif unplug(); QStringList::ConstIterator iterator (m_names.constBegin()); while ( iterator != m_names.constEnd() ) { QAction* action = new KAction (this); connect (action, SIGNAL (triggered()), SLOT (actionActivated())); action -> setText (*iterator); updateAction (action); m_actions.append (action); ++ iterator; } plug(); }
void KPlayerTrackActionList::addActions (const QMap<int, QString>& ids, int id) { QMap<int, QString>::ConstIterator iterator (ids.constBegin()), end (ids.constEnd()); while ( iterator != end ) { QString text (languageName (iterator.key(), iterator.value())); #ifdef DEBUG_KPLAYER_ACTIONLIST kdDebugTime() << " Stream " << iterator.key() << " " << iterator.value() << " " << text << "\n"; #endif KToggleAction* action = new KToggleAction (m_action_group); connect (action, SIGNAL (triggered()), SLOT (actionActivated())); action -> setText (text); updateAction (action); if ( id == iterator.key() ) action -> setChecked (true); m_actions.append (action); ++ iterator; } }
void KPlayerActionList::actionActivated (void) { #ifdef DEBUG_KPLAYER_ACTIONLIST kdDebugTime() << "KPlayerActionList::actionActivated\n"; #endif if ( sender() && sender() -> inherits ("QAction") ) { QAction* action = (QAction*) sender(); #ifdef DEBUG_KPLAYER_ACTIONLIST kdDebugTime() << " Name " << action -> text() << "\n"; #endif int index = 0; for ( QList<QAction*>::ConstIterator iterator (actions().begin()); iterator != actions().end(); ++ iterator ) { if ( *iterator == action ) { actionActivated (action, index); break; } ++ index; } } }
MediaListsManager::MediaListsManager(MainWindow* parent) : QObject(parent) { m_application = (BangarangApplication*)KApplication::kApplication(); Ui::MainWindowClass* ui = m_application->mainWindow()->ui; //Set up Audio lists view MediaListProperties audioListsProperties; audioListsProperties.lri = "medialists://audio"; m_audioListsModel = new MediaItemModel(this); m_audioListsModel->setMediaListProperties(audioListsProperties); QListView* audioLists = m_application->mainWindow()->audioListsStack()->ui->audioLists; audioLists->setModel(m_audioListsModel); connect(audioLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(audioListsSelectionChanged(const QItemSelection, const QItemSelection))); connect(m_audioListsModel, SIGNAL(mediaListChanged()), this, SLOT(audioListsChanged())); m_audioListsModel->load(); QToolButton* audioListSelect = m_application->mainWindow()->ui->audioListSelect; connect(audioListSelect, SIGNAL(clicked()), this, SLOT(selectAudioList())); //Set up Video lists view MediaListProperties videoListsProperties; videoListsProperties.lri = "medialists://video"; m_videoListsModel = new MediaItemModel(this); m_videoListsModel->setMediaListProperties(videoListsProperties); QListView* videoLists = m_application->mainWindow()->videoListsStack()->ui->videoLists; videoLists->setModel(m_videoListsModel); connect(videoLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(videoListsSelectionChanged(const QItemSelection, const QItemSelection))); connect(m_videoListsModel, SIGNAL(mediaListChanged()), this, SLOT(videoListsChanged())); m_videoListsModel->load(); QToolButton* videoListSelect = m_application->mainWindow()->ui->videoListSelect; connect(videoListSelect, SIGNAL(clicked()), this, SLOT(selectVideoList())); //Set up media list view m_loadingProgress = 0; MediaView* mediaView = ui->mediaView; mediaView->setMainWindow(m_application->mainWindow()); mediaView->setSourceModel(m_application->browsingModel()); connect(m_application->browsingModel(), SIGNAL(mediaListChanged()), this, SLOT(mediaListChanged())); connect(m_application->browsingModel(), SIGNAL(mediaListPropertiesChanged()), this, SLOT(mediaListPropertiesChanged())); connect(m_application->browsingModel(), SIGNAL(loading()), this, SLOT(mediaListLoading())); connect(m_application->browsingModel(), SIGNAL(loadingStateChanged(bool)), this, SLOT(mediaListLoadingStateChanged(bool))); connect(m_application->browsingModel(), SIGNAL(propertiesChanged()), this, SLOT(updateListHeader())); connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(categoryActivated(QModelIndex)), this, SLOT(mediaListCategoryActivated(QModelIndex))); connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(actionActivated(QModelIndex)), this, SLOT(mediaListActionActivated(QModelIndex))); connect(mediaView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(mediaSelectionChanged(const QItemSelection, const QItemSelection))); connect(ui->previous, SIGNAL(clicked()), this, SLOT(loadPreviousList())); connect(m_application->playlist()->nowPlayingModel(), SIGNAL(mediaListChanged()), this, SLOT(nowPlayingChanged())); connect(m_application->mainWindow(), SIGNAL(switchedMainWidget(MainWindow::MainWidget)), this, SLOT(defaultListLoad(MainWindow::MainWidget))); //Setup media list filter ui->mediaListFilterProxyLine->lineEdit()->setClickMessage(QString()); ui->mediaListFilterProxyLine->setProxy(ui->mediaView->filterProxyModel()); ui->mediaListFilter->setVisible(false); connect(ui->closeMediaListFilter, SIGNAL(clicked()), this, SLOT(closeMediaListFilter())); //Set up play select/all buttons connect(ui->playAll, SIGNAL(clicked()), this, SLOT(playAll())); connect(ui->playSelected, SIGNAL(clicked()), this, SLOT(playSelected())); //Setup browsing model status notifications connect(m_application->browsingModel(), SIGNAL(statusUpdated()), this, SLOT(browsingModelStatusUpdated())); //Set up search KLineEdit* searchField = m_application->mainWindow()->ui->Filter; connect(searchField, SIGNAL(returnPressed()), this, SLOT(loadSearch())); //Set up device notifier connect(DeviceManager::instance(), SIGNAL(deviceListChanged(DeviceManager::RelatedType)), this, SLOT(updateDeviceList(DeviceManager::RelatedType))); //Set default media list selection showMediaList(AudioList); }
// protected slots void kpTool::slotActionActivated () { emit actionActivated (); }