New upstream version 5.5.31
authorBoyuan Yang <byang@debian.org>
Wed, 25 May 2022 03:35:04 +0000 (23:35 -0400)
committerBoyuan Yang <byang@debian.org>
Wed, 25 May 2022 03:35:04 +0000 (23:35 -0400)
.github/workflows/call-build-deb.yml
.github/workflows/call-chatOps.yml
.github/workflows/cppcheck.yml
README.md
src/dconfig.cpp
src/filesystem/filesystem.pri
tests/ut_dconfig.cpp
tests/ut_dconfigfile.cpp

index f95fadb5490be12370771de9060f68f897beedb1..c0b94f44b7d9b22e58ac96f87b8a41fc8c1924b1 100644 (file)
@@ -1,7 +1,6 @@
 name: Call build-deb
 on:
   pull_request_target:
-    types: [opened, synchronize]
     paths-ignore:
       - ".github/workflows/**"
 
index 988861419c3603b5e1c210851d0adc8ca6271824..0eb0b7bc2b8b3e3dd23db4cb78b8395d0d8adcd7 100644 (file)
@@ -6,3 +6,5 @@ on:
 jobs:
   chatopt:
     uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master
+    secrets:
+      APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
index dfaef250ae47225354e98f6f264fecf3a08d40e3..6a92b5467043dc6e90dd14554237172c1602e114 100644 (file)
@@ -1,6 +1,8 @@
 name: cppcheck
 on:
   pull_request_target:
+    paths-ignore:
+      - ".github/workflows/**"
 
 concurrency:
   group: ${{ github.workflow }}-pull/${{ github.event.number }}
index 150a69d14e1d223754b7f122463c9d99e5f4bb07..96430ae0ab2abc5e5b0205934a2575f1d14a6175 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ You should read the [Deepin Application Specification](\ref doc/Specification) f
 
 ### Build dependencies
 
-* Qt >= 5.6
+* Qt >= 5.10
 
 ## Installation
 
index f8f6b80190fd22bfb80c6148a0b12825ec21a5cd..33b04df7c34eb044f1a9465117af1f274ae61bc8 100644 (file)
@@ -121,6 +121,16 @@ public:
 
     virtual ~DConfigPrivate() override;
 
+    inline bool invalid() const
+    {
+        const bool valid = backend && backend->isValid();
+        if (!valid)
+            qCWarning(cfLog, "DConfig is invalid of appid=%s name=%s, subpath=%s",
+                      qPrintable(appId), qPrintable(name), qPrintable(subpath));
+
+        return !valid;
+    }
+
     DConfigBackend *getOrCreateBackend();
     DConfigBackend *createBackendByEnv();
 
@@ -451,7 +461,8 @@ DConfigBackend *DConfigPrivate::getOrCreateBackend()
     if (DBusBackend::isServiceRegistered() || DBusBackend::isServiceActivatable()) {
         qCDebug(cfLog, "Fallback to DBus mode");
         backend.reset(new DBusBackend(this));
-    } else {
+    }
+    if (!backend) {
         qCDebug(cfLog, "Can't use DBus config service, fallback to DConfigFile mode");
         backend.reset(new FileBackend(this));
     }
@@ -586,6 +597,9 @@ DConfig::DConfig(DConfigBackend *backend, const QString &appId, const QString &n
 QString DConfig::backendName() const
 {
     D_DC(DConfig);
+    if (d->invalid())
+        return QString();
+
     return d->backend->name();
 }
 
@@ -596,6 +610,9 @@ QString DConfig::backendName() const
 QStringList DConfig::keyList() const
 {
     D_DC(DConfig);
+    if (d->invalid())
+        return QStringList();
+
     return d->backend->keyList();
 }
 
@@ -606,7 +623,7 @@ QStringList DConfig::keyList() const
 bool DConfig::isValid() const
 {
     D_DC(DConfig);
-    return d->backend->isValid();
+    return !d->invalid();
 }
 
 /*!
@@ -618,6 +635,9 @@ bool DConfig::isValid() const
 QVariant DConfig::value(const QString &key, const QVariant &fallback) const
 {
     D_DC(DConfig);
+    if (d->invalid())
+        return fallback;
+
     return d->backend->value(key, fallback);
 }
 
@@ -629,6 +649,9 @@ QVariant DConfig::value(const QString &key, const QVariant &fallback) const
 void DConfig::setValue(const QString &key, const QVariant &value)
 {
     D_D(DConfig);
+    if (d->invalid())
+        return;
+
     d->backend->setValue(key, value);
 }
 
@@ -639,6 +662,9 @@ void DConfig::setValue(const QString &key, const QVariant &value)
 void DConfig::reset(const QString &key)
 {
     D_D(DConfig);
+    if (d->invalid())
+        return;
+
     d->backend->reset(key);
 }
 
index e15ee08a545665861aab5b13e6dbf5fb1f70fb2f..53411f02f03f278b2d9bf581e05c98bd9c628c5e 100644 (file)
@@ -2,7 +2,9 @@ include($$PWD/private/private.pri)
 
 INCLUDEPATH += $$PWD/../base
 
-DEFINES += PREFIX=\\\"$$PREFIX\\\"
+INSTALL_PREFIX=$$QT_INSTALL_PREFIX
+isEmpty(INSTALL_PREFIX): INSTALL_PREFIX=$$[QT_INSTALL_PREFIX]
+DEFINES += PREFIX=\\\"$$INSTALL_PREFIX\\\"
 
 HEADERS += \
     $$PWD/dbasefilewatcher.h \
index f3b476e1fc2888725b991199d5dc61a10fe603b6..9f71611a257f6ceb772c6cfe495412ccbb08b221 100644 (file)
@@ -40,7 +40,7 @@ protected:
         metaGuard = new FileCopyGuard(":/data/dconf-example.meta.json", QString("%1" PREFIX"/share/dsg/configs/%2/%3.json").arg(fileBackendLocalPerfix.value(), APP_ID, FILE_NAME));
 
         backendType.set("DSG_DCONFIG_BACKEND_TYPE", "FileBackend");
-        dsgDataDir.set("DSG_DATA_DIRS", "/usr/share/dsg");
+        dsgDataDir.set("DSG_DATA_DIRS", PREFIX"/share/dsg");
     }
     static void TearDownTestCase() {
         QDir(fileBackendLocalPerfix.value()).removeRecursively();
index 3fc0f9c08345c1b370b79daaa8276872df6b9cc6..614a5e8b34eb72f9fcc8fe3ee6a1857385a7219d 100644 (file)
@@ -36,6 +36,7 @@ class ut_DConfigFile : public testing::Test
 protected:
     static void SetUpTestCase() {
         home.set("HOME", "/tmp/home");
+        dsgDataDir.set("DSG_DATA_DIRS", PREFIX"/share/dsg");
     }
     static void TearDownTestCase() {
         dsgDataDir.restore();