fix: 修复启动器应用图标为空的问题
修复启动器应用图标为空的问题 Log: Task: https://pms.uniontech.com/task-view-137731.html Influence: 无 Change-Id: I7e8d63fe6078893fd45557808bf0fe053bfe7ce6
This commit is contained in:
		@ -34,8 +34,8 @@
 | 
			
		||||
std::vector<std::string> 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<std::string> 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)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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<bool> 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<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)
 | 
			
		||||
{
 | 
			
		||||
    return parent()->requestRemoveFromDesktop(id);
 | 
			
		||||
 | 
			
		||||
@ -67,19 +67,6 @@ class DBusAdaptorLauncher: public QDBusAbstractAdaptor
 | 
			
		||||
                                       "      <arg direction=\"in\" type=\"s\" name=\"id\"/>\n"
 | 
			
		||||
                                       "      <arg direction=\"in\" type=\"b\" name=\"value\"/>\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"
 | 
			
		||||
                                       "      <arg type=\"s\" name=\"status\"/>\n"
 | 
			
		||||
                                       "      <arg type=\"(ssssxxas)\" name=\"itemInfo\"/>\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);
 | 
			
		||||
 | 
			
		||||
@ -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()) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user