本文整理汇总了C++中plasma::QueryMatch::selectedAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryMatch::selectedAction方法的具体用法?C++ QueryMatch::selectedAction怎么用?C++ QueryMatch::selectedAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plasma::QueryMatch
的用法示例。
在下文中一共展示了QueryMatch::selectedAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void RecentDocuments::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
const QString url = match.data().toString();
if (match.selectedAction() && match.selectedAction()->data().toString() == QLatin1String("openParentDir")) {
KIO::highlightInFileManager({QUrl(url)});
return;
}
new KRun(QUrl(url), 0);
}
示例2: run
void AudioPlayerControlRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
QDBusInterface tracklist(QString::fromLatin1( "org.mpris.%1").arg(m_player),
QLatin1String( "/TrackList" ), QLatin1String( "org.freedesktop.MediaPlayer" ));
QVariantList data = match.data().value<QVariantList>();
/* Only Amarok part*/
QString url = data[2].toString();
int pos = posInPlaylist(url);
kDebug() << "pos" << pos;
QAction *a = match.selectedAction();
if (data[3].toString().compare(NONE)) {
if (!a)
{
a = action(data[3].toString());
}
if (a == action(QUEUE)) {
KUrl::List list;
list << KUrl(url);
KRun::run(QLatin1String( "amarok --queue %u" ), list, 0);
} else if (a == action(APPEND)) {
if (!(pos > -1)) {
tracklist.call(QDBus::NoBlock, QLatin1String( "AddTrack" ), url , false);
}
} else {
//Action play was selected
if (pos > -1) {
tracklist.call(QDBus::NoBlock, QLatin1String( "PlayTrack" ), pos);
} else {
tracklist.call(QDBus::NoBlock, QLatin1String( "AddTrack" ), url, true);
}
}
}/* Only Amarok part over */ else {
if ((data[4].toString().compare(QLatin1String( "start" )) == 0)) {
//The players's interface isn't available but it should be started
if (!startPlayer()) {
return;
}
}
QDBusMessage msg = QDBusMessage::createMethodCall(QString::fromLatin1( "org.mpris.%1").arg(m_player),data[0].toString(),
data[1].toString(), data[2].toString());
kDebug() << msg;
QVariantList args;
for (int i = 5;data.length() > i;++i) {
args << data[i];
}
msg.setArguments(args);
QDBusConnection::sessionBus().call(msg, QDBus::NoBlock);
}
}