Skip to content
Merged
Changes from all commits
Commits
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
21 changes: 18 additions & 3 deletions src/ddeintegration/appmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
// SPDX-License-Identifier: GPL-3.0-or-later

#include "appmgr.h"
#include "iconutils.h"

Check warning on line 6 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "iconutils.h" not found.

#include <DUtil>

Check warning on line 8 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DUtil> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusConnection>

Check warning on line 9 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusConnection> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusMessage>
#include <QDBusReply>

Check warning on line 11 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusReply> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusVariant>

Check warning on line 12 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusVariant> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QFileInfo>

Check warning on line 13 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QFileInfo> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QIcon>

Check warning on line 14 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QIcon> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 15 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QProcess>

Check warning on line 16 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QProcess> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTimer>

Check warning on line 17 in src/ddeintegration/appmgr.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

#include <algorithm>

Expand Down Expand Up @@ -222,7 +224,13 @@
// For: bug-347859
bool AppMgr::waitForIcon(const QString &desktopId, const QString &iconName)
{
if (desktopId.isEmpty() || !QFileInfo(iconName).isAbsolute() || QFileInfo::exists(iconName)) {
// Defer the row until its icon is resolvable: an absolute path that does
// not exist yet, or a theme-name icon QIcon cannot resolve yet (theme not
// initialized at startup). For: bug-347859, bug-371833.
const bool resolvable = QFileInfo(iconName).isAbsolute()
? QFileInfo::exists(iconName)
: iconName.isEmpty() || !QIcon::fromTheme(iconName).isNull();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QIcon::fromTheme不能判断路径么?

if (desktopId.isEmpty() || resolvable) {
cancelPendingAppItem(desktopId);
return false;
}
Expand Down Expand Up @@ -261,17 +269,24 @@
{
++m_checkCount;

// Reload theme search paths so icons appearing after startup become visible.
IconUtils::tryUpdateIconCache();
QStringList readyItems;
for (auto it = m_pendingAppItems.begin(); it != m_pendingAppItems.end();) {
if (QFileInfo::exists(it.value())) {
const QString &iconName = it.value();
const bool ready = QFileInfo(iconName).isAbsolute()
? QFileInfo::exists(iconName)
: !QIcon::fromTheme(iconName).isNull();
if (ready) {
readyItems.append(it.key());
it = m_pendingAppItems.erase(it);
} else {
++it;
}
}

if (m_checkCount >= 20) {
// 120s timeout (3s interval): cover slow theme initialization.
if (m_checkCount >= 40) {
readyItems.append(m_pendingAppItems.keys());
m_pendingAppItems.clear();
}
Expand Down
Loading