Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions .tx/transifex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ filters:
file_format: QT
source_language: en_US
translation_files_expression: src/ddock-update-plugin/translations/dock-update-plugin_<lang>.ts
- filter_type: file
source_file: src/private-lastore-tray/translations/private-lastore-tray_en.ts
file_format: QT
source_language: en_US
translation_files_expression: src/private-lastore-tray/translations/private-lastore-tray_<lang>.ts

settings:
pr_branch_name: transifex_update_<br_unique_id>
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
# SPDX-FileCopyrightText: 2025-2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: CC0-1.0

Expand Down Expand Up @@ -40,4 +40,5 @@ add_subdirectory("src/dde-update")
add_subdirectory("src/dde-abrecovery")
add_subdirectory("src/dcc-update-plugin")
add_subdirectory("src/dock-update-plugin")
add_subdirectory("src/private-lastore-tray")

65 changes: 65 additions & 0 deletions src/common/dbus/updateassistant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "updateassistant.h"

UpdateAssistant::UpdateAssistant(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
, d_ptr(new UpdateAssistantPrivate)
{
QDBusConnection::systemBus().connect("org.deepin.upgradedelivery", "/org/deepin/upgradedelivery", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertyChanged(QString, QVariantMap, QStringList)));
}

UpdateAssistant::~UpdateAssistant()
{
delete d_ptr;
d_ptr = nullptr;
}

void UpdateAssistant::onPropertyChanged(const QString& interfaceName,
const QVariantMap& changedProperties,
const QStringList& invalidatedProperties)
{
if (interfaceName != staticInterfaceName())
return;

if (changedProperties.contains("UploadLimitSpeed")) {
Q_EMIT UploadLimitSpeedChanged(uploadLimitSpeed());
}
if (changedProperties.contains("DownloadLimitSpeed")) {
Q_EMIT DownloadLimitSpeedChanged(downloadLimitSpeed());
}

return;
}

void UpdateAssistant::CallQueued(const QString &callName, const QList<QVariant> &args)
{
if (d_ptr->m_waittingCalls.contains(callName)) {
d_ptr->m_waittingCalls[callName] = args;
return;
}
if (d_ptr->m_processingCalls.contains(callName)) {
d_ptr->m_waittingCalls.insert(callName, args);
} else {
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
connect(watcher, &QDBusPendingCallWatcher::finished, this, &UpdateAssistant::onPendingCallFinished);
d_ptr->m_processingCalls.insert(callName, watcher);
}
}

void UpdateAssistant::onPendingCallFinished(QDBusPendingCallWatcher *w)
{
if (!w)
return;
w->deleteLater();
const auto callName = d_ptr->m_processingCalls.key(w);
Q_ASSERT(!callName.isEmpty());
if (callName.isEmpty())
return;
d_ptr->m_processingCalls.remove(callName);
if (!d_ptr->m_waittingCalls.contains(callName))
return;
const auto args = d_ptr->m_waittingCalls.take(callName);
CallQueued(callName, args);
}
84 changes: 84 additions & 0 deletions src/common/dbus/updateassistant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef UPDATEASSISTANT_H
#define UPDATEASSISTANT_H

#include <QtCore/QObject>

Check warning on line 7 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QByteArray>

Check warning on line 8 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QByteArray> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QList>

Check warning on line 9 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QList> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QMap>

Check warning on line 10 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QMap> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QString>

Check warning on line 11 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QString> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QStringList>

Check warning on line 12 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QStringList> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtCore/QVariant>

Check warning on line 13 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtCore/QVariant> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtDBus/QtDBus>

Check warning on line 14 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtDBus/QtDBus> not found. Please note: Cppcheck does not need standard library headers to get proper results.

class UpdateAssistantPrivate
{
public:
UpdateAssistantPrivate() = default;

public:
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
QMap<QString, QList<QVariant>> m_waittingCalls;
};

/*
* Proxy class for interface org.deepin.updateassistant
*/
class UpdateAssistant: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.deepin.upgradedelivery"; }

public:
UpdateAssistant(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);

~UpdateAssistant();

Q_PROPERTY(QString UploadLimitSpeed READ uploadLimitSpeed NOTIFY UploadLimitSpeedChanged)
inline QString uploadLimitSpeed() const
{ return qvariant_cast<QString>(internalPropGet("UploadLimitSpeed")); }

Q_PROPERTY(QString DownloadLimitSpeed READ downloadLimitSpeed NOTIFY DownloadLimitSpeedChanged)
inline QString downloadLimitSpeed() const
{ return qvariant_cast<QString>(internalPropGet("DownloadLimitSpeed")); }

public Q_SLOTS: // METHODS

Check warning on line 49 in src/common/dbus/updateassistant.h

View workflow job for this annotation

GitHub Actions / cppcheck

There is an unknown macro here somewhere. Configuration is required. If Q_SLOTS is a macro then please configure it.

inline QDBusPendingReply<void> SetUploadRateLimit(int speed)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(speed);
return asyncCallWithArgumentList(QStringLiteral("SetUploadRateLimit"), argumentList);
}

inline QDBusPendingReply<void> SetDownloadRateLimit(int speed)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(speed);
return asyncCallWithArgumentList(QStringLiteral("SetDownloadRateLimit"), argumentList);
}

Q_SIGNALS: // SIGNALS
// begin property changed signals
void propertyChanged(const QString &propertyName, const QVariant &value);
void UploadLimitSpeedChanged(const QString & speed) const;
void DownloadLimitSpeedChanged(const QString & speed) const;

public Q_SLOTS:
void CallQueued(const QString &callName, const QList<QVariant> &args);

private Q_SLOTS:
void onPendingCallFinished(QDBusPendingCallWatcher *w);
void onPropertyChanged(const QString& interfaceName,
const QVariantMap& changedProperties,
const QStringList& invalidatedProperties);

private:
UpdateAssistantPrivate *d_ptr;
};

#endif // UPDATEASSISTANT_H
55 changes: 54 additions & 1 deletion src/common/dbus/updatedbusproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "updatedbusproxy.h"
Expand Down Expand Up @@ -207,6 +207,21 @@
return qvariant_cast<QString>(m_managerInter->property("UpdateStatus"));
}

bool UpdateDBusProxy::downloadLimitOnChanging()

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

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'downloadLimitOnChanging' is never used.
{
return qvariant_cast<bool>(m_managerInter->property("downloadLimitOnChanging"));
}

bool UpdateDBusProxy::p2PUpdateEnable()
{
return qvariant_cast<bool>(m_updateInter->property("P2PUpdateEnable"));
}

bool UpdateDBusProxy::p2PUpdateSupport()
{
return qvariant_cast<bool>(m_updateInter->property("P2PUpdateSupport"));
}

bool UpdateDBusProxy::immutableAutoRecovery()
{
return qvariant_cast<bool>(m_managerInter->property("ImmutableAutoRecovery"));
Expand Down Expand Up @@ -387,6 +402,36 @@
return m_managerInter->asyncCallWithArgumentList(QStringLiteral("GetUpdateLogs"), argumentList);
}

QDBusPendingReply<void> UpdateDBusProxy::SetUpgradeDeliveryEnable(bool enable)
{
qCDebug(logCommon) << "Setting upgrade delivery enable :" << enable;
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(enable);
return m_updateInter->asyncCallWithArgumentList(QStringLiteral("SetP2PUpdateEnable"), argumentList);
}

QDBusPendingReply<void> UpdateDBusProxy::SetUpgradeDeliveryDownloadSpeedLimit(const QString& downloadLimit)
{
qCDebug(logCommon) << "Setting upgrade delivery download speed limit : " << downloadLimit;
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(downloadLimit);
return m_updateInter->asyncCallWithArgumentList(QStringLiteral("SetDeliveryDownloadSpeedLimit"), argumentList);
}

QDBusPendingReply<void> UpdateDBusProxy::SetUpgradeDeliveryUploadSpeedLimit(const QString& uploadLimit)
{
qCDebug(logCommon) << "Setting upgrade delivery upload speed limit : " << uploadLimit;
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(uploadLimit);
return m_updateInter->asyncCallWithArgumentList(QStringLiteral("SetDeliveryUploadSpeedLimit"), argumentList);
}

QDBusPendingReply<void> UpdateDBusProxy::ClearUpgradeDeliveryCache()
{
qCDebug(logCommon) << "Clearing upgrade delivery cache";
return m_updateInter->asyncCall(QStringLiteral("CleanTransmissionFiles"));
}

QDBusPendingReply<void> UpdateDBusProxy::SetIdleDownloadConfig(const QString& config)
{
qCDebug(logCommon) << "Setting idle download config:" << config;
Expand Down Expand Up @@ -428,6 +473,14 @@
return m_managerInter->asyncCallWithArgumentList(QStringLiteral("GetUpdateDetails"), argumentList);
}

QDBusPendingReply<void> UpdateDBusProxy::SetShutdownForceUpdate(bool isShutdownUpdate)
{
qCDebug(logCommon) << "Setting shutdown force update , isShutdownUpdate:" << isShutdownUpdate;
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(isShutdownUpdate);
return m_managerInter->asyncCallWithArgumentList(QStringLiteral("SetShutdownForceUpdate"), argumentList);
}

bool UpdateDBusProxy::onBattery()
{
return qvariant_cast<bool>(m_powerInter->property("OnBattery"));
Expand Down
21 changes: 19 additions & 2 deletions src/common/dbus/updatedbusproxy.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef UPDATEDBUSPROXY_H
Expand Down Expand Up @@ -67,9 +67,18 @@ class UpdateDBusProxy : public QObject
Q_PROPERTY(QString updateStatus READ updateStatus NOTIFY UpdateStatusChanged)
QString updateStatus();

Q_PROPERTY(bool downloadLimitOnChanging READ downloadLimitOnChanging NOTIFY DownloadLimitOnChangingChanged)
bool downloadLimitOnChanging();

Q_PROPERTY(bool ImmutableAutoRecovery READ immutableAutoRecovery NOTIFY ImmutableAutoRecoveryChanged)
bool immutableAutoRecovery();

Q_PROPERTY(bool P2PUpdateEnable READ p2PUpdateEnable NOTIFY P2PUpdateEnableChanged)
bool p2PUpdateEnable();

Q_PROPERTY(bool P2PUpdateSupport READ p2PUpdateSupport NOTIFY P2PUpdateSupportChanged)
bool p2PUpdateSupport();

QString hardwareId();

quint64 checkUpdateMode();
Expand Down Expand Up @@ -103,12 +112,16 @@ class UpdateDBusProxy : public QObject
QDBusPendingReply<void> SetDownloadSpeedLimit(const QString &config);
QDBusPendingReply<qlonglong> QueryAllSizeWithSource(int updateType);
QDBusPendingReply<QString> GetUpdateLogs(int updateType);
QDBusPendingReply<void> SetUpgradeDeliveryEnable(bool enable);
QDBusPendingReply<void> SetUpgradeDeliveryDownloadSpeedLimit(const QString& downloadLimit);
QDBusPendingReply<void> SetUpgradeDeliveryUploadSpeedLimit(const QString& uploadLimit);
QDBusPendingReply<void> ClearUpgradeDeliveryCache();
QDBusPendingReply<void> SetIdleDownloadConfig(const QString &config);
QDBusPendingReply<QDBusObjectPath> PrepareDistUpgradePartly(int updateMode);
QDBusPendingReply<QDBusObjectPath> fixError(const QString &errorType);
QDBusPendingCall CheckUpgrade(int checkMode, int checkOrder);
QDBusPendingReply<void> GetUpdateDetails(int fd, bool realtime);

QDBusPendingReply<void> SetShutdownForceUpdate(bool isShutdownUpdate);

// Power
bool onBattery();
Expand Down Expand Up @@ -137,6 +150,7 @@ class UpdateDBusProxy : public QObject
void AutoInstallUpdatesChanged(bool value) const;
void AutoInstallUpdateTypeChanged(qulonglong value) const;
void MirrorSourceChanged(const QString &value) const;
void UpgradeDeliveryEnabledChanged(bool value) const;
void AutoCheckUpdatesChanged(bool value) const;
void ClassifiedUpdatablePackagesChanged(LastoreUpdatePackagesInfo value) const;

Expand All @@ -145,7 +159,10 @@ class UpdateDBusProxy : public QObject
void AutoCleanChanged(bool value) const;
void UpdateModeChanged(qulonglong value) const;
void UpdateStatusChanged(QString value) const;
void DownloadLimitOnChangingChanged(bool value) const;
void ImmutableAutoRecoveryChanged(bool value) const;
void P2PUpdateEnableChanged(bool value) const;
void P2PUpdateSupportChanged(bool value) const;
void managerInterServiceValidChanged(bool value) const;

// Power
Expand Down
7 changes: 6 additions & 1 deletion src/common/dbus/updatejobdbusproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "updatejobdbusproxy.h"
Expand Down Expand Up @@ -103,3 +103,8 @@ QString UpdateJobDBusProxy::type()
{
return qvariant_cast<QString>(m_updateJobInter->property("Type"));
}

QString UpdateJobDBusProxy::proto()
{
return qvariant_cast<QString>(m_updateJobInter->property("Proto"));
}
6 changes: 5 additions & 1 deletion src/common/dbus/updatejobdbusproxy.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018-2026 UnionTech Software Technology Co., Ltd.
//
//SPDX-License-Identifier: GPL-3.0-or-later
#ifndef UPDATEJOBDBUSPROXY_H
Expand Down Expand Up @@ -56,6 +56,9 @@ class UpdateJobDBusProxy : public QObject
Q_PROPERTY(QString Type READ type NOTIFY TypeChanged)
QString type();

Q_PROPERTY(QString Proto READ proto NOTIFY ProtoChanged)
QString proto();

inline QString path() const { return m_path; };

signals:
Expand All @@ -73,6 +76,7 @@ class UpdateJobDBusProxy : public QObject
void SpeedChanged(qlonglong value) const;
void StatusChanged(const QString & value) const;
void TypeChanged(const QString & value) const;
void ProtoChanged(const QString & value) const;

private:
DDBusInterface *m_updateJobInter;
Expand Down
Loading
Loading