[weather] Disable option for temperature in compact mode when in systray

parent 8c23889d
......@@ -26,7 +26,8 @@ ColumnLayout {
id: compactRoot
readonly property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical)
readonly property bool showTemperature: plasmoid.nativeInterface.configuration.showTemperatureInCompactMode
readonly property bool showTemperature: plasmoid.nativeInterface.configuration.showTemperatureInCompactMode &&
!plasmoid.nativeInterface.needsToBeSquare
Loader {
id: loader
......
......@@ -25,6 +25,8 @@ import org.kde.plasma.private.weather 1.0
ColumnLayout {
id: displayConfigPage
readonly property bool canShowTemperature: !plasmoid.nativeInterface.needsToBeSquare
signal configurationChanged
function saveConfig() {
......@@ -50,6 +52,7 @@ ColumnLayout {
Layout.row: 0
Layout.column: 0
Layout.alignment: Qt.AlignRight
enabled: canShowTemperature
text: i18n("Show temperature in compact mode:")
}
......@@ -58,6 +61,7 @@ ColumnLayout {
Layout.row: 0
Layout.column: 1
enabled: canShowTemperature
onCheckedChanged: displayConfigPage.configurationChanged();
}
......
......@@ -50,4 +50,13 @@ Item {
Plasmoid.fullRepresentation: FullRepresentation {
}
Component.onCompleted: {
// workaround for missing note about being in systray or similar (kde bug #388995)
// guess from cointainer structure data and make available to config page
plasmoid.nativeInterface.needsToBeSquare =
(plasmoid.parent !== null &&
((plasmoid.parent.pluginName === 'org.kde.plasma.private.systemtray' ||
plasmoid.parent.objectName === 'taskItemContainer')));
}
}
......@@ -32,6 +32,8 @@ class WeatherApplet : public Plasma::WeatherPopupApplet
Q_PROPERTY(QVariantList noticesModel READ noticesModel NOTIFY modelUpdated)
Q_PROPERTY(QVariantMap configuration READ configuration NOTIFY configurationChanged FINAL)
// used for making this information available to the config pages
Q_PROPERTY(bool needsToBeSquare MEMBER m_needsToBeSquare NOTIFY needsToBeSquareChanged FINAL)
public:
WeatherApplet(QObject *parent, const QVariantList &args);
......@@ -51,6 +53,7 @@ public:
Q_SIGNALS:
void modelUpdated();
void configurationChanged();
void needsToBeSquareChanged();
public: // WeatherPopupApplet API
QVariantMap configValues() const override;
......@@ -77,6 +80,7 @@ private:
QVariantList m_noticesModel;
QVariantMap m_configuration;
bool m_needsToBeSquare = false;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment