[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [discover] libdiscover/backends/PackageKitBackend: Require an update when the offline-update-action
From: Aleix Pol <null () kde ! org>
Date: 2018-07-11 20:01:25
Message-ID: E1fdLIj-0006iz-Rp () code ! kde ! org
[Download RAW message or body]
Git commit c78bbf9771f277359ff70435ba8f50578bfb5829 by Aleix Pol.
Committed on 11/07/2018 at 19:59.
Pushed by apol into branch 'master'.
Require an update when the offline-update-action is enabled
Upon /var/lib/PackageKit/offline-update-action modification
CCMAIL: sitter@kde.org
M +14 -2 libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp
M +1 -1 libdiscover/backends/PackageKitBackend/PackageKitNotifier.h
https://commits.kde.org/discover/c78bbf9771f277359ff70435ba8f50578bfb5829
diff --git a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp \
b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp index \
0ce055e8..e3761e3c 100644
--- a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp
+++ b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp
@@ -31,6 +31,7 @@
#include <PackageKit/Daemon>
#include <QDBusInterface>
#include <QFile>
+#include <QFileSystemWatcher>
#include <KLocalizedString>
#include <KDesktopFile>
#include <KConfigGroup>
@@ -77,6 +78,10 @@ PackageKitNotifier::PackageKitNotifier(QObject* parent)
m_recheckTimer->setInterval(200);
m_recheckTimer->setSingleShot(true);
connect(m_recheckTimer, &QTimer::timeout, this, \
&PackageKitNotifier::recheckSystemUpdate); +
+ QFileSystemWatcher* watcher = new QFileSystemWatcher(this);
+ watcher->addPath(QStringLiteral(PK_OFFLINE_ACTION_FILENAME));
+ connect(watcher, &QFileSystemWatcher::fileChanged, this, \
&PackageKitNotifier::nowNeedsReboot); }
PackageKitNotifier::~PackageKitNotifier()
@@ -276,8 +281,7 @@ void PackageKitNotifier::transactionListChanged(const \
QStringList& tids) if (!restart.isNull()) {
auto restartEvent = \
PackageKit::Transaction::Restart(restart.toInt());
if (restartEvent >= PackageKit::Transaction::RestartSession) {
- m_needsReboot = true;
- Q_EMIT needsRebootChanged();
+ nowNeedsReboot();
}
}
m_transactions.remove(t->tid().path());
@@ -287,6 +291,14 @@ void PackageKitNotifier::transactionListChanged(const \
QStringList& tids) }
}
+void PackageKitNotifier::nowNeedsReboot()
+{
+ if (!m_needsReboot) {
+ m_needsReboot = true;
+ Q_EMIT needsRebootChanged();
+ }
+}
+
void PackageKitNotifier::onRequireRestart(PackageKit::Transaction::Restart type, \
const QString &packageID) {
PackageKit::Transaction* t = qobject_cast<PackageKit::Transaction*>(sender());
diff --git a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.h \
b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.h index \
2fd74651..9df25d41 100644
--- a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.h
+++ b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.h
@@ -52,9 +52,9 @@ private Q_SLOTS:
void onDistroUpgrade(PackageKit::Transaction::DistroUpgrade type, const QString \
&name, const QString &description);
private:
+ void nowNeedsReboot();
void recheckSystemUpdate();
void checkOfflineUpdates();
- void requireRestartNotification(PackageKit::Transaction::Restart type);
void setupGetUpdatesTransaction(PackageKit::Transaction* transaction);
QProcess* checkAptVariable(const QString &aptconfig, const QLatin1String& \
varname, std::function<void(const QStringRef& val)> func);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic