127 lines
5.3 KiB
Diff
127 lines
5.3 KiB
Diff
diff -Nur apper-0.7.1.orig/apperd/apperd.cpp apper-0.7.1/apperd/apperd.cpp
|
|
--- apper-0.7.1.orig/apperd/apperd.cpp 2012-04-21 13:58:06.814615920 +0200
|
|
+++ apper-0.7.1/apperd/apperd.cpp 2012-04-21 14:09:00.559485569 +0200
|
|
@@ -56,6 +56,19 @@
|
|
connect(m_qtimer, SIGNAL(timeout()), this, SLOT(poll()));
|
|
m_qtimer->start(FIVE_MIN);
|
|
|
|
+ // Make sure we know is Sentinel is running
|
|
+ QDBusServiceWatcher *watcher;
|
|
+ watcher = new QDBusServiceWatcher(QLatin1String("org.kde.ApperSentinel"),
|
|
+ QDBusConnection::sessionBus(),
|
|
+ QDBusServiceWatcher::WatchForOwnerChange,
|
|
+ this);
|
|
+ connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
|
|
+ this, SLOT(serviceOwnerChanged(QString,QString,QString)));
|
|
+
|
|
+ // Check if Sentinel is running
|
|
+ m_sentinelIsRunning = nameHasOwner(QLatin1String("org.kde.ApperSentinel"),
|
|
+ QDBusConnection::sessionBus());
|
|
+
|
|
// Watch for TransactionListChanged so we start sentinel
|
|
QDBusConnection::systemBus().connect(QLatin1String(""),
|
|
QLatin1String(""),
|
|
@@ -81,19 +94,6 @@
|
|
connect(confWatch, SIGNAL(deleted(QString)), this, SLOT(configFileChanged()));
|
|
confWatch->startScan();
|
|
|
|
- // Make sure we know is Sentinel is running
|
|
- QDBusServiceWatcher *watcher;
|
|
- watcher = new QDBusServiceWatcher(QLatin1String("org.kde.ApperSentinel"),
|
|
- QDBusConnection::sessionBus(),
|
|
- QDBusServiceWatcher::WatchForOwnerChange,
|
|
- this);
|
|
- connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
|
|
- this, SLOT(serviceOwnerChanged(QString,QString,QString)));
|
|
-
|
|
- // Check if Sentinel is running
|
|
- m_sentinelIsRunning = nameHasOwner(QLatin1String("org.kde.ApperSentinel"),
|
|
- QDBusConnection::sessionBus());
|
|
-
|
|
// if PackageKit is running check to see if there are running transactons already
|
|
if (!m_sentinelIsRunning && nameHasOwner(QLatin1String("org.freedesktop.PackageKit"),
|
|
QDBusConnection::systemBus())) {
|
|
@@ -116,28 +116,30 @@
|
|
|
|
void ApperD::poll()
|
|
{
|
|
- if (m_lastRefreshCache.isNull()) {
|
|
- // This value wasn't set
|
|
- // convert this to QDateTime
|
|
- m_lastRefreshCache = getTimeSinceRefreshCache();
|
|
- }
|
|
-
|
|
- // If check for updates is active
|
|
- if (m_refreshCacheInterval != Enum::Never) {
|
|
- uint maxTime = QDateTime::currentDateTime().toTime_t() - m_refreshCacheInterval;
|
|
- // If lastRefreshCache is null it means that the cache was never refreshed
|
|
- if (m_lastRefreshCache.isNull() || m_lastRefreshCache.toTime_t() < maxTime) {
|
|
- callApperSentinel(QLatin1String("RefreshAndUpdate"));
|
|
+ if (!m_sentinelIsRunning) {
|
|
+ if (m_lastRefreshCache.isNull()) {
|
|
+ // This value wasn't set
|
|
+ // convert this to QDateTime
|
|
+ m_lastRefreshCache = getTimeSinceRefreshCache();
|
|
+ }
|
|
|
|
- // Invalidate the last time the cache was refreshed
|
|
- m_lastRefreshCache = QDateTime();
|
|
+ // If check for updates is active
|
|
+ if (m_refreshCacheInterval != Enum::Never) {
|
|
+ uint maxTime = QDateTime::currentDateTime().toTime_t() - m_refreshCacheInterval;
|
|
+ // If lastRefreshCache is null it means that the cache was never refreshed
|
|
+ if (m_lastRefreshCache.isNull() || m_lastRefreshCache.toTime_t() < maxTime) {
|
|
+ callApperSentinel(QLatin1String("RefreshAndUpdate"));
|
|
+
|
|
+ // Invalidate the last time the cache was refreshed
|
|
+ m_lastRefreshCache = QDateTime();
|
|
+ }
|
|
}
|
|
- }
|
|
|
|
- // display or update the system
|
|
- if (!m_showedUpdates) {
|
|
- m_showedUpdates = true; // don't do that so often
|
|
- callApperSentinel(QLatin1String("Update"));
|
|
+ // display or update the system
|
|
+ if (!m_showedUpdates) {
|
|
+ m_showedUpdates = true; // don't do that so often
|
|
+ callApperSentinel(QLatin1String("Update"));
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -162,20 +164,25 @@
|
|
message << static_cast<uint>(0);
|
|
QDBusConnection::sessionBus().send(message);
|
|
}
|
|
-
|
|
- if (tids.isEmpty()) {
|
|
- // update the last time the cache was refreshed
|
|
- // TODO PackageKit should emit a property change for this
|
|
- m_lastRefreshCache = getTimeSinceRefreshCache();
|
|
- }
|
|
+// revert this part of patch .wakeups because it, for me unknown reason,
|
|
+// 'blocks' doing updates. Martin Kho
|
|
+/*
|
|
+ * if (tids.isEmpty()) {
|
|
+ * // update the last time the cache was refreshed
|
|
+ * // TODO PackageKit should emit a property change for this
|
|
+ * m_lastRefreshCache = getTimeSinceRefreshCache();
|
|
+ * }
|
|
+ */
|
|
}
|
|
|
|
void ApperD::updatesChanged()
|
|
{
|
|
// - update time since last refresh
|
|
// - reset showed updates to display this change
|
|
- getTimeSinceRefreshCache();
|
|
- m_showedUpdates = false;
|
|
+ if (!m_sentinelIsRunning) {
|
|
+ getTimeSinceRefreshCache();
|
|
+ m_showedUpdates = false;
|
|
+ }
|
|
}
|
|
|
|
void ApperD::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
|