Skip to content
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
#include "desktopintegration.h"
#include "appmgr.h"

#include <DConfig>

Check warning on line 8 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 9 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 10 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 11 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 12 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 13 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 14 in desktopintegration.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDir> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QFileInfo>
#include <QRect>
#include <QGuiApplication>
Expand Down Expand Up @@ -64,6 +66,13 @@
return qEnvironmentVariable(env.toStdString().c_str());
}

bool DesktopIntegration::isDciIcon(const QString &iconName)
{
QByteArray themeName = Dtk::Gui::DGuiApplicationHelper::instance()->applicationTheme()->iconThemeName();
QString dciFile = Dtk::Gui::DIconTheme::findDciIconFile(iconName, QString::fromLatin1(themeName));
return !dciFile.isEmpty();
}

double DesktopIntegration::disableScale(const QString &desktopId)
{
return AppMgr::disableScale(desktopId);
Expand Down
1 change: 1 addition & 0 deletions desktopintegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DesktopIntegration : public QObject
Q_INVOKABLE static void setDisableScale(const QString & desktopId, double disableScale);
Q_INVOKABLE static void showFolder(enum QStandardPaths::StandardLocation location);
Q_INVOKABLE static void showUrl(const QString & url);
Q_INVOKABLE static bool isDciIcon(const QString &iconName);
Q_INVOKABLE bool appIsCompulsoryForDesktop(const QString & desktopId);
Q_INVOKABLE bool appIsDummyPackage(const QString & desktopId);
// TODO: async get wallpaper?
Expand Down
22 changes: 22 additions & 0 deletions qml/IconItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ Control {
Component {
id: imageComponent

Loader {
anchors.fill: parent
sourceComponent: DesktopIntegration.isDciIcon(iconSource) ? dciIconComponent : imageIconComponent
}
}

Component {
id: dciIconComponent

DciIcon {
objectName: "appIcon"
anchors.fill: parent
Expand All @@ -325,6 +334,19 @@ Control {
fillMode: Image.PreserveAspectFit
}
}

Component {
id: imageIconComponent

Image {
objectName: "appIcon"
anchors.fill: parent
source: "image://appicon/" + iconSource
fillMode: Image.PreserveAspectFit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (broader_impact): The non-DCI branch passes every iconSource through LauncherAppIconProvider, whose request parser strips the leading slash from absolute file paths and treats data:image/... values as icon names. Fullscreen icons supplied as an absolute SVG/bitmap path or data URL therefore fail to load and fall back to the provider's default/empty pixmap, whereas the previous DciIcon path accepted those sources.

Triggers: When an application's icon source is an absolute filesystem path or a data URL rather than a theme icon name.

Suggested fix: Use the provider only for theme icon names, or preserve and handle file paths/data URLs before routing the source through the theme-icon provider.

sourceSize: Qt.size(root.maxIconSize, root.maxIconSize)
scale: (iconContainer.width / root.maxIconSize) * root.iconScaleFactor
}
}
}

// as topMargin
Expand Down
2 changes: 2 additions & 0 deletions shell-launcher-applet/launcheritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#include "launcheritem.h"
#include "pluginfactory.h"
#include "../launchercontroller.h"
#include <appsmodel.h>

Check warning on line 8 in shell-launcher-applet/launcheritem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 9 in shell-launcher-applet/launcheritem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 10 in shell-launcher-applet/launcheritem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

#include <QLoggingCategory>
#include <QDBusConnection>
Expand Down Expand Up @@ -59,6 +60,7 @@
DApplet::init();

DQmlEngine().engine()->addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider);
DQmlEngine().engine()->addImageProvider(QLatin1String("appicon"), new LauncherAppIconProvider);

QDBusConnection connection = QDBusConnection::sessionBus();
if (!connection.registerService(QStringLiteral("org.deepin.dde.Launcher1")) ||
Expand Down
Loading