parent
399e698389
commit
f4afecbdd5
@ -0,0 +1,78 @@
|
||||
From 60ba050ce7c0bf650d23d597f7a11217213b5e48 Mon Sep 17 00:00:00 2001
|
||||
From: Aleix Pol <aleixpol@kde.org>
|
||||
Date: Thu, 16 Mar 2023 17:14:31 +0100
|
||||
Subject: [PATCH] offline: Make sure we allow for interactive authorization
|
||||
|
||||
Otherwise it might result in
|
||||
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired
|
||||
which PackageKit already contemplates.
|
||||
---
|
||||
src/offline.cpp | 40 ++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 34 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/offline.cpp b/src/offline.cpp
|
||||
index 01d0986..b28ccb7 100644
|
||||
--- a/src/offline.cpp
|
||||
+++ b/src/offline.cpp
|
||||
@@ -92,7 +92,15 @@ QDBusPendingReply<> Offline::trigger(Action action)
|
||||
};
|
||||
Q_ASSERT(!actionStr.isEmpty());
|
||||
|
||||
- return d->iface.Trigger(actionStr);
|
||||
+ // Manually invoke dbus because the qdbusxml2cpp does not allow
|
||||
+ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
|
||||
+ auto msg = QDBusMessage::createMethodCall(PK_NAME,
|
||||
+ PK_PATH,
|
||||
+ PK_OFFLINE_INTERFACE,
|
||||
+ QStringLiteral("Trigger"));
|
||||
+ msg << actionStr;
|
||||
+ msg.setInteractiveAuthorizationAllowed(true);
|
||||
+ return QDBusConnection::systemBus().asyncCall(msg);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Offline::triggerUpgrade(Action action)
|
||||
@@ -112,19 +120,39 @@ QDBusPendingReply<> Offline::triggerUpgrade(Action action)
|
||||
};
|
||||
Q_ASSERT(!actionStr.isEmpty());
|
||||
|
||||
- return d->iface.TriggerUpgrade(actionStr);
|
||||
+ // Manually invoke dbus because the qdbusxml2cpp does not allow
|
||||
+ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
|
||||
+ auto msg = QDBusMessage::createMethodCall(PK_NAME,
|
||||
+ PK_PATH,
|
||||
+ PK_OFFLINE_INTERFACE,
|
||||
+ QStringLiteral("TriggerUpgrade"));
|
||||
+ msg << actionStr;
|
||||
+ msg.setInteractiveAuthorizationAllowed(true);
|
||||
+ return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Offline::cancel()
|
||||
{
|
||||
- Q_D(Offline);
|
||||
- return d->iface.Cancel();
|
||||
+ // Manually invoke dbus because the qdbusxml2cpp does not allow
|
||||
+ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
|
||||
+ auto msg = QDBusMessage::createMethodCall(PK_NAME,
|
||||
+ PK_PATH,
|
||||
+ PK_OFFLINE_INTERFACE,
|
||||
+ QStringLiteral("Cancel"));
|
||||
+ msg.setInteractiveAuthorizationAllowed(true);
|
||||
+ return QDBusConnection::systemBus().asyncCall(msg);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Offline::clearResults()
|
||||
{
|
||||
- Q_D(Offline);
|
||||
- return d->iface.ClearResults();
|
||||
+ // Manually invoke dbus because the qdbusxml2cpp does not allow
|
||||
+ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag
|
||||
+ auto msg = QDBusMessage::createMethodCall(PK_NAME,
|
||||
+ PK_PATH,
|
||||
+ PK_OFFLINE_INTERFACE,
|
||||
+ QStringLiteral("ClearResults"));
|
||||
+ msg.setInteractiveAuthorizationAllowed(true);
|
||||
+ return QDBusConnection::systemBus().asyncCall(msg);
|
||||
}
|
||||
|
||||
void Offline::getPrepared()
|
@ -0,0 +1,96 @@
|
||||
From 40b24cb41e3a16cf68b664f212837eb26d7e1a27 Mon Sep 17 00:00:00 2001
|
||||
From: Alessandro Astone <ales.astone@gmail.com>
|
||||
Date: Mon, 28 Aug 2023 16:39:09 +0200
|
||||
Subject: [PATCH] Allow Transaction::setHints before the transaction has
|
||||
started
|
||||
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
src/transaction.cpp | 1 +
|
||||
src/transaction.h | 7 +++++--
|
||||
src/transactionprivate.cpp | 2 +-
|
||||
src/transactionprivate.h | 2 ++
|
||||
5 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 69c22f7..92c7d72 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -66,7 +66,7 @@ set (LOCALSTATEDIR "/var")
|
||||
set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/packagekitqt${QT_VERSION_MAJOR}/")
|
||||
|
||||
add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")
|
||||
-set (CMAKE_CXX_STANDARD 11)
|
||||
+set (CMAKE_CXX_STANDARD 17)
|
||||
|
||||
configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
||||
|
||||
diff --git a/src/transaction.cpp b/src/transaction.cpp
|
||||
index 9c733aa..48f07ed 100644
|
||||
--- a/src/transaction.cpp
|
||||
+++ b/src/transaction.cpp
|
||||
@@ -300,6 +300,7 @@ Transaction::Role Transaction::role() const
|
||||
QDBusPendingReply<> Transaction::setHints(const QStringList &hints)
|
||||
{
|
||||
Q_D(Transaction);
|
||||
+ d->hints = hints;
|
||||
if (d->p) {
|
||||
return d->p->SetHints(hints);
|
||||
}
|
||||
diff --git a/src/transaction.h b/src/transaction.h
|
||||
index 46a2fac..510773e 100644
|
||||
--- a/src/transaction.h
|
||||
+++ b/src/transaction.h
|
||||
@@ -634,11 +634,14 @@ public:
|
||||
* the package manager which can change as the transaction runs.
|
||||
*
|
||||
* This method can be sent before the transaction has been run
|
||||
- * (by using Daemon::setHints) or whilst it is running
|
||||
- * (by using Transaction::setHints).
|
||||
+ * or whilst it is running. If it is used before the transaction has
|
||||
+ * been run, the return value is meaningless: the \p hints will be
|
||||
+ * applied upon starting the transaction.
|
||||
* There is no limit to the number of times this
|
||||
* method can be sent, although some backends may only use the values
|
||||
* that were set before the transaction was started.
|
||||
+ * This method will override the global hints previously set by
|
||||
+ * Daemon::setHints, that are otherwise used by default.
|
||||
*
|
||||
* The \p hints can be filled with entries like these
|
||||
* ('locale=en_GB.utf8','idle=true','interactive=false').
|
||||
diff --git a/src/transactionprivate.cpp b/src/transactionprivate.cpp
|
||||
index b4b44b7..550e0ab 100644
|
||||
--- a/src/transactionprivate.cpp
|
||||
+++ b/src/transactionprivate.cpp
|
||||
@@ -49,7 +49,7 @@ void TransactionPrivate::setup(const QDBusObjectPath &transactionId)
|
||||
tid.path(),
|
||||
QDBusConnection::systemBus(),
|
||||
q);
|
||||
- QStringList hints = Daemon::global()->hints();
|
||||
+ QStringList hints = this->hints ? *this->hints : Daemon::global()->hints();
|
||||
hints << QStringLiteral("supports-plural-signals=true");
|
||||
q->setHints(hints);
|
||||
|
||||
diff --git a/src/transactionprivate.h b/src/transactionprivate.h
|
||||
index 69217a8..01463c7 100644
|
||||
--- a/src/transactionprivate.h
|
||||
+++ b/src/transactionprivate.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QDBusPendingCallWatcher>
|
||||
+#include <optional>
|
||||
|
||||
#include "transaction.h"
|
||||
#include "transactionproxy.h"
|
||||
@@ -84,6 +85,7 @@ protected:
|
||||
bool sentFinished = false;
|
||||
bool allowCancel = false;
|
||||
bool callerActive = false;
|
||||
+ std::optional<QStringList> hints;
|
||||
|
||||
// Queue params
|
||||
QString eulaId;
|
||||
--
|
||||
2.41.0
|
||||
|
Loading…
Reference in new issue