* BUG:#I7U9XD在设置时间同步模式调用dbus失败时会反选
* BUG:#I7POYD标签显示null或者为空时隐藏标签
This commit is contained in:
parent
75ac47c5b1
commit
ff585257c7
|
@ -19,6 +19,8 @@ CONFIG += link_pkgconfig \
|
|||
PKGCONFIG += gio-2.0 \
|
||||
gio-unix-2.0 \
|
||||
|
||||
LIBS += -lpam
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
|
|
|
@ -1,3 +1,148 @@
|
|||
/*change otheruser password on pam*/
|
||||
#include <stdio.h>
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *new_password = "";
|
||||
static char *error = "";
|
||||
|
||||
static int ni_conv (int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
|
||||
{
|
||||
struct pam_response *responses;
|
||||
int count;
|
||||
|
||||
// assert (NULL != non_interactive_password);
|
||||
|
||||
if (num_msg <= 0 || num_msg >= PAM_MAX_NUM_MSG) {
|
||||
printf("bad number of messages %d <= 0 || >= %d\n", num_msg, PAM_MAX_NUM_MSG);
|
||||
*resp = NULL;
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
|
||||
responses = (struct pam_response *) calloc ((size_t) num_msg, sizeof (*responses));
|
||||
if (NULL == responses) {
|
||||
return PAM_BUF_ERR;
|
||||
}
|
||||
|
||||
//循环每个消息
|
||||
for (count=0; count < num_msg; count++) {
|
||||
//初始化响应变量
|
||||
responses[count].resp_retcode = 0;
|
||||
|
||||
// printf("message[%d]: %d %s\n", count, msg[count]->msg_style, msg[count]->msg);
|
||||
|
||||
//根据消息类型处理消息
|
||||
switch (msg[count]->msg_style) {
|
||||
|
||||
//回显消息,从标准输入获取数据并显示在屏幕上,一般是交互的名称信息,如用户名等
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
fprintf (stderr, "PAM modules requesting echoing are not supported.\n");
|
||||
goto failed_conversation;
|
||||
|
||||
//从标准输入获取不回显数据,一般是输入密码
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
responses[count].resp = strdup (new_password);
|
||||
|
||||
if (NULL == responses[count].resp) {
|
||||
goto failed_conversation;
|
||||
}
|
||||
break;
|
||||
|
||||
//回显PAM模块传递的错误消息
|
||||
case PAM_ERROR_MSG:
|
||||
if ((NULL == msg[count]->msg)) {
|
||||
goto failed_conversation;
|
||||
} else {
|
||||
error = strdup(msg[count]->msg);
|
||||
}
|
||||
responses[count].resp = NULL;
|
||||
break;
|
||||
|
||||
//回显PAM模块传递的文本消息
|
||||
case PAM_TEXT_INFO:
|
||||
if ((NULL == msg[count]->msg)) {
|
||||
goto failed_conversation;
|
||||
} else {
|
||||
error = strdup(msg[count]->msg);
|
||||
}
|
||||
responses[count].resp = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf (stderr, ("conversation type %d not supported.\n"), msg[count]->msg_style);
|
||||
goto failed_conversation;
|
||||
}
|
||||
}
|
||||
|
||||
*resp = responses;
|
||||
|
||||
return PAM_SUCCESS;
|
||||
|
||||
failed_conversation:
|
||||
for (count=0; count < num_msg; count++) {
|
||||
if (NULL != responses[count].resp) {
|
||||
memset (responses[count].resp, 0, strlen (responses[count].resp));
|
||||
free (responses[count].resp);
|
||||
responses[count].resp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free (responses);
|
||||
*resp = NULL;
|
||||
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
|
||||
struct pam_conv conv;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
pam_handle_t * pamh = NULL;
|
||||
char * username;
|
||||
if (argc == 3) {
|
||||
username = argv[1];
|
||||
new_password = argv[2];
|
||||
} else {
|
||||
printf("missing parameter!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//会话函数传递到PAM模块中,在模块中通过pam_get_item获取并调用
|
||||
conv.conv = ni_conv;
|
||||
conv.appdata_ptr = NULL;
|
||||
|
||||
//
|
||||
if ((pam_start("passwd", username, &conv, &pamh)) != PAM_SUCCESS){
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
ret = pam_chauthtok(pamh, 0);
|
||||
if (ret == PAM_SUCCESS){
|
||||
if (error != "") {
|
||||
printf("%s\n", error);
|
||||
free(error);
|
||||
}
|
||||
} else {
|
||||
if (error == "") {
|
||||
printf("Unable to modify password!\n");
|
||||
} else {
|
||||
printf("%s\n", error);
|
||||
free(error);
|
||||
}
|
||||
}
|
||||
|
||||
//结束PAM
|
||||
ret = pam_end(pamh, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*end pam*/
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -8,22 +153,22 @@ PasswdHandler *passwd_handler = NULL;
|
|||
static void auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data);
|
||||
static void chpasswd_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//int main(int argc, char *argv[])
|
||||
//{
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
// if (argc != 3)
|
||||
// {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
QCoreApplication a(argc, argv);
|
||||
// QCoreApplication a(argc, argv);
|
||||
|
||||
passwd_handler = passwd_init();
|
||||
// passwd_handler = passwd_init();
|
||||
|
||||
passwd_change_password(passwd_handler, argv[1], argv[2], chpasswd_cb, NULL);
|
||||
// passwd_change_password(passwd_handler, argv[1], argv[2], chpasswd_cb, NULL);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
// return a.exec();
|
||||
//}
|
||||
|
||||
static void
|
||||
auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data)
|
||||
|
|
|
@ -19,6 +19,8 @@ CONFIG += link_pkgconfig \
|
|||
PKGCONFIG += gio-2.0 \
|
||||
gio-unix-2.0 \
|
||||
|
||||
LIBS += -lpam
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
|
|
|
@ -3,27 +3,178 @@
|
|||
#include <glib.h>
|
||||
#include "run-passwd.h"
|
||||
|
||||
/*using pam change password*/
|
||||
#include <stdio.h>
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *non_interactive_password = "";
|
||||
static const char *new_password = "";
|
||||
static int isCurrentPwd = 0;
|
||||
static char *error = "";
|
||||
|
||||
static int changeCurrent_conv (int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
|
||||
{
|
||||
struct pam_response *responses;
|
||||
int count;
|
||||
|
||||
// assert (NULL != non_interactive_password);
|
||||
|
||||
if (num_msg <= 0 || num_msg >= PAM_MAX_NUM_MSG) {
|
||||
printf("bad number of messages %d <= 0 || >= %d\n", num_msg, PAM_MAX_NUM_MSG);
|
||||
*resp = NULL;
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
|
||||
responses = (struct pam_response *) calloc ((size_t) num_msg, sizeof (*responses));
|
||||
if (NULL == responses) {
|
||||
return PAM_BUF_ERR;
|
||||
}
|
||||
|
||||
//循环每个消息
|
||||
for (count=0; count < num_msg; count++) {
|
||||
//初始化响应变量
|
||||
responses[count].resp_retcode = 0;
|
||||
|
||||
// printf("message[%d]: %d %s\n", count, msg[count]->msg_style, msg[count]->msg);
|
||||
|
||||
//根据消息类型处理消息
|
||||
switch (msg[count]->msg_style) {
|
||||
|
||||
//回显消息,从标准输入获取数据并显示在屏幕上,一般是交互的名称信息,如用户名等
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
fprintf (stderr, "PAM modules requesting echoing are not supported.\n");
|
||||
goto failed_conversation;
|
||||
|
||||
//从标准输入获取不回显数据,一般是输入密码
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
if (isCurrentPwd == 0){
|
||||
isCurrentPwd = 1;
|
||||
responses[count].resp = strdup (non_interactive_password);
|
||||
} else {
|
||||
responses[count].resp = strdup (new_password);
|
||||
}
|
||||
|
||||
if (NULL == responses[count].resp) {
|
||||
goto failed_conversation;
|
||||
}
|
||||
break;
|
||||
|
||||
//回显PAM模块传递的错误消息
|
||||
case PAM_ERROR_MSG:
|
||||
if ((NULL == msg[count]->msg)) {
|
||||
goto failed_conversation;
|
||||
} else {
|
||||
error = strdup(msg[count]->msg);
|
||||
}
|
||||
responses[count].resp = NULL;
|
||||
break;
|
||||
|
||||
//回显PAM模块传递的文本消息
|
||||
case PAM_TEXT_INFO:
|
||||
if ((NULL == msg[count]->msg)) {
|
||||
goto failed_conversation;
|
||||
} else {
|
||||
error = strdup(msg[count]->msg);
|
||||
}
|
||||
responses[count].resp = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf (stderr, ("conversation type %d not supported.\n"), msg[count]->msg_style);
|
||||
goto failed_conversation;
|
||||
}
|
||||
}
|
||||
|
||||
*resp = responses;
|
||||
|
||||
return PAM_SUCCESS;
|
||||
|
||||
failed_conversation:
|
||||
for (count=0; count < num_msg; count++) {
|
||||
if (NULL != responses[count].resp) {
|
||||
memset (responses[count].resp, 0, strlen (responses[count].resp));
|
||||
free (responses[count].resp);
|
||||
responses[count].resp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free (responses);
|
||||
*resp = NULL;
|
||||
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct pam_conv conv;
|
||||
int ret = 0;
|
||||
pam_handle_t * pamh = NULL;
|
||||
const char *username = g_get_user_name();
|
||||
if (argc == 3) {
|
||||
non_interactive_password = argv[1];
|
||||
new_password = argv[2];
|
||||
} else {
|
||||
printf("missing parameter!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//会话函数传递到PAM模块中,在模块中通过pam_get_item获取并调用
|
||||
conv.conv = changeCurrent_conv;
|
||||
conv.appdata_ptr = NULL;
|
||||
|
||||
//
|
||||
if ((pam_start("passwd", username, &conv, &pamh)) != PAM_SUCCESS){
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
ret = pam_chauthtok(pamh, 0);
|
||||
if (ret == PAM_SUCCESS){
|
||||
if (error != "") {
|
||||
printf("%s\n", error);
|
||||
free(error);
|
||||
}
|
||||
} else {
|
||||
if (error == "") {
|
||||
printf("Unable to modify password!\n");
|
||||
} else {
|
||||
printf("%s\n", error);
|
||||
free(error);
|
||||
}
|
||||
}
|
||||
|
||||
//结束PAM
|
||||
ret = pam_end(pamh, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*end pam*/
|
||||
|
||||
|
||||
PasswdHandler *passwd_handler = NULL;
|
||||
|
||||
static void auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data);
|
||||
static void chpasswd_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//int main(int argc, char *argv[])
|
||||
//{
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
// if (argc != 3)
|
||||
// {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
QCoreApplication a(argc, argv);
|
||||
// QCoreApplication a(argc, argv);
|
||||
|
||||
passwd_handler = passwd_init ();
|
||||
// passwd_handler = passwd_init ();
|
||||
|
||||
passwd_authenticate (passwd_handler, argv[1], auth_cb, argv[2]);
|
||||
// passwd_authenticate (passwd_handler, argv[1], auth_cb, argv[2]);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
// return a.exec();
|
||||
//}
|
||||
|
||||
static void
|
||||
auth_cb (PasswdHandler *passwd_handler,
|
||||
|
|
|
@ -194,10 +194,10 @@ void AuthPAM::onSockRead()
|
|||
Q_EMIT showPrompt(message.msg, Auth::PromptTypeQuestion);
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
Q_EMIT showMessage(message.msg, Auth::MessageTypeInfo);
|
||||
Q_EMIT showMessage(message.msg, Auth::MessageTypeError);
|
||||
break;
|
||||
case PAM_TEXT_INFO:
|
||||
Q_EMIT showMessage(message.msg, Auth::MessageTypeError);
|
||||
Q_EMIT showMessage(message.msg, Auth::MessageTypeInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ void Widget::onShowMessage(const QString &message, Auth::MessageType type)
|
|||
{
|
||||
// qDebug() << "showMessage" << message;
|
||||
accountlock = true;
|
||||
printf("%s\n", message.toUtf8().data());
|
||||
showMsg = message;
|
||||
// printf("%s\n", message.toUtf8().data());
|
||||
}
|
||||
|
||||
void Widget::onShowPrompt(const QString &prompt, Auth::PromptType type)
|
||||
|
@ -44,14 +45,11 @@ void Widget::onShowPrompt(const QString &prompt, Auth::PromptType type)
|
|||
|
||||
void Widget::onAuthComplete()
|
||||
{
|
||||
|
||||
if (!accountlock){
|
||||
if(auth->isAuthenticated()){
|
||||
// qDebug() << "Succes!\n";
|
||||
// printf("Succes!\n");
|
||||
} else {
|
||||
if(!auth->isAuthenticated()) {
|
||||
if (showMsg == "") {
|
||||
printf("Failed!\n");
|
||||
// qDebug() << "Failed!";
|
||||
} else {
|
||||
printf("%s\n", showMsg.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ private:
|
|||
|
||||
bool accountlock;
|
||||
|
||||
QString showMsg = "";
|
||||
|
||||
private Q_SLOTS:
|
||||
void onShowMessage(const QString &message, Auth::MessageType type);
|
||||
void onShowPrompt(const QString &prompt, Auth::PromptType type);
|
||||
|
|
|
@ -0,0 +1,291 @@
|
|||
{
|
||||
"Name": "org.ukui.ukcc.session",
|
||||
"Path": "/",
|
||||
"Interfaces": "org.ukui.ukcc.session.interface",
|
||||
"ukcc": [
|
||||
{
|
||||
"name": "account",
|
||||
"visible": true,
|
||||
"module_type": 0,
|
||||
"theme_icon_name": "kylin-settings-account",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-account.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "账户",
|
||||
"en_US" : "Account",
|
||||
"bo_CN" : "རྩིས་ཐོ།",
|
||||
"mn_MN" : "ᠳᠠᠩᠰᠠ",
|
||||
"zh_HK" : "賬戶"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "userinfo",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"name": "biometric"
|
||||
},
|
||||
{
|
||||
"name": "networkaccount"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "system",
|
||||
"module_type": 1,
|
||||
"theme_icon_name": "kylin-settings-system",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-system.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "系统",
|
||||
"en_US" : "System",
|
||||
"bo_CN" : "ལམ་ལུགས།",
|
||||
"mn_MN" : "ᠰᠢᠰᠲ᠋ᠧᠮ",
|
||||
"zh_HK" : "系統"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "display"
|
||||
},
|
||||
{
|
||||
"name": "audio"
|
||||
},
|
||||
{
|
||||
"name": "power"
|
||||
},
|
||||
{
|
||||
"name": "notice"
|
||||
},
|
||||
{
|
||||
"name": "vino"
|
||||
},
|
||||
{
|
||||
"name": "about"
|
||||
},
|
||||
{
|
||||
"name": "touchCalibrate"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "devices",
|
||||
"module_type": 2,
|
||||
"theme_icon_name": "kylin-settings-devices",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-devices.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "设备",
|
||||
"en_US" : "Devices",
|
||||
"bo_CN" : "སྒྲིག་ཆས།",
|
||||
"mn_MN" : "ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ",
|
||||
"zh_HK" : "設備"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "blueTooth"
|
||||
},
|
||||
{
|
||||
"name": "printer"
|
||||
},
|
||||
{
|
||||
"name": "mouse"
|
||||
},
|
||||
{
|
||||
"name": "touchpad"
|
||||
},
|
||||
{
|
||||
"name": "touchScreen"
|
||||
},
|
||||
{
|
||||
"name": "keyboard"
|
||||
},
|
||||
{
|
||||
"name": "shortcut"
|
||||
},
|
||||
{
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"name": "projection"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"module_type": 3,
|
||||
"theme_icon_name": "kylin-settings-network",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-network.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "网络",
|
||||
"en_US" : "Network",
|
||||
"bo_CN" : "དྲ་རྒྱ།",
|
||||
"mn_MN" : "ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠪᠠᠢᠳᠠᠯ",
|
||||
"zh_HK" : "網絡"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "netconnect"
|
||||
},
|
||||
{
|
||||
"name": "wlanconnect"
|
||||
},
|
||||
{
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"name": "proxy"
|
||||
},
|
||||
{
|
||||
"name": "vpn"
|
||||
},
|
||||
{
|
||||
"name": "mobilehotspot"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "personalized",
|
||||
"module_type": 4,
|
||||
"theme_icon_name": "kylin-settings-personalized",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-personalized.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "个性化",
|
||||
"en_US" : "Personalized",
|
||||
"bo_CN" : "རང་གཤིས་ཅན་",
|
||||
"mn_MN" : "ᠦᠪᠡᠷᠮᠢᠴᠡᠬᠦᠯᠬᠦ",
|
||||
"zh_HK" : "個性化"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "wallpaper"
|
||||
},
|
||||
{
|
||||
"name": "theme"
|
||||
},
|
||||
{
|
||||
"name": "screenlock"
|
||||
},
|
||||
{
|
||||
"name": "screensaver"
|
||||
},
|
||||
{
|
||||
"name": "fonts"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datetime",
|
||||
"module_type": 5,
|
||||
"theme_icon_name": "kylin-settings-datetime",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-datetime.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "时间语言",
|
||||
"en_US" : "Datetime",
|
||||
"bo_CN" : "དུས་ཚོད་ཀྱི་དུས་ཚོད།",
|
||||
"mn_MN" : "ᠴᠠᠭ ᠬᠤᠭᠤᠴᠠᠭᠠᠨ ᠤ᠋ ᠦᠭᠡ ᠬᠡᠯᠡ",
|
||||
"zh_HK" : "時間語言"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "date"
|
||||
},
|
||||
{
|
||||
"name": "area"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"module_type": 6,
|
||||
"theme_icon_name": "kylin-settings-update",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-update.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "更新",
|
||||
"en_US" : "Update",
|
||||
"bo_CN" : "གསར་སྒྱུར།",
|
||||
"mn_MN" : "ᠰᠢᠨᠡᠳᠬᠡᠬᠦ",
|
||||
"zh_HK" : "更新"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "upgrade"
|
||||
},
|
||||
{
|
||||
"name": "backup"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "security",
|
||||
"module_type": 7,
|
||||
"theme_icon_name": "kylin-settings-security",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-security.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "安全",
|
||||
"en_US" : "Security",
|
||||
"bo_CN" : "བདེ་འཇགས།",
|
||||
"mn_MN" : "ᠠᠮᠤᠷ ᠳᠦᠪᠰᠢᠨ ᠰᠢᠨᠵᠢ",
|
||||
"zh_HK" : "安全"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "securitycenter"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "application",
|
||||
"module_type": 8,
|
||||
"theme_icon_name": "kylin-settings-application",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-application.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "应用",
|
||||
"en_US" : "Application",
|
||||
"bo_CN" : "རེ་འདུན་ཞུ་ཡིག",
|
||||
"mn_MN" : "ᠬᠡᠷᠡᠭᠯᠡᠬᠡᠨ ᠤ᠋ ᠰᠣᠹᠲ",
|
||||
"zh_HK" : "應用"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "autoboot"
|
||||
},
|
||||
{
|
||||
"name": "defaultapp"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "search_f",
|
||||
"module_type": 9,
|
||||
"theme_icon_name": "kylin-settings-search",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-search.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "搜索",
|
||||
"en_US" : "Investigation",
|
||||
"bo_CN" : "བརྟག་དཔྱད།",
|
||||
"mn_MN" : "ᠬᠠᠢᠬᠤ",
|
||||
"zh_HK" : "搜索"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "search"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "commoninfo",
|
||||
"module_type": 10,
|
||||
"theme_icon_name": "kylin-settings-commoninfo",
|
||||
"local_icon_name": ":/img/homepage/kylin-settings-commoninfo.png",
|
||||
"name_locale": {
|
||||
"zh_CN" : "通用",
|
||||
"en_US" : "Commoninfo",
|
||||
"bo_CN" : "ཀུན་སྤྱོད་",
|
||||
"mn_MN" : "ᠨᠡᠢᠳᠡᠮ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ",
|
||||
"zh_HK" : "通用"
|
||||
},
|
||||
"childnode": [
|
||||
{
|
||||
"name": "boot"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,3 +1,13 @@
|
|||
ukui-control-center (3.22.1.25-ok44) yangtze; urgency=medium
|
||||
|
||||
* BUG:#I7U9XD在设置时间同步模式调用dbus失败时会反选
|
||||
* BUG:#I7POYD标签显示null或者为空时隐藏标签
|
||||
* 需求号: 无
|
||||
* 其他改动说明:
|
||||
* 其他改动影响域:无,重新编译
|
||||
|
||||
-- zhoubin <zhoubin@kylinos.cn> Thu, 16 Nov 2023 19:52:39 +0800
|
||||
|
||||
ukui-control-center (3.22.1.25-ok43) yangtze; urgency=medium
|
||||
|
||||
* BUG:#无
|
||||
|
|
|
@ -7,7 +7,6 @@ Build-Depends: debhelper-compat (= 12),
|
|||
libqt5svg5-dev,
|
||||
libgsettings-qt-dev,
|
||||
libglib2.0-dev,
|
||||
libmatekbd-dev,
|
||||
libqt5x11extras5-dev,
|
||||
libxklavier-dev,
|
||||
libkf5screen-dev,
|
||||
|
@ -18,10 +17,10 @@ Build-Depends: debhelper-compat (= 12),
|
|||
libkf5globalaccel-dev,
|
||||
qtdeclarative5-dev,
|
||||
libdconf-dev,
|
||||
libmatemixer-dev,
|
||||
libxml2-dev,
|
||||
qtbase5-dev,
|
||||
libx11-dev,
|
||||
libxcursor-dev,
|
||||
libxkbfile-dev,
|
||||
libboost-dev,
|
||||
qttools5-dev-tools,
|
||||
|
@ -33,7 +32,6 @@ Build-Depends: debhelper-compat (= 12),
|
|||
libupower-glib-dev,
|
||||
libpam0g-dev,
|
||||
libukui-log4qt-dev[!sw64],
|
||||
libmate-desktop-dev,
|
||||
libddcutil-dev(>=0.9.9-5kylin1),
|
||||
libkylin-chkname-dev,
|
||||
libcups2-dev,
|
||||
|
@ -42,6 +40,7 @@ Build-Depends: debhelper-compat (= 12),
|
|||
libkysdk-waylandhelper-dev,
|
||||
libkysdk-diagnostics-dev,
|
||||
libkf5service-dev,
|
||||
libkysdk-systime-dev,
|
||||
Standards-Version: 4.5.0
|
||||
Rules-Requires-Root: no
|
||||
Homepage: https://github.com/ukui/ukui-control-center
|
||||
|
@ -63,7 +62,6 @@ Depends: ${shlibs:Depends},
|
|||
ukui-biometric-manager(>=1.0.1-1kylin1~46),
|
||||
openkylin-theme
|
||||
Suggests: gsettings-desktop-schemas,
|
||||
mate-desktop-common,
|
||||
ukui-power-manager(>=2.1.29~rc11),
|
||||
ukui-session-manager,
|
||||
ukui-screensaver,
|
||||
|
|
|
@ -17,3 +17,4 @@ usr/share/ukui/faces/*
|
|||
usr/share/ukui-control-center/shell/res/i18n/*
|
||||
usr/share/ukui-control-center/shell/res/*
|
||||
usr/lib/*/ukui-control-center/*.so
|
||||
usr/share/ukui-control-center/data/*
|
||||
|
|
|
@ -4,6 +4,8 @@ set -e
|
|||
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas/
|
||||
|
||||
chmod u+s /usr/bin/changeuserpwd
|
||||
|
||||
if [ -x /usr/share/kylin-system-updater/kylin-reboot-required ];then
|
||||
/usr/share/kylin-system-updater/kylin-reboot-required
|
||||
fi
|
||||
|
|
|
@ -4,12 +4,14 @@ SOURCES += \
|
|||
$$PWD/fixlabel.cpp \
|
||||
$$PWD/iconlabel.cpp \
|
||||
$$PWD/lightlabel.cpp \
|
||||
$$PWD/passwordlabel.cpp \
|
||||
$$PWD/titlelabel.cpp \
|
||||
$$PWD/tristatelabel.cpp
|
||||
HEADERS += \
|
||||
$$PWD/fixlabel.h \
|
||||
$$PWD/iconlabel.h \
|
||||
$$PWD/lightlabel.h \
|
||||
$$PWD/passwordlabel.h \
|
||||
$$PWD/titlelabel.h \
|
||||
$$PWD/tristatelabel.h \
|
||||
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
#include "passwordlabel.h"
|
||||
#include <QPainter>
|
||||
#include <QIcon>
|
||||
#include <QGSettings/QGSettings>
|
||||
#include <QDebug>
|
||||
#include <QRect>
|
||||
|
||||
#define THEME_QT_SCHEMA "org.ukui.style"
|
||||
#define MODE_QT_KEY "style-name"
|
||||
|
||||
EyeBtn::EyeBtn(QWidget *parent) :QLabel(parent)
|
||||
{
|
||||
this->setPixmap(QIcon::fromTheme("ukui-eye-hidden-symbolic").pixmap(24,24));
|
||||
this->setProperty("useIconHighlightEffect", 0x2);
|
||||
this->setFixedSize(36, 36);
|
||||
this->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
EyeBtn::~EyeBtn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EyeBtn::setIconStatus(bool isHidden)
|
||||
{
|
||||
if (isHidden) {
|
||||
this->setPixmap(QIcon::fromTheme("ukui-eye-hidden-symbolic").pixmap(24,24));
|
||||
} else {
|
||||
this->setPixmap(QIcon::fromTheme("ukui-eye-display-symbolic").pixmap(24,24));
|
||||
}
|
||||
mIsHidden = isHidden;
|
||||
}
|
||||
|
||||
void EyeBtn::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
}
|
||||
|
||||
void EyeBtn::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
setIconStatus(!mIsHidden);
|
||||
|
||||
Q_EMIT clicked(mIsHidden);
|
||||
}
|
||||
|
||||
PasswordLabel::PasswordLabel(QWidget *parent) :QWidget(parent)
|
||||
{
|
||||
mPassword = new QLineEdit(this);
|
||||
mPassword->setEnabled(false);
|
||||
mPassword->setEchoMode(QLineEdit::Password);
|
||||
mPassword->installEventFilter(this);
|
||||
QPalette palette = mPassword->palette();
|
||||
QColor color = palette.color(QPalette::Active, QPalette::Text);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Button, Qt::transparent);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Text, color);
|
||||
mPassword->setPalette(palette);
|
||||
|
||||
mPassword->setContentsMargins(0,0,0,0);
|
||||
mPassword->setMinimumWidth(0);
|
||||
mEyesBtn = new EyeBtn(this);
|
||||
QHBoxLayout *mainHLayout = new QHBoxLayout();
|
||||
mainHLayout->setContentsMargins(0,0,0,0);
|
||||
mainHLayout->setSpacing(0);
|
||||
mainHLayout->addWidget(mPassword);
|
||||
mainHLayout->addWidget(mEyesBtn);
|
||||
mainHLayout->addStretch();
|
||||
this->setLayout(mainHLayout);
|
||||
|
||||
const QByteArray idd(THEME_QT_SCHEMA);
|
||||
QGSettings *qtSettings = new QGSettings(idd, QByteArray(), this);
|
||||
connect(qtSettings, &QGSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "styleName") {
|
||||
QPalette textPal = mEyesBtn->palette();
|
||||
QColor color1 = textPal.color(QPalette::Active, QPalette::Text);
|
||||
textPal.setColor(QPalette::Disabled, QPalette::Button, Qt::transparent);
|
||||
textPal.setColor(QPalette::Disabled, QPalette::Text, color1);
|
||||
mPassword->setPalette(textPal);
|
||||
}
|
||||
});
|
||||
|
||||
connect(mEyesBtn, &EyeBtn::clicked, this, [=](bool isHidden){
|
||||
if (isHidden) {
|
||||
mPassword->setEchoMode(QLineEdit::Password);
|
||||
} else {
|
||||
mPassword->setEchoMode(QLineEdit::Normal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PasswordLabel::~PasswordLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PasswordLabel::setStatus(bool isPassword)
|
||||
{
|
||||
if (isPassword && mPassword->echoMode() == QLineEdit::Normal) {
|
||||
mPassword->setEchoMode(QLineEdit::Password);
|
||||
mEyesBtn->setIconStatus(isPassword);
|
||||
}
|
||||
}
|
||||
|
||||
void PasswordLabel::setText(const QString &str)
|
||||
{
|
||||
mPassword->setText(str);
|
||||
}
|
||||
|
||||
QString PasswordLabel::text() const
|
||||
{
|
||||
return mPassword->text();
|
||||
}
|
||||
|
||||
void PasswordLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
if (mPassword->echoMode() == QLineEdit::Password) {
|
||||
QFontInfo fInfo(this->font());
|
||||
int charWidth = fInfo.pixelSize();
|
||||
mPassword->setFixedWidth(charWidth*mPassword->text().size() + 16);
|
||||
} else {
|
||||
int fontSize = fontMetrics.width(mPassword->text());
|
||||
mPassword->setFixedWidth(fontSize+16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef PASSWORDLABEL_H
|
||||
#define PASSWORDLABEL_H
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPaintEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "libukcc_global.h"
|
||||
|
||||
class LIBUKCC_EXPORT EyeBtn: public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EyeBtn(QWidget *parent = nullptr);
|
||||
~EyeBtn();
|
||||
void setIconStatus(bool isHidden);
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
private:
|
||||
bool mIsHidden = true;
|
||||
|
||||
Q_SIGNALS:
|
||||
void clicked(bool isHidden);
|
||||
};
|
||||
|
||||
class LIBUKCC_EXPORT PasswordLabel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PasswordLabel(QWidget *parent = nullptr);
|
||||
~PasswordLabel();
|
||||
|
||||
void setStatus(bool isPassword);
|
||||
void setText(const QString &);
|
||||
QString text() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
QLineEdit *mPassword;
|
||||
EyeBtn *mEyesBtn;
|
||||
};
|
||||
|
||||
#endif // PASSWORDLABEL_H
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QProcess>
|
||||
|
||||
|
||||
#ifdef signals
|
||||
|
@ -379,7 +380,6 @@ void ChangeUserPwd::setupConnect(){
|
|||
isChecking = false;
|
||||
} else {
|
||||
//修改密码
|
||||
QString output;
|
||||
QString currentPwd = currentPwdLineEdit->text();
|
||||
int ci = 0;
|
||||
for (ci = 0; ci < currentPwd.count(); ci++){
|
||||
|
@ -405,25 +405,24 @@ void ChangeUserPwd::setupConnect(){
|
|||
|
||||
char * cmd = g_strdup_printf("/usr/bin/changeuserpwd %s %s", currentPwd.toLatin1().data(), newPwd.toLatin1().data());
|
||||
|
||||
FILE *stream = NULL;
|
||||
char buf[256] = {0};
|
||||
FILE * stream;
|
||||
QString result;
|
||||
char output[256];
|
||||
|
||||
if ((stream = popen(cmd, "r" )) == NULL){
|
||||
return;
|
||||
if ((stream = popen(cmd, "r")) != NULL){
|
||||
|
||||
while(fgets(output, 256, stream) != NULL){
|
||||
result = QString(output).simplified();
|
||||
}
|
||||
pclose(stream);
|
||||
}
|
||||
|
||||
while(fgets(buf, 256, stream) != NULL){
|
||||
output = QString(buf).simplified();
|
||||
}
|
||||
|
||||
pclose(stream);
|
||||
|
||||
this->accept();
|
||||
|
||||
if (isDomainUser(g_get_user_name())) {
|
||||
QString primaryText;
|
||||
primaryText = output.simplified().isEmpty() ? tr("Pwd Changed Succes") : output;
|
||||
qDebug() << "output of changeUserpwd = " << output;
|
||||
primaryText = result.simplified().isEmpty() ? tr("Pwd Changed Succes") : output;
|
||||
qDebug() << "output of changeUserpwd = " << result;
|
||||
QMessageBox::warning(NULL, "", primaryText, QMessageBox::Yes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,16 @@ void VinoUi::initUi()
|
|||
mSecurityWidget = new SwitchWidget(tr("You must confirm every visit for this machine"));
|
||||
//~ contents_path /Vino/Require user to enter this password:
|
||||
mSecurityPwdWidget = new SwitchWidget(tr("Require user to enter this password: "));
|
||||
#ifdef Nile
|
||||
mPwdinputLabel = new PasswordLabel(this);
|
||||
mSecurityPwdWidget->insertWidget(1, mPwdinputLabel);
|
||||
#else
|
||||
mPwdstrLabel = new QLabel(this);
|
||||
mPwdEditBtn = new QPushButton(tr("Edit"), this);
|
||||
mSecurityPwdWidget->insertWidget(1, mPwdstrLabel);
|
||||
#endif
|
||||
mPwdstrLabel->setObjectName("vnc-pwdsettings");
|
||||
mPwdEditBtn = new QPushButton(tr("Edit"), this);
|
||||
|
||||
mSecurityPwdWidget->insertWidget(3, mPwdEditBtn);
|
||||
|
||||
mVinoFrame->addWidget(mVinoEnableWidget);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "switchwidget.h"
|
||||
#include "settinggroup.h"
|
||||
#include "ukccframe.h"
|
||||
#include "passwordlabel.h"
|
||||
|
||||
const QByteArray kVinoSchemas = "org.gnome.Vino";
|
||||
const QString kEnableKey = "enabled";
|
||||
|
@ -47,7 +48,11 @@ public:
|
|||
SwitchWidget *getSecurityWidget() {return mSecurityWidget;}
|
||||
SwitchWidget *getSecurityPwdWidget() {return mSecurityPwdWidget;}
|
||||
|
||||
#ifdef Nile
|
||||
PasswordLabel *getPwdLabel() {return mPwdinputLabel;}
|
||||
#else
|
||||
QLabel *getPwdLabel() {return mPwdstrLabel;}
|
||||
#endif
|
||||
QPushButton *getPwdEditBtn() {return mPwdEditBtn;}
|
||||
|
||||
private:
|
||||
|
@ -62,6 +67,7 @@ private:
|
|||
TitleLabel *mVinoTitleLabel;
|
||||
|
||||
QLabel *mPwdstrLabel;
|
||||
PasswordLabel *mPwdinputLabel;
|
||||
QPushButton *mPwdEditBtn;
|
||||
};
|
||||
|
||||
|
|
|
@ -49,7 +49,11 @@ void Area::cloudChangedSlot(const QString &key)
|
|||
initCountry();
|
||||
initCalendar();
|
||||
initFirstDay();
|
||||
#ifdef Nile
|
||||
initDateComboBox();
|
||||
#else
|
||||
initDateFormat();
|
||||
#endif
|
||||
initTimeFormat();
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +114,9 @@ QWidget *Area::pluginUi()
|
|||
} else {
|
||||
// 有可能修改了日期,因此重新加载日期格式
|
||||
if (areaInterface->isValid()) {
|
||||
#ifndef Nile
|
||||
initDateFormat();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return areaWidget;
|
||||
|
@ -146,9 +152,13 @@ void Area::dataChanged(QString key)
|
|||
} else if (key == QString("firstDay")) {
|
||||
initFirstDay();
|
||||
} else if (key == QString("dateFormat")) {
|
||||
#ifndef Nile
|
||||
initDateFormat();
|
||||
#endif
|
||||
} else if (key == QString("timeFormat")) {
|
||||
#ifndef Nile
|
||||
initTimeFormat();
|
||||
#endif
|
||||
} else if (key == QString("showLanguageList") || key == QString("language")) {
|
||||
initLanguage();
|
||||
} else if (key == "iconThemeName") {
|
||||
|
@ -164,9 +174,12 @@ void Area::initContent()
|
|||
initCalendar();
|
||||
initFirstDay();
|
||||
initDateFormat();
|
||||
initTimeFormat();
|
||||
initTimeFormat(true);
|
||||
initLanguage();
|
||||
initAddLanguage();
|
||||
#ifdef Nile
|
||||
initDateComboBox();
|
||||
#endif
|
||||
initConnect();
|
||||
}
|
||||
|
||||
|
@ -265,12 +278,102 @@ void Area::initFirstDay()
|
|||
|
||||
void Area::initDateFormat()
|
||||
{
|
||||
#ifdef Nile
|
||||
qDebug() << "fjoiwiejofiwojefoiwajeoifjowaiejfoiawjeofiajwoeifjoiweofa";
|
||||
QString currentsecStr;
|
||||
QDateTime current = QDateTime::currentDateTime();
|
||||
|
||||
if (areaWidget->countryComboBox()->currentIndex() == 0) {
|
||||
currentsecStr = current.toString("M.d.yy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("M/d/yy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("M-d-yy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("MM.dd.yyyy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("MM/dd/yyyy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("MM-dd-yyyy");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
} else {
|
||||
currentsecStr = current.toString("yy.M.d");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("yy/M/d");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("yy-M-d");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("yyyy.MM.dd");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("yyyy/MM/dd");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = current.toString("yyyy-MM-dd");
|
||||
areaWidget->shortDateComboBox()->addItem(currentsecStr);
|
||||
}
|
||||
|
||||
QLocale locale = QLocale::system();
|
||||
if ("zh_CN" == locale.name()){
|
||||
locale = QLocale::Chinese;
|
||||
} else {
|
||||
locale = QLocale::English;
|
||||
}
|
||||
currentsecStr = locale.toString(current, tr("MMMM dd, yyyy"));
|
||||
areaWidget->longDateComboBox()->addItem(currentsecStr);
|
||||
|
||||
currentsecStr = locale.toString(current, tr("MMMM d, yy"));
|
||||
areaWidget->longDateComboBox()->addItem(currentsecStr);
|
||||
initDateComboBox();
|
||||
#else
|
||||
initComboBox(areaWidget->dateComboBox(), initInteractiveInfo(AreaUi::DATEFORMAT));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Area::initTimeFormat()
|
||||
void Area::initTimeFormat(bool firstLoad)
|
||||
{
|
||||
#ifndef Nile
|
||||
Q_UNUSED(firstLoad)
|
||||
initComboBox(areaWidget->timeComboBox(), initInteractiveInfo(AreaUi::TIMEFORMAT));
|
||||
#else
|
||||
if(firstLoad) {
|
||||
areaWidget->timeComboBox()->addItem(tr("12 Hours"), "12");
|
||||
areaWidget->timeComboBox()->addItem(tr("24 Hours"), "24");
|
||||
}
|
||||
|
||||
QString hourFormat;
|
||||
|
||||
hourFormat = kdk_system_get_now_timeformat();
|
||||
hourFormat = hourFormat.left(2);
|
||||
|
||||
if (firstLoad) {
|
||||
InteractiveInfo info = initInteractiveInfo(AreaUi::TIMEFORMAT);
|
||||
QString orgGsettingFormat = areaInterface->property(info.key.toUtf8().data()).toString().left(2);
|
||||
if (hourFormat != orgGsettingFormat) {
|
||||
hourFormat = orgGsettingFormat;
|
||||
if (hourFormat == "24") {
|
||||
kdk_system_set_24_timeformat();
|
||||
} else {
|
||||
kdk_system_set_12_timeformat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ("24" == hourFormat) {
|
||||
areaWidget->timeComboBox()->setCurrentIndex(1);
|
||||
} else {
|
||||
areaWidget->timeComboBox()->setCurrentIndex(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Area::initLanguage()
|
||||
|
@ -366,6 +469,118 @@ void Area::initConnect()
|
|||
areaInterface->call("setShowLanguageList", showLanguageList);
|
||||
UkccCommon::buriedSettings(name(), QString("Delete"), QString("clicked"), languageCode);
|
||||
});
|
||||
|
||||
#ifdef Nile
|
||||
connect(areaWidget->shortDateComboBox(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[=]{
|
||||
kdk_system_set_short_dateformat(areaWidget->shortDateComboBox()->itemText(areaWidget->shortDateComboBox()->currentIndex()).toLatin1().data());
|
||||
});
|
||||
|
||||
connect(areaWidget->longDateComboBox(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[=]{
|
||||
kdk_system_set_long_dateformat(areaWidget->longDateComboBox()->itemText(areaWidget->longDateComboBox()->currentIndex()).toLocal8Bit().data());
|
||||
});
|
||||
|
||||
connect(areaWidget->timeComboBox(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
areaWidget,
|
||||
[=](int num) {
|
||||
Q_UNUSED(num);
|
||||
bool flag_24;
|
||||
if (0 == areaWidget->timeComboBox()->currentIndex()) {
|
||||
flag_24 = false;
|
||||
kdk_system_set_12_timeformat();
|
||||
} else {
|
||||
flag_24 = true;
|
||||
kdk_system_set_24_timeformat();
|
||||
}
|
||||
InteractiveInfo info = initInteractiveInfo(AreaUi::TIMEFORMAT);
|
||||
areaInterface->call(info.setkey.toUtf8().data(), areaWidget->timeComboBox()->currentData().toString());
|
||||
UkccCommon::buriedSettings(name(), info.setkey, QString("select"), areaWidget->timeComboBox()->currentData().toString());
|
||||
});
|
||||
|
||||
QDBusConnection::sessionBus().connect("com.kylin.kysdk.DateServer",
|
||||
"/com/kylin/kysdk/Date",
|
||||
"com.kylin.kysdk.DateInterface",
|
||||
"TimeSignal",
|
||||
this,
|
||||
SLOT(TimeChanged(QString)));
|
||||
QDBusConnection::sessionBus().connect("com.kylin.kysdk.DateServer",
|
||||
"/com/kylin/kysdk/Date",
|
||||
"com.kylin.kysdk.DateInterface",
|
||||
"LongDateSignal",
|
||||
this,
|
||||
SLOT(refreshLongDate(QString)));
|
||||
QDBusConnection::sessionBus().connect("com.kylin.kysdk.DateServer",
|
||||
"/com/kylin/kysdk/Date",
|
||||
"com.kylin.kysdk.DateInterface",
|
||||
"ShortDateSignal",
|
||||
this,
|
||||
SLOT(refreshShortDate(QString)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Area::initDateComboBox() {
|
||||
refreshShortDate(kdk_system_get_shortformat());
|
||||
refreshLongDate(kdk_system_get_longformat());
|
||||
}
|
||||
|
||||
void Area::TimeChanged(QString time) {
|
||||
Q_UNUSED(time);
|
||||
initTimeFormat();
|
||||
InteractiveInfo info = initInteractiveInfo(AreaUi::TIMEFORMAT);
|
||||
areaInterface->call(info.setkey.toUtf8().data(), areaWidget->timeComboBox()->currentData().toString());
|
||||
}
|
||||
|
||||
void Area::refreshLongDate(QString date) {
|
||||
QString mLongFormatDate = date;
|
||||
int longindex = 0;
|
||||
|
||||
if ((mLongFormatDate.at(mLongFormatDate.length() - 4) == ',')
|
||||
|| ((mLongFormatDate.at(2) < '0' || mLongFormatDate.at(2) > '9')
|
||||
&& (mLongFormatDate.at(2) < 'a' || mLongFormatDate.at(2) > 'z')))
|
||||
{
|
||||
longindex = 1;
|
||||
} else {
|
||||
longindex = 0;
|
||||
}
|
||||
|
||||
if (longindex == areaWidget->longDateComboBox()->currentIndex())
|
||||
return;
|
||||
|
||||
areaWidget->longDateComboBox()->setCurrentIndex(longindex);
|
||||
}
|
||||
|
||||
void Area::refreshShortDate(QString date) {
|
||||
QString mShortFormatDate = date;
|
||||
int shortindex = 0;
|
||||
int ansindex = 0;
|
||||
|
||||
if (areaWidget->countryComboBox()->currentIndex() == 0) {
|
||||
ansindex = mShortFormatDate.length() - 3;
|
||||
} else {
|
||||
ansindex = 2;
|
||||
}
|
||||
|
||||
if (mShortFormatDate.at(ansindex) == 'M' ||
|
||||
mShortFormatDate.at(ansindex) == 'y') {
|
||||
shortindex = 3;
|
||||
switch (ansindex) {
|
||||
case 2:
|
||||
ansindex += 2;
|
||||
break;
|
||||
default:
|
||||
ansindex -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (mShortFormatDate.at(ansindex) == '/')
|
||||
shortindex += 1;
|
||||
if (mShortFormatDate.at(ansindex) == '-')
|
||||
shortindex += 2;
|
||||
if (shortindex == areaWidget->shortDateComboBox()->currentIndex())
|
||||
return;
|
||||
|
||||
areaWidget->shortDateComboBox()->setCurrentIndex(shortindex);
|
||||
}
|
||||
|
||||
QString Area::showLanguageName(QString languageCode)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <QtPlugin>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#include <kysdk/kysdk-system/libkydate.h>
|
||||
using namespace kdk;
|
||||
|
||||
/* qt会将glib里的signals成员识别为宏,所以取消该宏
|
||||
* 后面如果用到signals时,使用Q_SIGNALS代替即可
|
||||
|
@ -74,9 +76,10 @@ public:
|
|||
void initCalendar();
|
||||
void initFirstDay();
|
||||
void initDateFormat();
|
||||
void initTimeFormat();
|
||||
void initTimeFormat(bool firstLoad = false);
|
||||
void initLanguage();
|
||||
void initAddLanguage();
|
||||
void initDateComboBox();
|
||||
void initConnect();
|
||||
void connectToServer();
|
||||
QString showLanguageName(QString languageCode);
|
||||
|
@ -87,6 +90,9 @@ public Q_SLOTS:
|
|||
|
||||
private slots:
|
||||
void cloudChangedSlot(const QString &key);
|
||||
void TimeChanged(QString time);
|
||||
void refreshLongDate(QString date);
|
||||
void refreshShortDate(QString date);
|
||||
|
||||
private:
|
||||
AreaUi *areaWidget = nullptr;
|
||||
|
|
|
@ -32,6 +32,7 @@ PKGCONFIG += gio-2.0 \
|
|||
gio-unix-2.0 \
|
||||
kysdk-qtwidgets \
|
||||
kysdk-diagnostics \
|
||||
kysdk-systime
|
||||
|
||||
#DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
|
|
|
@ -41,7 +41,13 @@ void AreaUi::initLanguageFormat()
|
|||
//~ contents_path /Area/First Day Of Week
|
||||
dayWidget = new ComboxWidget(tr("First Day Of Week"), formatGroup, UkccFrame::BorderRadiusStyle::None);
|
||||
//~ contents_path /Area/Date
|
||||
dateWidget = new ComboxWidget(tr("Date"), formatGroup, UkccFrame::BorderRadiusStyle::None);
|
||||
#ifdef Nile
|
||||
shortDateWidget = new ComboxWidget(tr("Short Foramt Date"), formatGroup, UkccFrame::BorderRadiusStyle::None);
|
||||
longDateWidget = new ComboxWidget(tr("Long Format Date"), formatGroup, UkccFrame::BorderRadiusStyle::None);
|
||||
#else
|
||||
shortDateWidget = new ComboxWidget(tr("Date"), formatGroup, UkccFrame::BorderRadiusStyle::None);
|
||||
#endif
|
||||
|
||||
//~ contents_path /Area/Time
|
||||
timeWidget = new ComboxWidget(tr("Time"), formatGroup, UkccFrame::BorderRadiusStyle::Bottom);
|
||||
|
||||
|
@ -50,7 +56,10 @@ void AreaUi::initLanguageFormat()
|
|||
formatGroup->insertWidget(COUNTRY, countryWidget);
|
||||
formatGroup->insertWidget(CALENDAR, calendarWidget);
|
||||
formatGroup->insertWidget(FIRSTDAY, dayWidget);
|
||||
formatGroup->insertWidget(DATEFORMAT, dateWidget);
|
||||
formatGroup->insertWidget(DATEFORMAT, shortDateWidget);
|
||||
#ifdef Nile
|
||||
formatGroup->insertWidget(DATEFORMAT, longDateWidget);
|
||||
#endif
|
||||
formatGroup->insertWidget(TIMEFORMAT, timeWidget);
|
||||
//~ contents_path /Area/Language Format
|
||||
formatTitleLabel->setText(tr("Language Format"));
|
||||
|
|
|
@ -21,6 +21,10 @@ public:
|
|||
CALENDAR,
|
||||
FIRSTDAY,
|
||||
DATEFORMAT,
|
||||
#ifdef Nile
|
||||
SHORTDATEFORMAT,
|
||||
LONGDATEFORMAT,
|
||||
#endif
|
||||
TIMEFORMAT
|
||||
};
|
||||
AreaUi(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
@ -60,8 +64,26 @@ public:
|
|||
|
||||
inline QComboBox *dateComboBox()
|
||||
{
|
||||
if (dateWidget) {
|
||||
return dateWidget->comboBox();
|
||||
if (shortDateWidget) {
|
||||
return shortDateWidget->comboBox();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline QComboBox *shortDateComboBox()
|
||||
{
|
||||
if (shortDateWidget) {
|
||||
return shortDateWidget->comboBox();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline QComboBox *longDateComboBox()
|
||||
{
|
||||
if (longDateWidget) {
|
||||
return longDateWidget->comboBox();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -110,7 +132,8 @@ private:
|
|||
ComboxWidget *countryWidget = nullptr;
|
||||
ComboxWidget *calendarWidget = nullptr;
|
||||
ComboxWidget *dayWidget = nullptr;
|
||||
ComboxWidget *dateWidget = nullptr;
|
||||
ComboxWidget *shortDateWidget = nullptr;
|
||||
ComboxWidget *longDateWidget = nullptr;
|
||||
ComboxWidget *timeWidget = nullptr;
|
||||
|
||||
private:
|
||||
|
|
|
@ -33,6 +33,9 @@ DategroupWidget::DategroupWidget(QWidget *parent)
|
|||
MinSecColonLabel->setAlignment(Qt::AlignCenter);
|
||||
dateEdit->setCalendarPopup(true);
|
||||
dateEdit->setCalendarWidget(calendarWidget);
|
||||
#ifdef Nile
|
||||
resetDateEdit(kdk_system_get_shortformat());
|
||||
#endif
|
||||
|
||||
areaInterface = new QDBusInterface("org.ukui.ukcc.session",
|
||||
"/Area",
|
||||
|
@ -48,6 +51,14 @@ DategroupWidget::DategroupWidget(QWidget *parent)
|
|||
"changed",
|
||||
this,
|
||||
SLOT(dataChangedSlot(QString)));
|
||||
#ifdef Nile
|
||||
QDBusConnection::sessionBus().connect("com.kylin.kysdk.DateServer",
|
||||
"/com/kylin/kysdk/Date",
|
||||
"com.kylin.kysdk.DateInterface",
|
||||
"ShortDateSignal",
|
||||
this,
|
||||
SLOT(resetDateEdit(QString)));
|
||||
#endif
|
||||
initHour();
|
||||
initMinAndSec();
|
||||
initConnect();
|
||||
|
@ -67,6 +78,43 @@ void DategroupWidget::dataChangedSlot(QString key)
|
|||
}
|
||||
}
|
||||
|
||||
void DategroupWidget::resetDateEdit(QString date) {
|
||||
QString dateformat;
|
||||
int locale = 0;
|
||||
int i = 0;
|
||||
|
||||
|
||||
QLocale l1ocale = QLocale::system();
|
||||
if ("zh_CN" == l1ocale.name()){
|
||||
locale = 1;
|
||||
} else if ("bo_CN" == l1ocale.name()){
|
||||
locale = 2;
|
||||
}
|
||||
|
||||
dateformat = date;
|
||||
while(i < dateformat.length()) {
|
||||
if (dateformat.at(i) != 'M' &&
|
||||
dateformat.at(i) != 'd' &&
|
||||
dateformat.at(i) != 'y')
|
||||
break;
|
||||
else
|
||||
++i;
|
||||
}
|
||||
|
||||
QString split = dateformat.at(i);
|
||||
if (locale == 0) {
|
||||
if (dateformat.at(dateformat.length() - 3) == split)
|
||||
dateEdit->setDisplayFormat("M" + split + "d" + split + "yy");
|
||||
else
|
||||
dateEdit->setDisplayFormat("MM" + split + "dd" + split + "yyyy");
|
||||
} else {
|
||||
if (dateformat.at(2) == split)
|
||||
dateEdit->setDisplayFormat("yy" + split + "M" + split + "d");
|
||||
else
|
||||
dateEdit->setDisplayFormat("yyyy" + split + "MM" + split + "dd");
|
||||
}
|
||||
}
|
||||
|
||||
void DategroupWidget::initHour()
|
||||
{
|
||||
hourComboBox->clear();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QTimerEvent>
|
||||
#include <kysdk/kysdk-system/libkydate.h>
|
||||
|
||||
class DategroupWidget : public QWidget
|
||||
{
|
||||
|
@ -22,6 +23,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void dataChangedSlot(QString key);
|
||||
void resetDateEdit(QString date);
|
||||
|
||||
Q_SIGNALS:
|
||||
void dateChanged(QDate date, QTime time);
|
||||
|
|
|
@ -70,6 +70,11 @@ QWidget *DateTime::pluginUi()
|
|||
} else {
|
||||
qCritical() << "org.ukui.ukcc.session.Datetime DBus error:" << datetimeInterface->lastError();
|
||||
}
|
||||
} else {
|
||||
#ifdef Nile
|
||||
datetimeUi->resetDateFormat();
|
||||
datetimeUi->updateDate();
|
||||
#endif
|
||||
}
|
||||
|
||||
return datetimeUi;
|
||||
|
|
|
@ -40,6 +40,7 @@ PKGCONFIG += gio-2.0 \
|
|||
gsettings-qt \
|
||||
kysdk-qtwidgets \
|
||||
kysdk-diagnostics \
|
||||
kysdk-systime
|
||||
|
||||
#DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
|
|
|
@ -176,6 +176,14 @@ void DatetimeUi::initCurrentDate()
|
|||
setNtpLineEdit->blockSignals(false);
|
||||
setNtpButton->setEnabled(!setNtpLineEdit->text().isEmpty()); //为空时不允许保存
|
||||
});
|
||||
#ifdef Nile
|
||||
QDBusConnection::sessionBus().connect("com.kylin.kysdk.DateServer",
|
||||
"/com/kylin/kysdk/Date",
|
||||
"com.kylin.kysdk.DateInterface",
|
||||
"LongDateSignal",
|
||||
this,
|
||||
SLOT(updateDateFormat(QString)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatetimeUi::initOtherTimezone()
|
||||
|
@ -220,9 +228,45 @@ void DatetimeUi::initSignals()
|
|||
|
||||
void DatetimeUi::updateDate()
|
||||
{
|
||||
QString dateStr = timeLabel->dateText();
|
||||
if (!dateStr.isEmpty() && !timezoneStr.isEmpty()) {
|
||||
mDateLabel->setText(dateStr + " " + timezoneStr);
|
||||
#ifdef Nile
|
||||
updateDateFormat(kdk_system_get_longformat_date());
|
||||
#else
|
||||
QString timeAndWeek;
|
||||
timeAndWeek = timeLabel->dateText();
|
||||
if (!timeAndWeek.isEmpty() && !timezoneStr.isEmpty())
|
||||
{
|
||||
mDateLabel->setText(timeAndWeek + " " + timezoneStr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatetimeUi::updateDateFormat(QString date)
|
||||
{
|
||||
QString timeAndWeek;
|
||||
int longindex = 0;
|
||||
QString mLongFormatDate = date;
|
||||
if ((mLongFormatDate.at(mLongFormatDate.length() - 4) == ',')
|
||||
|| ((mLongFormatDate.at(2) < '0' || mLongFormatDate.at(2) > '9')
|
||||
&& (mLongFormatDate.at(2) < 'a' || mLongFormatDate.at(2) > 'z')))
|
||||
{
|
||||
longindex = 1;
|
||||
}
|
||||
|
||||
QLocale l1ocale = QLocale::system();
|
||||
if ("zh_CN" == l1ocale.name()){
|
||||
l1ocale = QLocale::Chinese;
|
||||
} else if ("bo_CN" == l1ocale.name()){
|
||||
l1ocale = QLocale::Tibetan;
|
||||
} else {
|
||||
l1ocale = QLocale::English;
|
||||
}
|
||||
if (longindex)
|
||||
timeAndWeek = l1ocale.toString(QDateTime::currentDateTime(), tr("MMMM d, yy ddd")).replace("周","星期");
|
||||
else
|
||||
timeAndWeek = l1ocale.toString(QDateTime::currentDateTime(), tr("MMMM dd, yyyy ddd")).replace("周","星期");
|
||||
|
||||
if (!timeAndWeek.isEmpty() && !timezoneStr.isEmpty()) {
|
||||
mDateLabel->setText(timeAndWeek + " " + timezoneStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,3 +355,7 @@ void DatetimeUi::setAddTimezoneBtnEnabled(bool b)
|
|||
{
|
||||
addTimezoneButton->setEnabled(b);
|
||||
}
|
||||
|
||||
void DatetimeUi::resetDateFormat() {
|
||||
dategroupWidget->resetDateEdit(kdk_system_get_shortformat());
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
void setTimezoneStr(QString str);
|
||||
void addOtherTimezone(const QString &timezone, const QString & timezoneName);
|
||||
void setAddTimezoneBtnEnabled(bool b);
|
||||
void resetDateFormat();
|
||||
void updateDate();
|
||||
|
||||
// 初始化
|
||||
private:
|
||||
|
@ -42,8 +44,8 @@ private:
|
|||
void initOtherTimezone();
|
||||
void initSignals();
|
||||
|
||||
private:
|
||||
void updateDate();
|
||||
private slots:
|
||||
void updateDateFormat(QString date);
|
||||
|
||||
private:
|
||||
QVBoxLayout *uiLayout = nullptr;
|
||||
|
|
|
@ -27,15 +27,31 @@ QMap<QString, QVariant> ukccSessionServer::getJsonInfo(const QString &configFile
|
|||
|
||||
for (int i = 0 ; i < obj.size(); i++) {
|
||||
QJsonObject faObj= obj[i].toObject();
|
||||
moduleMap.insert(faObj["name"].toString(), faObj["visible"].toVariant());
|
||||
if (!faObj.contains("name")) {
|
||||
continue;
|
||||
}
|
||||
QString name = faObj["name"].toString();
|
||||
bool visible = true;
|
||||
if (faObj.contains("visible")) {
|
||||
visible = faObj["visible"].toBool();
|
||||
}
|
||||
moduleMap.insert(name, visible);
|
||||
QJsonArray childNodeAry = faObj["childnode"].toArray();
|
||||
for (int j = 0; j < childNodeAry.size(); j++) {
|
||||
QString modeName = childNodeAry.at(j).toObject().value("name").toString();
|
||||
QJsonObject childObj= childNodeAry.at(j).toObject();
|
||||
if (!childObj.contains("name")) {
|
||||
continue;
|
||||
}
|
||||
QString modeName = childObj["name"].toString();
|
||||
bool modeVisiable = true;
|
||||
if (childObj.contains("visible")) {
|
||||
modeVisiable = childObj["visible"].toBool();
|
||||
}
|
||||
QString modeSet = modeName + "Settings";
|
||||
QVariant modeVisiable = childNodeAry.at(j).toObject().value("visible").toVariant();
|
||||
|
||||
moduleMap.insert(modeName, modeVisiable);
|
||||
moduleMap.insert(modeSet, childNodeAry.at(j).toObject().value(modeSet).toString());
|
||||
if (childObj.contains(modeSet)) {
|
||||
moduleMap.insert(modeSet, childObj[modeSet].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +132,13 @@ QString ukccSessionServer::GetSecurityConfigPath() {
|
|||
}
|
||||
|
||||
QString userFilename = QDir::homePath() + "/.config/ukui-control-center-security-config.json";
|
||||
QFile userFile(userFilename);
|
||||
if (userFile.exists()) {
|
||||
return userFilename;
|
||||
}
|
||||
|
||||
return userFilename;
|
||||
QString moduleFileName = "/usr/share/ukui-control-center/data/ukui-control-center-config.json";
|
||||
return moduleFileName;
|
||||
}
|
||||
|
||||
void ukccSessionServer::monitoFileChanged()
|
||||
|
|
|
@ -32,18 +32,19 @@
|
|||
|
||||
#include <QSvgRenderer>
|
||||
#include "mainwindow.h"
|
||||
#include "utils/keyvalueconverter.h"
|
||||
#include "utils/functionselect.h"
|
||||
#include "interface/ukcccommon.h"
|
||||
using namespace ukcc;
|
||||
#include "flowlayout.h"
|
||||
#include "utils/modulefactory.h"
|
||||
|
||||
#define STYLE_FONT_SCHEMA "org.ukui.style"
|
||||
|
||||
const QStringList KexcludeModule{"update","security","application","search_f"};
|
||||
|
||||
HomePageWidget::HomePageWidget(QWidget *parent) :
|
||||
HomePageWidget::HomePageWidget(QWidget *parent, QMap<QString, QGSettings *> map) :
|
||||
QWidget(parent),
|
||||
vecGsettins(map),
|
||||
ui(new Ui::HomePageWidget)
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
|
@ -72,23 +73,18 @@ void HomePageWidget::initUI() {
|
|||
flowLayout->setContentsMargins(70, 0, 70, 0);
|
||||
mModuleMap = UkccCommon::getModuleHideStatus();
|
||||
|
||||
//构建枚举键值转换对象
|
||||
KeyValueConverter * kvConverter = new KeyValueConverter(); //继承QObject,No Delete
|
||||
|
||||
//初始化功能列表数据
|
||||
FunctionSelect::loadHomeModule();
|
||||
|
||||
QSignalMapper * moduleSignalMapper = new QSignalMapper(this);
|
||||
|
||||
list_path = FunctionSelect::listExistsCustomNoticePath(PLUGINS_PATH);
|
||||
for (int moduleIndex = 0; moduleIndex < TOTALMODULES; moduleIndex++) {
|
||||
//获取插件QMap
|
||||
QMap<QString, QObject *> moduleMap;
|
||||
moduleMap = pmainWindow->exportModule(moduleIndex);
|
||||
|
||||
int totalModule = ModulesFactory::size();
|
||||
for(int index = 0; index < totalModule; index++) {
|
||||
ModuleInfo *curModuleInfo = ModulesFactory::getModuleInfoByIndex(index);
|
||||
if (curModuleInfo == nullptr) {
|
||||
continue;
|
||||
}
|
||||
//获取当前模块名
|
||||
QString modulenameString = kvConverter->keycodeTokeystring(moduleIndex).toLower();
|
||||
QString modulenamei18nString = kvConverter->keycodeTokeyi18nstring(moduleIndex);
|
||||
const QString locale = QLocale::system().name();
|
||||
QString modulenamei18nString = curModuleInfo->getModuleNameLocale(locale);
|
||||
QString modulenameString = curModuleInfo->moduleName;
|
||||
|
||||
if ((mModuleMap.keys().contains(modulenameString) && !mModuleMap[modulenameString].toBool())
|
||||
|| (UkccCommon::isTablet() && KexcludeModule.contains(modulenameString))) {
|
||||
continue;
|
||||
|
@ -124,7 +120,6 @@ void HomePageWidget::initUI() {
|
|||
|
||||
//内容Widget的构建
|
||||
QPushButton * widget = new QPushButton();
|
||||
QString moduleName = modulenameString;
|
||||
QString picModuleName = modulenameString;
|
||||
widget->setMinimumWidth(300);
|
||||
widget->setMinimumHeight(97);
|
||||
|
@ -144,8 +139,8 @@ void HomePageWidget::initUI() {
|
|||
logoLabel->setFixedSize(48, 48);
|
||||
logoLabel->setObjectName("logoLabel");
|
||||
logoLabel->setScaledContents(true);
|
||||
QString themeIconName = QString("kylin-settings-%1").arg(picModuleName);
|
||||
QString localIconName = QString(":/img/homepage/%1.png").arg(themeIconName);
|
||||
QString themeIconName = curModuleInfo->themeIconName;
|
||||
QString localIconName = curModuleInfo->localIconName;
|
||||
logoLabel->setPixmap(QIcon::fromTheme(themeIconName,QIcon(localIconName))
|
||||
.pixmap(logoLabel->size()));
|
||||
const QByteArray settingId(STYLE_FONT_SCHEMA);
|
||||
|
@ -171,34 +166,23 @@ void HomePageWidget::initUI() {
|
|||
|
||||
uint AllWidth = 0;
|
||||
QList<TristateLabel *> Labels;
|
||||
//循环填充模块下属功能
|
||||
if (moduleIndex >= FunctionSelect::funcinfoListHomePage.size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QList<FuncInfo> tmpList = FunctionSelect::funcinfoListHomePage[moduleIndex];
|
||||
QList<PluginInfo> tmpList = curModuleInfo->pluginInfoList;
|
||||
int showModuleCount = 0;
|
||||
for (int funcIndex = 0; funcIndex < tmpList.size(); funcIndex++){
|
||||
FuncInfo single = tmpList.at(funcIndex);
|
||||
|
||||
QGSettings *plugin_settings = setGsettingsPath(list_path, single.nameString);
|
||||
vecGsettins.insert(single.nameString, plugin_settings);
|
||||
|
||||
//跳过插件不存在的功能项
|
||||
if (!moduleMap.contains(single.namei18nString)){
|
||||
continue;
|
||||
}
|
||||
PluginInfo single = tmpList.at(funcIndex);
|
||||
|
||||
//跳过不在首页显示的功能
|
||||
if (!single.mainShow)
|
||||
continue;
|
||||
|
||||
showModuleCount++;
|
||||
if (mModuleMap.keys().contains(single.nameString.toLower())) {
|
||||
if (!mModuleMap[single.nameString.toLower()].toBool()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(single.namei18nString);
|
||||
if (pluginObj == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString textName = single.namei18nString;
|
||||
TristateLabel *label = new TristateLabel(textName, widget);
|
||||
|
@ -213,20 +197,20 @@ void HomePageWidget::initUI() {
|
|||
}
|
||||
|
||||
// 监听该插件是否启用
|
||||
if (plugin_settings) {
|
||||
if (vecGsettins.contains(single.oriNameString)) {
|
||||
// 插件未启用直接隐藏该label
|
||||
if (!plugin_settings->get(SHOW_KEY).toBool())
|
||||
if (!vecGsettins[single.oriNameString]->get(SHOW_KEY).toBool())
|
||||
label->setVisible(false);
|
||||
|
||||
connect(plugin_settings, &QGSettings::changed,[=](QString key){
|
||||
connect(vecGsettins[single.oriNameString], &QGSettings::changed,[=](QString key){
|
||||
if (key == SHOW_KEY) {
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(moduleMap.value(single.namei18nString));
|
||||
bool isShow = pluginInstance->isEnable() && vecGsettins[single.nameString]->get(SHOW_KEY).toBool();
|
||||
CommonInterface* pluginInstance = qobject_cast<CommonInterface*>(pluginObj);
|
||||
bool isShow = pluginInstance->isEnable() && vecGsettins[single.oriNameString]->get(SHOW_KEY).toBool();
|
||||
// 动态调整在首页显示的插件池
|
||||
if (isShow) {
|
||||
mLabels[moduleIndex].insert(funcIndex, label);
|
||||
mLabels[index].insert(funcIndex, label);
|
||||
int MWidth = 0;
|
||||
for (TristateLabel * label : mLabels[moduleIndex]) {
|
||||
for (TristateLabel * label : mLabels[index]) {
|
||||
if ((MWidth += label->width() + funcHorLayout->spacing()) < 198) {
|
||||
label->setVisible(true);
|
||||
} else {
|
||||
|
@ -234,7 +218,7 @@ void HomePageWidget::initUI() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
mLabels[moduleIndex].removeOne(label);
|
||||
mLabels[index].removeOne(label);
|
||||
label->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
@ -242,15 +226,16 @@ void HomePageWidget::initUI() {
|
|||
}
|
||||
|
||||
connect(label, SIGNAL(clicked()), moduleSignalMapper, SLOT(map()));
|
||||
moduleSignalMapper->setMapping(label, moduleMap[single.namei18nString]);
|
||||
moduleSignalMapper->setMapping(label, pluginObj);
|
||||
|
||||
funcHorLayout->addWidget(label);
|
||||
++showModuleCount;
|
||||
}
|
||||
mLabels.append(Labels);
|
||||
funcHorLayout->addStretch();
|
||||
|
||||
// 下属无插件,不显示
|
||||
if (FunctionSelect::funcinfoListHomePage[moduleIndex].size() == 0 || showModuleCount == 0) {
|
||||
if (curModuleInfo->pluginInfoList.size() == 0 || showModuleCount == 0) {
|
||||
widget->setVisible(false);
|
||||
continue;
|
||||
}
|
||||
|
@ -260,7 +245,7 @@ void HomePageWidget::initUI() {
|
|||
connect(stylesettings,&QGSettings::changed, [=](QString key) {
|
||||
if ("systemFont" == key || "systemFontSize" == key) {
|
||||
int MWidth = 0;
|
||||
for (TristateLabel * label : mLabels[moduleIndex]) {
|
||||
for (TristateLabel * label : mLabels[index]) {
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
int fontSize = fontMetrics.width(label->text());
|
||||
label->setFixedWidth(fontSize);
|
||||
|
@ -273,12 +258,10 @@ void HomePageWidget::initUI() {
|
|||
}
|
||||
});
|
||||
connect(widget, &QPushButton::clicked, [=]() {
|
||||
int moduleIndex = kvConverter->keystringTokeycode(moduleName);
|
||||
|
||||
//获取模块的第一项跳转
|
||||
QString firstFunc;
|
||||
QList<FuncInfo> tmpList = FunctionSelect::funcinfoListHomePage[moduleIndex];
|
||||
for (FuncInfo tmpStruct : tmpList) {
|
||||
QList<PluginInfo> tmpList = curModuleInfo->pluginInfoList;
|
||||
for (PluginInfo tmpStruct : tmpList) {
|
||||
bool isIntel = UkccCommon::isTablet();
|
||||
|
||||
if ((isIntel && tmpStruct.namei18nString == "User Info")
|
||||
|
@ -289,6 +272,10 @@ void HomePageWidget::initUI() {
|
|||
if (!tmpStruct.isEnable) {
|
||||
continue;
|
||||
}
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(tmpStruct.namei18nString);
|
||||
if (pluginObj == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 若该插件不启用,跳转为下一项
|
||||
if (vecGsettins.contains(tmpStruct.nameString)) {
|
||||
|
@ -299,15 +286,12 @@ void HomePageWidget::initUI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleMap.keys().contains(tmpStruct.namei18nString)) {
|
||||
if (mModuleMap.isEmpty() || !mModuleMap.contains(tmpStruct.nameString.toLower()) || mModuleMap[tmpStruct.nameString.toLower()].toBool()) {
|
||||
firstFunc = tmpStruct.namei18nString;
|
||||
UkccCommon::buriedSettings(tmpStruct.nameString, nullptr, "home clicked");
|
||||
//跳转
|
||||
pmainWindow->functionBtnClicked(moduleMap.value(firstFunc));
|
||||
break;
|
||||
}
|
||||
if (mModuleMap.isEmpty() || !mModuleMap.contains(tmpStruct.nameString.toLower()) || mModuleMap[tmpStruct.nameString.toLower()].toBool()) {
|
||||
firstFunc = tmpStruct.namei18nString;
|
||||
UkccCommon::buriedSettings(tmpStruct.nameString, nullptr, "home clicked");
|
||||
//跳转
|
||||
pmainWindow->functionBtnClicked(pluginObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ class HomePageWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HomePageWidget(QWidget *parent = 0);
|
||||
explicit HomePageWidget(QWidget *parent = nullptr, QMap<QString, QGSettings *> map = {});
|
||||
~HomePageWidget();
|
||||
|
||||
public:
|
||||
|
@ -72,7 +72,6 @@ private:
|
|||
QPixmap drawSymbolicColoredPixmap(const QPixmap &source, COLOR color);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
public:
|
||||
QList<char *> list_path;
|
||||
QMap<QString, QGSettings *> vecGsettins;
|
||||
private:
|
||||
Ui::HomePageWidget *ui;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
*/
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "utils/keyvalueconverter.h"
|
||||
#include "utils/functionselect.h"
|
||||
#include "interface/ukcccommon.h"
|
||||
using namespace ukcc;
|
||||
#include "imageutil.h"
|
||||
|
@ -47,6 +45,8 @@ using namespace ukcc;
|
|||
#include "iconbutton.h"
|
||||
#include "lightlabel.h"
|
||||
#include "../../shell/customstyle.h"
|
||||
#include "utils/modulefactory.h"
|
||||
#include "utils/functionselect.h"
|
||||
|
||||
#define THEME_QT_SCHEMA "org.ukui.style"
|
||||
|
||||
|
@ -84,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
qApp->installEventFilter(this);
|
||||
qApp->setStyle(new InternalStyle("ukui"));
|
||||
is_ExitPower = isExitsPower();
|
||||
pluginPathList = FunctionSelect::listExistsCustomNoticePath(PLUGINS_PATH);
|
||||
if (UkccCommon::isOpenkylin()) {
|
||||
connect(WindowManager::self(),&WindowManager::windowAdded,this,[=](const WindowId& windowId){
|
||||
if (getpid() == WindowManager::getPid(windowId)) {
|
||||
|
@ -104,44 +105,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
MainWindow::~MainWindow()
|
||||
{
|
||||
//执行插件的析构函数
|
||||
QMap<QString, QObject *> moduleMap;
|
||||
for (int type = 0; type < TOTALMODULES; type++) {
|
||||
moduleMap = this->exportModule(type);
|
||||
QMap<QString, QObject*>::const_iterator it;
|
||||
for (it = moduleMap.constBegin(); it != moduleMap.constEnd(); ++it) {
|
||||
CommonInterface *pluginInstance = qobject_cast<CommonInterface *>(it.value());
|
||||
if (pluginInstance) {
|
||||
qInfo()<<"~exit && delete-plugin:"<<pluginInstance->name();
|
||||
delete pluginInstance;
|
||||
pluginInstance = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
ModulesFactory::pluginDelete();
|
||||
qInfo()<<"~exit ukui-control-center";
|
||||
delete ui;
|
||||
ui = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::bootOptionsFilter(QString opt, bool firstIn) {
|
||||
int moduleNum;
|
||||
bool isExitsModule = false;
|
||||
QString funcStr;
|
||||
QString funcName;
|
||||
QList<FuncInfo> pFuncStructList;
|
||||
for (int i = 0; i < FunctionSelect::funcinfoList.size(); i++) {
|
||||
for (int j = 0; j < FunctionSelect::funcinfoList[i].size(); j++) {
|
||||
if (!FunctionSelect::funcinfoList[i][j].nameString.compare(opt, Qt::CaseInsensitive)) {
|
||||
moduleNum = FunctionSelect::funcinfoList[i][j].type;
|
||||
funcStr = FunctionSelect::funcinfoList[i][j].namei18nString;
|
||||
funcName = FunctionSelect::funcinfoList[i][j].nameString;
|
||||
pFuncStructList = FunctionSelect::funcinfoList[i];
|
||||
isExitsModule = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isExitsModule) {
|
||||
PluginInfo* pluginInfo = ModulesFactory::getPluginInfoByName(opt);
|
||||
if (pluginInfo == nullptr) {
|
||||
//避免无限循环的风险
|
||||
if (UkccCommon::isTablet()) {
|
||||
if (firstIn) {
|
||||
|
@ -151,29 +123,21 @@ void MainWindow::bootOptionsFilter(QString opt, bool firstIn) {
|
|||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
QMap<QString, QObject *> pluginsObjMap = modulesList.at(moduleNum);
|
||||
|
||||
if (pluginsObjMap.keys().contains(funcStr)){
|
||||
QString pluginName = pluginInfo->nameString;
|
||||
QString moduleName = ModulesFactory::getModuleNamebyName(pluginName);
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(pluginInfo->namei18nString);
|
||||
if (pluginObj != nullptr) {
|
||||
if (m_ModuleMap.isEmpty()) {
|
||||
//开始跳转
|
||||
functionBtnClicked(pluginsObjMap.value(funcStr));
|
||||
functionBtnClicked(pluginObj);
|
||||
return ;
|
||||
} else {
|
||||
QString superordinate = "";
|
||||
for (auto it : moduleSuperordinate) {
|
||||
if (it.first == funcName) {
|
||||
superordinate = it.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "module:" << funcName.toLower() << ";superordinate:" << superordinate.toLower();
|
||||
qDebug() << "module:" << pluginName.toLower() << ";superordinate:" << moduleName;
|
||||
// 若跳转节点或跳转节点父节点不存在直接跳转,不受管控文件控制,若存在,则根据管控文件判断是否被禁用
|
||||
if (!m_ModuleMap.contains(funcName.toLower()) || !m_ModuleMap.contains(superordinate.toLower())
|
||||
|| (m_ModuleMap[funcName.toLower()].toBool() && m_ModuleMap[superordinate.toLower()].toBool())) {
|
||||
if (!m_ModuleMap.contains(pluginName.toLower()) || !m_ModuleMap.contains(moduleName)
|
||||
|| (m_ModuleMap[pluginName.toLower()].toBool() && m_ModuleMap[moduleName].toBool())) {
|
||||
//开始跳转
|
||||
functionBtnClicked(pluginsObjMap.value(funcStr));
|
||||
functionBtnClicked(pluginObj);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
@ -276,11 +240,8 @@ void MainWindow::initUI() {
|
|||
initTileBar();
|
||||
initStyleSheet();
|
||||
|
||||
//初始化功能列表数据
|
||||
FunctionSelect::initValue();
|
||||
|
||||
//构建枚举键值转换对象
|
||||
kvConverter = new KeyValueConverter(); //继承QObject,No Delete
|
||||
// 一级菜单配置加载
|
||||
ModulesFactory::loadConfig();
|
||||
|
||||
//加载插件
|
||||
loadPlugins();
|
||||
|
@ -329,7 +290,7 @@ void MainWindow::initUI() {
|
|||
});
|
||||
|
||||
//加载首页Widget
|
||||
homepageWidget = new HomePageWidget(this);
|
||||
homepageWidget = new HomePageWidget(this, vecGsettins);
|
||||
homepageWidget->installEventFilter(this);
|
||||
ui->stackedWidget->addWidget(homepageWidget);
|
||||
ui->stackedWidget->setFocusPolicy(Qt::ClickFocus);
|
||||
|
@ -476,7 +437,6 @@ void MainWindow::initTileBar() {
|
|||
});
|
||||
|
||||
m_searchWidget->setFixedWidth(240);
|
||||
|
||||
titleLayout->addWidget(mTitleIcon);
|
||||
titleLayout->addSpacing(8);
|
||||
titleLayout->addWidget(titleLabel);
|
||||
|
@ -607,18 +567,12 @@ void MainWindow::setBtnLayout(QPushButton * &pBtn) {
|
|||
|
||||
void MainWindow::loadPlugins()
|
||||
{
|
||||
for (int index = 0; index < TOTALMODULES; index++){
|
||||
QMap<QString, QObject *> pluginsMaps;
|
||||
modulesList.append(pluginsMaps);
|
||||
}
|
||||
|
||||
bool installed = (QCoreApplication::applicationDirPath() == QDir(("/usr/bin")).canonicalPath());
|
||||
if (installed) {
|
||||
pluginsDir = QDir(PLUGIN_INSTALL_DIRS);
|
||||
} else {
|
||||
pluginsDir = QDir(qApp->applicationDirPath() + "/plugins");
|
||||
}
|
||||
|
||||
loadUpdatePlugins();
|
||||
|
||||
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
||||
|
@ -669,15 +623,14 @@ void MainWindow::determinePlugin(const QString &fileName, const QDir &dir)
|
|||
return;
|
||||
}
|
||||
|
||||
modulesList[pluginInstance->pluginTypes()].insert(pluginInstance->plugini18nName(), plugin);
|
||||
qDebug() << "Load Plugin :" << pluginInstance->plugini18nName();
|
||||
QGSettings *pluginSettings = setGsettingsPath(pluginPathList, pluginInstance->name());
|
||||
vecGsettins.insert(pluginInstance->name(), pluginSettings);
|
||||
|
||||
qDebug() << "Load Plugin :" << kvConverter->keycodeTokeyi18nstring(pluginInstance->pluginTypes()) << "->" << pluginInstance->plugini18nName() ;
|
||||
|
||||
m_searchWidget->addModulesName(pluginInstance->name(), pluginInstance->plugini18nName(), pluginInstance->translationPath());
|
||||
|
||||
int moduletypeInt = pluginInstance->pluginTypes();
|
||||
if (!moduleIndexList.contains(moduletypeInt))
|
||||
moduleIndexList.append(moduletypeInt);
|
||||
ModulesFactory::loadPluginInfo(plugin);
|
||||
if (pluginInstance->isEnable() && pluginSettings->get(SHOW_KEY).toBool()) {
|
||||
m_searchWidget->addModulesName(pluginInstance->name(), pluginInstance->plugini18nName(), pluginInstance->translationPath());
|
||||
}
|
||||
} else {
|
||||
//如果加载错误且文件后缀为so,输出错误
|
||||
if (fileName.endsWith(".so"))
|
||||
|
@ -710,7 +663,7 @@ void MainWindow::initLeftsideBar()
|
|||
scrollArea = new KNavigationBar(ui->leftBotWidget);
|
||||
|
||||
connect(this,&MainWindow::specifiedPluginLoaded,this,[=](CommonInterface * pluginInstance){
|
||||
int type = TOTALMODULES;
|
||||
int type = ModulesFactory::size();
|
||||
QString typeName = tr("Specified");
|
||||
|
||||
QStandardItem *specifiedPlugin = new QStandardItem(pluginInstance->icon(), pluginInstance->plugini18nName());
|
||||
|
@ -723,39 +676,35 @@ void MainWindow::initLeftsideBar()
|
|||
pluginInstance->pluginBtn = specifiedPlugin;
|
||||
});
|
||||
|
||||
for(int type = 0; type < TOTALMODULES; type++) {
|
||||
int totalModule = ModulesFactory::size();
|
||||
for(int index = 0; index < totalModule; index++) {
|
||||
//循环构建左侧边栏一级菜单按钮
|
||||
if (moduleIndexList.contains(type)){
|
||||
QString mnameString = kvConverter->keycodeTokeystring(type);
|
||||
QString mnamei18nString = kvConverter->keycodeTokeyi18nstring(type); //设置TEXT
|
||||
|
||||
QList<FuncInfo> moduleList = FunctionSelect::funcinfoList[type];
|
||||
for (int funcIndex = 0; funcIndex < moduleList.size(); funcIndex++) {
|
||||
FuncInfo single = moduleList.at(funcIndex);
|
||||
|
||||
QPair<QString, QString> data;
|
||||
data.first = single.nameString;
|
||||
data.second = mnameString;
|
||||
moduleSuperordinate.append(data);
|
||||
|
||||
}
|
||||
|
||||
if (m_ModuleMap.keys().contains(mnameString.toLower())) {
|
||||
if (!m_ModuleMap[mnameString.toLower()].toBool()) {
|
||||
ModuleInfo *curModuleInfo = ModulesFactory::getModuleInfoByIndex(index);
|
||||
if (curModuleInfo == nullptr) {
|
||||
continue;
|
||||
}
|
||||
int type = curModuleInfo->moduleType;
|
||||
if (ModulesFactory::checkModuleType(type)){ // 一级菜单不会有多个
|
||||
QString mnameString = curModuleInfo->moduleName;
|
||||
const QString locale = QLocale::system().name();
|
||||
QString mnamei18nString = curModuleInfo->getModuleNameLocale(locale);
|
||||
if (m_ModuleMap.keys().contains(mnameString)) {
|
||||
if (!m_ModuleMap[mnameString].toBool()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
QMap<QString, QObject *> moduleMap;
|
||||
moduleMap = this->exportModule(type);
|
||||
|
||||
QList<QStandardItem *> secondList;
|
||||
QList<FuncInfo> functionStructList = FunctionSelect::funcinfoList[type];
|
||||
QList<PluginInfo> functionStructList = curModuleInfo->pluginInfoList;
|
||||
if (functionStructList.size() <= 0) { // 下属无插件,不显示
|
||||
continue;
|
||||
}
|
||||
int showModuleCount = 0;
|
||||
for (int funcIndex = 0; funcIndex < functionStructList.size(); funcIndex++) {
|
||||
FuncInfo single = functionStructList.at(funcIndex);
|
||||
PluginInfo single = functionStructList.at(funcIndex);
|
||||
|
||||
//跳过插件不存在的功能项
|
||||
if (!moduleMap.contains(single.namei18nString) || !single.isEnable) {
|
||||
if (!ModulesFactory::checkPluginExist(single.namei18nString) || !single.isEnable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -774,20 +723,23 @@ void MainWindow::initLeftsideBar()
|
|||
}
|
||||
|
||||
//填充左侧菜单
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(moduleMap.value(single.namei18nString));
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(single.namei18nString);
|
||||
if (pluginObj == nullptr) {
|
||||
continue;
|
||||
}
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(pluginObj);
|
||||
QStandardItem *pluginItem = new QStandardItem(pluginInstance->icon(), single.namei18nString);
|
||||
secondList << pluginItem;
|
||||
pluginItem->setData(type, Qt::UserRole+1);
|
||||
pluginItem->setData(single.namei18nString, Qt::UserRole+2);
|
||||
pluginInstance->pluginBtn = pluginItem;
|
||||
pluginInstance->pluginBtn = pluginItem;
|
||||
// 初始化插件状态
|
||||
QGSettings *msettings = nullptr;
|
||||
int row = scrollArea->model()->rowCount() + secondList.count();
|
||||
if (homepageWidget->vecGsettins.contains(single.nameString)) {
|
||||
msettings = homepageWidget->vecGsettins[single.nameString];
|
||||
if (vecGsettins.contains(single.oriNameString)) {
|
||||
msettings = vecGsettins[single.oriNameString];
|
||||
if (msettings && plgIsVisiable) {
|
||||
|
||||
connect(msettings , &QGSettings::changed,[=](QString key){
|
||||
connect(msettings, &QGSettings::changed,[=](QString key){
|
||||
bool visible = !pluginInstance->isEnable() ? false : msettings->get(SHOW_KEY).toBool();
|
||||
qDebug() << "isEnable = " << pluginInstance->isEnable();
|
||||
if (key == SHOW_KEY) {
|
||||
|
@ -795,22 +747,28 @@ void MainWindow::initLeftsideBar()
|
|||
ui->stackedWidget->setCurrentIndex(0);
|
||||
}
|
||||
scrollArea->listview()->setRowHidden(row, !visible);
|
||||
m_searchWidget->hiddenSearchItem(single.namei18nString, msettings->get(SHOW_KEY).toBool());
|
||||
m_searchWidget->hiddenSearchItem(QLocale::system().name() == "zh_CN" ? single.namei18nString : single.oriNameString, msettings->get(SHOW_KEY).toBool());
|
||||
} else {
|
||||
m_searchWidget->hiddenSearchItem(single.namei18nString, msettings->get(SHOW_KEY).toBool());
|
||||
m_searchWidget->hiddenSearchItem(QLocale::system().name() == "zh_CN" ? single.namei18nString : single.oriNameString, msettings->get(SHOW_KEY).toBool());
|
||||
}
|
||||
});
|
||||
|
||||
bool isShow = !pluginInstance->isEnable() ? false : msettings->get(SHOW_KEY).toBool();
|
||||
qDebug() << "Load Plugin : " << single.namei18nString << "isShow:" <<isShow << "isEnable:" << single.isEnable;
|
||||
scrollArea->listview()->setRowHidden(row, !isShow);
|
||||
m_searchWidget->hiddenSearchItem(single.namei18nString, msettings->get(SHOW_KEY).toBool());
|
||||
m_searchWidget->hiddenSearchItem(QLocale::system().name() == "zh_CN" ? single.namei18nString : single.oriNameString, msettings->get(SHOW_KEY).toBool());
|
||||
|
||||
}
|
||||
}
|
||||
++showModuleCount;
|
||||
}
|
||||
// 下属无插件,不显示
|
||||
if (curModuleInfo->pluginInfoList.size() == 0 || showModuleCount == 0 || secondList.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
scrollArea->addGroupItems(secondList, mnamei18nString);
|
||||
for (int funcIndex = 0; funcIndex < functionStructList.size(); funcIndex++) {
|
||||
FuncInfo single = functionStructList.at(funcIndex);
|
||||
PluginInfo single = functionStructList.at(funcIndex);
|
||||
if (!single.isEnable) {
|
||||
QList<QStandardItem *> itemList = scrollArea->model()->findItems(single.namei18nString);
|
||||
if (!itemList.isEmpty()) {
|
||||
|
@ -823,137 +781,46 @@ void MainWindow::initLeftsideBar()
|
|||
}
|
||||
|
||||
connect(scrollArea->listview(), &QListView::clicked, this, [=](const QModelIndex &index){
|
||||
QMap<QString, QObject *> moduleMap;
|
||||
moduleMap = this->exportModule(index.data(Qt::UserRole+1).toInt());
|
||||
qDebug() << "moduleMap = " << moduleMap;
|
||||
qDebug() << "index = " << index.data(Qt::UserRole+2).toString();
|
||||
QString moduleName = index.data(Qt::UserRole+2).toString();
|
||||
QString pluginil8Name = index.data(Qt::UserRole+2).toString();
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(pluginil8Name);
|
||||
if (pluginObj != nullptr) {
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(pluginObj);
|
||||
if (pluginInstance) {
|
||||
modulepageWidget->refreshPluginWidget(pluginInstance);
|
||||
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(moduleMap.value(moduleName));
|
||||
if (pluginInstance) {
|
||||
modulepageWidget->refreshPluginWidget(pluginInstance);
|
||||
|
||||
// 埋点点击左侧导航插件
|
||||
UkccCommon::buriedSettings(pluginInstance->name(), nullptr, QString("left clicked"));
|
||||
// 埋点点击左侧导航插件
|
||||
UkccCommon::buriedSettings(pluginInstance->name(), nullptr, QString("left clicked"));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
ui->leftBotLayout->addWidget(scrollArea);
|
||||
}
|
||||
|
||||
QPushButton * MainWindow::buildLeftsideBtn(QString bname,QString tipName, QIcon icon) {
|
||||
int itype = kvConverter->keystringTokeycode(bname);
|
||||
|
||||
QPushButton * leftsidebarBtn = new QPushButton();
|
||||
leftsidebarBtn->setAttribute(Qt::WA_DeleteOnClose);
|
||||
leftsidebarBtn->setCheckable(true);
|
||||
if (UkccCommon::isTablet()) {
|
||||
leftsidebarBtn->setFixedSize(230,48);
|
||||
} else {
|
||||
leftsidebarBtn->setFixedSize(230,40); //一级菜单按钮显示的宽度
|
||||
QGSettings *MainWindow::setGsettingsPath(QList<char *> list, QString name)
|
||||
{
|
||||
// 为每个插件创建动态QGSettings对象,用于监听插件是否隐藏
|
||||
QByteArray ba;
|
||||
char *path;
|
||||
ba = (QString("%1%2").arg(name).arg("/")).toUtf8();
|
||||
path = ba.data();
|
||||
const QByteArray id(PLUGINS_SCHEMA);
|
||||
if (!QGSettings::isSchemaInstalled(id)) {
|
||||
return nullptr;
|
||||
}
|
||||
QGSettings *settings = nullptr;
|
||||
QString plugin = QString("%1%2%3").arg(PLUGINS_PATH).arg(name).arg("/");
|
||||
settings = new QGSettings(id, plugin.toUtf8().data(), this);
|
||||
|
||||
IconButton * iconBtn = new IconButton(bname, icon, leftsidebarBtn);
|
||||
iconBtn->setCheckable(true);
|
||||
iconBtn->setFixedSize(QSize(16, 16));
|
||||
iconBtn->setFocusPolicy(Qt::NoFocus);
|
||||
iconBtn->reLoadIcon();
|
||||
static QString hoverColor;
|
||||
static QString clickColor;
|
||||
|
||||
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
QGSettings *qtSettings = new QGSettings("org.ukui.style", QByteArray(), this);
|
||||
if (qtSettings->keys().contains("styleName")) {
|
||||
hoverColor = pluginBtnHoverColor(qtSettings->get("style-name").toString(), true);
|
||||
clickColor = pluginBtnHoverColor(qtSettings->get("style-name").toString(), false);
|
||||
if (!leftsidebarBtn->isChecked())
|
||||
leftsidebarBtn->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
|
||||
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(hoverColor).arg(clickColor));
|
||||
//判断是否已存在该路径,不存在则赋初值
|
||||
for (int j = 0; j < list.count(); j++) {
|
||||
if (!qstrcmp(path, list.at(j))){
|
||||
return settings;
|
||||
}
|
||||
|
||||
connect(qtSettings, &QGSettings::changed, this, [=,&hoverColor](const QString &key) {
|
||||
if (key == "styleName") {
|
||||
iconBtn->reLoadIcon();
|
||||
hoverColor = this->pluginBtnHoverColor(qtSettings->get("style-name").toString(), true);
|
||||
clickColor = pluginBtnHoverColor(qtSettings->get("style-name").toString(), false);
|
||||
if (!leftsidebarBtn->isChecked())
|
||||
leftsidebarBtn->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
|
||||
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(hoverColor).arg(clickColor));
|
||||
} else if (key == "themeColor" && leftsidebarBtn->isChecked()) {
|
||||
leftsidebarBtn->toggled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QLabel * textLabel = new QLabel(leftsidebarBtn);
|
||||
textLabel->setFixedWidth(leftsidebarBtn->width() - 40);
|
||||
QFontMetrics fontMetrics(textLabel->font());
|
||||
int fontSize = fontMetrics.width(tipName);
|
||||
if (fontSize > textLabel->width()) {
|
||||
textLabel->setText(fontMetrics.elidedText(tipName, Qt::ElideRight, textLabel->width()));
|
||||
} else {
|
||||
textLabel->setText(tipName);
|
||||
}
|
||||
const QByteArray styleID(THEME_QT_SCHEMA);
|
||||
QGSettings *stylesettings = new QGSettings(styleID, QByteArray(), this);
|
||||
connect(stylesettings,&QGSettings::changed,[=](QString key)
|
||||
{
|
||||
if("systemFont" == key || "systemFontSize" == key)
|
||||
{
|
||||
QFontMetrics fontMetrics_1(textLabel->font());
|
||||
int fontSize_1 = fontMetrics_1.width(tipName);
|
||||
|
||||
if (fontSize_1 > textLabel->width()) {
|
||||
qDebug()<<textLabel->width();
|
||||
textLabel->setText(fontMetrics_1.elidedText(tipName, Qt::ElideRight, textLabel->width()));
|
||||
} else {
|
||||
textLabel->setText(tipName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
QSizePolicy textLabelPolicy = textLabel->sizePolicy();
|
||||
textLabelPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
|
||||
textLabelPolicy.setVerticalPolicy(QSizePolicy::Fixed);
|
||||
textLabel->setSizePolicy(textLabelPolicy);
|
||||
textLabel->setScaledContents(true);
|
||||
|
||||
leftMicBtnGroup->addButton(iconBtn, itype);
|
||||
|
||||
connect(iconBtn, &QPushButton::toggled, this, [=] (bool checked) {
|
||||
iconBtn->reLoadIcon();
|
||||
if (checked) {
|
||||
textLabel->setStyleSheet("color:white");
|
||||
} else {
|
||||
textLabel->setStyleSheet("color:palette(windowText)");
|
||||
}
|
||||
});
|
||||
|
||||
connect(iconBtn, &QPushButton::clicked, leftsidebarBtn, &QPushButton::click);
|
||||
|
||||
connect(leftsidebarBtn, &QPushButton::toggled, this, [=](bool checked) {
|
||||
iconBtn->setChecked(checked);
|
||||
if (checked) {
|
||||
leftsidebarBtn->setStyleSheet("QPushButton:checked{background-color: palette(highlight);border-radius: 6px;}");
|
||||
textLabel->setStyleSheet("color:white");
|
||||
} else {
|
||||
leftsidebarBtn->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
|
||||
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(hoverColor).arg(clickColor));
|
||||
textLabel->setStyleSheet("color:palette(windowText)");
|
||||
}
|
||||
});
|
||||
|
||||
QHBoxLayout * btnHorLayout = new QHBoxLayout();
|
||||
btnHorLayout->setContentsMargins(14,0,0,0);
|
||||
btnHorLayout->addWidget(iconBtn, Qt::AlignCenter);
|
||||
btnHorLayout->addWidget(textLabel);
|
||||
btnHorLayout->addStretch();
|
||||
btnHorLayout->setSpacing(8);
|
||||
|
||||
leftsidebarBtn->setLayout(btnHorLayout);
|
||||
|
||||
return leftsidebarBtn;
|
||||
settings->set(PLUGIN_NAME, name);
|
||||
settings->set(SHOW_KEY, true);
|
||||
return settings;
|
||||
}
|
||||
|
||||
bool MainWindow::isExitsCloudAccount() {
|
||||
|
@ -1098,14 +965,6 @@ void MainWindow::setModuleBtnHightLight(int id) {
|
|||
leftMicBtnGroup->button(id)->setChecked(true);
|
||||
}
|
||||
|
||||
QMap<QString, QObject *> MainWindow::exportModule(int type) {
|
||||
QMap<QString, QObject *> emptyMaps;
|
||||
if (type < modulesList.length())
|
||||
return modulesList[type];
|
||||
else
|
||||
return emptyMaps;
|
||||
}
|
||||
|
||||
void MainWindow::pluginBtnClicked(QObject *plugin) {
|
||||
|
||||
CommonInterface * pluginInstance = qobject_cast<CommonInterface *>(plugin);
|
||||
|
@ -1150,29 +1009,19 @@ void MainWindow::sltMessageReceived(const QString &msg) {
|
|||
}
|
||||
|
||||
void MainWindow::switchPage(QString moduleName, QString jumpMoudle, QString jumpText) {
|
||||
|
||||
for (int i = 0; i < modulesList.length(); i++) {
|
||||
auto modules = modulesList.at(i);
|
||||
//开始跳转
|
||||
if (modules.keys().contains(moduleName)) {
|
||||
if (m_ModuleMap.isEmpty()) {
|
||||
functionBtnClicked(modules.value(moduleName));
|
||||
return ;
|
||||
} else {
|
||||
QString superordinate = "";
|
||||
for (auto it : moduleSuperordinate) {
|
||||
if (it.first == jumpMoudle) {
|
||||
superordinate = it.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 若跳转节点或跳转节点父节点不存在直接跳转,不受管控文件控制,若存在,则根据管控文件判断是否被禁用
|
||||
if (!m_ModuleMap.contains(jumpMoudle.toLower()) || !m_ModuleMap.contains(superordinate.toLower())
|
||||
//开始跳转
|
||||
QObject* pluginObj = ModulesFactory::getPluginObjectByName(moduleName);
|
||||
if (pluginObj != nullptr) {
|
||||
if (m_ModuleMap.isEmpty()) {
|
||||
functionBtnClicked(pluginObj);
|
||||
return;
|
||||
} else {
|
||||
QString superordinate = ModulesFactory::getModuleNamebyName(jumpMoudle);
|
||||
// 若跳转节点或跳转节点父节点不存在直接跳转,不受管控文件控制,若存在,则根据管控文件判断是否被禁用
|
||||
if (!m_ModuleMap.contains(jumpMoudle.toLower()) || !m_ModuleMap.contains(superordinate.toLower())
|
||||
|| (m_ModuleMap[jumpMoudle.toLower()].toBool() && m_ModuleMap[superordinate.toLower()].toBool())) {
|
||||
functionBtnClicked(modules.value(moduleName));
|
||||
return ;
|
||||
}
|
||||
functionBtnClicked(pluginObj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
class QLabel;
|
||||
class QPushButton;
|
||||
class QButtonGroup;
|
||||
class KeyValueConverter;
|
||||
|
||||
using namespace kdk;
|
||||
namespace Ui {
|
||||
|
@ -62,7 +61,6 @@ public:
|
|||
~MainWindow();
|
||||
|
||||
public:
|
||||
QMap<QString, QObject *> exportModule(int);
|
||||
void setModuleBtnHightLight(int id);
|
||||
void bootOptionsFilter(QString opt, bool firstIn = true); // 模块跳转
|
||||
void moveEvent(QMoveEvent *event);
|
||||
|
@ -85,11 +83,7 @@ private:
|
|||
|
||||
QDir pluginsDir;
|
||||
QDir updatePluginDir;
|
||||
QList<int> moduleIndexList;
|
||||
QList<QMap<QString, QObject *>> modulesList;
|
||||
QList<QPair<QString, QString>> moduleSuperordinate;
|
||||
|
||||
KeyValueConverter * kvConverter;
|
||||
SearchWidget * m_searchWidget;
|
||||
|
||||
QPushButton *backBtn;
|
||||
|
@ -115,6 +109,8 @@ private:
|
|||
bool isTabletMode = false;
|
||||
|
||||
QList<WindowId> m_listWinIds;
|
||||
QMap<QString, QGSettings *> vecGsettins;
|
||||
QList<char *> pluginPathList;
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
|
@ -125,7 +121,7 @@ private:
|
|||
void determinePlugin(const QString& fileName, const QDir& dir);
|
||||
void loadSpecifiedPlugin(QString pluginFullName);
|
||||
void initLeftsideBar();
|
||||
QPushButton * buildLeftsideBtn(QString bname, QString tipName, QIcon icon);
|
||||
QGSettings *setGsettingsPath(QList<char *> list , QString name);
|
||||
bool isExitsCloudAccount();
|
||||
bool isExitsPower();
|
||||
bool isExitWirelessDevice();
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "mainwindow.h"
|
||||
#include "interface.h"
|
||||
#include "utils/keyvalueconverter.h"
|
||||
#include "utils/functionselect.h"
|
||||
#include "interface/ukcccommon.h"
|
||||
using namespace ukcc;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<translation type="obsolete">版权所有 @ 2009-%1%2 保留所有权利。 {2020.?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="545"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="543"/>
|
||||
<source>Status</source>
|
||||
<translation>系统状态</translation>
|
||||
</message>
|
||||
|
@ -104,14 +104,14 @@
|
|||
<translation>试用到期时间</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="455"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="551"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="453"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="549"/>
|
||||
<source>expired</source>
|
||||
<translation>已过期</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="242"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="456"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="454"/>
|
||||
<source>Extend</source>
|
||||
<translation>延长服务</translation>
|
||||
</message>
|
||||
|
@ -146,17 +146,17 @@
|
|||
<translation>银河麒麟桌面操作系统(平板版)V10 (SP1)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="516"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="514"/>
|
||||
<source>The system needs to be restarted to set the HostName, whether to reboot</source>
|
||||
<translation>计算机名已被修改,需要重启系统才可正常使用。建议立即重启系统!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="517"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="515"/>
|
||||
<source>Reboot Now</source>
|
||||
<translation>立即重启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="518"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="516"/>
|
||||
<source>Reboot Later</source>
|
||||
<translation>稍后重启</translation>
|
||||
</message>
|
||||
|
@ -187,7 +187,7 @@
|
|||
<translation type="vanished">版权所有2009-2021@kylinos保留所有权利</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="543"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="541"/>
|
||||
<source>Version</source>
|
||||
<translation>版本名称</translation>
|
||||
</message>
|
||||
|
@ -243,7 +243,7 @@
|
|||
<translation type="vanished">有效期</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="547"/>
|
||||
<location filename="../../../plugins/system/about/about.cpp" line="545"/>
|
||||
<source>Serial</source>
|
||||
<translation>序列号</translation>
|
||||
</message>
|
||||
|
@ -1083,22 +1083,22 @@
|
|||
<extra-contents_path>/Area/system language</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="375"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="590"/>
|
||||
<source>Simplified Chinese</source>
|
||||
<translation>简体中文</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="180"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="193"/>
|
||||
<source>English (US)</source>
|
||||
<translation>英文 (美国)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="181"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="194"/>
|
||||
<source>Simplified Chinese (CN)</source>
|
||||
<translation>简体中文 (中国)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="182"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="195"/>
|
||||
<source>Tibetan (CN)</source>
|
||||
<translation>藏文 (中国)</translation>
|
||||
</message>
|
||||
|
@ -1108,12 +1108,14 @@
|
|||
<extra-contents_path>/Area/First Day Of Week</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="205"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="218"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="348"/>
|
||||
<source>12 Hours</source>
|
||||
<translation>12小时制</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="206"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="219"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="349"/>
|
||||
<source>24 Hours</source>
|
||||
<translation>24小时制</translation>
|
||||
</message>
|
||||
|
@ -1130,97 +1132,107 @@
|
|||
<translation type="vanished">藏语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="187"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="200"/>
|
||||
<source>Solar calendar</source>
|
||||
<translation>公历</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="188"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="201"/>
|
||||
<source>Lunar</source>
|
||||
<translation>农历</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="193"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="206"/>
|
||||
<source>Monday</source>
|
||||
<translation>星期一</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="194"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="207"/>
|
||||
<source>Sunday</source>
|
||||
<translation>星期日</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="379"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="330"/>
|
||||
<source>MMMM dd, yyyy</source>
|
||||
<translation>yyyy年MM月dd日</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="333"/>
|
||||
<source>MMMM d, yy</source>
|
||||
<translation>yy年M月d日</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="594"/>
|
||||
<source>Tibetan</source>
|
||||
<translation>藏语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="381"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="596"/>
|
||||
<source>Kazakhstan</source>
|
||||
<translation>哈萨克语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="383"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="598"/>
|
||||
<source>Uygur</source>
|
||||
<translation>维吾尔语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="385"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="600"/>
|
||||
<source>Kirghiz</source>
|
||||
<translation>柯尔克孜语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="387"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="602"/>
|
||||
<source>Traditional Chinese</source>
|
||||
<translation>繁体</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="389"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="604"/>
|
||||
<source>Mongolian</source>
|
||||
<translation>蒙古语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="391"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="606"/>
|
||||
<source>German</source>
|
||||
<translation>德语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="393"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="608"/>
|
||||
<source>Spanish</source>
|
||||
<translation>西班牙语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="395"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="610"/>
|
||||
<source>French</source>
|
||||
<translation>法语</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="408"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="623"/>
|
||||
<source>Modify the current region need to logout to take effect, whether to logout?</source>
|
||||
<translation>修改当前区域需要注销后生效,是否注销?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="409"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="624"/>
|
||||
<source>Logout later</source>
|
||||
<translation>稍后注销</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="410"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="625"/>
|
||||
<source>Logout now</source>
|
||||
<translation>立即注销</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="412"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="627"/>
|
||||
<source>Modify the first language need to reboot to take effect, whether to reboot?</source>
|
||||
<translation>修改首选语言需要重启后生效,是否重启?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="413"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="628"/>
|
||||
<source>Reboot later</source>
|
||||
<translation>稍后重启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="414"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="629"/>
|
||||
<source>Reboot now</source>
|
||||
<translation>立即重启</translation>
|
||||
</message>
|
||||
|
@ -1285,7 +1297,7 @@
|
|||
<translation type="vanished">区域格式数据</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="377"/>
|
||||
<location filename="../../../plugins/time-language/area/area.cpp" line="592"/>
|
||||
<source>English</source>
|
||||
<translation>英语</translation>
|
||||
</message>
|
||||
|
@ -1354,25 +1366,35 @@
|
|||
<extra-contents_path>/Area/First Day Of Week</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="44"/>
|
||||
<source>Date</source>
|
||||
<translation>日期</translation>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="46"/>
|
||||
<source>Long Format Date</source>
|
||||
<translation>日期长格式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="45"/>
|
||||
<source>Short Foramt Date</source>
|
||||
<translation>日期短格式</translation>
|
||||
<extra-contents_path>/Area/Date</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="46"/>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="48"/>
|
||||
<source>Date</source>
|
||||
<translation>日期</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="52"/>
|
||||
<source>Time</source>
|
||||
<translation>时间</translation>
|
||||
<extra-contents_path>/Area/Time</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="56"/>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="65"/>
|
||||
<source>Language Format</source>
|
||||
<translation>语言格式</translation>
|
||||
<extra-contents_path>/Area/Language Format</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="74"/>
|
||||
<location filename="../../../plugins/time-language/area/areaui.cpp" line="83"/>
|
||||
<source>System Language</source>
|
||||
<translation>系统语言</translation>
|
||||
<extra-contents_path>/Area/System Language</extra-contents_path>
|
||||
|
@ -2870,87 +2892,87 @@ Please authenticate yourself to continue</source>
|
|||
<context>
|
||||
<name>ChangeUserPwd</name>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="97"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="98"/>
|
||||
<source>Change password</source>
|
||||
<translation>修改密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="102"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="553"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="103"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="552"/>
|
||||
<source>Current Pwd</source>
|
||||
<translation>当前密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="115"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="157"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="190"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="116"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="158"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="191"/>
|
||||
<source>Required</source>
|
||||
<translation>必填</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="146"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="554"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="562"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="147"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="553"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="561"/>
|
||||
<source>New Pwd</source>
|
||||
<translation>新密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="186"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="555"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="563"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="187"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="554"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="562"/>
|
||||
<source>Sure Pwd</source>
|
||||
<translation>确认新密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="248"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="249"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="252"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="374"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="442"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="253"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="375"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="441"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="317"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="626"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="318"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="625"/>
|
||||
<source>Inconsistency with pwd</source>
|
||||
<translation>与新密码不同</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="370"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="371"/>
|
||||
<source>Same with old pwd</source>
|
||||
<translation>与旧密码相同</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="425"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="424"/>
|
||||
<source>Pwd Changed Succes</source>
|
||||
<translation>密码修改成功</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="432"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="431"/>
|
||||
<source>Authentication failed, input authtok again!</source>
|
||||
<translation>密码输入错误,重新输入!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="585"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="584"/>
|
||||
<source>Contains illegal characters!</source>
|
||||
<translation>含有非法字符!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="697"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="696"/>
|
||||
<source>current pwd cannot be empty!</source>
|
||||
<translation>当前密码不能为空!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="702"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="701"/>
|
||||
<source>new pwd cannot be empty!</source>
|
||||
<translation>新密码不能为空!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="707"/>
|
||||
<location filename="../../../plugins/account/userinfo/changeuserpwd.cpp" line="706"/>
|
||||
<source>sure pwd cannot be empty!</source>
|
||||
<translation>确认密码不能为空!</translation>
|
||||
</message>
|
||||
|
@ -3847,7 +3869,7 @@ change system settings</source>
|
|||
<extra-contents_path>/Date/Sync Server</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="331"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="336"/>
|
||||
<source>Add Timezone</source>
|
||||
<translation>添加时区</translation>
|
||||
</message>
|
||||
|
@ -3910,8 +3932,8 @@ change system settings</source>
|
|||
<translation type="vanished">确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="196"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="333"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="201"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetime.cpp" line="338"/>
|
||||
<source>Change Timezone</source>
|
||||
<translation>修改时区</translation>
|
||||
</message>
|
||||
|
@ -3997,23 +4019,33 @@ change system settings</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="164"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="264"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="308"/>
|
||||
<source>Customize</source>
|
||||
<translation>自定义</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="184"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="192"/>
|
||||
<source>Other Timezone</source>
|
||||
<translation>其他时区时间</translation>
|
||||
<extra-contents_path>/Date/Other Timezone</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="253"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="264"/>
|
||||
<source>MMMM d, yy ddd</source>
|
||||
<translation>yy年M月d日 ddd</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="266"/>
|
||||
<source>MMMM dd, yyyy ddd</source>
|
||||
<translation>yyyy年MM月dd日 ddd</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="297"/>
|
||||
<source>Sync failed</source>
|
||||
<translation>同步失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="263"/>
|
||||
<location filename="../../../plugins/time-language/datetime/datetimeui.cpp" line="307"/>
|
||||
<source>Default</source>
|
||||
<translation>系统默认</translation>
|
||||
</message>
|
||||
|
@ -6471,20 +6503,20 @@ Please retry or relogin!</source>
|
|||
<translation type="vanished">设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="421"/>
|
||||
<location filename="../../mainwindow.cpp" line="443"/>
|
||||
<location filename="../../mainwindow.cpp" line="580"/>
|
||||
<location filename="../../mainwindow.cpp" line="1037"/>
|
||||
<location filename="../../mainwindow.cpp" line="380"/>
|
||||
<location filename="../../mainwindow.cpp" line="402"/>
|
||||
<location filename="../../mainwindow.cpp" line="538"/>
|
||||
<location filename="../../mainwindow.cpp" line="902"/>
|
||||
<source>Settings</source>
|
||||
<translation>设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="463"/>
|
||||
<location filename="../../mainwindow.cpp" line="422"/>
|
||||
<source>Option</source>
|
||||
<translation>选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="464"/>
|
||||
<location filename="../../mainwindow.cpp" line="423"/>
|
||||
<source>Minimize</source>
|
||||
<translation>最小化</translation>
|
||||
</message>
|
||||
|
@ -6493,53 +6525,53 @@ Please retry or relogin!</source>
|
|||
<translation type="vanished">最大化/正常</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="183"/>
|
||||
<location filename="../../mainwindow.cpp" line="145"/>
|
||||
<source>Warnning</source>
|
||||
<translation>警告</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="201"/>
|
||||
<location filename="../../mainwindow.cpp" line="163"/>
|
||||
<source>Restore</source>
|
||||
<translation>还原</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="204"/>
|
||||
<location filename="../../mainwindow.cpp" line="465"/>
|
||||
<location filename="../../mainwindow.cpp" line="166"/>
|
||||
<location filename="../../mainwindow.cpp" line="424"/>
|
||||
<source>Maximize</source>
|
||||
<translation>最大化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="437"/>
|
||||
<location filename="../../mainwindow.cpp" line="396"/>
|
||||
<source>Back home</source>
|
||||
<translation>返回首页</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="466"/>
|
||||
<location filename="../../mainwindow.cpp" line="425"/>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="568"/>
|
||||
<location filename="../../mainwindow.cpp" line="526"/>
|
||||
<source>Help</source>
|
||||
<translation>帮助</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="570"/>
|
||||
<location filename="../../mainwindow.cpp" line="528"/>
|
||||
<source>About</source>
|
||||
<translation>关于</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="572"/>
|
||||
<location filename="../../mainwindow.cpp" line="530"/>
|
||||
<source>Exit</source>
|
||||
<translation>退出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="581"/>
|
||||
<location filename="../../mainwindow.cpp" line="539"/>
|
||||
<source>Version: </source>
|
||||
<translation>版本:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="716"/>
|
||||
<location filename="../../mainwindow.cpp" line="667"/>
|
||||
<source>Specified</source>
|
||||
<translation>指定插件</translation>
|
||||
</message>
|
||||
|
@ -6548,13 +6580,13 @@ Please retry or relogin!</source>
|
|||
<translation type="vanished">控制面板</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="1181"/>
|
||||
<location filename="../../mainwindow.cpp" line="1028"/>
|
||||
<source>Warning</source>
|
||||
<translation>警告</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../mainwindow.cpp" line="183"/>
|
||||
<location filename="../../mainwindow.cpp" line="1181"/>
|
||||
<location filename="../../mainwindow.cpp" line="145"/>
|
||||
<location filename="../../mainwindow.cpp" line="1028"/>
|
||||
<source>This function has been controlled</source>
|
||||
<translation>该功能已被管控</translation>
|
||||
</message>
|
||||
|
@ -12964,7 +12996,7 @@ E-mail: support@kylinos.cn</source>
|
|||
<extra-contents_path>/Vino/Require user to enter this password:</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../plugins/system/vino/vinoui.cpp" line="32"/>
|
||||
<location filename="../../../plugins/system/vino/vinoui.cpp" line="39"/>
|
||||
<source>Edit</source>
|
||||
<translation>编辑</translation>
|
||||
</message>
|
||||
|
|
|
@ -0,0 +1,275 @@
|
|||
#include "modulefactory.h"
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QByteArray>
|
||||
#include <QJsonParseError>
|
||||
#include <QJsonObject>
|
||||
#include "interface.h"
|
||||
|
||||
int ModulesFactory::totalModule;
|
||||
QList<int> ModulesFactory::moduleTypeList;
|
||||
QList<QPair<QString, QString>> ModulesFactory::pluginToModuleNameList;
|
||||
QVector<ModuleInfo *> ModulesFactory::moduleInfoVec;
|
||||
QMap<int, QMap<QString, QObject *>> ModulesFactory::moduleTypeToPluginMap;
|
||||
|
||||
const QString MODULEPATH = "/usr/share/ukui-control-center/data/ukui-control-center-config.json";
|
||||
|
||||
ModulesFactory::ModulesFactory() {
|
||||
clear();
|
||||
}
|
||||
|
||||
ModulesFactory::~ModulesFactory() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void ModulesFactory::clear() {
|
||||
totalModule = 0;
|
||||
moduleInfoVec.clear();
|
||||
moduleTypeList.clear();
|
||||
moduleTypeToPluginMap.clear();
|
||||
pluginToModuleNameList.clear();
|
||||
}
|
||||
|
||||
int ModulesFactory::size() {
|
||||
return totalModule;
|
||||
}
|
||||
|
||||
void ModulesFactory::loadConfig() {
|
||||
QFile file(MODULEPATH);
|
||||
moduleInfoVec.clear();
|
||||
if (!file.exists()) {
|
||||
qDebug() << "file not exist:" << MODULEPATH;
|
||||
return;
|
||||
}
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QByteArray readBy = file.readAll();
|
||||
QJsonParseError error;
|
||||
QJsonDocument moduleDoc = QJsonDocument::fromJson(readBy, &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qDebug() << "ModuleFactory parseJson failed:" << error.errorString();
|
||||
return;
|
||||
}
|
||||
QJsonObject modulesObj = moduleDoc.object();
|
||||
if (!modulesObj.contains("ukcc")) {
|
||||
qDebug() << "ModuleFactory has not ukcc item";
|
||||
return;
|
||||
}
|
||||
QJsonArray moduleArr = modulesObj.value("ukcc").toArray();
|
||||
totalModule = moduleArr.size();
|
||||
for (int order = 0; order < totalModule; order++) {
|
||||
QJsonObject moduleObj = moduleArr[order].toObject();
|
||||
QString moduleName = moduleObj["name"].toString().toLower();
|
||||
QString localIconName = moduleObj["local_icon_name"].toString();
|
||||
QString themeIconName = moduleObj["theme_icon_name"].toString();
|
||||
int moduleType = moduleObj["module_type"].toInt();
|
||||
QJsonObject localeObj = moduleObj.value("name_locale").toObject();
|
||||
int moduleOrder = order;
|
||||
ModuleInfo* curModuleInfo = new ModuleInfo(moduleName, moduleOrder, moduleType, themeIconName, localIconName);
|
||||
if (curModuleInfo == nullptr) {
|
||||
continue;
|
||||
}
|
||||
int totalLocale = localeObj.size();
|
||||
for (int localeIdx = 0; localeIdx < totalLocale; ++localeIdx) {
|
||||
QString key = localeObj.keys().at(localeIdx);
|
||||
QString value = localeObj[key].toString();
|
||||
curModuleInfo->appendNameLocale(key, value);
|
||||
}
|
||||
QJsonArray pluginArr = moduleObj.value("childnode").toArray();
|
||||
int totalPlugin = pluginArr.size();
|
||||
for (int pluginIdx = 0; pluginIdx < totalPlugin; ++pluginIdx) {
|
||||
QJsonObject pluginObj = pluginArr[pluginIdx].toObject();
|
||||
if (!pluginObj.keys().contains("name")) {
|
||||
continue;
|
||||
}
|
||||
QString pluginname = pluginObj["name"].toString().toLower();
|
||||
curModuleInfo->appendPluginNameList(pluginIdx, pluginname);
|
||||
}
|
||||
moduleInfoVec.append(curModuleInfo);
|
||||
}
|
||||
std::sort(moduleInfoVec.begin(), moduleInfoVec.end(),
|
||||
[&](const ModuleInfo* lModuleInfo, const ModuleInfo* rModuleInfo) {
|
||||
if (lModuleInfo->moduleOrder != rModuleInfo->moduleOrder) {
|
||||
return lModuleInfo->moduleOrder < rModuleInfo->moduleOrder;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
foreach (ModuleInfo* moduleInfo, moduleInfoVec) {
|
||||
QMap<QString, QObject*> pluginsMaps;
|
||||
int moduleType = moduleInfo->moduleType;
|
||||
moduleTypeToPluginMap.insert(moduleType, pluginsMaps);
|
||||
qDebug() << "modulename: " <<moduleInfo->moduleName << moduleInfo->moduleOrder;
|
||||
}
|
||||
totalModule = moduleInfoVec.size();
|
||||
file.close();
|
||||
}
|
||||
|
||||
void ModulesFactory::loadPluginInfo(QObject* pluginObj) {
|
||||
if (!pluginObj) {
|
||||
return;
|
||||
}
|
||||
CommonInterface* pluginInstance = qobject_cast<CommonInterface*>(pluginObj);
|
||||
if (!pluginInstance) {
|
||||
return;
|
||||
}
|
||||
QString name = pluginInstance->name().toLower();
|
||||
QString i18nName = pluginInstance->plugini18nName();
|
||||
int moduleType = pluginInstance->pluginTypes();
|
||||
bool isShow = pluginInstance->isShowOnHomePage();
|
||||
bool isEnable = pluginInstance->isEnable();
|
||||
ModuleInfo* moduleInfo = getModuleInfoByType(moduleType);
|
||||
if (moduleInfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
QList<QString>& pluginName = moduleInfo->pluginNameList;
|
||||
QList<PluginInfo>& pluginInfoList = moduleInfo->pluginInfoList;
|
||||
|
||||
// 查找当前加载的插件序号i
|
||||
int pluginIdx = 0;
|
||||
for (; pluginIdx < pluginName.size(); pluginIdx++) {
|
||||
if (name.compare(pluginName.at(pluginIdx), Qt::CaseInsensitive) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
PluginInfo pluginInfo;
|
||||
pluginInfo.oriNameString = pluginInstance->name();
|
||||
pluginInfo.nameString = name;
|
||||
pluginInfo.namei18nString = i18nName;
|
||||
pluginInfo.type = moduleType;
|
||||
pluginInfo.mainShow = isShow;
|
||||
pluginInfo.isEnable = isEnable;
|
||||
QPair<QString, QString> data;
|
||||
data.first = pluginInfo.nameString;
|
||||
data.second = moduleInfo->moduleName;
|
||||
pluginToModuleNameList.append(data);
|
||||
if (!moduleTypeList.contains(pluginInfo.type)) {
|
||||
moduleTypeList.append(pluginInfo.type);
|
||||
}
|
||||
int pluginInfoListSize = pluginInfoList.size();
|
||||
if (pluginInfoListSize == 0) {
|
||||
pluginInfoList.append(pluginInfo);
|
||||
} else {
|
||||
bool isInsert = false;
|
||||
// 遍历原有list,对比pluginInfo的序号与list中每个元素序号的关系
|
||||
for (int preItemIndex = pluginInfoListSize - 1; preItemIndex >= 0; preItemIndex--) {
|
||||
int nItemIndex = 0;
|
||||
for (nItemIndex = 0; nItemIndex < pluginName.count(); nItemIndex++) {
|
||||
if (pluginInfoList[preItemIndex].nameString.toLower().compare(pluginName.at(nItemIndex).toLower(), Qt::CaseInsensitive) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 原有list元素序号小于新的module序号,将module插入该元素之后
|
||||
if (nItemIndex <= pluginIdx) {
|
||||
pluginInfoList.insert(preItemIndex + 1, pluginInfo);
|
||||
isInsert = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isInsert) {
|
||||
pluginInfoList.insert(0, pluginInfo);
|
||||
}
|
||||
}
|
||||
moduleTypeToPluginMap[moduleType].insert(i18nName, pluginObj);
|
||||
}
|
||||
|
||||
QString ModulesFactory::getModuleNamebyName(QString pluginName) {
|
||||
QString moduleName = "";
|
||||
for (auto it : pluginToModuleNameList) {
|
||||
if (it.first.toLower() == pluginName.toLower()) {
|
||||
moduleName = it.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
PluginInfo* ModulesFactory::getPluginInfoByName(QString pluginName) {
|
||||
for (int moduleIdx = 0; moduleIdx < totalModule; moduleIdx++) {
|
||||
for (int pluginIdx = 0; pluginIdx < moduleInfoVec.at(moduleIdx)->pluginInfoList.size(); pluginIdx++) {
|
||||
if (!moduleInfoVec.at(moduleIdx)->pluginInfoList[pluginIdx].nameString.compare(pluginName, Qt::CaseInsensitive)) {
|
||||
return &moduleInfoVec.at(moduleIdx)->pluginInfoList[pluginIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QObject* ModulesFactory::getPluginObjectByName(QString pluginil8Name) {
|
||||
for (int idx = 0; idx < moduleTypeToPluginMap.size(); ++idx) {
|
||||
if (moduleTypeToPluginMap[idx].contains(pluginil8Name)) {
|
||||
return moduleTypeToPluginMap[idx][pluginil8Name];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QObject* ModulesFactory::getPluginObjectByType(int moduleType, QString pluginil8Name) {
|
||||
if (moduleTypeToPluginMap.contains(moduleType)) {
|
||||
return nullptr;
|
||||
}
|
||||
QMap<QString, QObject*> curPluginMap = moduleTypeToPluginMap[moduleType];
|
||||
if (!curPluginMap.empty() && curPluginMap.keys().contains(pluginil8Name)) {
|
||||
return curPluginMap.value(pluginil8Name);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ModuleInfo* ModulesFactory::getModuleInfoByIndex(int index) {
|
||||
if (!checkModuleIndex(index)) {
|
||||
return nullptr;
|
||||
}
|
||||
return moduleInfoVec[index];
|
||||
}
|
||||
|
||||
ModuleInfo* ModulesFactory::getModuleInfoByType(int moduleType) {
|
||||
for (int moduleIdx = 0; moduleIdx < totalModule; moduleIdx++) {
|
||||
int curModuleType = moduleInfoVec[moduleIdx]->moduleType;
|
||||
if (moduleType != curModuleType) {
|
||||
continue;
|
||||
}
|
||||
return moduleInfoVec[moduleIdx];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ModulesFactory::checkPluginExist(QString pluginil8Name) {
|
||||
for (int idx = 0; idx < moduleTypeToPluginMap.size(); ++idx) {
|
||||
if (moduleTypeToPluginMap[idx].contains(pluginil8Name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ModulesFactory::checkModuleIndex(int index) {
|
||||
int moduleSize = moduleInfoVec.size();
|
||||
if (index >= 0 && index < moduleSize) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ModulesFactory::checkModuleType(int moduleType) {
|
||||
return moduleTypeList.contains(moduleType);
|
||||
}
|
||||
|
||||
void ModulesFactory::pluginDelete() {
|
||||
QMap<QString, QObject*> moduleMap;
|
||||
for (auto plugin : moduleTypeList) {
|
||||
if (!moduleTypeToPluginMap.contains(plugin)) {
|
||||
continue;
|
||||
}
|
||||
moduleMap = moduleTypeToPluginMap[plugin];
|
||||
QMap<QString, QObject*>::const_iterator it;
|
||||
for (it = moduleMap.constBegin(); it != moduleMap.constEnd(); ++it) {
|
||||
CommonInterface* pluginInstance = qobject_cast<CommonInterface*>(it.value());
|
||||
if (pluginInstance) {
|
||||
qInfo() << "~exit && delete-plugin:" << pluginInstance->name();
|
||||
delete pluginInstance;
|
||||
pluginInstance = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
#ifndef MODULEFACTORY_H
|
||||
#define MODULEFACTORY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaEnum>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QStack>
|
||||
//#include "interface.h"
|
||||
#include <QDebug>
|
||||
|
||||
struct PluginInfo {
|
||||
int type;
|
||||
int index;
|
||||
bool mainShow;
|
||||
bool isEnable;
|
||||
QString oriNameString;
|
||||
QString nameString;
|
||||
QString namei18nString;
|
||||
};
|
||||
|
||||
struct ModuleInfo {
|
||||
ModuleInfo(QString modulename, int moduleorder,int moduletype,
|
||||
QString themeiconname, QString localiconname) {
|
||||
clear();
|
||||
moduleName = modulename;
|
||||
moduleOrder = moduleorder;
|
||||
localIconName = localiconname;
|
||||
themeIconName = themeiconname;
|
||||
moduleType = moduletype;
|
||||
}
|
||||
~ModuleInfo() {
|
||||
clear();
|
||||
}
|
||||
void clear() {
|
||||
moduleOrder = -1;
|
||||
moduleType = -1;
|
||||
moduleName.clear();
|
||||
moduleLocaleMap.clear();
|
||||
pluginNameList.clear();
|
||||
pluginInfoList.clear();
|
||||
localIconName.clear();
|
||||
themeIconName.clear();
|
||||
}
|
||||
void appendNameLocale(QString key, QString value) {
|
||||
moduleLocaleMap.insert(key, value);
|
||||
}
|
||||
void appendPluginNameList(int index, QString value) {
|
||||
pluginNameList.insert(index, value);
|
||||
}
|
||||
QString getModuleNameLocale(const QString locale) {
|
||||
QString moduleName = "";
|
||||
if (moduleLocaleMap.find(locale) != moduleLocaleMap.end()) {
|
||||
moduleName = moduleLocaleMap[locale];
|
||||
}
|
||||
return moduleName;
|
||||
}
|
||||
int moduleOrder;
|
||||
int moduleType;
|
||||
QString moduleName;
|
||||
QString themeIconName;
|
||||
QString localIconName;
|
||||
QMap<QString, QString> moduleLocaleMap;
|
||||
QList<QString> pluginNameList;
|
||||
QList<PluginInfo> pluginInfoList;
|
||||
};
|
||||
|
||||
class ModulesFactory : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModulesFactory();
|
||||
~ModulesFactory();
|
||||
|
||||
public:
|
||||
static void loadConfig();
|
||||
static void loadPluginInfo(QObject* pluginObj);
|
||||
static ModuleInfo* getModuleInfoByIndex(int index);
|
||||
static ModuleInfo* getModuleInfoByType(int moduleType);
|
||||
static QString getModuleNamebyName(QString pluginName);
|
||||
static QObject* getPluginObjectByName(QString pluginil8Name);
|
||||
static QObject* getPluginObjectByType(int moduleType, QString pluginil8Name);
|
||||
static PluginInfo* getPluginInfoByName(QString pluginName);
|
||||
static bool checkModuleType(int moduleType);
|
||||
static bool checkPluginExist(QString pluginil8Name);
|
||||
static void pluginDelete();
|
||||
static int size();
|
||||
|
||||
private:
|
||||
static void clear();
|
||||
static bool checkModuleIndex(int index);
|
||||
|
||||
private:
|
||||
static int totalModule;
|
||||
static QVector<ModuleInfo *> moduleInfoVec;
|
||||
static QList<int> moduleTypeList;
|
||||
static QList<QPair<QString, QString>> pluginToModuleNameList;
|
||||
static QMap<int, QMap<QString, QObject *>> moduleTypeToPluginMap;
|
||||
};
|
||||
|
||||
#endif // MODULEFACTORY_H
|
Loading…
Reference in New Issue