File: 2014_removing-unnecessary-mobile-only-functionality.patch

package info (click to toggle)
lomiri-system-settings 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,484 kB
  • sloc: cpp: 15,892; python: 5,994; xml: 362; javascript: 80; makefile: 46; sh: 5
file content (333 lines) | stat: -rw-r--r-- 11,907 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
From 73b736bf6a24173fd6f6673f5116f285d3410330 Mon Sep 17 00:00:00 2001
From: Adam Havelka <adam@uxes.cz>
Date: Fri, 9 May 2025 09:48:35 +0200
Subject: [PATCH] removing unnecessary mobile-only functionality

---
 plugins/CMakeLists.txt          |  2 +-
 plugins/about/CMakeLists.txt    |  8 +--
 plugins/about/PageComponent.qml | 95 ++-------------------------------
 plugins/about/plugin.cpp        | 11 ----
 plugins/about/storageabout.cpp  | 31 -----------
 plugins/about/systeminfo.cpp    | 21 +++-----
 plugins/about/systeminfo.h      |  2 +
 7 files changed, 15 insertions(+), 155 deletions(-)

--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -1,8 +1,8 @@
 if(ANDR_PROP_FOUND)
-    add_subdirectory(about)
     add_subdirectory(brightness)
     add_subdirectory(nfc)
 endif()
+add_subdirectory(about)
 add_subdirectory(background)
 add_subdirectory(battery)
 add_subdirectory(bluetooth)
--- a/plugins/about/CMakeLists.txt
+++ b/plugins/about/CMakeLists.txt
@@ -1,15 +1,9 @@
-include_directories(${ANDR_PROP_INCLUDE_DIRS})
-include_directories(${DEVICEINFO_INCLUDE_DIRS})
 include_directories(${GLIB_INCLUDE_DIRS})
 include_directories(${GIO_INCLUDE_DIRS})
 include_directories(${CLICK_INCLUDE_DIRS})
 include_directories(${CLICK_INCLUDE_DIRS})
 add_definitions(-DQT_NO_KEYWORDS)
 
-if(DEVICEINFO_FOUND)
-    add_definitions(-DENABLE_DEVICEINFO)
-endif()
-
 set(QML_SOURCES
     EntryComponent.qml
     License.qml
@@ -36,7 +30,7 @@
 )
 
 target_link_libraries(LomiriStorageAboutPanel Qt5::Qml Qt5::Quick Qt5::DBus
-${ANDR_PROP_LDFLAGS} ${DEVICEINFO_LDFLAGS} ${GLIB_LDFLAGS} ${GIO_LDFLAGS} ${CLICK_LDFLAGS} LomiriSystemSettingsPrivate)
+${GLIB_LDFLAGS} ${GIO_LDFLAGS} ${CLICK_LDFLAGS} LomiriSystemSettingsPrivate)
 
 set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Lomiri/SystemSettings/StorageAbout)
 install(TARGETS LomiriStorageAboutPanel DESTINATION ${PLUG_DIR})
--- a/plugins/about/PageComponent.qml
+++ b/plugins/about/PageComponent.qml
@@ -43,10 +43,6 @@
         id: bluetooth
     }
 
-    DeviceInfo {
-        id: deviceInfos
-    }
-
     OfonoManager {
         id: manager
         onModemsChanged: root.modemsSorted = modems.slice(0).sort()
@@ -101,37 +97,6 @@
             }
 
             SettingsListItems.SingleValue {
-                objectName: "imeiItem"
-                text: "IMEI"
-                value: i18n.tr("Press to show")
-                visible: !showImei
-                onClicked: showImei = true
-            }
-            SettingsListItems.SingleValue {
-                objectName: "imeiItem"
-                property string imeiNumber
-                imeiNumber: deviceInfos.imei(0)
-                text: "IMEI"
-                value: modemsSorted.length ? (imeiNumber || i18n.tr("None")) :
-                    i18n.tr("None")
-                visible: modemsSorted.length == 1 && showImei
-            }
-
-            SettingsListItems.Standard {
-                text: "IMEI"
-                objectName: "imeiItems"
-                layout.subtitle.text: {
-                    var imeis = [];
-                    modemsSorted.forEach(function (path, i) {
-                        var imei = deviceInfos.imei(i);
-                        imei ? imeis.push(imei) : imeis.push(i18n.tr("None"));
-                    });
-                    return imeis.join(", ");
-                }
-                visible: modemsSorted.length > 1 && showImei
-            }
-
-            SettingsListItems.SingleValue {
                 property string address: wlinfo.macAddress(NetworkInfo.WlanMode, 0)
                 text: i18n.tr("Wi-Fi address")
                 value: address ? address.toUpperCase() : ""
@@ -149,13 +114,12 @@
 
             SettingsListItems.Divider {}
 
-            SettingsListItems.SingleValueProgression {
+            SettingsListItems.SingleValue {
                 id: storageItem
                 objectName: "storageItem"
                 text: i18n.tr("Storage")
                 /* TRANSLATORS: that's the free disk space, indicated in the most appropriate storage unit */
                 value: i18n.tr("%1 free").arg(Utilities.formatSize(backendInfos.getFreeSpace("/home")))
-                onClicked: pageStack.addPageToNextColumn(root, Qt.resolvedUrl("Storage.qml"))
             }
 
             SettingsItemTitle {
@@ -164,64 +128,11 @@
                 text: i18n.tr("Software:")
             }
 
-            SettingsListItems.SingleValueProgression {
+            SettingsListItems.SingleValue {
                 visible: softwareItem.visible
-                property string versionIdentifier: {
-                    var num = SystemImage.currentBuildNumber;
-                    var ota = SystemImage.versionTag;
-                    num = num ? "r%1".arg(num.toString()) : "";
-                    return ota ? ota : num;
-                }
                 objectName: "osItem"
                 text: i18n.tr("OS")
-                value: "Ubuntu Touch %1%2"
-                    .arg(deviceInfos.version(DeviceInfo.Os))
-                    .arg(versionIdentifier ? " (%1)".arg(versionIdentifier) : "")
-                onClicked: pageStack.addPageToNextColumn(root, Qt.resolvedUrl("Version.qml"), {
-                    version: versionIdentifier
-                })
-            }
-
-            SettingsListItems.SingleValue {
-                objectName: "lastUpdatedItem"
-                visible: softwareItem.visible
-                text: i18n.tr("Last updated")
-                value: SystemImage.lastUpdateDate && !isNaN(SystemImage.lastUpdateDate) ?
-                    Qt.formatDate(SystemImage.lastUpdateDate) : i18n.tr("Never")
-            }
-
-            SettingsListItems.SingleControl {
-                visible: softwareItem.visible
-
-                Button {
-                    objectName: "updateButton"
-                    text: i18n.tr("Check for updates")
-                    width: parent.width - units.gu(4)
-                    onClicked: {
-                        var upPlugin = pluginManager.getByName("system-update")
-                        if (upPlugin) {
-                            var updatePage = upPlugin.pageComponent
-                            var updatePageIncubator;
-                            if (updatePage) {
-                                updatePageIncubator = pageStack.addPageToNextColumn(root, updatePage, {
-                                    plugin: upPlugin, pluginManager: pluginManager
-                                });
-                                if (updatePageIncubator && updatePageIncubator.status == Component.Loading) {
-                                    updatePageIncubator.onStatusChanged = function(status) {
-                                        if (status == Component.Ready) {
-                                            updatePageIncubator.object.check(true);
-                                        }
-                                    }
-                                }
-                            } else {
-                                console.warn("Failed to get system-update pageComponent")
-                            }
-                        } else {
-                            console.warn("Failed to get system-update plugin instance")
-                        }
-                    }
-                }
-                showDivider: false
+                value: SystemInfo.distribution
             }
 
             SettingsItemTitle {
--- a/plugins/about/plugin.cpp
+++ b/plugins/about/plugin.cpp
@@ -24,14 +24,6 @@
 #include "click.h"
 #include "storageabout.h"
 #include "systeminfo.h"
-#include "systemimage.h"
-
-static QObject *siSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
-{
-    Q_UNUSED(engine)
-    Q_UNUSED(scriptEngine)
-    return new LomiriSystemSettings::QSystemImage;
-}
 
 static QObject *sinfoSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
 {
@@ -47,9 +39,6 @@
     qRegisterMetaType<ClickModel::Roles>();
     qmlRegisterType<ClickModel>(uri, 1, 0, "ClickRoles");
     qmlRegisterType<StorageAbout>(uri, 1, 0, "LomiriStorageAboutPanel");
-    qmlRegisterSingletonType<LomiriSystemSettings::QSystemImage>(
-        uri, 1, 0, "SystemImage", siSingletonProvider
-    );
     qmlRegisterSingletonType<SystemInfo>(
         uri, 1, 0, "SystemInfo", sinfoSingletonProvider
     );
--- a/plugins/about/storageabout.cpp
+++ b/plugins/about/storageabout.cpp
@@ -43,7 +43,6 @@
 #include <QtGlobal>
 #include <QProcess>
 #include <QVariant>
-#include <hybris/properties/properties.h>
 #include <QDBusReply>
 
 namespace {
@@ -164,47 +163,17 @@
 QString StorageAbout::serialNumber()
 {
 
-    if (m_serialNumber.isEmpty() || m_serialNumber.isNull())
-    {
-        char serialBuffer[PROP_VALUE_MAX];
-        property_get("ro.serialno", serialBuffer, "");
-        m_serialNumber = QString(serialBuffer);
-    }
-
     return m_serialNumber;
 }
 
 QString StorageAbout::vendorString()
 {
-    if (m_vendorString.isEmpty() || m_vendorString.isNull())
-    {
-        char manufacturerBuffer[PROP_VALUE_MAX];
-        char modelBuffer[PROP_VALUE_MAX];
-        property_get("ro.product.manufacturer", manufacturerBuffer, "");
-        property_get("ro.product.model", modelBuffer, "");
-
-        // Special case for devices using generic Halium system.img
-        if (QString(manufacturerBuffer).startsWith("halium", Qt::CaseInsensitive))
-        {
-            property_get("ro.product.vendor.manufacturer", manufacturerBuffer, "");
-            property_get("ro.product.vendor.model", modelBuffer, "");
-        }
-
-        m_vendorString = QString("%1 %2").arg(manufacturerBuffer).arg(modelBuffer);
-    }
-
     return m_vendorString;
 }
 
 QString StorageAbout::deviceBuildDisplayID()
 {
 
-    if (m_deviceBuildDisplayID.isEmpty() || m_deviceBuildDisplayID.isNull())
-    {
-        char serialBuffer[PROP_VALUE_MAX];
-        property_get("ro.build.display.id", serialBuffer, "");
-        m_deviceBuildDisplayID = QString(serialBuffer);
-    }
 
     return m_deviceBuildDisplayID;
 }
--- a/plugins/about/systeminfo.cpp
+++ b/plugins/about/systeminfo.cpp
@@ -21,12 +21,9 @@
 #include <sstream>
 #include <unistd.h>
 
-#ifdef ENABLE_DEVICEINFO
-#include <deviceinfo.h>
-#endif
-
+#include <QCoreApplication>
+#include <QSysInfo>
 #include "systeminfo.h"
-#include "storageabout.h"
 
 SystemInfo::SystemInfo(QObject *parent) : QObject(parent)
 {
@@ -75,7 +72,6 @@
 QString SystemInfo::prettyName()
 {
     QString str = "unknown";
-    auto storageAbout = std::make_unique<StorageAbout>();
 #ifdef ENABLE_DEVICEINFO
     DeviceInfo info;
     str = QString::fromStdString(info.prettyName());
@@ -85,9 +81,7 @@
         || str.toStdString() == "Generic Halium device"
         || str.toStdString() == "Generic linux device") {
     // Fallback if we happen to stumble onto default values.
-        if (!storageAbout->vendorString().isEmpty()) {
-            return storageAbout->vendorString();
-        } else if (access("/sys/devices/virtual/dmi", F_OK) != -1) {
+        if (access("/sys/devices/virtual/dmi", F_OK) != -1) {
             return QString::fromStdString(dmi_devicename());
         } else {
             return QString::fromStdString(devicetree_devicename());
@@ -95,3 +89,8 @@
     }
     return str;
 }
+
+QString SystemInfo::distribution()
+{
+    return QSysInfo::prettyProductName();
+}
--- a/plugins/about/systeminfo.h
+++ b/plugins/about/systeminfo.h
@@ -27,6 +27,7 @@
     Q_PROPERTY(QString cpuArch READ cpuArch CONSTANT)
     Q_PROPERTY(QString kernelVersion READ kernelVersion CONSTANT)
     Q_PROPERTY(QString prettyName READ prettyName CONSTANT)
+    Q_PROPERTY(QString distribution READ distribution CONSTANT)
 
 public:
     SystemInfo(QObject *parent = 0);
@@ -35,4 +36,5 @@
     QString cpuArch();
     QString kernelVersion();
     QString prettyName();
+    QString distribution();
 };