Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
<arg name="patch" type="s" direction="in" />
<arg name="activate" type="b" direction="in" />
</method>
<method name="getToggleServicesList">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QStringList"/>
<arg name="services" type="a{s}" direction="out" />
</method>
<method name="getToggleServices">
<arg name="toggle" type="b" direction="out" />
</method>
Expand Down
15 changes: 15 additions & 0 deletions src/bin/patchmanager-daemon/patchmanagerobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/bin/patchmanager-daemon/patchmanagerobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
57 changes: 43 additions & 14 deletions src/qml/RestartServicesDialog.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/*
* Copyright (C) 2013 Lucien XU <[email protected]>
* Copyright (C) 2016 Andrey Kozhevnikov <[email protected]>
* Copyright (c) 2021, Patchmanger for SailfishOS contributors:
* - olf "Olf0" <https://github.com/Olf0>
* - Peter G. "nephros" <[email protected]>
* - Vlad G. "b100dian" <https://github.com/b100dian>
*
* You may use this file under the terms of the BSD license as follows:
*
Expand Down Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for all languages but English, because English doesn't have a dedicated translation and so uses the (lowercase) original strings.

Copy link
Contributor

@Olf0 Olf0 Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a serious issue from your POV? I.e., serious enough to resurrect and maintain the English TS file?

My first thought was: So what, then it just uses lower case strings.
Or maybe this dialog (its textual context) can phrased in a way, that this is fine without having these strings starting with a capital letter?
But as you seem to have looked at it in "real life", just decide how to proceed.

Resolved per #153

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, totally minor issue that just came up along the way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

Copy link
Contributor

@Olf0 Olf0 Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to document that Transifex uses "translated" strings from the source file as source strings, when the are available (which makes sense IMO).

Side note: Thus this change changed the source strings of all 14 PM-categories for all 14 translations. And because Transifex does not allow programmatic changes at Transifex (e.g., per RegEx), I manually adapted these 14 terms for 13 translations (all, but zh). Maybe scripted downloading, programmatic changing the strings locally and scripted uploading would have been easier, but that would have required learning how to use Transifex's web API, which I wanted to avid this time.

Copy link
Contributor

@Olf0 Olf0 Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nephros, please use the exclamation mark only if something went wrong.
Unfortunately the classic conventions for writing dialogues are less obeyed than in the early 2000s, but I still would like to stick to them.

  • ! means: Attention, something went wrong.
  • ... (concluding, i.e., at the end of a phrase or sentence) means: A new window is going to be opened. This is most suitable for choices (which would open a new window).
  • There are more, which I do not remember spontaneously.

The dialogues in MS-Windows and most of KDE and Gnome are adhering to these conventions, so people are used to them (even most not consciously).

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}
}
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/qml/patchmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -233,6 +234,20 @@ QString PatchManager::patchmanagerVersion() const
return m_patchmanagerVersion;
}

QStringList PatchManager::toggleServicesList() const
{
QStringList list;

QDBusPendingReply<QStringList> 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;
Expand Down
3 changes: 3 additions & 0 deletions src/qml/patchmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
66 changes: 49 additions & 17 deletions translations/settings-patchmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="222"/>
<location filename="../src/bin/dialog/dialog.qml" line="165"/>
<location filename="../src/qml/AboutPage.qml" line="63"/>
<location filename="../src/qml/RestartServicesDialog.qml" line="78"/>
<source>Patchmanager</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -128,8 +129,8 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WebPatchPage.qml" line="85"/>
<location filename="../src/qml/PatchManagerPage.qml" line="490"/>
<location filename="../src/qml/WebPatchPage.qml" line="85"/>
<source>Patch details</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -143,11 +144,6 @@
<source>Maintainer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/UnifiedPatchPage.qml" line="165"/>
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/UnifiedPatchPage.qml" line="171"/>
<source>Description</source>
Expand Down Expand Up @@ -214,6 +210,11 @@
<source>May conflict with:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/UnifiedPatchPage.qml" line="165"/>
<source>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!&amp;lt;br /&amp;gt;See the developer section in the &amp;lt;a href=&amp;quot;%1&amp;quot;&amp;gt;README&amp;lt;/a&amp;gt; for details.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/PatchManagerPage.qml" line="147"/>
<source>Unapply all patches</source>
Expand Down Expand Up @@ -298,15 +299,35 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="48"/>
<source>Restart services</source>
<location filename="../src/qml/RestartServicesDialog.qml" line="52"/>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="56"/>
<location filename="../src/qml/RestartServicesDialog.qml" line="58"/>
<source>Some services will be restarted now. Reloading the homescreen of the device might take a little time.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="62"/>
<source>List of services:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="77"/>
<source>Note: this will close all apps.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="78"/>
<source>Note: this will close %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/RestartServicesDialog.qml" line="81"/>
<source>Note: this will close the %1 app.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/ScreenshotsPage.qml" line="71"/>
<location filename="../src/qml/WebPatchPage.qml" line="272"/>
Expand Down Expand Up @@ -427,41 +448,47 @@
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="236"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="245"/>
<source>Services need restart!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="241"/>
<source>Patch removed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="237"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="242"/>
<source>Patch %1 removed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="240"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="250"/>
<source>Failed to install patch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="241"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="251"/>
<source>Patch %1 installation failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="244"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="254"/>
<source>Failed to remove patch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="245"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="255"/>
<source>Patch %1 removal failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="248"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="258"/>
<source>Update available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="249"/>
<location filename="../src/bin/patchmanager-daemon/patchmanagerobject.cpp" line="259"/>
<source>Patch %1 have update candidate</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -561,9 +588,14 @@
</message>
<message>
<location filename="../src/qml/patchmanager.cpp" line="63"/>
<location filename="../src/qml/patchmanager.cpp" line="216"/>
<location filename="../src/qml/patchmanager.cpp" line="217"/>
<source>other</source>
<translation>Other</translation>
</message>
<message>
<location filename="../src/qml/patchmanager.cpp" line="64"/>
<source>keyboard</source>
<translation>Keyboard</translation>
</message>
</context>
</TS>