From adf095e8317ba3d019151840e274f04722cd30c3 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sat, 8 Jun 2024 14:00:42 +0300 Subject: [PATCH] UI: AppInfoManager: Use "noCache" flag --- src/ui/fortmanager.cpp | 3 ++- src/ui/fortsettings.cpp | 2 +- src/ui/rpc/appinfomanagerrpc.cpp | 5 +++-- src/ui/rpc/appinfomanagerrpc.h | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index bf7f9011..fa1cf6e3 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -98,7 +98,8 @@ inline void setupClientServices(IocContainer *ioc, const FortSettings *settings) ioc->setService(new AskPendingManagerRpc()); ioc->setService(new AutoUpdateManagerRpc(settings->cachePath())); ioc->setService(new DriverManagerRpc()); - ioc->setService(new AppInfoManagerRpc(settings->cacheFilePath())); + ioc->setService( + new AppInfoManagerRpc(settings->cacheFilePath(), settings->noCache())); ioc->setService(new LogManagerRpc()); ioc->setService(new ServiceInfoManagerRpc()); ioc->setService(new TaskManagerRpc()); diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 9ce6f026..138c95aa 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -50,7 +50,7 @@ QString FortSettings::statBlockFilePath() const QString FortSettings::cacheFilePath() const { - return noCache() && !hasService() ? ":memory:" : cachePath() + "appinfo.db"; + return noCache() ? ":memory:" : cachePath() + "appinfo.db"; } QString FortSettings::passwordUnlockedTillText() const diff --git a/src/ui/rpc/appinfomanagerrpc.cpp b/src/ui/rpc/appinfomanagerrpc.cpp index d5115fa8..d45bd781 100644 --- a/src/ui/rpc/appinfomanagerrpc.cpp +++ b/src/ui/rpc/appinfomanagerrpc.cpp @@ -5,8 +5,9 @@ #include #include -AppInfoManagerRpc::AppInfoManagerRpc(const QString &filePath, QObject *parent) : - AppInfoManager(filePath, parent, SqliteDb::OpenDefaultReadOnly) +AppInfoManagerRpc::AppInfoManagerRpc(const QString &filePath, bool noCache, QObject *parent) : + AppInfoManager(filePath, parent, + (noCache ? SqliteDb::OpenDefaultReadWrite : SqliteDb::OpenDefaultReadOnly)) { } diff --git a/src/ui/rpc/appinfomanagerrpc.h b/src/ui/rpc/appinfomanagerrpc.h index 1d8326ae..9fce517a 100644 --- a/src/ui/rpc/appinfomanagerrpc.h +++ b/src/ui/rpc/appinfomanagerrpc.h @@ -12,7 +12,7 @@ class AppInfoManagerRpc : public AppInfoManager Q_OBJECT public: - explicit AppInfoManagerRpc(const QString &filePath, QObject *parent = nullptr); + explicit AppInfoManagerRpc(const QString &filePath, bool noCache, QObject *parent = nullptr); static bool processServerCommand( const ProcessCommandArgs &p, QVariantList &resArgs, bool &ok, bool &isSendResult);