[neon/kde/plasma-workspace/Neon/release] debian/patches: add neon_revert_autostart.diff to revert revent autostart changes which cause crash on startup

Jonathan Esk-Riddell null at kde.org
Thu Feb 9 20:41:46 GMT 2023


Git commit 827c06989bd73547649d4c74321458bdb27feb38 by Jonathan Esk-Riddell.
Committed on 09/02/2023 at 20:41.
Pushed by jriddell into branch 'Neon/release'.

add neon_revert_autostart.diff to revert revent autostart changes which cause crash on startup

A  +205  -0    debian/patches/neon_revert_autostart.diff
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/kde/plasma-workspace/commit/827c06989bd73547649d4c74321458bdb27feb38

diff --git a/debian/patches/neon_revert_autostart.diff b/debian/patches/neon_revert_autostart.diff
new file mode 100644
index 0000000..583847b
--- /dev/null
+++ b/debian/patches/neon_revert_autostart.diff
@@ -0,0 +1,205 @@
+diff --git a/kcms/autostart/autostartmodel.cpp b/kcms/autostart/autostartmodel.cpp
+index 7250bc18b..7c03460b0 100644
+--- a/kcms/autostart/autostartmodel.cpp
++++ b/kcms/autostart/autostartmodel.cpp
+@@ -17,7 +17,6 @@
+ #include <QWindow>
+ 
+ #include <QDirIterator>
+-#include <QFileIconProvider>
+ #include <QFileInfo>
+ #include <QMimeDatabase>
+ #include <QRegularExpression>
+@@ -91,8 +90,6 @@ std::optional<AutostartEntry> AutostartModel::loadDesktopEntry(const QString &fi
+     return AutostartEntry{name, name, kind, enabled, fileName, onlyInPlasma, iconName};
+ }
+ 
+-static const QString FALLBACK_ICON = QStringLiteral("application-x-executable-script");
+-
+ AutostartModel::AutostartModel(QObject *parent)
+     : QAbstractListModel(parent)
+     , m_xdgConfigPath(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation))
+@@ -148,22 +145,17 @@ void AutostartModel::loadScriptsFromDir(const QString &subDir, AutostartModel::A
+     const auto autostartDirFilesInfo = dir.entryInfoList(QDir::Files);
+     for (const QFileInfo &fi : autostartDirFilesInfo) {
+         QString targetFileDir = fi.absoluteDir().path();
+-        QString fileName = fi.fileName();
+-        QString iconName;
++        QString targetFilePath = fi.absoluteFilePath();
++        QString fileName = QUrl::fromLocalFile(targetFilePath).fileName();
+         const bool isSymlink = fi.isSymLink();
+-
+-        // logout scripts are saved as symlinks
+         if (isSymlink) {
+-            QFileInfo symLinkTarget(fi.symLinkTarget());
+-            iconName = m_iconProvider.icon(symLinkTarget).name();
++            targetFilePath = fi.symLinkTarget();
++            QFileInfo symLinkTarget(targetFilePath);
+             targetFileDir = symLinkTarget.absoluteDir().path();
+             fileName = symLinkTarget.fileName();
+-        } else {
+-            iconName = m_iconProvider.icon(fi).name();
+         }
+ 
+-        iconName = iconName == QString("text-plain") ? FALLBACK_ICON : iconName;
+-        m_entries.push_back({fileName, targetFileDir, kind, true, fi.absoluteFilePath(), false, iconName});
++        m_entries.push_back({fileName, targetFileDir, kind, true, fi.absoluteFilePath(), false, QStringLiteral("dialog-scripts")});
+     }
+ }
+ 
+@@ -264,7 +256,7 @@ void AutostartModel::addApplication(const KService::Ptr &service)
+         newDesktopFile->sync();
+     }
+ 
+-    const QString iconName = !service->icon().isEmpty() ? service->icon() : FALLBACK_ICON;
++    const QString iconName = !service->icon().isEmpty() ? service->icon() : QStringLiteral("dialog-scripts");
+ 
+     const auto entry = AutostartEntry{service->name(),
+                                       service->name(),
+@@ -360,8 +352,6 @@ void AutostartModel::addScript(const QUrl &url, AutostartModel::AutostartEntrySo
+         // path of the desktop file that is about to be created
+         const QString newFilePath = m_xdgAutoStartPath.absoluteFilePath(fileName + QStringLiteral(".desktop"));
+ 
+-        QIcon icon = m_iconProvider.icon(file);
+-        QString iconName = icon.name() == QString("text-plain") ? FALLBACK_ICON : icon.name();
+         if (QFileInfo::exists(newFilePath)) {
+             const QUrl baseUrl = QUrl::fromLocalFile(m_xdgAutoStartPath.path());
+             QString newName = suggestName(baseUrl, fileName + QStringLiteral(".desktop"));
+@@ -369,11 +359,11 @@ void AutostartModel::addScript(const QUrl &url, AutostartModel::AutostartEntrySo
+             // remove the .desktop part from String
+             newName.chop(8);
+ 
+-            AutostartScriptDesktopFile desktopFile(newName, file.filePath(), iconName);
++            AutostartScriptDesktopFile desktopFile(newName, file.filePath());
+             insertScriptEntry(lastLoginScript + 1, file.fileName(), file.absoluteDir().path(), desktopFile.fileName(), kind);
+ 
+         } else {
+-            AutostartScriptDesktopFile desktopFile(fileName, file.filePath(), iconName);
++            AutostartScriptDesktopFile desktopFile(fileName, file.filePath());
+             insertScriptEntry(lastLoginScript + 1, file.fileName(), file.absoluteDir().path(), desktopFile.fileName(), kind);
+         }
+ 
+@@ -411,10 +401,8 @@ void AutostartModel::addScript(const QUrl &url, AutostartModel::AutostartEntrySo
+ void AutostartModel::insertScriptEntry(int index, const QString &name, const QString &targetFileDirPath, const QString &path, AutostartEntrySource kind)
+ {
+     beginInsertRows(QModelIndex(), index, index);
+-    QFileInfo targetFile{QDir(targetFileDirPath).filePath(name)};
+-    const QIcon icon = m_iconProvider.icon(targetFile);
+-    const QString iconName = icon.name() == QString("text-plain") ? FALLBACK_ICON : icon.name();
+-    AutostartEntry entry = AutostartEntry{name, targetFileDirPath, kind, true, path, false, iconName};
++
++    AutostartEntry entry = AutostartEntry{name, targetFileDirPath, kind, true, path, false, QStringLiteral("dialog-scripts")};
+ 
+     m_entries.insert(index, entry);
+ 
+diff --git a/kcms/autostart/autostartmodel.h b/kcms/autostart/autostartmodel.h
+index 21bcbbf4e..129a9fb58 100644
+--- a/kcms/autostart/autostartmodel.h
++++ b/kcms/autostart/autostartmodel.h
+@@ -8,7 +8,6 @@
+ 
+ #include <QAbstractListModel>
+ #include <QDir>
+-#include <QFileIconProvider>
+ 
+ #include <KService>
+ #include <optional>
+@@ -70,7 +69,6 @@ private:
+     QDir m_xdgConfigPath;
+     QDir m_xdgAutoStartPath;
+     QVector<AutostartEntry> m_entries;
+-    QFileIconProvider m_iconProvider;
+ };
+ 
+ struct AutostartEntry {
+diff --git a/kcms/autostart/package/contents/ui/main.qml b/kcms/autostart/package/contents/ui/main.qml
+index a3edd49eb..89eb6c386 100644
+--- a/kcms/autostart/package/contents/ui/main.qml
++++ b/kcms/autostart/package/contents/ui/main.qml
+@@ -77,7 +77,6 @@ KCM.ScrollViewKCM {
+             activeTextColor: Kirigami.Theme.textColor
+ 
+             contentItem: Kirigami.BasicListItem {
+-                width: listView.width - baseListItem.overlayWidth
+                 icon: model.iconName
+                 iconSelected: false // prevent icon flickering now that we've disabled background color changes
+                 reserveSpaceForSubtitle: true
+diff --git a/libkworkspace/autostartscriptdesktopfile.cpp b/libkworkspace/autostartscriptdesktopfile.cpp
+index 1e2885eb0..f44e96d38 100644
+--- a/libkworkspace/autostartscriptdesktopfile.cpp
++++ b/libkworkspace/autostartscriptdesktopfile.cpp
+@@ -14,14 +14,14 @@ QDir AutostartScriptDesktopFile::autostartLocation()
+     return QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)).filePath(QStringLiteral("autostart"));
+ }
+ 
+-AutostartScriptDesktopFile::AutostartScriptDesktopFile(const QString &name, const QString &execPath, const QString &iconName)
++AutostartScriptDesktopFile::AutostartScriptDesktopFile(const QString &name, const QString &execPath)
+     : KDesktopFile(autostartLocation().absoluteFilePath(name + QStringLiteral(".desktop")))
+ {
+     KConfigGroup kcg = desktopGroup();
+     kcg.writeEntry("Type", "Application");
+     kcg.writeEntry("Name", name);
+     kcg.writeEntry("Exec", execPath);
+-    kcg.writeEntry("Icon", iconName);
++    kcg.writeEntry("Icon", "dialog-scripts");
+     kcg.writeEntry(autostartScriptKey, "true");
+     kcg.writeEntry("Path", "");
+ }
+diff --git a/libkworkspace/autostartscriptdesktopfile.h b/libkworkspace/autostartscriptdesktopfile.h
+index 86ce282c4..43c28d96b 100644
+--- a/libkworkspace/autostartscriptdesktopfile.h
++++ b/libkworkspace/autostartscriptdesktopfile.h
+@@ -17,7 +17,7 @@
+ class KWORKSPACE_EXPORT AutostartScriptDesktopFile : public KDesktopFile
+ {
+ public:
+-    explicit AutostartScriptDesktopFile(const QString &name, const QString &execPath, const QString &iconName);
++    explicit AutostartScriptDesktopFile(const QString &name, const QString &execPath);
+ 
+     /**
+      * Checks whether this KDesktopFile has X-KDE-AutostartScript=true
+diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp
+index 4d8e45480..c3e314250 100644
+--- a/startkde/startplasma.cpp
++++ b/startkde/startplasma.cpp
+@@ -6,15 +6,15 @@
+ 
+ #include <config-startplasma.h>
+ 
+-#include <QDBusConnectionInterface>
+-#include <QDBusServiceWatcher>
+ #include <QDir>
+ #include <QEventLoop>
+-#include <QFileIconProvider>
+ #include <QProcess>
+ #include <QStandardPaths>
+ #include <QTextStream>
+ 
++#include <QDBusConnectionInterface>
++#include <QDBusServiceWatcher>
++
+ #include <KConfig>
+ #include <KConfigGroup>
+ #include <KNotifyConfig>
+@@ -591,7 +591,6 @@ static void migrateUserScriptsAutostart()
+     }
+     const QDir autostartScriptsMovedLocation(configLocation.filePath(QStringLiteral("old-autostart-scripts")));
+     const auto entries = autostartScriptsLocation.entryInfoList(QDir::Files);
+-    QFileIconProvider iconProvider;
+     for (const auto &info : entries) {
+         const auto scriptName = info.fileName();
+         const auto scriptPath = info.absoluteFilePath();
+@@ -605,12 +604,8 @@ static void migrateUserScriptsAutostart()
+             continue;
+         }
+ 
+-        QIcon icon = iconProvider.icon(info);
+-        QString iconName = icon.name();
+         // Migrate autostart script to a standard .desktop autostart file
+-        AutostartScriptDesktopFile desktopFile(scriptName,
+-                                               info.isSymLink() ? info.symLinkTarget() : scriptMovedPath,
+-                                               iconName == QStringLiteral("text-plain") ? QStringLiteral("application-x-executable-script") : iconName);
++        AutostartScriptDesktopFile desktopFile(scriptName, info.isSymLink() ? info.symLinkTarget() : scriptMovedPath);
+         qCInfo(PLASMA_STARTUP) << "Migrated legacy autostart script" << scriptPath << "to" << desktopFile.fileName();
+ 
+         if (info.isSymLink() && QFile::remove(scriptPath)) {
diff --git a/debian/patches/series b/debian/patches/series
index 03db5ec..165b965 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 disable_incompatible_tests
+neon_revert_autostart.diff


More information about the Neon-commits mailing list