Changeset View
Changeset View
Standalone View
Standalone View
runners/baloo/dbusutils_p.h
- This file was added.
1 | #pragma once | ||||
---|---|---|---|---|---|
2 | | ||||
3 | #include <QList> | ||||
4 | #include <QString> | ||||
5 | #include <QDBusArgument> | ||||
6 | #include <QVariantMap> | ||||
7 | #include <KRunner/QueryMatch> | ||||
8 | | ||||
9 | struct RemoteMatch | ||||
10 | { | ||||
11 | //sssuda{sv} | ||||
12 | QString id; | ||||
13 | QString text; | ||||
14 | QString iconName; | ||||
15 | Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch; | ||||
16 | qreal relevance = 0; | ||||
17 | QVariantMap properties; | ||||
18 | }; | ||||
19 | | ||||
20 | typedef QList<RemoteMatch> RemoteMatches; | ||||
21 | | ||||
22 | struct RemoteAction | ||||
23 | { | ||||
24 | QString id; | ||||
25 | QString text; | ||||
26 | QString iconName; | ||||
27 | }; | ||||
28 | | ||||
29 | typedef QList<RemoteAction> RemoteActions; | ||||
30 | | ||||
31 | inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteMatch &match) { | ||||
32 | argument.beginStructure(); | ||||
33 | argument << match.id; | ||||
34 | argument << match.text; | ||||
35 | argument << match.iconName; | ||||
36 | argument << match.type; | ||||
37 | argument << match.relevance; | ||||
38 | argument << match.properties; | ||||
39 | argument.endStructure(); | ||||
40 | return argument; | ||||
41 | } | ||||
42 | | ||||
43 | inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteMatch &match) { | ||||
44 | argument.beginStructure(); | ||||
45 | argument >> match.id; | ||||
46 | argument >> match.text; | ||||
47 | argument >> match.iconName; | ||||
48 | uint type; | ||||
49 | argument >> type; | ||||
50 | match.type = (Plasma::QueryMatch::Type)type; | ||||
51 | argument >> match.relevance; | ||||
52 | argument >> match.properties; | ||||
53 | argument.endStructure(); | ||||
54 | | ||||
55 | return argument; | ||||
56 | } | ||||
57 | | ||||
58 | inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteAction &action) | ||||
59 | { | ||||
60 | argument.beginStructure(); | ||||
61 | argument << action.id; | ||||
62 | argument << action.text; | ||||
63 | argument << action.iconName; | ||||
64 | argument.endStructure(); | ||||
65 | return argument; | ||||
66 | } | ||||
67 | | ||||
68 | inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteAction &action) { | ||||
69 | argument.beginStructure(); | ||||
70 | argument >> action.id; | ||||
71 | argument >> action.text; | ||||
72 | argument >> action.iconName; | ||||
73 | argument.endStructure(); | ||||
74 | return argument; | ||||
75 | } | ||||
76 | | ||||
77 | Q_DECLARE_METATYPE(RemoteMatch); | ||||
78 | Q_DECLARE_METATYPE(RemoteMatches); | ||||
79 | Q_DECLARE_METATYPE(RemoteAction); | ||||
80 | Q_DECLARE_METATYPE(RemoteActions); | ||||
81 | |