diff --git a/src/bin/patchmanager-daemon/dbus/org.SfietKonstantin.patchmanager.xml b/src/bin/patchmanager-daemon/dbus/org.SfietKonstantin.patchmanager.xml index 22fd0eed..9fcb89cf 100644 --- a/src/bin/patchmanager-daemon/dbus/org.SfietKonstantin.patchmanager.xml +++ b/src/bin/patchmanager-daemon/dbus/org.SfietKonstantin.patchmanager.xml @@ -91,6 +91,10 @@ + + + + diff --git a/src/bin/patchmanager-daemon/patchmanagerobject.cpp b/src/bin/patchmanager-daemon/patchmanagerobject.cpp index 24609db7..43f432e4 100644 --- a/src/bin/patchmanager-daemon/patchmanagerobject.cpp +++ b/src/bin/patchmanager-daemon/patchmanagerobject.cpp @@ -231,10 +231,20 @@ void PatchManagerObject::notify(const QString &patch, NotifyAction action) case NotifyActionSuccessApply: summary = qApp->translate("", "Patch installed"); body = qApp->translate("", "Patch %1 installed").arg(patch); + if (getToggleServices()) { + body.append( ", " ); + body.append( qApp->translate("", "Services need restart!") ); + notification.setHintValue("icon", "icon-lock-warning"); + }; break; case NotifyActionSuccessUnapply: summary = qApp->translate("", "Patch removed"); body = qApp->translate("", "Patch %1 removed").arg(patch); + if (getToggleServices()) { + body.append( ", " ); + body.append( qApp->translate("", "Services need restart!") ); + notification.setHintValue("icon", "icon-lock-warning"); + }; break; case NotifyActionFailedApply: summary = qApp->translate("", "Failed to install patch"); @@ -1274,6 +1284,11 @@ void PatchManagerObject::patchToggleService(const QString &patch) } } +QStringList PatchManagerObject::getToggleServicesList() const +{ + return m_toggleServices.keys(); +} + bool PatchManagerObject::getToggleServices() const { return !m_toggleServices.isEmpty(); diff --git a/src/bin/patchmanager-daemon/patchmanagerobject.h b/src/bin/patchmanager-daemon/patchmanagerobject.h index 246e029e..011c422f 100644 --- a/src/bin/patchmanager-daemon/patchmanagerobject.h +++ b/src/bin/patchmanager-daemon/patchmanagerobject.h @@ -124,6 +124,7 @@ public slots: void patchToggleService(const QString &patch); bool getToggleServices() const; + QStringList getToggleServicesList() const; bool getFailure() const; bool getLoaded() const; void resolveFailure(); diff --git a/src/qml/RestartServicesDialog.qml b/src/qml/RestartServicesDialog.qml index ee03d979..3c9afe71 100644 --- a/src/qml/RestartServicesDialog.qml +++ b/src/qml/RestartServicesDialog.qml @@ -1,6 +1,10 @@ /* * Copyright (C) 2013 Lucien XU * Copyright (C) 2016 Andrey Kozhevnikov + * Copyright (c) 2021, Patchmanger for SailfishOS contributors: + * - olf "Olf0" + * - Peter G. "nephros" + * - Vlad G. "b100dian" * * You may use this file under the terms of the BSD license as follows: * @@ -39,21 +43,46 @@ Dialog { id: container onAccepted: PatchManager.restartServices() - SilicaFlickable { - anchors.fill: parent - Column { - spacing: Theme.paddingMedium - anchors.left: parent.left; anchors.right: parent.right - DialogHeader { - acceptText: qsTranslate("", "Restart services") - } + Component.onCompleted: console.info("Will restart " + PatchManager.appsToRestart); - Label { - anchors.left: parent.left; anchors.leftMargin: Theme.paddingMedium - anchors.right: parent.right; anchors.rightMargin: Theme.paddingMedium - wrapMode: Text.WordWrap - color: Theme.highlightColor - text: qsTranslate("", "Some services will be restarted now. Reloading the homescreen of the device might take a little time.") + Column { + spacing: Theme.paddingSmall + width: parent.width + DialogHeader { + acceptText: qsTranslate("", "Restart") + } + Label { + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - Theme.horizontalPageMargin * 2 + color: Theme.highlightColor + text: qsTranslate("", "Some services will be restarted now. Reloading the homescreen of the device might take a little time.") + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignJustify + } + SectionHeader { text: qsTranslate("", "List of services:" ); color: Theme.secondaryHighlightColor } + Column { + id: col + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - Theme.horizontalPageMargin * 2 + Repeater { + model: PatchManager.appsToRestart + delegate: Component { TextSwitch { + text: qsTranslate("Sections", modelData) + automaticCheck: false + checked: true + enabled: true + description: { + if ((modelData == "homescreen") + || (modelData == "silica")) + { return qsTranslate("","Note: this will close all apps."); } + else if (modelData == "settings") { return qsTranslate("","Note: this will close %1.").arg(qsTranslate("", "Patchmanager")); } + else if (modelData == "keyboard") { return "" } + else if (modelData == "other") { return "" } + else { return qsTranslate("","Note: this will close the %1 app.").arg(text); } + } + TouchBlocker { anchors.fill: parent} + } + } } } } diff --git a/src/qml/patchmanager.cpp b/src/qml/patchmanager.cpp index 0d17c325..1ede2e90 100644 --- a/src/qml/patchmanager.cpp +++ b/src/qml/patchmanager.cpp @@ -61,6 +61,7 @@ static const char *noop_strings[] = { QT_TRANSLATE_NOOP("Sections", "silica"), QT_TRANSLATE_NOOP("Sections", "settings"), QT_TRANSLATE_NOOP("Sections", "other"), + QT_TRANSLATE_NOOP("Sections", "keyboard"), }; PatchManager::PatchManager(QObject *parent) @@ -233,6 +234,20 @@ QString PatchManager::patchmanagerVersion() const return m_patchmanagerVersion; } +QStringList PatchManager::toggleServicesList() const +{ + QStringList list; + + QDBusPendingReply reply = m_interface->getToggleServicesList(); + reply.waitForFinished(); + if (reply.isFinished()) { + qDebug() << Q_FUNC_INFO << "dbus replied:" << reply.value(); + list = reply.value();; + return list; + } + return list; +} + bool PatchManager::toggleServices() const { return m_toggleServices; diff --git a/src/qml/patchmanager.h b/src/qml/patchmanager.h index 7b0f1a06..387b78d4 100644 --- a/src/qml/patchmanager.h +++ b/src/qml/patchmanager.h @@ -69,6 +69,7 @@ class PatchManager: public QObject Q_PROPERTY(PatchManagerModel *installedModel READ installedModel CONSTANT) Q_PROPERTY(QVariantMap updates READ getUpdates NOTIFY updatesChanged) Q_PROPERTY(QStringList updatesNames READ getUpdatesNames NOTIFY updatesChanged) + Q_PROPERTY(QStringList appsToRestart READ toggleServicesList NOTIFY toggleServicesListChanged) Q_PROPERTY(bool appsNeedRestart READ toggleServices NOTIFY toggleServicesChanged) Q_PROPERTY(bool failure READ failure NOTIFY failureChanged) Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) @@ -88,6 +89,7 @@ class PatchManager: public QObject QVariantMap getUpdates() const; QStringList getUpdatesNames() const; QString patchmanagerVersion() const; + QStringList toggleServicesList() const; bool toggleServices() const; bool failure() const; @@ -161,6 +163,7 @@ public slots: void failureChanged(bool failed); void loadedChanged(bool loaded); void patchmanagerVersionChanged(const QString &patchmanagerVersion); + void toggleServicesListChanged(const QStringList &servicesToBeToggled); private: void successCall(QJSValue callback, const QVariant &value); diff --git a/translations/settings-patchmanager.ts b/translations/settings-patchmanager.ts index d4d2fbde..c82e5ea8 100644 --- a/translations/settings-patchmanager.ts +++ b/translations/settings-patchmanager.ts @@ -43,6 +43,7 @@ + Patchmanager @@ -128,8 +129,8 @@ - + Patch details @@ -143,11 +144,6 @@ Maintainer - - - This patch uses the legacy format for its patch.json file. If you are its maintainer, please do consider updating to the new format; if you are using the Web Catalog you shall not include a patch.json file in your upload!<br />See the developer section in the <a href="%1">README</a> for details. - - Description @@ -214,6 +210,11 @@ May conflict with: + + + This patch uses the legacy format for its patch.json file. If you are its maintainer, please do consider updating to the new format; if you are using the Web Catalog you shall not include a patch.json file in your upload!&lt;br /&gt;See the developer section in the &lt;a href=&quot;%1&quot;&gt;README&lt;/a&gt; for details. + + Unapply all patches @@ -298,15 +299,35 @@ - - Restart services + + Restart - + Some services will be restarted now. Reloading the homescreen of the device might take a little time. + + + List of services: + + + + + Note: this will close all apps. + + + + + Note: this will close %1. + + + + + Note: this will close the %1 app. + + @@ -427,41 +448,47 @@ + + Services need restart! + + + + Patch removed - + Patch %1 removed - + Failed to install patch - + Patch %1 installation failed - + Failed to remove patch - + Patch %1 removal failed - + Update available - + Patch %1 have update candidate @@ -561,9 +588,14 @@ - + other Other + + + keyboard + Keyboard +