Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/common/commondefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ const static QString LockService = QStringLiteral("org.deepin.dde.LockService1")
const static QString LockPath = QStringLiteral("/org/deepin/dde/LockService1");
const static QString LockInterface = QStringLiteral("org.deepin.dde.LockService1");

// shutdownFront1
const static QString ShutdownFront1Service = QStringLiteral("org.deepin.dde.ShutdownFront1");
const static QString ShutdownFront1Path = QStringLiteral("/org/deepin/dde/ShutdownFront1");
const static QString ShutdownFront1Interface = QStringLiteral("org.deepin.dde.ShutdownFront1");

const static QString PropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties");
const static QString PropertiesChanged = QStringLiteral("PropertiesChanged");
15 changes: 15 additions & 0 deletions src/common/dbus/updatedbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
this))
, m_lockServiceInter(new DDBusInterface(
LockService, LockPath, LockInterface, QDBusConnection::systemBus(), this))
, m_shutdownFrontInter(new DDBusInterface(
ShutdownFront1Service, ShutdownFront1Path, ShutdownFront1Interface, QDBusConnection::sessionBus(), this))
, m_interWatcher(new QDBusServiceWatcher(UpdaterService, QDBusConnection::systemBus()))

{
Expand Down Expand Up @@ -416,4 +418,17 @@
QString UpdateDBusProxy::CurrentUser()
{
return QDBusPendingReply<QString>(m_lockServiceInter->asyncCall(QStringLiteral("CurrentUser")));
}

void UpdateDBusProxy::Restart()

Check warning on line 423 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'Restart' is never used.
{
m_shutdownFrontInter->asyncCall(QStringLiteral("Restart"));
}
void UpdateDBusProxy::UpdateAndReboot()

Check warning on line 427 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'UpdateAndReboot' is never used.
{
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndReboot"));
}
void UpdateDBusProxy::UpdateAndShutdown()

Check warning on line 431 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'UpdateAndShutdown' is never used.
{
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndShutdown"));
}
6 changes: 6 additions & 0 deletions src/common/dbus/updatedbusproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ class UpdateDBusProxy : public QObject

// lockService
QString CurrentUser();

// shutdownFront
void Restart();
void UpdateAndReboot();
void UpdateAndShutdown();
signals:
// updater
void UpdateNotifyChanged(bool value) const;
Expand Down Expand Up @@ -156,6 +161,7 @@ class UpdateDBusProxy : public QObject
DDBusInterface *m_smartMirrorInter;
DDBusInterface *m_login1Inter;
DDBusInterface *m_lockServiceInter;
DDBusInterface *m_shutdownFrontInter;

QDBusServiceWatcher *m_interWatcher;
};
Expand Down
20 changes: 13 additions & 7 deletions src/dcc-update-plugin/operation/updatework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,18 @@ void UpdateWorker::doUpgrade(int updateTypes, bool doBackup)

void UpdateWorker::reStart()
{
DDBusSender()
.service("com.deepin.dde.shutdownFront")
.interface("com.deepin.dde.shutdownFront")
.path("/com/deepin/dde/shutdownFront")
.method("Restart")
.call();
qCInfo(DCC_UPDATE_WORKER) << "request restart";
m_updateInter->Restart();
}

void UpdateWorker::modalUpgrade(bool rebootAfterUpgrade)
{
qCInfo(DCC_UPDATE_WORKER) << "request modal upgrade, reboot after upgrade:" << rebootAfterUpgrade;
if (rebootAfterUpgrade) {
m_updateInter->UpdateAndReboot();
} else {
m_updateInter->UpdateAndShutdown();
}
}

void UpdateWorker::setBackupJob(const QString& jobPath)
Expand Down Expand Up @@ -1404,7 +1410,7 @@ void UpdateWorker::onBackupStatusChanged(const QString &value)
m_model->setLastError(BackupFailed, analyzeJobErrorMessage(description, BackupFailed));
m_model->setBackupFailedTips(m_model->errorToText(m_model->lastError(BackupFailed)));
} else if (value == "end") {
deleteJob(m_downloadJob);
deleteJob(m_backupJob);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/dcc-update-plugin/operation/updatework.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class UpdateWorker : public QObject
// 备份并安装更新
Q_INVOKABLE void doUpgrade(int updateTypes, bool doBackup);
Q_INVOKABLE void reStart();
Q_INVOKABLE void modalUpgrade(bool rebootAfterUpgrade = true);
void setBackupJob(const QString& jobPath);
void setDistUpgradeJob(const QString& jobPath);
void updateSystemVersion();
Expand Down
70 changes: 70 additions & 0 deletions src/dcc-update-plugin/qml/UpdateSelectDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.5

import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style as DS
import org.deepin.dcc 1.0

D.DialogWindow {
id: root
width: 360
height: 130
icon: "preferences-system"
modality: Qt.WindowModal

signal silentBtnClicked()
signal upgradeRebootBtnClicked()
signal upgradeShutdownBtnClicked()

ColumnLayout {
anchors.fill: parent
Label {
Layout.alignment: Qt.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("The updates have been already downloaded. What do you want to do?")
}

Item {
Layout.fillHeight: true
}

RowLayout {
Layout.fillWidth: true
Layout.bottomMargin: 0
spacing: 10

D.Button {
text: qsTr("Silent Installation")
Layout.fillWidth: true
onClicked: {
root.silentBtnClicked()
}
}

D.Button {
text: qsTr("Update and Reboot")
Layout.fillWidth: true
onClicked: {
root.upgradeRebootBtnClicked()
}
}

D.Button {
text: qsTr("Update and Shut Down")
textColor: D.Palette {
normal {
common: D.DTK.makeColor(D.Color.Highlight)
}
normalDark: normal
}
Layout.fillWidth: true
onClicked: {
root.upgradeShutdownBtnClicked()
}
}
}
}
}
20 changes: 19 additions & 1 deletion src/dcc-update-plugin/qml/updateMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,25 @@ DccObject {
updateListEnable: !dccData.model().upgradeWaiting

onBtnClicked: function(index, updateType) {
dccData.work().doUpgrade(updateType, true)
updateSelectDialog.updateType = updateType
updateSelectDialog.show()
}

UpdateSelectDialog {
id: updateSelectDialog
property var updateType: 0
palette: parent.palette
visible: false
onSilentBtnClicked: {
dccData.work().doUpgrade(updateType, true)
close()
}
onUpgradeRebootBtnClicked: {
dccData.work().modalUpgrade(true)
}
onUpgradeShutdownBtnClicked: {
dccData.work().modalUpgrade(false)
}
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions src/dcc-update-plugin/translations/update_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSelectDialog</name>
<message>
<source>The updates have been already downloaded. What do you want to do?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Silent Installation</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Shut Down</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSetting</name>
<message>
Expand Down Expand Up @@ -324,6 +343,14 @@
<source>Forum users at level 2 and above can join the beta test to receive the latest updates.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Collapse</source>
<translation type="unfinished">قم بطي ذلك</translation>
</message>
<message>
<source>Only numbers between 1-99999 are allowed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWorker</name>
Expand Down
27 changes: 27 additions & 0 deletions src/dcc-update-plugin/translations/update_az.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSelectDialog</name>
<message>
<source>The updates have been already downloaded. What do you want to do?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Silent Installation</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Shut Down</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSetting</name>
<message>
Expand Down Expand Up @@ -324,6 +343,14 @@
<source>Forum users at level 2 and above can join the beta test to receive the latest updates.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Collapse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Only numbers between 1-99999 are allowed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWorker</name>
Expand Down
27 changes: 27 additions & 0 deletions src/dcc-update-plugin/translations/update_bo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSelectDialog</name>
<message>
<source>The updates have been already downloaded. What do you want to do?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Silent Installation</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Shut Down</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSetting</name>
<message>
Expand Down Expand Up @@ -324,6 +343,14 @@
<source>Forum users at level 2 and above can join the beta test to receive the latest updates.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Collapse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Only numbers between 1-99999 are allowed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWorker</name>
Expand Down
27 changes: 27 additions & 0 deletions src/dcc-update-plugin/translations/update_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@
<translation>Les actualitzacions del sistema estan desactivades. Poseu-vos en contacte amb l&apos;administrador per obtenir ajuda.</translation>
</message>
</context>
<context>
<name>UpdateSelectDialog</name>
<message>
<source>The updates have been already downloaded. What do you want to do?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Silent Installation</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update and Shut Down</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateSetting</name>
<message>
Expand Down Expand Up @@ -324,6 +343,14 @@
<source>Forum users at level 2 and above can join the beta test to receive the latest updates.</source>
<translation>Els usuaris del fòrum de nivell 2 o superior poden unir-se a la prova beta per rebre les últimes actualitzacions.</translation>
</message>
<message>
<source>Collapse</source>
<translation type="unfinished">Replega</translation>
</message>
<message>
<source>Only numbers between 1-99999 are allowed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWorker</name>
Expand Down
Loading