File indexing completed on 2024-05-05 17:44:59

0001 #pragma once
0002 
0003 #include <KRunner/QueryMatch>
0004 #include <QDBusArgument>
0005 #include <QList>
0006 #include <QString>
0007 #include <QVariantMap>
0008 
0009 struct RemoteMatch {
0010     // sssuda{sv}
0011     QString id;
0012     QString text;
0013     QString iconName;
0014     Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
0015     qreal relevance = 0;
0016     QVariantMap properties;
0017 };
0018 
0019 typedef QList<RemoteMatch> RemoteMatches;
0020 
0021 struct RemoteAction {
0022     QString id;
0023     QString text;
0024     QString iconName;
0025 };
0026 
0027 typedef QList<RemoteAction> RemoteActions;
0028 
0029 inline QDBusArgument &operator<<(QDBusArgument &argument, const RemoteMatch &match)
0030 {
0031     argument.beginStructure();
0032     argument << match.id;
0033     argument << match.text;
0034     argument << match.iconName;
0035     argument << match.type;
0036     argument << match.relevance;
0037     argument << match.properties;
0038     argument.endStructure();
0039     return argument;
0040 }
0041 
0042 inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteMatch &match)
0043 {
0044     argument.beginStructure();
0045     argument >> match.id;
0046     argument >> match.text;
0047     argument >> match.iconName;
0048     uint type;
0049     argument >> type;
0050     match.type = (Plasma::QueryMatch::Type)type;
0051     argument >> match.relevance;
0052     argument >> match.properties;
0053     argument.endStructure();
0054 
0055     return argument;
0056 }
0057 
0058 inline QDBusArgument &operator<<(QDBusArgument &argument, const RemoteAction &action)
0059 {
0060     argument.beginStructure();
0061     argument << action.id;
0062     argument << action.text;
0063     argument << action.iconName;
0064     argument.endStructure();
0065     return argument;
0066 }
0067 
0068 inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteAction &action)
0069 {
0070     argument.beginStructure();
0071     argument >> action.id;
0072     argument >> action.text;
0073     argument >> action.iconName;
0074     argument.endStructure();
0075     return argument;
0076 }
0077 
0078 Q_DECLARE_METATYPE(RemoteMatch)
0079 Q_DECLARE_METATYPE(RemoteMatches)
0080 Q_DECLARE_METATYPE(RemoteAction)
0081 Q_DECLARE_METATYPE(RemoteActions)