Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frameworks
Integration for Frameworks
Commits
9eed27b5
Commit
9eed27b5
authored
Jan 04, 2021
by
Alexander Lohnau
💬
Browse files
Fix window decorations not being uninstallable
BUG: 414570
FIXED-IN: 5.79
parent
5dddcdee
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/kpackage-install-handlers/kns/main.cpp
View file @
9eed27b5
/*
This file is part of the KDE libraries
SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
...
...
@@ -12,6 +13,7 @@
#include
<QDebug>
#include
<QStandardPaths>
#include
<QFile>
#include
<QFileInfo>
#include
<KLocalizedString>
...
...
@@ -22,8 +24,37 @@
#include
"knshandlerversion.h"
/**
* Unfortunately there are two knsrc files for the window decorations, but only one is used in the KCM.
* But both are used by third parties, consequently we can not remove one. To solve this we create a symlink
* which links the old cache file to the new cache file, which is exposed on the GUI.
* This way users can again remove window decorations that are installed as a dependency of a global theme.
* BUG: 414570
*/
void
createSymlinkForWindowDecorations
()
{
QFileInfo
info
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/knewstuff3/aurorae.knsregistry"
));
// If we have created the symbolic link already we can exit the function here
if
(
info
.
isSymbolicLink
())
{
return
;
}
// Delete this file, it the KNS entries are not exposed in any GUI
if
(
info
.
exists
())
{
QFile
::
remove
(
info
.
absoluteFilePath
());
}
QFileInfo
newFileInfo
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/knewstuff3/window-decorations.knsregistry"
));
QFile
file
(
newFileInfo
.
absoluteFilePath
());
// Make sure that the file exists
if
(
!
newFileInfo
.
exists
())
{
file
.
open
(
QFile
::
WriteOnly
);
file
.
close
();
}
file
.
link
(
info
.
absoluteFilePath
());
}
int
main
(
int
argc
,
char
**
argv
)
{
createSymlinkForWindowDecorations
();
QCoreApplication
app
(
argc
,
argv
);
app
.
setApplicationName
(
QLatin1String
(
"kpackage-knshandler"
));
app
.
setApplicationVersion
(
knshandlerversion
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment