Skip to content

Commit e35323d

Browse files
arrowdaleixpol
authored andcommitted
Add new GetResult* methods of the Offline interface
1 parent c888e1c commit e35323d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/offline.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,42 @@ QDBusPendingReply<> Offline::triggerUpgrade(Action action)
131131
return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000);
132132
}
133133

134+
QDBusPendingReply<bool> Offline::getResult()
135+
{
136+
// Manually invoke dbus because the qdbusxml2cpp does not allow
137+
// setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
138+
auto msg = QDBusMessage::createMethodCall(PK_NAME,
139+
PK_PATH,
140+
PK_OFFLINE_INTERFACE,
141+
QStringLiteral("GetResult"));
142+
msg.setInteractiveAuthorizationAllowed(true);
143+
return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000);
144+
}
145+
146+
QDBusPendingReply<QStringList> Offline::getResultPackages()
147+
{
148+
// Manually invoke dbus because the qdbusxml2cpp does not allow
149+
// setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
150+
auto msg = QDBusMessage::createMethodCall(PK_NAME,
151+
PK_PATH,
152+
PK_OFFLINE_INTERFACE,
153+
QStringLiteral("GetResultPackages"));
154+
msg.setInteractiveAuthorizationAllowed(true);
155+
return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000);
156+
}
157+
158+
QDBusPendingReply<QString, QString> Offline::getResultError()
159+
{
160+
// Manually invoke dbus because the qdbusxml2cpp does not allow
161+
// setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
162+
auto msg = QDBusMessage::createMethodCall(PK_NAME,
163+
PK_PATH,
164+
PK_OFFLINE_INTERFACE,
165+
QStringLiteral("GetResultError"));
166+
msg.setInteractiveAuthorizationAllowed(true);
167+
return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000);
168+
}
169+
134170
QDBusPendingReply<> Offline::cancel()
135171
{
136172
// Manually invoke dbus because the qdbusxml2cpp does not allow

src/offline.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ class PACKAGEKITQT_LIBRARY Offline : public QObject
9999
*/
100100
QDBusPendingReply<> triggerUpgrade(Action action);
101101

102+
/**
103+
* Returns if the last offline action was completed successfully.
104+
*/
105+
QDBusPendingReply<bool> getResult();
106+
107+
/**
108+
* Returns a list of packages that were updated during the last offline action.
109+
*/
110+
QDBusPendingReply<QStringList> getResultPackages();
111+
112+
/**
113+
* Returns the error if the last offline action has failed. The first returned
114+
* string is a PackageKit error code. The second one is a textual description.
115+
*/
116+
QDBusPendingReply<QString, QString> getResultError();
117+
102118
/**
103119
* Cancels the offline update so the next boot procceeds as normal.
104120
*/

0 commit comments

Comments
 (0)