fix: 修复启动器应用图标为空的问题

修复启动器应用图标为空的问题

Log:
Task: https://pms.uniontech.com/task-view-137731.html
Influence: 无
Change-Id: I7e8d63fe6078893fd45557808bf0fe053bfe7ce6
This commit is contained in:
weizhixiang 2022-05-27 21:48:33 +08:00
parent 42d50bae4f
commit 602f7c55e1
4 changed files with 11 additions and 48 deletions

View File

@ -118,11 +118,9 @@ bool DesktopInfo::getIsHidden()
bool DesktopInfo::getShowIn(std::vector<std::string> desktopEnvs) bool DesktopInfo::getShowIn(std::vector<std::string> desktopEnvs)
{ {
if (desktopEnvs.size() == 0) { if (desktopEnvs.size() == 0) {
if (currentDesktops.size() == 0) {
const char *env = getenv(envDesktopEnv.c_str()); const char *env = getenv(envDesktopEnv.c_str());
const auto &desktop = DString::splitChars(env, ':'); const auto &desktop = DString::splitChars(env, ':');
currentDesktops.assign(desktop.begin(), desktop.end()); currentDesktops.assign(desktop.begin(), desktop.end());
}
desktopEnvs.assign(currentDesktops.begin(), currentDesktops.end()); desktopEnvs.assign(currentDesktops.begin(), currentDesktops.end());
} }

View File

@ -19,7 +19,7 @@ DBusAdaptorLauncher::DBusAdaptorLauncher(QObject *parent)
DBusAdaptorLauncher::~DBusAdaptorLauncher() DBusAdaptorLauncher::~DBusAdaptorLauncher()
{ {
// destructor
} }
Launcher *DBusAdaptorLauncher::parent() const Launcher *DBusAdaptorLauncher::parent() const
@ -47,13 +47,6 @@ void DBusAdaptorLauncher::setFullscreen(bool value)
parent()->setFullscreen(value); parent()->setFullscreen(value);
} }
bool DBusAdaptorLauncher::AddAutostart(const QString &desktopFile)
{
QDBusInterface interface = QDBusInterface("com.deepin.daemon.Display", "/com/deepin/StartManager", "com.deepin.StartManager");
QDBusReply<bool> reply = interface.call("AddAutostart", desktopFile);
return reply.isValid() ? reply.value() : false;
}
LauncherItemInfoList DBusAdaptorLauncher::GetAllItemInfos() LauncherItemInfoList DBusAdaptorLauncher::GetAllItemInfos()
{ {
return parent()->getAllItemInfos(); return parent()->getAllItemInfos();
@ -84,21 +77,6 @@ bool DBusAdaptorLauncher::IsItemOnDesktop(const QString &id)
return parent()->isItemOnDesktop(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<bool> 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<bool> reply = interface.call("RemoveAutostart", desktopFile);
return reply.isValid() ? reply.value() : false;
}
bool DBusAdaptorLauncher::RequestRemoveFromDesktop(const QString &id) bool DBusAdaptorLauncher::RequestRemoveFromDesktop(const QString &id)
{ {
return parent()->requestRemoveFromDesktop(id); return parent()->requestRemoveFromDesktop(id);

View File

@ -67,19 +67,6 @@ class DBusAdaptorLauncher: public QDBusAbstractAdaptor
" <arg direction=\"in\" type=\"s\" name=\"id\"/>\n" " <arg direction=\"in\" type=\"s\" name=\"id\"/>\n"
" <arg direction=\"in\" type=\"b\" name=\"value\"/>\n" " <arg direction=\"in\" type=\"b\" name=\"value\"/>\n"
" </method>\n" " </method>\n"
" <method name=\"LaunchWithTimestamp\">\n"
" <arg direction=\"in\" type=\"s\" name=\"desktopFile\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"time\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"value\"/>\n"
" </method>\n"
" <method name=\"RemoveAutostart\">\n"
" <arg direction=\"in\" type=\"s\" name=\"desktopFile\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"value\"/>\n"
" </method>\n"
" <method name=\"AddAutostart\">\n"
" <arg direction=\"in\" type=\"s\" name=\"desktopFile\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"value\"/>\n"
" </method>\n"
" <signal name=\"ItemChanged\">\n" " <signal name=\"ItemChanged\">\n"
" <arg type=\"s\" name=\"status\"/>\n" " <arg type=\"s\" name=\"status\"/>\n"
" <arg type=\"(ssssxxas)\" name=\"itemInfo\"/>\n" " <arg type=\"(ssssxxas)\" name=\"itemInfo\"/>\n"
@ -116,15 +103,12 @@ public: // PROPERTIES
void setFullscreen(bool value); void setFullscreen(bool value);
public Q_SLOTS: // METHODS public Q_SLOTS: // METHODS
bool AddAutostart(const QString &desktopFile);
LauncherItemInfoList GetAllItemInfos(); LauncherItemInfoList GetAllItemInfos();
QStringList GetAllNewInstalledApps(); QStringList GetAllNewInstalledApps();
bool GetDisableScaling(const QString &id); bool GetDisableScaling(const QString &id);
LauncherItemInfo GetItemInfo(const QString &id); LauncherItemInfo GetItemInfo(const QString &id);
bool GetUseProxy(const QString &id); bool GetUseProxy(const QString &id);
bool IsItemOnDesktop(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 RequestRemoveFromDesktop(const QString &id);
bool RequestSendToDesktop(const QString &id); bool RequestSendToDesktop(const QString &id);
void RequestUninstall(const QString &id); void RequestUninstall(const QString &id);

View File

@ -1187,12 +1187,15 @@ Item Launcher:: NewItemWithDesktopInfo(DesktopInfo &info)
Item item; Item item;
item.info.path = appFileName; item.info.path = appFileName;
item.info.name = appName; item.info.name = appName;
//item.info.keywords << enName << appName; item.info.keywords << enName << appName;
item.info.id = getAppIdByFilePath(item.info.path, appDirs); item.info.id = getAppIdByFilePath(item.info.path, appDirs);
item.info.timeInstalled = ctime; item.info.timeInstalled = ctime;
item.exec = info.getCommandLine().c_str(); item.exec = info.getCommandLine().c_str();
item.genericName = info.getGenericName().c_str(); item.genericName = info.getGenericName().c_str();
item.comment = enComment; item.comment = enComment;
if (!info.getIcon().empty())
item.info.icon = info.getIcon().c_str();
xDeepinCategory = xDeepinCategory.toLower(); xDeepinCategory = xDeepinCategory.toLower();
for (auto &keyWord : info.getKeywords()) { for (auto &keyWord : info.getKeywords()) {