From 602f7c55e1fb1a2ef185b963e6ccc240d0ed087c Mon Sep 17 00:00:00 2001 From: weizhixiang Date: Fri, 27 May 2022 21:48:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=20=E4=BF=AE=E5=A4=8D=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=99=A8=E5=BA=94=E7=94=A8=E5=9B=BE=E6=A0=87=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复启动器应用图标为空的问题 Log: Task: https://pms.uniontech.com/task-view-137731.html Influence: 无 Change-Id: I7e8d63fe6078893fd45557808bf0fe053bfe7ce6 --- src/lib/desktopinfo.cpp | 14 +++++------- src/modules/launcher/dbusadaptorlauncher.cpp | 24 +------------------- src/modules/launcher/dbusadaptorlauncher.h | 16 ------------- src/modules/launcher/launcher.cpp | 5 +++- 4 files changed, 11 insertions(+), 48 deletions(-) diff --git a/src/lib/desktopinfo.cpp b/src/lib/desktopinfo.cpp index 6a3270e..a3134d3 100644 --- a/src/lib/desktopinfo.cpp +++ b/src/lib/desktopinfo.cpp @@ -34,8 +34,8 @@ std::vector DesktopInfo::currentDesktops; DesktopInfo::DesktopInfo(const std::string &_fileName) - : m_isValid(true) - , m_keyFile(KeyFile()) + : m_isValid(true) + , m_keyFile(KeyFile()) { std::string fileNameWithSuffix(_fileName); if (!DString::endWith(_fileName, ".desktop")) @@ -118,11 +118,9 @@ bool DesktopInfo::getIsHidden() bool DesktopInfo::getShowIn(std::vector desktopEnvs) { if (desktopEnvs.size() == 0) { - if (currentDesktops.size() == 0) { - const char *env = getenv(envDesktopEnv.c_str()); - const auto &desktop = DString::splitChars(env, ':'); - currentDesktops.assign(desktop.begin(), desktop.end()); - } + const char *env = getenv(envDesktopEnv.c_str()); + const auto &desktop = DString::splitChars(env, ':'); + currentDesktops.assign(desktop.begin(), desktop.end()); desktopEnvs.assign(currentDesktops.begin(), currentDesktops.end()); } @@ -327,7 +325,7 @@ KeyFile *DesktopInfo::getKeyFile() // class AppsDir AppsDir::AppsDir(const std::string &dirPath) - : m_path(dirPath) + : m_path(dirPath) { } diff --git a/src/modules/launcher/dbusadaptorlauncher.cpp b/src/modules/launcher/dbusadaptorlauncher.cpp index d8efd2c..0a974ab 100644 --- a/src/modules/launcher/dbusadaptorlauncher.cpp +++ b/src/modules/launcher/dbusadaptorlauncher.cpp @@ -19,7 +19,7 @@ DBusAdaptorLauncher::DBusAdaptorLauncher(QObject *parent) DBusAdaptorLauncher::~DBusAdaptorLauncher() { - // destructor + } Launcher *DBusAdaptorLauncher::parent() const @@ -47,13 +47,6 @@ void DBusAdaptorLauncher::setFullscreen(bool value) parent()->setFullscreen(value); } -bool DBusAdaptorLauncher::AddAutostart(const QString &desktopFile) -{ - QDBusInterface interface = QDBusInterface("com.deepin.daemon.Display", "/com/deepin/StartManager", "com.deepin.StartManager"); - QDBusReply reply = interface.call("AddAutostart", desktopFile); - return reply.isValid() ? reply.value() : false; -} - LauncherItemInfoList DBusAdaptorLauncher::GetAllItemInfos() { return parent()->getAllItemInfos(); @@ -84,21 +77,6 @@ bool DBusAdaptorLauncher::IsItemOnDesktop(const QString &id) return parent()->isItemOnDesktop(id); } -bool DBusAdaptorLauncher::LaunchWithTimestamp(const QString &desktopFile, int time) -{ - - QDBusInterface interface = QDBusInterface("com.deepin.daemon.Display", "/com/deepin/StartManager", "com.deepin.StartManager"); - QDBusReply reply = interface.call("LaunchWithTimestamp", desktopFile, time); - return reply.isValid() ? reply.value() : false; -} - -bool DBusAdaptorLauncher::RemoveAutostart(const QString &desktopFile) -{ - QDBusInterface interface = QDBusInterface("com.deepin.daemon.Display", "/com/deepin/StartManager", "com.deepin.StartManager"); - QDBusReply reply = interface.call("RemoveAutostart", desktopFile); - return reply.isValid() ? reply.value() : false; -} - bool DBusAdaptorLauncher::RequestRemoveFromDesktop(const QString &id) { return parent()->requestRemoveFromDesktop(id); diff --git a/src/modules/launcher/dbusadaptorlauncher.h b/src/modules/launcher/dbusadaptorlauncher.h index c709c7f..84bfce5 100644 --- a/src/modules/launcher/dbusadaptorlauncher.h +++ b/src/modules/launcher/dbusadaptorlauncher.h @@ -67,19 +67,6 @@ class DBusAdaptorLauncher: public QDBusAbstractAdaptor " \n" " \n" " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" " \n" " \n" " \n" @@ -116,15 +103,12 @@ public: // PROPERTIES void setFullscreen(bool value); public Q_SLOTS: // METHODS - bool AddAutostart(const QString &desktopFile); LauncherItemInfoList GetAllItemInfos(); QStringList GetAllNewInstalledApps(); bool GetDisableScaling(const QString &id); LauncherItemInfo GetItemInfo(const QString &id); bool GetUseProxy(const QString &id); bool IsItemOnDesktop(const QString &id); - bool LaunchWithTimestamp(const QString &desktopFile, int time); - bool RemoveAutostart(const QString &desktopFile); bool RequestRemoveFromDesktop(const QString &id); bool RequestSendToDesktop(const QString &id); void RequestUninstall(const QString &id); diff --git a/src/modules/launcher/launcher.cpp b/src/modules/launcher/launcher.cpp index 1d3527f..89a7c0b 100644 --- a/src/modules/launcher/launcher.cpp +++ b/src/modules/launcher/launcher.cpp @@ -1187,12 +1187,15 @@ Item Launcher:: NewItemWithDesktopInfo(DesktopInfo &info) Item item; item.info.path = appFileName; item.info.name = appName; - //item.info.keywords << enName << appName; + item.info.keywords << enName << appName; item.info.id = getAppIdByFilePath(item.info.path, appDirs); item.info.timeInstalled = ctime; item.exec = info.getCommandLine().c_str(); item.genericName = info.getGenericName().c_str(); item.comment = enComment; + if (!info.getIcon().empty()) + item.info.icon = info.getIcon().c_str(); + xDeepinCategory = xDeepinCategory.toLower(); for (auto &keyWord : info.getKeywords()) {