Skip to content

Commit f1e73d7

Browse files
committed
fix: Fix the issue with link text style errors
Fix the issue with link text style errors Log: Fix the issue with link text style errors pms: BUG-320975
1 parent 0613e62 commit f1e73d7

File tree

3 files changed

+50
-16
lines changed

3 files changed

+50
-16
lines changed

src/plugin-systeminfo/operation/systeminfowork.cpp

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ SystemInfoWork::SystemInfoWork(SystemInfoModel *model, QObject *parent)
6666
&SystemInfoDBusProxy::ShortDateFormatChanged,
6767
this,
6868
&SystemInfoWork::onShortDateFormatChanged);
69+
connect(Dtk::Gui::DGuiApplicationHelper::instance(),
70+
&Dtk::Gui::DGuiApplicationHelper::themeTypeChanged,
71+
this,
72+
&SystemInfoWork::onThemeTypeChanged);
6973

7074

7175
updateFrequency(false);
@@ -136,18 +140,7 @@ void SystemInfoWork::activate()
136140
// 用户体验计划内容
137141
m_model->setJoinUeProgram(isUeProgramEnabled());
138142

139-
http = IS_COMMUNITY_SYSTEM ? tr("https://www.deepin.org/en/agreement/privacy/") : tr("https://www.uniontech.com/agreement/experience-en");
140-
if (IS_COMMUNITY_SYSTEM) {
141-
text = tr("<p>Joining User Experience Program means that you grant and authorize us to collect and use the information of your device, system and applications. "
142-
"If you refuse our collection and use of the aforementioned information, do not join User Experience Program. "
143-
"For details, please refer to Deepin Privacy Policy (<a href=\"%1\"> %1</a>).</p>")
144-
.arg(http);
145-
} else {
146-
text = tr("<p>Joining User Experience Program means that you grant and authorize us to collect and use the information of your device, system and applications. "
147-
"If you refuse our collection and use of the aforementioned information, please do not join it. For the details of User Experience Program, please visit <a href=\"%1\"> %1</a>.</p>")
148-
.arg(http);
149-
}
150-
m_model->setUserExperienceProgramText(text);
143+
updateUserExperienceProgramText();
151144

152145
m_model->setShowDetail(true);
153146

@@ -167,6 +160,37 @@ void SystemInfoWork::activate()
167160
initSystemCopyright();
168161
}
169162

163+
void SystemInfoWork::updateUserExperienceProgramText()
164+
{
165+
if (!m_model)
166+
return;
167+
168+
QString http = IS_COMMUNITY_SYSTEM ? tr("https://www.deepin.org/en/agreement/privacy/")
169+
: tr("https://www.uniontech.com/agreement/experience-en");
170+
171+
// 根据当前主题选择普通文本颜色:浅色主题用半透明黑,深色主题用半透明白
172+
auto themeType = Dtk::Gui::DGuiApplicationHelper::instance()->themeType();
173+
const QString normalColor = themeType == Dtk::Gui::DGuiApplicationHelper::DarkType
174+
? QStringLiteral("#B3FFFFFF")
175+
: QStringLiteral("#64000000");
176+
177+
QString text;
178+
if (IS_COMMUNITY_SYSTEM) {
179+
text = tr("<p><span style=\"color:%2;\">Joining User Experience Program means that you grant and authorize us to collect and use the information of your device, system and applications. "
180+
"If you refuse our collection and use of the aforementioned information, do not join User Experience Program. "
181+
"For details, please refer to Deepin Privacy Policy (</span><a href=\"%1\" style=\"text-decoration: none;\">%1</a><span style=\"color:%2;\">).</span></p>")
182+
.arg(http)
183+
.arg(normalColor);
184+
} else {
185+
text = tr("<p><span style=\"color:%2;\">Joining User Experience Program means that you grant and authorize us to collect and use the information of your device, system and applications. "
186+
"If you refuse our collection and use of the aforementioned information, please do not join it. For the details of User Experience Program, please visit </span><a href=\"%1\" style=\"text-decoration: none;\">%1</a><span style=\"color:%2;\">.</span></p>")
187+
.arg(http)
188+
.arg(normalColor);
189+
}
190+
191+
m_model->setUserExperienceProgramText(text);
192+
}
193+
170194
void SystemInfoWork::deactivate() { }
171195

172196
QString SystemInfoWork::getEndUserAgreementText()
@@ -451,6 +475,11 @@ void SystemInfoWork::onShortDateFormatChanged(const int)
451475
m_model->setSystemInstallationDate(getSystemInstallDate(m_systemInfDBusProxy->shortDateFormat(), m_systemInfDBusProxy->timezone()));
452476
}
453477

478+
void SystemInfoWork::onThemeTypeChanged()
479+
{
480+
updateUserExperienceProgramText();
481+
}
482+
454483
bool SystemInfoWork::isUeProgramEnabled()
455484
{
456485
if (!m_dBusUeProgram || !m_dBusUeProgram->isValid())

src/plugin-systeminfo/operation/systeminfowork.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public Q_SLOTS:
5555
void onTimezoneChanged(const QString timezone);
5656
void onShortDateFormatChanged(const int shortDateFormate);
5757
void onLicenseAuthorizationProperty();
58+
void onThemeTypeChanged();
5859

5960
private:
6061
void getLicenseState();
62+
void updateUserExperienceProgramText();
6163

6264
private:
6365
SystemInfoModel *m_model;

src/plugin-systeminfo/qml/UserExperienceProgramPage.qml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ DccObject {
6262
pageType: DccObject.Item
6363
page: D.Label {
6464
id: userExperienceLabel
65-
anchors.fill: parent
66-
anchors.margins: 10
67-
font: DTK.fontManager.t6
65+
leftPadding: 10
66+
rightPadding: 10
67+
topPadding: 10
68+
bottomPadding: 10
69+
font: D.DTK.fontManager.t6
6870
horizontalAlignment: Text.AlignLeft
6971
wrapMode: Text.WordWrap
70-
opacity: 0.7
72+
textFormat: Text.RichText
73+
width: parent ? parent.width : implicitWidth
7174
text: dccData.systemInfoMode().userExperienceProgramText
7275

7376
property string currentLinkUrl: ""

0 commit comments

Comments
 (0)