dde-control-center/0002-hide-authorized.patch

637 lines
24 KiB
Diff
Raw Normal View History

2023-04-10 09:45:16 +08:00
From cf9e61a42436a5eeea0aeccd702a477aa8ca3d9a Mon Sep 17 00:00:00 2001
From: leeffo <loong_c@yeah.net>
Date: Tue, 23 Aug 2022 16:33:21 +0800
Subject: [PATCH] hide authorized
---
2023-04-10 09:45:16 +08:00
src/frame/CMakeLists.txt | 1 +
.../modules/systeminfo/systeminfomodel.cpp | 5 ++++-
.../modules/systeminfo/systeminfomodel.h | 12 ++++++++++
.../modules/systeminfo/systeminfowork.cpp | 6 +++++
src/frame/modules/systeminfo/systeminfowork.h | 4 ++++
src/frame/modules/update/updatemodel.cpp | 4 ++++
src/frame/modules/update/updatemodel.h | 6 +++++
src/frame/modules/update/updatework.cpp | 4 ++++
src/frame/modules/update/updatework.h | 4 ++++
.../modules/systeminfo/nativeinfowidget.cpp | 14 ++++++++++++
.../modules/systeminfo/nativeinfowidget.h | 6 +++++
.../modules/systeminfo/systeminfomodule.cpp | 2 ++
.../modules/update/updatectrlwidget.cpp | 22 +++++++++++++++++++
.../window/modules/update/updatectrlwidget.h | 6 +++++
.../window/modules/update/updatemodule.cpp | 6 ++++-
15 files changed, 100 insertions(+), 2 deletions(-)
diff --git a/src/frame/CMakeLists.txt b/src/frame/CMakeLists.txt
2023-04-10 09:45:16 +08:00
index 319ca1d..9b7638b 100644
--- a/src/frame/CMakeLists.txt
+++ b/src/frame/CMakeLists.txt
@@ -30,6 +30,7 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif ()
set(DEFINED_LIST
+DISABLE_ACTIVATOR
DISABLE_OPACITY_ANIMATION
DISABLE_CLOUD_SYNC
DISABLE_SYS_UPDATE
diff --git a/src/frame/modules/systeminfo/systeminfomodel.cpp b/src/frame/modules/systeminfo/systeminfomodel.cpp
2023-04-10 09:45:16 +08:00
index c890183..20da279 100644
--- a/src/frame/modules/systeminfo/systeminfomodel.cpp
+++ b/src/frame/modules/systeminfo/systeminfomodel.cpp
@@ -60,7 +60,9 @@ SystemInfoModel::SystemInfoModel(QObject *parent)
, m_themeEnabled(false)
, m_updating(false)
, m_type(64)
+#ifndef DISABLE_ACTIVATOR
, m_licenseState(ActiveState::Unauthorized)
+#endif
{
}
2023-04-10 09:45:16 +08:00
@@ -227,6 +229,7 @@ void SystemInfoModel::setKernel(const QString &kernel)
kernelChanged(kernel);
}
+#ifndef DISABLE_ACTIVATOR
void SystemInfoModel::setLicenseState(ActiveState state)
{
if (m_licenseState != state) {
2023-04-10 09:45:16 +08:00
@@ -234,6 +237,6 @@ void SystemInfoModel::setLicenseState(ActiveState state)
Q_EMIT licenseStateChanged(state);
}
}
2023-04-10 09:45:16 +08:00
-
+#endif
}
}
diff --git a/src/frame/modules/systeminfo/systeminfomodel.h b/src/frame/modules/systeminfo/systeminfomodel.h
2023-04-10 09:45:16 +08:00
index 7ae81e0..ce4dfb9 100644
--- a/src/frame/modules/systeminfo/systeminfomodel.h
+++ b/src/frame/modules/systeminfo/systeminfomodel.h
@@ -34,6 +34,7 @@ namespace systeminfo{
// !!! 不要用C++11的前置声明枚举类型这里lupdate命令有个bug具体见
// https://stackoverflow.com/questions/6504902/lupdate-error-qualifying-with-unknown-namespace-class
+#ifndef DISABLE_ACTIVATOR
//授权状态
enum ActiveState {
Unauthorized = 0, //未授权
@@ -42,6 +43,7 @@ enum ActiveState {
TrialAuthorized, //试用期已授权
TrialExpired //试用期已过期
};
+#endif
class SystemInfoModel : public QObject
{
2023-04-10 09:45:16 +08:00
@@ -65,7 +67,9 @@ public:
QString kernel() const { return m_kernel;}
2023-04-10 09:45:16 +08:00
QString hostName() const { return m_hostName;}
+#ifndef DISABLE_ACTIVATOR
inline ActiveState licenseState() const { return m_licenseState; }
+#endif
bool bootDelay() const;
bool themeEnabled() const { return m_themeEnabled; }
2023-04-10 09:45:16 +08:00
@@ -90,7 +94,9 @@ Q_SIGNALS:
void memoryChanged(const QString& memory);
void diskChanged(const QString& disk);
void kernelChanged(const QString& kernel);
+#ifndef DISABLE_ACTIVATOR
void licenseStateChanged(ActiveState state);
+#endif
2023-04-10 09:45:16 +08:00
void hostNameChanged(const QString& hostName);
void setHostNameChanged(const QString& hostName);
void setHostNameError(const QString& error);
@@ -110,7 +116,9 @@ public Q_SLOTS:
void setMemory(qulonglong totalMemory, qulonglong installedMemory);
void setDisk(qulonglong disk);
void setKernel(const QString &kernel);
+#ifndef DISABLE_ACTIVATOR
void setLicenseState(ActiveState state);
+#endif
2023-04-10 09:45:16 +08:00
void setHostName(const QString& hostName);
private:
2023-04-10 09:45:16 +08:00
@@ -132,12 +140,16 @@ private:
QString m_disk;
QString m_kernel;
2023-04-10 09:45:16 +08:00
QString m_hostName;
+#ifndef DISABLE_ACTIVATOR
ActiveState m_licenseState;
+#endif
};
}
}
+#ifndef DISABLE_ACTIVATOR
Q_DECLARE_METATYPE(dcc::systeminfo::ActiveState);
+#endif
#endif // SYSTEMINFOMODEL_H
diff --git a/src/frame/modules/systeminfo/systeminfowork.cpp b/src/frame/modules/systeminfo/systeminfowork.cpp
2023-04-10 09:45:16 +08:00
index 4173622..a688706 100644
--- a/src/frame/modules/systeminfo/systeminfowork.cpp
+++ b/src/frame/modules/systeminfo/systeminfowork.cpp
2023-04-10 09:45:16 +08:00
@@ -111,12 +111,14 @@ SystemInfoWork::SystemInfoWork(SystemInfoModel *model, QObject *parent)
m_dbusGrubTheme->setSync(false, false);
2023-04-10 09:45:16 +08:00
m_dbusHostName->setSync(false, false);
+#ifndef DISABLE_ACTIVATOR
if (DSysInfo::isDeepin()) {
QDBusConnection::systemBus().connect("com.deepin.license", "/com/deepin/license/Info",
"com.deepin.license.Info", "LicenseStateChange",
this, SLOT(licenseStateChangeSlot()));
licenseStateChangeSlot();
}
+#endif
connect(m_dbusGrub, &GrubDbus::DefaultEntryChanged, m_model, &SystemInfoModel::setDefaultEntry);
connect(m_dbusGrub, &GrubDbus::EnableThemeChanged, m_model, &SystemInfoModel::setThemeEnabled);
2023-04-10 09:45:16 +08:00
@@ -160,7 +162,9 @@ SystemInfoWork::SystemInfoWork(SystemInfoModel *model, QObject *parent)
void SystemInfoWork::activate()
{
+#ifndef DISABLE_ACTIVATOR
qRegisterMetaType<ActiveState>("ActiveState");
+#endif
m_model->setDistroID(m_systemInfoInter->distroID());
m_model->setDistroVer(m_systemInfoInter->distroVer());
m_model->setDisk(m_systemInfoInter->diskCap());
2023-04-10 09:45:16 +08:00
@@ -309,6 +313,7 @@ void SystemInfoWork::setBackground(const QString &path)
});
}
+#ifndef DISABLE_ACTIVATOR
void SystemInfoWork::showActivatorDialog()
{
QDBusInterface activator("com.deepin.license.activator",
2023-04-10 09:45:16 +08:00
@@ -327,6 +332,7 @@ void SystemInfoWork::licenseStateChangeSlot()
QFuture<void> future = QtConcurrent::run(this, &SystemInfoWork::getLicenseState);
watcher->setFuture(future);
}
+#endif
void SystemInfoWork::getEntryTitles()
{
diff --git a/src/frame/modules/systeminfo/systeminfowork.h b/src/frame/modules/systeminfo/systeminfowork.h
2023-04-10 09:45:16 +08:00
index f092cdf..e3466f0 100644
--- a/src/frame/modules/systeminfo/systeminfowork.h
+++ b/src/frame/modules/systeminfo/systeminfowork.h
2023-04-10 09:45:16 +08:00
@@ -64,14 +64,18 @@ public Q_SLOTS:
void grubServerFinished();
void onBackgroundChanged();
void setBackground(const QString &path);
+#ifndef DISABLE_ACTIVATOR
void showActivatorDialog();
void licenseStateChangeSlot();
+#endif
void processChanged(QDBusMessage msg);
private:
void getEntryTitles();
void getBackgroundFinished(QDBusPendingCallWatcher *w);
+#ifndef DISABLE_ACTIVATOR
void getLicenseState();
+#endif
private:
SystemInfoModel* m_model;
diff --git a/src/frame/modules/update/updatemodel.cpp b/src/frame/modules/update/updatemodel.cpp
index 378f33d..4fcc591 100644
--- a/src/frame/modules/update/updatemodel.cpp
+++ b/src/frame/modules/update/updatemodel.cpp
@@ -69,7 +69,9 @@ UpdateModel::UpdateModel(QObject *parent)
, m_bRecoverRestoring(false)
, m_systemVersionInfo("")
, m_metaEnum(QMetaEnum::fromType<ModelUpdatesStatus>())
+#ifndef DISABLE_ACTIVATOR
, m_bSystemActivation(UiActiveState::Unknown)
+#endif
, m_autoCheckUpdateCircle(0)
, m_isUpdatablePackages(false)
@@ -353,6 +355,7 @@ void UpdateModel::setSystemVersionInfo(const QString &systemVersionInfo)
Q_EMIT systemVersionChanged(systemVersionInfo);
}
+#ifndef DISABLE_ACTIVATOR
void UpdateModel::setSystemActivation(const UiActiveState &systemactivation)
{
if (m_bSystemActivation == systemactivation) {
@@ -362,6 +365,7 @@ void UpdateModel::setSystemActivation(const UiActiveState &systemactivation)
Q_EMIT systemActivationChanged(systemactivation);
}
+#endif
void UpdateModel::isUpdatablePackages(bool isUpdatablePackages)
{
diff --git a/src/frame/modules/update/updatemodel.h b/src/frame/modules/update/updatemodel.h
2023-04-10 09:45:16 +08:00
index b268e09..036292c 100644
--- a/src/frame/modules/update/updatemodel.h
+++ b/src/frame/modules/update/updatemodel.h
@@ -158,8 +158,10 @@ public:
bool getIsRecoveryBackingup(UpdatesStatus state) const;
+#ifndef DISABLE_ACTIVATOR
inline UiActiveState systemActivation() const {return m_bSystemActivation;}
void setSystemActivation(const UiActiveState &systemactivation);
+#endif
inline bool getUpdatablePackages() const {return m_isUpdatablePackages;}
void isUpdatablePackages(bool isUpdatablePackages);
@@ -203,7 +205,9 @@ Q_SIGNALS:
void recoverConfigValidChanged(bool recoverConfigValid);
void recoverRestoringChanged(bool recoverRestoring);
void systemVersionChanged(QString version);
+#ifndef DISABLE_ACTIVATOR
void systemActivationChanged(UiActiveState systemactivation);
+#endif
void beginCheckUpdate();
void updateCheckUpdateTime();
void updateHistoryAppInfos();
2023-04-10 09:45:16 +08:00
@@ -239,7 +243,9 @@ private:
bool m_bRecoverRestoring;
QString m_systemVersionInfo;
QMetaEnum m_metaEnum;
+#ifndef DISABLE_ACTIVATOR
UiActiveState m_bSystemActivation;
+#endif
QString m_lastCheckUpdateTime; //上次检查更新时间
QList<AppUpdateInfo> m_historyAppInfos; //历史更新应用列表
diff --git a/src/frame/modules/update/updatework.cpp b/src/frame/modules/update/updatework.cpp
2023-04-10 09:45:16 +08:00
index 01e9a3f..71d889d 100644
--- a/src/frame/modules/update/updatework.cpp
+++ b/src/frame/modules/update/updatework.cpp
2023-04-10 09:45:16 +08:00
@@ -199,6 +199,7 @@ void UpdateWorker::init() {
#endif
}
+#ifndef DISABLE_ACTIVATOR
void UpdateWorker::licenseStateChangeSlot()
{
QFutureWatcher<void> *watcher = new QFutureWatcher<void>();
2023-04-10 09:45:16 +08:00
@@ -226,6 +227,7 @@ void UpdateWorker::getLicenseState()
qDebug() << "Authorization State:" << reply;
m_model->setSystemActivation(reply);
}
+#endif
void UpdateWorker::activate()
{
@@ -260,11 +262,13 @@ void UpdateWorker::activate()
refreshMirrors();
#endif
+#ifndef DISABLE_ACTIVATOR
licenseStateChangeSlot();
QDBusConnection::systemBus().connect("com.deepin.license", "/com/deepin/license/Info",
"com.deepin.license.Info", "LicenseStateChange",
this, SLOT(licenseStateChangeSlot()));
+#endif
QFutureWatcher<QStringList> *packagesWatcher = new QFutureWatcher<QStringList>();
connect(packagesWatcher, &QFutureWatcher<QStringList>::finished, this, [=] {
diff --git a/src/frame/modules/update/updatework.h b/src/frame/modules/update/updatework.h
2023-04-10 09:45:16 +08:00
index 66cfbdb..4e4a65a 100644
--- a/src/frame/modules/update/updatework.h
+++ b/src/frame/modules/update/updatework.h
@@ -72,7 +72,9 @@ public:
void setOnBattery(bool onBattery);
void setBatteryPercentage(const BatteryPercentageInfo &info);
void setSystemBatteryPercentage(const double &value);
+#ifndef DISABLE_ACTIVATOR
void getLicenseState();
+#endif
Q_SIGNALS:
void requestInit();
@@ -107,7 +109,9 @@ public Q_SLOTS:
void recoveryCanBackup();
void recoveryStartRestore();
void onNotifyDownloadInfoChanged();
+#ifndef DISABLE_ACTIVATOR
void licenseStateChangeSlot();
+#endif
void refreshHistoryAppsInfo();
void refreshLastTimeAndCheckCircle();
void setUpdateNotify(const bool notify);
diff --git a/src/frame/window/modules/systeminfo/nativeinfowidget.cpp b/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
2023-04-10 09:45:16 +08:00
index 184b2be..d7db8d6 100644
--- a/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
+++ b/src/frame/window/modules/systeminfo/nativeinfowidget.cpp
2023-04-10 09:45:16 +08:00
@@ -92,7 +92,9 @@ NativeInfoWidget::NativeInfoWidget(SystemInfoModel *model, QWidget *parent)
NativeInfoWidget::~NativeInfoWidget()
{
+#ifndef DISABLE_ACTIVATOR
GSettingWatcher::instance()->erase("systeminfoNativeinfoAuthorized", m_authorized);
+#endif
GSettingWatcher::instance()->erase("systeminfoNativeinfoKernel", m_kernel);
GSettingWatcher::instance()->erase("systeminfoNativeinfoProcessor", m_processor);
GSettingWatcher::instance()->erase("systeminfoNativeinfoMemory", m_memory);
2023-04-10 09:45:16 +08:00
@@ -202,6 +204,7 @@ void NativeInfoWidget::initWidget()
//~ child_page About This PC
m_type->setTitle(tr("Type:"));
+#ifndef DISABLE_ACTIVATOR
m_authorized = new TitleAuthorizedItem(frame);
2023-04-10 09:45:16 +08:00
//~ contents_path /systeminfo/About This PC
//~ child_page About This PC
@@ -214,6 +217,7 @@ void NativeInfoWidget::initWidget()
} else {
m_authorized->setVisable(true);
}
+#endif
m_kernel = new TitleValueItem(frame);
//~ contents_path /systeminfo/About This PC
2023-04-10 09:45:16 +08:00
@@ -233,7 +237,9 @@ void NativeInfoWidget::initWidget()
m_memory->setTitle(tr("Memory:"));
m_memory->setValue(m_model->memory());
+#ifndef DISABLE_ACTIVATOR
GSettingWatcher::instance()->bind("systeminfoNativeinfoAuthorized", m_authorized);
+#endif
GSettingWatcher::instance()->bind("systeminfoNativeinfoKernel", m_kernel);
GSettingWatcher::instance()->bind("systeminfoNativeinfoProcessor", m_processor);
GSettingWatcher::instance()->bind("systeminfoNativeinfoMemory", m_memory);
2023-04-10 09:45:16 +08:00
@@ -246,9 +252,11 @@ void NativeInfoWidget::initWidget()
}
infoGroup->appendItem(m_version, SettingsGroup::ItemBackground);
infoGroup->appendItem(m_type);
+#ifndef DISABLE_ACTIVATOR
if (!DSysInfo::isCommunityEdition())
infoGroup->appendItem(m_authorized);
m_authorized->setVisible(!DSysInfo::isCommunityEdition());
+#endif
infoGroup->appendItem(m_kernel);
infoGroup->appendItem(m_processor);
infoGroup->appendItem(m_memory);
2023-04-10 09:45:16 +08:00
@@ -279,13 +287,17 @@ void NativeInfoWidget::initWidget()
connect(m_model, &SystemInfoModel::processorChanged, this, &NativeInfoWidget::setProcessor);
connect(m_model, &SystemInfoModel::memoryChanged, this, &NativeInfoWidget::setMemory);
+#ifndef DISABLE_ACTIVATOR
//传递button的点击信号
connect(m_authorized, &TitleAuthorizedItem::clicked, this, &NativeInfoWidget::clickedActivator);
connect(m_model, &SystemInfoModel::licenseStateChanged, this, &NativeInfoWidget::setLicenseState);
+#endif
setType(m_model->type());
+#ifndef DISABLE_ACTIVATOR
setLicenseState(m_model->licenseState());
+#endif
}
2023-04-10 09:45:16 +08:00
void NativeInfoWidget::resizeEvent(QResizeEvent *event)
@@ -328,6 +340,7 @@ void NativeInfoWidget::setMemory(const QString &memory)
m_memory->setValue(memory);
}
+#ifndef DISABLE_ACTIVATOR
void NativeInfoWidget::setLicenseState(ActiveState state)
{
if (state == Authorized) {
2023-04-10 09:45:16 +08:00
@@ -352,6 +365,7 @@ void NativeInfoWidget::setLicenseState(ActiveState state)
m_authorized->setButtonText(tr("Activate"));
}
}
+#endif
const QString NativeInfoWidget::systemCopyright() const
{
diff --git a/src/frame/window/modules/systeminfo/nativeinfowidget.h b/src/frame/window/modules/systeminfo/nativeinfowidget.h
2023-04-10 09:45:16 +08:00
index 1849793..93e24ef 100644
--- a/src/frame/window/modules/systeminfo/nativeinfowidget.h
+++ b/src/frame/window/modules/systeminfo/nativeinfowidget.h
2023-04-10 09:45:16 +08:00
@@ -79,7 +79,9 @@ public Q_SLOTS:
void setType(const QString &type);
void setProcessor(const QString &processor);
void setMemory(const QString &memory);
+#ifndef DISABLE_ACTIVATOR
void setLicenseState(dcc::systeminfo::ActiveState state);
+#endif
2023-04-10 09:45:16 +08:00
void onToolButtonButtonClicked();
void onFocusChanged(const bool onFocus);
@@ -90,7 +92,9 @@ public Q_SLOTS:
void onSetHostNameError(const QString &error);
Q_SIGNALS:
+#ifndef DISABLE_ACTIVATOR
void clickedActivator();
+#endif
2023-04-10 09:45:16 +08:00
protected:
void resizeEvent(QResizeEvent *event) override;
@@ -108,7 +112,9 @@ private:
dcc::widgets::TitleValueItem *m_versionNumber;
dcc::widgets::TitleValueItem *m_version;
dcc::widgets::TitleValueItem *m_type;
+#ifndef DISABLE_ACTIVATOR
dcc::widgets::TitleAuthorizedItem *m_authorized;
+#endif
dcc::widgets::TitleValueItem *m_kernel;
dcc::widgets::TitleValueItem *m_processor;
dcc::widgets::TitleValueItem *m_memory;
diff --git a/src/frame/window/modules/systeminfo/systeminfomodule.cpp b/src/frame/window/modules/systeminfo/systeminfomodule.cpp
index 05fac20..563a3ee 100644
--- a/src/frame/window/modules/systeminfo/systeminfomodule.cpp
+++ b/src/frame/window/modules/systeminfo/systeminfomodule.cpp
@@ -129,7 +129,9 @@ void SystemInfoModule::onShowAboutNativePage()
m_frameProxy->pushWidget(this, w);
w->setVisible(true);
//showActivatorDialog
+#ifndef DISABLE_ACTIVATOR
connect(w, &NativeInfoWidget::clickedActivator, m_work, &SystemInfoWork::showActivatorDialog);
+#endif
}
void SystemInfoModule::onVersionProtocolPage()
diff --git a/src/frame/window/modules/update/updatectrlwidget.cpp b/src/frame/window/modules/update/updatectrlwidget.cpp
2023-04-10 09:45:16 +08:00
index 158d6c4..415e89c 100644
--- a/src/frame/window/modules/update/updatectrlwidget.cpp
+++ b/src/frame/window/modules/update/updatectrlwidget.cpp
2023-04-10 09:45:16 +08:00
@@ -63,9 +63,13 @@ UpdateCtrlWidget::UpdateCtrlWidget(UpdateModel *model, QWidget *parent)
, m_bRecoverBackingUp(false)
, m_bRecoverConfigValid(false)
, m_bRecoverRestoring(false)
2023-04-10 09:45:16 +08:00
+#ifndef DISABLE_ACTIVATOR
, m_activeState(UiActiveState::Unknown)
2023-04-10 09:45:16 +08:00
+#endif
, m_updateList(new ContentWidget)
+#ifndef DISABLE_ACTIVATOR
, m_authorizationPrompt(new TipsLabel)
+#endif
, m_checkUpdateBtn(new QPushButton)
, m_lastCheckTimeTip(new TipsLabel)
{
2023-04-10 09:45:16 +08:00
@@ -85,11 +89,15 @@ UpdateCtrlWidget::UpdateCtrlWidget(UpdateModel *model, QWidget *parent)
m_fullProcess->setVisible(false);
m_fullProcess->setProcessValue(100);
+#ifndef DISABLE_ACTIVATOR
m_authorizationPrompt->setText(tr("Your system is not authorized, please activate first"));
m_authorizationPrompt->setAlignment(Qt::AlignHCenter);
m_authorizationPrompt->setVisible(false);
+#endif
fullProcesslayout->addWidget(m_fullProcess);
+#ifndef DISABLE_ACTIVATOR
fullProcesslayout->addWidget(m_authorizationPrompt);
+#endif
m_summaryGroup->setVisible(true);
2023-04-10 09:45:16 +08:00
@@ -172,7 +180,9 @@ void UpdateCtrlWidget::setShowInfo(const UiActiveState value)
}
m_fullProcess->setEnabled(activation);
+#ifndef DISABLE_ACTIVATOR
m_authorizationPrompt->setVisible(UpdatesStatus::UpdatesAvailable == m_model->status() && !activation);
+#endif
}
void UpdateCtrlWidget::loadAppList(const QList<AppUpdateInfo> &infos)
2023-04-10 09:45:16 +08:00
@@ -253,9 +263,11 @@ void UpdateCtrlWidget::setStatus(const UpdatesStatus &status)
{
m_status = status;
+#ifndef DISABLE_ACTIVATOR
if (m_model->systemActivation() == UiActiveState::Unauthorized || m_model->systemActivation() == UiActiveState::TrialExpired) {
m_status = NoAtive;
}
+#endif
Q_EMIT notifyUpdateState(m_status);
2023-04-10 09:45:16 +08:00
@@ -264,7 +276,9 @@ void UpdateCtrlWidget::setStatus(const UpdatesStatus &status)
m_resultItem->setVisible(false);
m_progress->setVisible(false);
m_fullProcess->setVisible(false);
+#ifndef DISABLE_ACTIVATOR
m_authorizationPrompt->setVisible(false);
+#endif
m_updateList->setVisible(false);
m_upgradeWarningGroup->setVisible(false);
m_reminderTip->setVisible(false);
2023-04-10 09:45:16 +08:00
@@ -312,7 +326,9 @@ void UpdateCtrlWidget::setStatus(const UpdatesStatus &status)
//~ child_page Updates
m_fullProcess->setMessage(tr("Download and install updates"));
setDownloadInfo(m_model->downloadInfo());
+#ifndef DISABLE_ACTIVATOR
setShowInfo(m_model->systemActivation());
+#endif
2023-04-10 09:45:16 +08:00
setLowBattery(m_model->lowBattery());
break;
case UpdatesStatus::Downloading:
2023-04-10 09:45:16 +08:00
@@ -457,10 +473,12 @@ void UpdateCtrlWidget::setLowBattery(const bool &lowBattery)
{
if (m_status == UpdatesStatus::Downloaded || m_status == UpdatesStatus::UpdatesAvailable) {
bool activation = false;
+#ifndef DISABLE_ACTIVATOR
const UiActiveState value = m_model->systemActivation();
if (UiActiveState::Authorized == value || UiActiveState::TrialAuthorized == value || UiActiveState::AuthorizedLapse == value) {
activation = true;
}
+#endif
if (lowBattery) {
m_powerTip->setText(tr("Your battery is lower than 50%, please plug in to continue"));
} else {
@@ -502,6 +520,7 @@ void UpdateCtrlWidget::setRecoverRestoring(const bool value)
}
}
+#ifndef DISABLE_ACTIVATOR
void UpdateCtrlWidget::setActiveState(const UiActiveState &activestate)
{
if (m_activeState != activestate) {
@@ -515,6 +534,7 @@ void UpdateCtrlWidget::setActiveState(const UiActiveState &activestate)
}
}
+#endif
void UpdateCtrlWidget::setModel(UpdateModel *model)
{
@@ -528,7 +548,9 @@ void UpdateCtrlWidget::setModel(UpdateModel *model)
connect(m_model, &UpdateModel::recoverBackingUpChanged, this, &UpdateCtrlWidget::setRecoverBackingUp);
connect(m_model, &UpdateModel::recoverConfigValidChanged, this, &UpdateCtrlWidget::setRecoverConfigValid);
connect(m_model, &UpdateModel::recoverRestoringChanged, this, &UpdateCtrlWidget::setRecoverRestoring);
+#ifndef DISABLE_ACTIVATOR
connect(m_model, &UpdateModel::systemActivationChanged, this, &UpdateCtrlWidget::setActiveState);
+#endif
setUpdateProgress(m_model->updateProgress());
diff --git a/src/frame/window/modules/update/updatectrlwidget.h b/src/frame/window/modules/update/updatectrlwidget.h
2023-04-10 09:45:16 +08:00
index f54ee46..0e219f9 100644
--- a/src/frame/window/modules/update/updatectrlwidget.h
+++ b/src/frame/window/modules/update/updatectrlwidget.h
2023-04-10 09:45:16 +08:00
@@ -86,7 +86,9 @@ private:
void setRecoverConfigValid(const bool value);
void setRecoverRestoring(const bool value);
void setShowInfo(const UiActiveState value);
+#ifndef DISABLE_ACTIVATOR
void setActiveState(const UiActiveState &activestate);
+#endif
private:
dcc::update::UpdateModel *m_model;
@@ -107,9 +109,13 @@ private:
bool m_bRecoverBackingUp;
bool m_bRecoverConfigValid;
bool m_bRecoverRestoring;
2023-04-10 09:45:16 +08:00
+#ifndef DISABLE_ACTIVATOR
UiActiveState m_activeState;
2023-04-10 09:45:16 +08:00
+#endif
dcc::ContentWidget *m_updateList;
+#ifndef DISABLE_ACTIVATOR
dcc::widgets::TipsLabel *m_authorizationPrompt;
+#endif
QPushButton *m_checkUpdateBtn;
dcc::widgets::TipsLabel *m_lastCheckTimeTip;
diff --git a/src/frame/window/modules/update/updatemodule.cpp b/src/frame/window/modules/update/updatemodule.cpp
2023-04-10 09:45:16 +08:00
index ef5529b..e84f643 100644
--- a/src/frame/window/modules/update/updatemodule.cpp
+++ b/src/frame/window/modules/update/updatemodule.cpp
2023-04-10 09:45:16 +08:00
@@ -77,7 +77,9 @@ void UpdateModule::preInitialize(bool sync, FrameProxyInterface::PushType pushty
connect(m_work.get(), &UpdateWorker::requestInit, m_work.get(), &UpdateWorker::init);
connect(m_work.get(), &UpdateWorker::requestActive, m_work.get(), &UpdateWorker::activate);
+#ifndef DISABLE_ACTIVATOR
connect(m_work.get(), &UpdateWorker::requestRefreshLicenseState, m_work.get(), &UpdateWorker::licenseStateChangeSlot);
+#endif
#ifndef DISABLE_SYS_UPDATE_MIRRORS
connect(m_work.get(), &UpdateWorker::requestRefreshMirrors, m_work.get(), &UpdateWorker::refreshMirrors);
2023-04-10 09:45:16 +08:00
@@ -150,9 +152,11 @@ void UpdateModule::active()
Q_EMIT m_work->requestRefreshLicenseState();
+#ifndef DISABLE_ACTIVATOR
if (m_model->systemActivation() == UiActiveState::Authorized || m_model->systemActivation() == UiActiveState::TrialAuthorized || m_model->systemActivation() == UiActiveState::AuthorizedLapse) {
m_updateWidget->setSystemVersion(m_model->systemVersionInfo());
}
+#endif
m_updateWidget->setModel(m_model, m_work.get());
connect(m_updateWidget, &UpdateWidget::pushMirrorsView, this, [=]() {
2023-04-10 09:45:16 +08:00
@@ -186,7 +190,7 @@ void UpdateModule::active()
m_updateWidget->setSystemVersion(m_model->systemVersionInfo());
}
#else
- mainWidget->setSystemVersion(m_model->systemVersionInfo());
+ m_updateWidget->setSystemVersion(m_model->systemVersionInfo());
#endif
m_frameProxy->pushWidget(this, m_updateWidget);
--
2.20.1