From 778442f97f0af8631980f4dc75ee264c448b8d6e Mon Sep 17 00:00:00 2001
From: leeffo <leeffo@yeah.net>
Date: Thu, 16 Feb 2023 14:48:33 +0800
Subject: [PATCH] dde-control-center uos add Free license

---
 include/widgets/utils.h                                  | 3 ++-
 src/frame/modules/systeminfo/systeminfomodel.h           | 3 ++-
 src/frame/window/modules/systeminfo/nativeinfowidget.cpp | 4 ++++
 translations/dde-control-center_zh_CN.ts                 | 7 ++++++-
 translations/dde-control-center_zh_HK.ts                 | 7 ++++++-
 translations/dde-control-center_zh_TW.ts                 | 7 ++++++-
 6 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/include/widgets/utils.h b/include/widgets/utils.h
index 1387ada..45debcc 100644
--- a/include/widgets/utils.h
+++ b/include/widgets/utils.h
@@ -39,7 +39,8 @@ enum UiActiveState {
     Authorized,  //已授权
     AuthorizedLapse,  //授权失效
     TrialAuthorized, //试用期已授权
-    TrialExpired //试用期已过期
+    TrialExpired, //试用期已过期
+    FreeLicenseAuthorized = 5 //商业免费授权
 };
 
 inline bool isFileExist(const QString &path){
diff --git a/src/frame/modules/systeminfo/systeminfomodel.h b/src/frame/modules/systeminfo/systeminfomodel.h
index 8cdb1fa..401c76f 100644
--- a/src/frame/modules/systeminfo/systeminfomodel.h
+++ b/src/frame/modules/systeminfo/systeminfomodel.h
@@ -19,7 +19,8 @@ enum ActiveState {
     Authorized,  //已授权
     AuthorizedLapse,  //授权失效
     TrialAuthorized, //试用期已授权
-    TrialExpired //试用期已过期
+    TrialExpired, //试用期已过期
+    FreeLicenseAuthorized = 5 //商业免费授权
 };
 
 class SystemInfoModel : public QObject
diff --git a/src/frame/window/modules/systeminfo/nativeinfowidget.cpp b/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
index 7c6c1b5..771bb57 100644
--- a/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
+++ b/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
@@ -357,6 +357,10 @@ void NativeInfoWidget::setLicenseState(ActiveState state)
         m_authorized->setValue(tr("Trial expired"));
         m_authorized->setValueForegroundRole(QColor(255, 87, 54));
         m_authorized->setButtonText(tr("Activate"));
+    } else if (state == FreeLicenseAuthorized) {
+        m_authorized->setValue(tr("Free license"));
+        m_authorized->setValueForegroundRole(QColor(21, 187, 24));
+        m_authorized->setButtonText(tr("View"));
     }
 }
 
diff --git a/translations/dde-control-center_zh_CN.ts b/translations/dde-control-center_zh_CN.ts
index 2ce90ac..3d5e66b 100644
--- a/translations/dde-control-center_zh_CN.ts
+++ b/translations/dde-control-center_zh_CN.ts
@@ -4511,6 +4511,11 @@
         <source>Activate</source>
         <translation>激活</translation>
     </message>
+    <message>
+        <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="362"/>
+        <source>Free license</source>
+        <translation>免费授权</translation>
+    </message>
     <message>
         <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="214"/>
         <source>Kernel</source>
@@ -6488,4 +6493,4 @@ UnionTech Software is committed to research and improve the security, accuracy a
         <translation>控制中心提供操作系统的所有设置选项。</translation>
     </message>
 </context>
-</TS>
\ No newline at end of file
+</TS>
diff --git a/translations/dde-control-center_zh_HK.ts b/translations/dde-control-center_zh_HK.ts
index 9ba8c3a..2adaccd 100644
--- a/translations/dde-control-center_zh_HK.ts
+++ b/translations/dde-control-center_zh_HK.ts
@@ -4511,6 +4511,11 @@
         <source>Activate</source>
         <translation>啟用</translation>
     </message>
+    <message>
+        <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="362"/>
+        <source>Free license</source>
+        <translation>免費授權</translation>
+    </message>
     <message>
         <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="214"/>
         <source>Kernel</source>
@@ -6488,4 +6493,4 @@ UnionTech Software is committed to research and improve the security, accuracy a
         <translation>控制中心提供操作系統的所有設置選項。</translation>
     </message>
 </context>
-</TS>
\ No newline at end of file
+</TS>
diff --git a/translations/dde-control-center_zh_TW.ts b/translations/dde-control-center_zh_TW.ts
index 23f6817..de875ec 100644
--- a/translations/dde-control-center_zh_TW.ts
+++ b/translations/dde-control-center_zh_TW.ts
@@ -4511,6 +4511,11 @@
         <source>Activate</source>
         <translation>啟用</translation>
     </message>
+    <message>
+        <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="362"/>
+        <source>Free license</source>
+        <translation>免費授權</translation>
+    </message>
     <message>
         <location filename="../src/frame/window/modules/systeminfo/nativeinfowidget.cpp" line="214"/>
         <source>Kernel</source>
@@ -6488,4 +6493,4 @@ UnionTech Software is committed to research and improve the security, accuracy a
         <translation>《控制中心》提供系統設定選項。</translation>
     </message>
 </context>
-</TS>
\ No newline at end of file
+</TS>
-- 
2.20.1

