kiran-cc-daemon/0002-feature-error-Add-error-message-when-Failed-to-apply.patch

630 lines
18 KiB
Diff
Raw Normal View History

From ff582cbf24c9727716ca9a1af6a9866a5e0840f6 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Thu, 1 Sep 2022 17:41:40 +0800
Subject: [PATCH 2/3] feature(error): Add error message when Failed to apply
display setting.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 当应用显示设置失败时添加错误提示。
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
lib/base/error.cpp | 4 +-
plugins/display/display-manager.cpp | 14 +-
po/zh_CN.po | 217 ++++++++++++++--------------
3 files changed, 127 insertions(+), 108 deletions(-)
diff --git a/lib/base/error.cpp b/lib/base/error.cpp
index 0dcbcee..656e732 100644
--- a/lib/base/error.cpp
+++ b/lib/base/error.cpp
@@ -219,6 +219,9 @@ std::string CCError::get_error_desc(CCErrorCode error_code, bool attach_error_co
case CCErrorCode::ERROR_DISPLAY_UNKNOWN_REFLECT_TYPE:
error_desc = _("Unknown reflect type.");
break;
+ case CCErrorCode::ERROR_DISPLAY_EXEC_XRANDR_FAILED:
+ error_desc = _("The current settings cannot be applied.");
+ break;
case CCErrorCode::ERROR_APPEARANCE_THEME_NOT_EXIST:
error_desc = _("Theme not exist.");
break;
@@ -387,7 +390,6 @@ std::string CCError::get_error_desc(CCErrorCode error_code, bool attach_error_co
case CCErrorCode::ERROR_ACCOUNTS_USER_GROUP_NOT_FOUND:
case CCErrorCode::ERROR_ACCOUNTS_USER_AUTH_SAVE_DATA_FAILED:
case CCErrorCode::ERROR_ACCOUNTS_USER_AUTH_DEL_DATA_FAILED:
- case CCErrorCode::ERROR_DISPLAY_EXEC_XRANDR_FAILED:
case CCErrorCode::ERROR_DISPLAY_SAVE_CREATE_FILE_FAILED:
case CCErrorCode::ERROR_DISPLAY_WRITE_CONF_FILE_FAILED:
case CCErrorCode::ERROR_APPEARANCE_SET_BACKGROUND_FAILED:
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
index bc18eb9..9b7190e 100644
--- a/plugins/display/display-manager.cpp
+++ b/plugins/display/display-manager.cpp
@@ -580,13 +580,23 @@ bool DisplayManager::apply(CCErrorCode &error_code)
try
{
+ std::string standard_error;
+ int32_t exit_status = 0;
+
KLOG_DEBUG("cmdline: %s.", cmdline.c_str());
- Glib::spawn_command_line_sync(cmdline);
+ Glib::spawn_command_line_sync(cmdline, nullptr, &standard_error, &exit_status);
+
+ if (!standard_error.empty() || exit_status != 0)
+ {
+ error_code = CCErrorCode::ERROR_DISPLAY_EXEC_XRANDR_FAILED;
+ KLOG_WARNING("Failed to run xrandr: %s.", standard_error.c_str());
+ return false;
+ }
}
catch (const Glib::Error &e)
{
error_code = CCErrorCode::ERROR_DISPLAY_EXEC_XRANDR_FAILED;
- KLOG_WARNING("%s.", e.what().c_str());
+ KLOG_WARNING("Failed to run xrandr: %s.", e.what().c_str());
return false;
}
return true;
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 0f3f202..e1c431e 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kiran-cc-daemon 2.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-08-16 17:47+0800\n"
+"POT-Creation-Date: 2022-09-01 17:39+0800\n"
"PO-Revision-Date: 2020-07-01 17:54+0800\n"
"Last-Translator: tangjie02 <tangjie02@kylinos.com.cn>\n"
"Language-Team: Chinese (simplified)\n"
@@ -406,424 +406,428 @@ msgstr "输出版本信息并退出"
msgid "Control center"
msgstr "控制中心"
-#: ../lib/base/error.cpp:32
+#: ../lib/base/error.cpp:34
msgid "The argument is invalid."
msgstr "参数不合法。"
-#: ../lib/base/error.cpp:35
+#: ../lib/base/error.cpp:37
msgid "Operation failed."
msgstr "操作失败。"
-#: ../lib/base/error.cpp:39
+#: ../lib/base/error.cpp:41
msgid "The plugin doesn't exist."
msgstr "插件不存在。"
-#: ../lib/base/error.cpp:46
+#: ../lib/base/error.cpp:48
msgid "No user found."
msgstr "没有发现用户。"
-#: ../lib/base/error.cpp:49
+#: ../lib/base/error.cpp:51
msgid "Multiple users have the same authentication data."
msgstr "多个用户存在相同的认证数据"
-#: ../lib/base/error.cpp:52
+#: ../lib/base/error.cpp:54
msgid ""
"The user is already logined in, Please log off the user before deleting it."
msgstr "用户已经登录,请注销该用户后再删除"
-#: ../lib/base/error.cpp:55
+#: ../lib/base/error.cpp:57
msgid "The user already exists."
msgstr "用户已存在。"
-#: ../lib/base/error.cpp:58
+#: ../lib/base/error.cpp:60
msgid "Unknown account type."
msgstr "未知的用户类型。"
-#: ../lib/base/error.cpp:61
+#: ../lib/base/error.cpp:63
msgid "Can't update password file."
msgstr "不能更新password文件。"
-#: ../lib/base/error.cpp:64
+#: ../lib/base/error.cpp:66
msgid "Invalid command syntax."
msgstr "命令语法无效。"
-#: ../lib/base/error.cpp:67
+#: ../lib/base/error.cpp:69
msgid "Invalid argument to option."
msgstr "命令参数无效。"
-#: ../lib/base/error.cpp:70
+#: ../lib/base/error.cpp:72
msgid "UID already in use."
msgstr "UID已在使用中。"
-#: ../lib/base/error.cpp:73
+#: ../lib/base/error.cpp:75
msgid "Passwd file contains errors."
msgstr "Passwd文件存在错误。"
-#: ../lib/base/error.cpp:76
+#: ../lib/base/error.cpp:78
msgid "Specified user/group doesn't exist."
msgstr "指定的用户/组不存在。"
-#: ../lib/base/error.cpp:79
+#: ../lib/base/error.cpp:81
msgid "User to modify is logged in."
msgstr "要修改的用户已登陆。"
-#: ../lib/base/error.cpp:82
+#: ../lib/base/error.cpp:84
msgid "Username already in use."
msgstr "用户名已经在使用中。"
-#: ../lib/base/error.cpp:85
+#: ../lib/base/error.cpp:87
msgid "Can't update group file."
msgstr "不能更新group文件。"
-#: ../lib/base/error.cpp:88
+#: ../lib/base/error.cpp:90
msgid "Insufficient space to move home dir."
msgstr "空间不足,无法移动主目录。"
-#: ../lib/base/error.cpp:91
+#: ../lib/base/error.cpp:93
msgid "Can't create/remove/move home directory."
msgstr "不能创建/删除/移动主目录。"
-#: ../lib/base/error.cpp:95
+#: ../lib/base/error.cpp:97
msgid "Can't update SELinux user mapping."
msgstr "无法更新SELinux用户映射。"
-#: ../lib/base/error.cpp:98
+#: ../lib/base/error.cpp:100
msgid "Can't update the subordinate uid file."
msgstr "无法更新下级uid文件。"
-#: ../lib/base/error.cpp:101
+#: ../lib/base/error.cpp:103
msgid "Can't update the subordinate gid file."
msgstr "无法更新下级gid文件。"
-#: ../lib/base/error.cpp:104
+#: ../lib/base/error.cpp:106
msgid "Refuse to delete root user."
msgstr "禁止删除root用户。"
-#: ../lib/base/error.cpp:107
+#: ../lib/base/error.cpp:109
msgid "Refuse to delete three authority user."
msgstr "禁止删除三权用户。"
-#: ../lib/base/error.cpp:113
+#: ../lib/base/error.cpp:115
msgid "The authentication mode isn't supported."
msgstr "认证模式不支持。"
-#: ../lib/base/error.cpp:116
+#: ../lib/base/error.cpp:118
msgid "User is locked."
msgstr "用户被锁定。"
-#: ../lib/base/error.cpp:119
+#: ../lib/base/error.cpp:121
msgid "The name already exists."
msgstr "名字已存在"
-#: ../lib/base/error.cpp:123
+#: ../lib/base/error.cpp:125
msgid "The range of volume is between 0 and 1.0."
msgstr "音量范围必须在[0, 1.0]之间"
-#: ../lib/base/error.cpp:127
+#: ../lib/base/error.cpp:129
msgid "The range of balance is between -1 and 1."
msgstr "平衡范围必须在[-1, 1]之间"
-#: ../lib/base/error.cpp:131
+#: ../lib/base/error.cpp:133
msgid "The sink device isn't found."
msgstr "未找到输出设备。"
-#: ../lib/base/error.cpp:135
+#: ../lib/base/error.cpp:137
msgid "The source device isn't found."
msgstr "未找到输入设备。"
-#: ../lib/base/error.cpp:139
+#: ../lib/base/error.cpp:141
msgid "The sink stream isn't found."
msgstr "未找到输出流。"
-#: ../lib/base/error.cpp:142
+#: ../lib/base/error.cpp:144
msgid "NTP unit is active."
msgstr "NTP服务已开启。"
-#: ../lib/base/error.cpp:145
+#: ../lib/base/error.cpp:147
msgid "Invalid timezone."
msgstr "不合法的时区。"
-#: ../lib/base/error.cpp:148
+#: ../lib/base/error.cpp:150
msgid "No NTP unit available."
msgstr "没有NTP服务可用。"
-#: ../lib/base/error.cpp:152
+#: ../lib/base/error.cpp:154
msgid "Unknown date format type."
msgstr "未知的日期格式化类型。"
-#: ../lib/base/error.cpp:155
+#: ../lib/base/error.cpp:157
msgid "Failed to set date format."
msgstr "设置日期显示格式失败。"
-#: ../lib/base/error.cpp:158
+#: ../lib/base/error.cpp:160
msgid "Failed to set hour format."
msgstr "设置时间显示格式失败。"
-#: ../lib/base/error.cpp:161
+#: ../lib/base/error.cpp:163
msgid "Failed to set seconds showing."
msgstr "设置秒数是否显示失败。"
-#: ../lib/base/error.cpp:164
+#: ../lib/base/error.cpp:166
msgid "Failed to start NTP unit."
msgstr "开启NTP服务失败。"
-#: ../lib/base/error.cpp:167
+#: ../lib/base/error.cpp:169
msgid "Failed to stop NTP unit."
msgstr "停止NTP服务失败。"
-#: ../lib/base/error.cpp:171
+#: ../lib/base/error.cpp:173
msgid "Unknown display style."
msgstr "未知的显示类型。"
-#: ../lib/base/error.cpp:174
+#: ../lib/base/error.cpp:176
msgid ""
"The mode of monitors which contain resolution and refresh rate is no "
"intersection."
msgstr "所有显示器没有相同的分辨率和刷新率。"
-#: ../lib/base/error.cpp:177
+#: ../lib/base/error.cpp:179
msgid "Auto mode is set failed."
msgstr "自动模式设置失败。"
-#: ../lib/base/error.cpp:181
+#: ../lib/base/error.cpp:183
msgid "Failed to set the window scaling factor."
msgstr "设置窗口缩放因子失败。"
-#: ../lib/base/error.cpp:184
+#: ../lib/base/error.cpp:186
msgid "The custom configuration file isn't found."
msgstr "未找到自定义配置文件。"
-#: ../lib/base/error.cpp:187
+#: ../lib/base/error.cpp:189
msgid "Not found matched item in custom configuration file."
msgstr "不能找到匹配的配置项。"
-#: ../lib/base/error.cpp:190
+#: ../lib/base/error.cpp:192
msgid "The primary monitor must not be empty."
msgstr "主显示器不能为空。"
-#: ../lib/base/error.cpp:193
+#: ../lib/base/error.cpp:195
msgid "Not found the primary monitor."
msgstr "未找到主显示器。"
-#: ../lib/base/error.cpp:196
+#: ../lib/base/error.cpp:198
msgid ""
"Cannot disable the monitor, because the number of the enabled monitor is "
"less than 1."
msgstr "不能禁用显示器因为启用的显示器数量已经少于2个。"
-#: ../lib/base/error.cpp:199
+#: ../lib/base/error.cpp:201
msgid "Exist null mode in mode list."
msgstr "模式列表中存在空的模式。"
-#: ../lib/base/error.cpp:202
+#: ../lib/base/error.cpp:204
msgid "Exist null mode in preferred mode list."
msgstr "在推荐模式中存在空的模式。"
-#: ../lib/base/error.cpp:205
+#: ../lib/base/error.cpp:207
msgid "The current mode is not exist."
msgstr "当前模式不存在。"
-#: ../lib/base/error.cpp:209
+#: ../lib/base/error.cpp:211
msgid "Not found match mode."
msgstr "未发现匹配的模式。"
-#: ../lib/base/error.cpp:212
+#: ../lib/base/error.cpp:214
msgid "The mode is not exist."
msgstr "当前模式不存在。"
-#: ../lib/base/error.cpp:215
+#: ../lib/base/error.cpp:217
msgid "Unknown rotation type."
msgstr "未知的旋转类型。"
-#: ../lib/base/error.cpp:218
+#: ../lib/base/error.cpp:220
msgid "Unknown reflect type."
msgstr "未知的映射类型。"
-#: ../lib/base/error.cpp:221
+#: ../lib/base/error.cpp:223
+msgid "The current settings cannot be applied."
+msgstr "无法应用当前设置。"
+
+#: ../lib/base/error.cpp:226
msgid "Theme not exist."
msgstr "主题不存在。"
-#: ../lib/base/error.cpp:224
+#: ../lib/base/error.cpp:229
msgid "Unsupported theme type."
msgstr "主题类型不支持。"
-#: ../lib/base/error.cpp:227
+#: ../lib/base/error.cpp:232
msgid "Invalid theme type."
msgstr "主题类型不合法。"
-#: ../lib/base/error.cpp:231
+#: ../lib/base/error.cpp:236
msgid "Invalid font type."
msgstr "字体类型不合法。"
-#: ../lib/base/error.cpp:234
+#: ../lib/base/error.cpp:239
msgid "Unsupported font type."
msgstr "字体类型不支持。"
-#: ../lib/base/error.cpp:237
+#: ../lib/base/error.cpp:242
msgid "An incomplete request already exists."
msgstr "存在未完成的请求。"
-#: ../lib/base/error.cpp:240
+#: ../lib/base/error.cpp:245
msgid "The request is canceled."
msgstr "请求被取消。"
-#: ../lib/base/error.cpp:246
+#: ../lib/base/error.cpp:251
msgid "The request is rejected."
msgstr "请求被拒绝。"
-#: ../lib/base/error.cpp:249
+#: ../lib/base/error.cpp:254
msgid "Not found adapter."
msgstr "未发现适配器。"
-#: ../lib/base/error.cpp:257
+#: ../lib/base/error.cpp:262
msgid "Sync to file failed."
msgstr "同步到文件失败。"
-#: ../lib/base/error.cpp:263
+#: ../lib/base/error.cpp:268
msgid "Invalid scale mode."
msgstr "缩放模式不合法。"
-#: ../lib/base/error.cpp:266
+#: ../lib/base/error.cpp:271
msgid "The number of the layout can't exceeds {0}."
msgstr "布局数量不能超过{0}个。"
-#: ../lib/base/error.cpp:269
+#: ../lib/base/error.cpp:274
msgid "The layout is invalid."
msgstr "该布局不合法。"
-#: ../lib/base/error.cpp:272
+#: ../lib/base/error.cpp:277
msgid "The layout already exist."
msgstr "该布局已存在。"
-#: ../lib/base/error.cpp:275
+#: ../lib/base/error.cpp:280
msgid "Failed to set the layout."
msgstr "设置布局失败。"
-#: ../lib/base/error.cpp:278
+#: ../lib/base/error.cpp:283
msgid "The layout is no exist."
msgstr "该布局不存在。"
-#: ../lib/base/error.cpp:281
+#: ../lib/base/error.cpp:286
msgid "Failed to update the layout."
msgstr "更新布局失败。"
-#: ../lib/base/error.cpp:284
+#: ../lib/base/error.cpp:289
msgid "The layout option already exist."
msgstr "布局选项已存在。"
-#: ../lib/base/error.cpp:287
+#: ../lib/base/error.cpp:292
msgid "Failed to set the layout option."
msgstr "设置布局选项失败。"
-#: ../lib/base/error.cpp:290
+#: ../lib/base/error.cpp:295
msgid "The layout option is no exist."
msgstr "布局选项不存在。"
-#: ../lib/base/error.cpp:293
+#: ../lib/base/error.cpp:298
msgid "Failed to update the layout option."
msgstr "更新布局选项失败。"
-#: ../lib/base/error.cpp:296
+#: ../lib/base/error.cpp:301
msgid "Failed to clear the layout option."
msgstr "清理布局选项失败。"
-#: ../lib/base/error.cpp:299
+#: ../lib/base/error.cpp:304
msgid "The custom shortcut isn't exist."
msgstr "自定义快捷键不存在。"
-#: ../lib/base/error.cpp:303
+#: ../lib/base/error.cpp:308
msgid "The key combination already exist."
msgstr "按键组合已经存在。"
-#: ../lib/base/error.cpp:307
+#: ../lib/base/error.cpp:312
msgid "The key combination is invalid."
msgstr "按键组合不合法。"
-#: ../lib/base/error.cpp:310
+#: ../lib/base/error.cpp:315
msgid "The system shortcut isn't exist."
msgstr "该系统快捷键不存在。"
-#: ../lib/base/error.cpp:316
+#: ../lib/base/error.cpp:321
msgid "Unsupported power supply mode."
msgstr "不支持该供电模式。"
-#: ../lib/base/error.cpp:322
+#: ../lib/base/error.cpp:327
msgid "Unsupported power device."
msgstr "不支持该设备。"
-#: ../lib/base/error.cpp:325
+#: ../lib/base/error.cpp:330
msgid "The value must be between 0 and 100."
msgstr "值必须在0到100之间"
-#: ../lib/base/error.cpp:329
+#: ../lib/base/error.cpp:334
msgid "Unknown power action."
msgstr "未知电源动作。"
-#: ../lib/base/error.cpp:333
+#: ../lib/base/error.cpp:338
msgid "Unsupported power event."
msgstr "事件不支持。"
-#: ../lib/base/error.cpp:336
+#: ../lib/base/error.cpp:341
msgid "Failed to set the action."
msgstr "设置触发行为失败。"
-#: ../lib/base/error.cpp:339
+#: ../lib/base/error.cpp:344
msgid "Failed to set brightness."
msgstr "设置亮度失败。"
-#: ../lib/base/error.cpp:342
+#: ../lib/base/error.cpp:347
msgid "The systeminfo type is invalid."
msgstr "系统信息类型不合法。"
-#: ../lib/base/error.cpp:345
+#: ../lib/base/error.cpp:350
msgid "Failed to set host name."
msgstr "设置主机名失败。"
-#: ../lib/base/error.cpp:348
+#: ../lib/base/error.cpp:353
msgid "Not found the property."
msgstr "未找到该属性。"
-#: ../lib/base/error.cpp:351
+#: ../lib/base/error.cpp:356
msgid "The type is mismatch."
msgstr "类型不匹配。"
-#: ../lib/base/error.cpp:354
+#: ../lib/base/error.cpp:359
msgid "The property is invalid."
msgstr "属性不合法"
-#: ../lib/base/error.cpp:357
+#: ../lib/base/error.cpp:362
msgid "The property must not be modified manually."
msgstr "属性不能手动修改。"
-#: ../lib/base/error.cpp:360
+#: ../lib/base/error.cpp:365
msgid "The property is unsupported."
msgstr "属性不支持。"
-#: ../lib/base/error.cpp:364
+#: ../lib/base/error.cpp:369
msgid "Arguments invalid."
msgstr "参数不合法"
-#: ../lib/base/error.cpp:367
+#: ../lib/base/error.cpp:372
msgid "The network proxy mode is invalid."
msgstr "代理模式不合法"
-#: ../lib/base/error.cpp:370
+#: ../lib/base/error.cpp:375
msgid "The current network proxy mode is not manual."
msgstr "当前代理模式不是手动模式。"
-#: ../lib/base/error.cpp:373
+#: ../lib/base/error.cpp:378
msgid "The current network proxy mode is not auto."
msgstr "当前代理模式不是自动模式。"
-#: ../lib/base/error.cpp:414
+#: ../lib/base/error.cpp:418
msgid "Internel error."
msgstr "内部错误。"
-#: ../lib/base/error.cpp:417 ../lib/base/error.cpp:420
+#: ../lib/base/error.cpp:421 ../lib/base/error.cpp:424
msgid "Unknown error."
msgstr "未知错误。"
-#: ../lib/base/error.cpp:426 ../plugins/accounts/accounts-util.cpp:209
+#: ../lib/base/error.cpp:430 ../plugins/accounts/accounts-util.cpp:209
msgid " (error code: 0x{:x})"
msgstr "(错误码0x{:x})"
@@ -1194,6 +1198,9 @@ msgstr "电源管理"
msgid "Power management daemon"
msgstr "电源管理后端"
+#~ msgid "Display setting failed."
+#~ msgstr "显示设置失败。"
+
#~ msgid "The custom shortcut is invalid."
#~ msgstr "自定义快捷键不合法。"
--
2.33.0