fix: ISSUE #I6B4CS 重复安装应用的bug

应用安装过程中,重新进入应用详情页,仅通过 `dpkg-query -s $pkgName` 判断本地是否已安装,未判断当前安装任务执行状态

Log: 判断本地安装状态后,执行 isDownloading 函数判断安装任务状态,更新按钮显示状态;整理应用详情页代码
This commit is contained in:
zty199
2023-02-01 11:59:16 +08:00
parent 05cb318737
commit 1074e941a6
5 changed files with 279 additions and 230 deletions

View File

@@ -1,25 +1,24 @@
#include "utils.h"
#include "application.h"
Utils::Utils()
{
}
#include <QDBusInterface>
// Author: chatGPT
void Utils::sendNotification(QString icon, QString title, QString body)
void Utils::sendNotification(const QString &icon, const QString &title, const QString &body)
{
QDBusInterface iface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications");
QDBusInterface interface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications");
QVariantList args;
args << QCoreApplication::applicationName() // the name of the application
<< (uint)0 // replaces the previous notification with the same ID
<< icon // the application icon of the notification
<< title // the title of the notification
<< body // the body of the notification
<< QStringList() // no actions
<< QVariantMap() // no hints
<< -1; // no timeout
args << Application::applicationName() // the name of the application
<< static_cast<quint32>(0) // replaces the previous notification with the same ID
<< icon // the application icon of the notification
<< title // the title of the notification
<< body // the body of the notification
<< QStringList() // no actions
<< QVariantMap() // no hints
<< -1; // no timeout
iface.callWithArgumentList(QDBus::AutoDetect, "Notify", args);
interface.callWithArgumentList(QDBus::AutoDetect, "Notify", args);
}

View File

@@ -2,13 +2,11 @@
#define UTILS_H
#include <QObject>
#include <QtDBus>
class Utils
{
public:
Utils();
static void sendNotification(QString icon,QString title,QString body);
static void sendNotification(const QString &icon, const QString &title, const QString &body);
};
#endif // UTILS_H