Commit Graph

17 Commits

Author SHA1 Message Date
wangfei 9c3e18ebf3 chore: add flag UserPublic
add flag UserPublic to Meta file for managing permission among users.

Issue: https://github.com/linuxdeepin/developer-center/issues/5928
2023-10-23 10:26:11 +08:00
YeShanShan 1a16c38d77 fix: DConfig's `subpathIsValid` produces error
It's correctly even if subpath is not exist, so we can't use
`QDir::canonicalPath` to adjust subpath.
  Add ut.
2023-06-01 13:45:52 +08:00
YeShanShan f7a7a3b1fc feat: DConfig add check for no existed item when override
We shouldn't add the item when override file has no existed
item in meta items.
2023-05-17 13:38:09 +08:00
Ye ShanShan 3ace2e4fa7 feat: Support cache to be relocated for DConfigFile
Add setCachePrefix function to support that cache can be relocated
by caller, It's default value doesn't changed, and we can refer to
`配置文件规范` in https://github.com/linuxdeepin/deepin-specifications.
  Permissions is left to the caller.
  For DConfig's FileBackend, we use it's default value.

Issue: https://github.com/linuxdeepin/dtkcore/issues/271
2023-03-20 14:19:20 +08:00
yeshanshan 072dd9562d
feat: Add generic configuration support for DConfig (#236)
All application can use same configuration by generic
  configuration.
    Loading cache file can fallback to noappid's directory when not
using appid or not find cache file.
    one application writes configuration.
    ```c++
    auto config = DConfig::createGeneric(FileName);
    config->setValue("common-configuration", true);
    ```
    other applications read configration can give appid or not to
get the configuration.

    Set empty string for DBus caller when using acquireManager.

Log: 配置策略支持应用无关配置,缓存精准匹配到meta是否使用appid
Influence: none

Change-Id: I78b331f9c455617d5dfea6df087b1f4828390974
2023-02-16 09:41:28 +00:00
heyuming d1605f7da2 feat: support Qt6
Log: 支持Qt6
2023-02-14 13:22:03 +08:00
guoyao c6629ebb55 chore: adapt REUSE license header
开源合规

Log: 开源合规
2022-08-11 14:02:36 +08:00
Ye ShanShan 9c9c027209 fix: application crash when dconfig is invalid
Add invalid check for all DConfig's method(avoid null pointer dereference).
fallback to FileBackend when DBusBackend can't be created.

set correct environment value in unit test.

Log:
Influence: all application crash when dconfig is invalid but still
call other method expect isValid.

Change-Id: I7395f44518989cb14a09306fcfd4db380608a24e
2022-04-29 08:03:57 +00:00
Ye ShanShan b6d3462745 fix: dconfig can't support embed complex data type
using recursion to parse QDBusArgument.

Log:
Influence: none
2022-03-23 11:16:43 +08:00
Ye ShanShan e594322141 fix: modify loading order of application meta path
for application meta path loads order change from
/usr/share/dsg/apps/${appid}/confgis to
/usr/share/dsg/configs/${appid} or /usr/share/dsg/configs;
replace DStandardPaths::paths to DStandardPaths::path.
modify saved path。

Log:
Influence: all application's configuration would not be loaded
unless updating dtkcommon and it's application package.

Change-Id: Ia8212618fd2d4a5ecf67f05aad32a92d934ea01d
2022-03-14 10:17:56 +08:00
Ye ShanShan 438f3adce5 feat: add data type check for config
Check value's type of incoming is compatible,
it copies a value and converts to meta type, it promises
that setValue function is not changing meta type.

Log:
Influence: calling DConfig's setValue maybe fail because of type
incompatible.

Change-Id: I35bef57261a3130ebcb4aeeff83261737ad51197
2022-03-02 20:14:28 +08:00
Ye ShanShan a3503969de fix: Can't access QStringList type data for DConfig
it's occur in DBusBackend, and we directly to get meta value that not
exist cache.
normal value type is automatic casted from QDBusVariant to QVariant,
and QVariantList type need to cast explicitly, it's value type is
QDBusArgument.
because our data store backend is using QJsonValue to resolve, so
we only case QVariantList and QVariantMap, it maybe error in lastly.

Log: 
Influence: DConfig is not access stringlist data type.
Change-Id: I81dbc2ea6b7933154d26ddba70def95ef79240d6
2022-03-01 17:21:41 +08:00
zorowk 90e010a7ba fix: ut link error in dtk.
the member definition need to be separate in some build environment.

Log:
Influence: build error.
Signed-off-by: zorowk <pengwenhao@uniontech.com>
Change-Id: Idd982f0e0a17efa50e170c4590c83ea75abaa031
2021-12-01 10:12:58 +08:00
Ye ShanShan 9144991404 refactor: 规范DConfigFile命名及部分暴露接口
提供拷贝DConfigFile构造函数来拷贝global cache;
去掉命名Service后缀;
解除DConfigCache依赖DConfigMeta
(serial字段传参获得,version从supportedVersion);

Log:
Influence: 需要重构配置中心的更新服务
Change-Id: I5ef78ce9a749ed7ad1317f9d5e1ef6a4886f2369
2021-10-30 11:55:37 +08:00
Ye ShanShan 36da3a6b9e refactor: 重构DConFile Class并适配DBus service开发。
DConfigFile移除user cache保存及管理接口,
只负责global cache和meta接口的维护;移除无关dbus接口

Log: 
Influence: 配置策略
Change-Id: Ibad1afcc150b349c835d39f37b35b3a77b9722ff
2021-10-26 10:23:47 +08:00
Ye ShanShan 23beccfc00 refactor: 重构DConf Class并适配DBus service开发。
重构DConfig类的实现,按类型处理不同的程序配置实现;
调整DConfig class接口来适配dbusservice开发;
添加客户端请求资源释放请求;
增加通过环境变量来初始化后端类型;
修改翻译解析方式;
添加单元测试;
loadOverride函数的局部变量path名称与成员变量因同名被隐藏。

Log: 
Change-Id: I48206c666068e8a85feca6a35639059fc6112be0
2021-10-14 15:35:42 +08:00
Ye ShanShan 07bb75f6c0 feat: 新增 DConfigFile 类
用于实现 https://gitlabwh.uniontech.com/wuhan/se/deepin-specifications/-/issues/3
规范,提供了加载和解析配置文件内容的接口。

Log:
Change-Id: I99663d0f1f07008ab1f3f91c547167d0fff9c15b
2021-08-17 09:19:22 +08:00