本文整理汇总了C++中plasma::QueryMatch::data方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryMatch::data方法的具体用法?C++ QueryMatch::data怎么用?C++ QueryMatch::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plasma::QueryMatch
的用法示例。
在下文中一共展示了QueryMatch::data方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void PowerDevilRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
QDBusInterface iface("org.kde.Solid.PowerManagement",
"/org/kde/Solid/PowerManagement",
"org.kde.Solid.PowerManagement");
if (match.id().startsWith("PowerDevil_ProfileChange")) {
iface.asyncCall("loadProfile", match.data().toString());
} else if (match.id() == "PowerDevil_BrightnessChange") {
iface.asyncCall("setBrightness", match.data().toInt());
} else if (match.id() == "PowerDevil_DimTotal") {
iface.asyncCall("setBrightness", 0);
} else if (match.id() == "PowerDevil_DimHalf") {
iface.asyncCall("setBrightness", -2);
} else if (match.id() == "PowerDevil_TurnOffScreen") {
// FIXME: Maybe this should be even removed
// iface.asyncCall("turnOffScreen");
} else if (match.id().startsWith("PowerDevil_Suspend")) {
switch ((Solid::PowerManagement::SleepState)match.data().toInt()) {
case Solid::PowerManagement::SuspendState:
case Solid::PowerManagement::StandbyState:
iface.asyncCall("suspendToRam");
break;
case Solid::PowerManagement::HibernateState:
iface.asyncCall("suspendToDisk");
break;
}
}
}
示例2: run
void RecentDocuments::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
QString url = match.data().toString();
qDebug() << "Opening Recent Document" << url;
new KRun(url, 0);
}
示例3: run
void BookmarksRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action)
{
Q_UNUSED(context);
const QString term = action.data().toString();
QUrl url = QUrl(term);
//support urls like "kde.org" by transforming them to http://kde.org
if (url.scheme().isEmpty()) {
const int idx = term.indexOf('/');
url.clear();
url.setHost(term.left(idx));
if (idx != -1) {
//allow queries
const int queryStart = term.indexOf('?', idx);
int pathLength = -1;
if ((queryStart > -1) && (idx < queryStart)) {
pathLength = queryStart - idx;
url.setQuery(term.mid(queryStart));
}
url.setPath(term.mid(idx, pathLength));
}
url.setScheme(QStringLiteral("http"));
}
KToolInvocation::invokeBrowser(url.url());
}
示例4: 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);
}
}
示例5: 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);
}
示例6: QStringLiteral
QList<QAction *> RecentDocuments::actionsForMatch(const Plasma::QueryMatch &match)
{
Q_UNUSED(match)
const QString openParentDirId = QStringLiteral("openParentDir");
if (!action(openParentDirId)) {
(addAction(openParentDirId, QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("Open Containing Folder")))->setData(openParentDirId);
}
QList<QAction *> actions;
if (QUrl(match.data().toString()).isLocalFile()) {
actions << action(openParentDirId);
}
return actions;
}
示例7: run
void KopeteRunner::run(const Plasma::RunnerContext& context, const Plasma::QueryMatch& match)
{
Q_UNUSED(context)
// HACK: Strip off the "kopete_" prefix
const QString id = match.data().toString();
QString method;
QVariantList args;
if (id == "connect")
method = "connectAll";
else if (id == "disconnect")
method = "disconnectAll";
else if (id == "status")
{
method = "setOnlineStatus";
QStringList status = match.text().split(": ");
status.takeFirst();
QStringList message = match.subtext().split(": ");
message.takeFirst();
args << status.join(": ") << message.join(": ");
}
else if (id == "message")
{
method = "setStatusMessage";
QStringList message = match.text().split(": ");
message.takeFirst();
args << message.join(": ");
}
else if (!QUuid(id).isNull())
{
method = "openChat";
args << id;
}
else
qDebug("Unknown ID: %s", id.toUtf8().constData());
if (!method.isNull())
{
QDBusMessage message = generateMethodCall(method);
message.setArguments(args);
QDBusConnection::sessionBus().send(message);
}
}
示例8: run
void WebshortcutRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
QString location;
//qDebug() << "filter before run?" << m_filterBeforeRun;
if (m_filterBeforeRun) {
m_filterBeforeRun = false;
//qDebug() << "look up webshortcut:" << context.query();
KUriFilterData filterData (context.query());
if (KUriFilter::self()->filterSearchUri(filterData, KUriFilter::WebShortcutFilter))
location = filterData.uri().url();
} else {
location = match.data().toString();
}
//qDebug() << location;
if (!location.isEmpty()) {
KToolInvocation::invokeBrowser(location);
}
}
示例9: run
void WebshortcutRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
QUrl location;
//qDebug() << "filter before run?" << m_filterBeforeRun;
if (m_filterBeforeRun) {
m_filterBeforeRun = false;
//qDebug() << "look up webshortcut:" << context.query();
KUriFilterData filterData (context.query());
if (KUriFilter::self()->filterSearchUri(filterData, KUriFilter::WebShortcutFilter))
location = filterData.uri();
} else {
location = match.data().toUrl();
}
//qDebug() << location;
if (!location.isEmpty()) {
QDesktopServices::openUrl(location);
}
}
示例10: addAction
QList<QAction*> AudioPlayerControlRunner::actionsForMatch(const Plasma::QueryMatch &match)
{
QList<QAction*> ret;
QVariantList data = match.data().value<QVariantList>();
if (data.length() > 3 && data[3].toString().compare(NONE)) {
if (!action(PLAY)) {
addAction(PLAY, KIcon(QLatin1String( "media-playback-start" )), i18n("Play"));
addAction(QUEUE, KIcon(QLatin1String( "media-track-queue-amarok" )), i18n("Queue"));
addAction(APPEND, KIcon(QLatin1String( "media-track-add-amarok" )), i18n("Append to playlist"));
}
const QStringList actions = data[3].toString().split(QLatin1Char( ',' ));
for (int i = 0; i < actions.length(); ++i) {
ret << action(actions[i]);
}
}
return ret;
}
示例11: run
void PidginRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match){
Q_UNUSED(context);
qDebug() << match.text() << match.data().toString();
pidgin_d.startChat(match.data().toString());
}