Commit 5b5a9957 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Fix TestXdgShellClient::testDesktopFileName

Summary:
Allows AbstractClient::m_desktopFileName be an absolute path, which is
used by tests.

Test Plan: Test passes, other things still work, including telegram.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29758
parent d6e119f4
......@@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDesktopFile>
#include <QDir>
#include <QMouseEvent>
#include <QStyleHints>
......@@ -2545,8 +2546,16 @@ void AbstractClient::setDesktopFileName(QByteArray name)
QString AbstractClient::iconFromDesktopFile() const
{
const QString desktopFileName = QString::fromUtf8(m_desktopFileName);
QString desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation,
desktopFileName);
QString desktopFilePath;
if (QDir::isAbsolutePath(desktopFileName)) {
desktopFilePath = desktopFileName;
}
if (desktopFilePath.isEmpty()) {
desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation,
desktopFileName);
}
if (desktopFilePath.isEmpty()) {
desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation,
desktopFileName + QLatin1String(".desktop"));
......
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