Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit adc23c04 authored by Jan Grulich's avatar Jan Grulich

Fix getting application name from application desktop file

parent 20c2f3a0
......@@ -6,7 +6,7 @@ set(PROJECT_VERSION "5.14.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.11.0")
set(KF5_MIN_VERSION "5.50.0")
set(KF5_MIN_VERSION "5.48.0")
################# set KDE specific information #################
......
......@@ -53,13 +53,19 @@ RemoteDesktopDialog::RemoteDesktopDialog(const QString &appName, RemoteDesktopPo
QString applicationName;
const QString desktopFile = appName + QLatin1String(".desktop");
const QStringList desktopFilesLocations = QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, desktopFile, QStandardPaths::LocateFile);
QSettings settings(desktopFile, QSettings::IniFormat);
settings.beginGroup(QLatin1String("Desktop Entry"));
if (settings.contains(QLatin1String("X-GNOME-FullName"))) {
applicationName = settings.value(QLatin1String("X-GNOME-FullName")).toString();
} else {
applicationName = settings.value(QLatin1String("Name")).toString();
const QStringList desktopFileLocations = QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, desktopFile, QStandardPaths::LocateFile);
foreach (const QString &location, desktopFileLocations) {
QSettings settings(location, QSettings::IniFormat);
settings.beginGroup(QLatin1String("Desktop Entry"));
if (settings.contains(QLatin1String("X-GNOME-FullName"))) {
applicationName = settings.value(QLatin1String("X-GNOME-FullName")).toString();
} else {
applicationName = settings.value(QLatin1String("Name")).toString();
}
if (!applicationName.isEmpty()) {
break;
}
}
if (applicationName.isEmpty()) {
......
......@@ -44,13 +44,19 @@ ScreenChooserDialog::ScreenChooserDialog(const QString &appName, bool multiple,
QString applicationName;
const QString desktopFile = appName + QLatin1String(".desktop");
const QStringList desktopFilesLocations = QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, desktopFile, QStandardPaths::LocateFile);
QSettings settings(desktopFile, QSettings::IniFormat);
settings.beginGroup(QLatin1String("Desktop Entry"));
if (settings.contains(QLatin1String("X-GNOME-FullName"))) {
applicationName = settings.value(QLatin1String("X-GNOME-FullName")).toString();
} else {
applicationName = settings.value(QLatin1String("Name")).toString();
const QStringList desktopFileLocations = QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, desktopFile, QStandardPaths::LocateFile);
foreach (const QString &location, desktopFileLocations) {
QSettings settings(location, QSettings::IniFormat);
settings.beginGroup(QLatin1String("Desktop Entry"));
if (settings.contains(QLatin1String("X-GNOME-FullName"))) {
applicationName = settings.value(QLatin1String("X-GNOME-FullName")).toString();
} else {
applicationName = settings.value(QLatin1String("Name")).toString();
}
if (!applicationName.isEmpty()) {
break;
}
}
if (applicationName.isEmpty()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment