From: Boyuan Yang Date: Wed, 25 May 2022 03:35:04 +0000 (-0400) Subject: New upstream version 5.5.31 X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~3^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b7944896a4701501743be1617718ba6c2f7c47d1;p=dtkcore.git New upstream version 5.5.31 --- diff --git a/.github/workflows/call-build-deb.yml b/.github/workflows/call-build-deb.yml index f95fadb..c0b94f4 100644 --- a/.github/workflows/call-build-deb.yml +++ b/.github/workflows/call-build-deb.yml @@ -1,7 +1,6 @@ name: Call build-deb on: pull_request_target: - types: [opened, synchronize] paths-ignore: - ".github/workflows/**" diff --git a/.github/workflows/call-chatOps.yml b/.github/workflows/call-chatOps.yml index 9888614..0eb0b7b 100644 --- a/.github/workflows/call-chatOps.yml +++ b/.github/workflows/call-chatOps.yml @@ -6,3 +6,5 @@ on: jobs: chatopt: uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index dfaef25..6a92b54 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -1,6 +1,8 @@ name: cppcheck on: pull_request_target: + paths-ignore: + - ".github/workflows/**" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} diff --git a/README.md b/README.md index 150a69d..96430ae 100644 --- 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 diff --git a/src/dconfig.cpp b/src/dconfig.cpp index f8f6b80..33b04df 100644 --- a/src/dconfig.cpp +++ b/src/dconfig.cpp @@ -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); } diff --git a/src/filesystem/filesystem.pri b/src/filesystem/filesystem.pri index e15ee08..53411f0 100644 --- a/src/filesystem/filesystem.pri +++ b/src/filesystem/filesystem.pri @@ -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 \ diff --git a/tests/ut_dconfig.cpp b/tests/ut_dconfig.cpp index f3b476e..9f71611 100644 --- a/tests/ut_dconfig.cpp +++ b/tests/ut_dconfig.cpp @@ -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(); diff --git a/tests/ut_dconfigfile.cpp b/tests/ut_dconfigfile.cpp index 3fc0f9c..614a5e8 100644 --- a/tests/ut_dconfigfile.cpp +++ b/tests/ut_dconfigfile.cpp @@ -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();