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
Plasma
Plasma Workspace
Commits
b9ff1a4e
Commit
b9ff1a4e
authored
Mar 06, 2022
by
Volker Krause
Browse files
Remove 4 era migration code
The necessary infrastructure is not available in KF6 anymore.
parent
b307cfea
Pipeline
#146453
passed with stage
in 9 minutes and 7 seconds
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
kcms/icons/main.cpp
View file @
b9ff1a4e
...
...
@@ -35,7 +35,6 @@
#include
<KPluginFactory>
#include
<KSharedConfig>
#include
<KTar>
#include
<Kdelibs4Migration>
#include
<KIO/DeleteJob>
#include
<KIO/FileCopyJob>
...
...
@@ -117,8 +116,6 @@ void IconModule::load()
void
IconModule
::
save
()
{
bool
needToExportToKDE4
=
iconsSettings
()
->
isSaveNeeded
();
// keep track of Group of icons size that has changed
QList
<
int
>
notifyList
;
for
(
int
i
=
0
;
i
<
m_iconSizeCategoryModel
->
rowCount
();
++
i
)
{
...
...
@@ -131,11 +128,6 @@ void IconModule::save()
ManagedConfigModule
::
save
();
if
(
needToExportToKDE4
)
{
// Is this still needed?
exportToKDE4
();
}
processPendingDeletions
();
// Notify the group(s) where icon sizes have changed
...
...
@@ -227,62 +219,6 @@ void IconModule::installThemeFile(const QString &path)
m_model
->
load
();
}
void
IconModule
::
exportToKDE4
()
{
// TODO: killing the kde4 icon cache: possible? (kde4migration doesn't let access the cache folder)
Kdelibs4Migration
migration
;
QString
configFilePath
=
migration
.
saveLocation
(
"config"
);
if
(
configFilePath
.
isEmpty
())
{
return
;
}
configFilePath
+=
QLatin1String
(
"kdeglobals"
);
KSharedConfigPtr
kglobalcfg
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
"kdeglobals"
));
KConfig
kde4config
(
configFilePath
,
KConfig
::
SimpleConfig
);
KConfigGroup
kde4IconGroup
(
&
kde4config
,
"Icons"
);
kde4IconGroup
.
writeEntry
(
"Theme"
,
iconsSettings
()
->
theme
());
// Synchronize icon effects
for
(
int
row
=
0
;
row
<
m_iconSizeCategoryModel
->
rowCount
();
row
++
)
{
QModelIndex
idx
(
m_iconSizeCategoryModel
->
index
(
row
,
0
));
QString
group
=
m_iconSizeCategoryModel
->
data
(
idx
,
IconSizeCategoryModel
::
ConfigSectionRole
).
toString
();
const
QString
groupName
=
group
+
QLatin1String
(
"Icons"
);
KConfigGroup
cg
(
kglobalcfg
,
groupName
);
KConfigGroup
kde4Cg
(
&
kde4config
,
groupName
);
// HACK copyTo only copies keys, it doesn't replace the entire group
// which means if we removed the effects in our config it won't remove
// them from the kde4 config, hence revert all of them prior to copying
const
QStringList
keys
=
cg
.
keyList
()
+
kde4Cg
.
keyList
();
for
(
const
QString
&
key
:
keys
)
{
kde4Cg
.
revertToDefault
(
key
);
}
// now copy over the new values
cg
.
copyTo
(
&
kde4Cg
);
}
kde4config
.
sync
();
QProcess
*
cachePathProcess
=
new
QProcess
(
this
);
connect
(
cachePathProcess
,
&
QProcess
::
finished
,
this
,
[
cachePathProcess
](
int
exitCode
,
QProcess
::
ExitStatus
status
)
{
if
(
status
==
QProcess
::
NormalExit
&&
exitCode
==
0
)
{
QString
path
=
cachePathProcess
->
readAllStandardOutput
().
trimmed
();
path
.
append
(
QLatin1String
(
"icon-cache.kcache"
));
QFile
::
remove
(
path
);
}
// message kde4 apps that icon theme has changed
for
(
int
i
=
0
;
i
<
KIconLoader
::
LastGroup
;
++
i
)
{
notifyKcmChange
(
GlobalChangeType
::
IconChanged
,
KIconLoader
::
Group
(
i
));
}
cachePathProcess
->
deleteLater
();
});
cachePathProcess
->
start
(
QStringLiteral
(
"kde4-config"
),
{
QStringLiteral
(
"--path"
),
QStringLiteral
(
"cache"
)});
}
QStringList
IconModule
::
findThemeDirs
(
const
QString
&
archiveName
)
{
QStringList
foundThemes
;
...
...
kcms/icons/main.h
View file @
b9ff1a4e
...
...
@@ -95,8 +95,6 @@ private:
bool
installThemes
(
const
QStringList
&
themes
,
const
QString
&
archiveName
);
void
installThemeFile
(
const
QString
&
path
);
void
exportToKDE4
();
static
QPixmap
getBestIcon
(
KIconTheme
&
theme
,
const
QStringList
&
iconNames
,
int
size
,
qreal
dpr
);
IconsData
*
m_data
;
...
...
kcms/krdb/krdb.cpp
View file @
b9ff1a4e
...
...
@@ -47,7 +47,6 @@
#include
<KLocalizedString>
#include
<KProcess>
#include
<KWindowSystem>
#include
<Kdelibs4Migration>
#include
<updatelaunchenvjob.h>
...
...
@@ -505,106 +504,4 @@ void runRdb(uint flags)
}
#endif
}
// Legacy support:
// Try to sync kde4 settings with ours
Kdelibs4Migration
migration
;
// kf5 congig groups for general and icons
KConfigGroup
generalGroup
(
kglobalcfg
,
"General"
);
KConfigGroup
iconsGroup
(
kglobalcfg
,
"Icons"
);
const
QString
colorSchemeName
=
generalGroup
.
readEntry
(
"ColorScheme"
,
QStringLiteral
(
"BreezeLight"
));
QString
colorSchemeSrcFile
;
if
(
colorSchemeName
!=
QLatin1String
(
"Default"
))
{
// fix filename, copied from ColorsCM::saveScheme()
QString
colorSchemeFilename
=
colorSchemeName
;
colorSchemeFilename
.
remove
(
'\''
);
// So Foo's does not become FooS
QRegExp
fixer
(
QStringLiteral
(
"[
\\
W,.-]+(.?)"
));
int
offset
;
while
((
offset
=
fixer
.
indexIn
(
colorSchemeFilename
))
>=
0
)
colorSchemeFilename
.
replace
(
offset
,
fixer
.
matchedLength
(),
fixer
.
cap
(
1
).
toUpper
());
colorSchemeFilename
.
replace
(
0
,
1
,
colorSchemeFilename
.
at
(
0
).
toUpper
());
// clone the color scheme
colorSchemeSrcFile
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
"color-schemes/"
+
colorSchemeFilename
+
".colors"
);
const
QString
dest
=
migration
.
saveLocation
(
"data"
,
QStringLiteral
(
"color-schemes"
))
+
colorSchemeName
+
".colors"
;
QFile
::
remove
(
dest
);
QFile
::
copy
(
colorSchemeSrcFile
,
dest
);
}
// Apply the color scheme
QString
configFilePath
=
migration
.
saveLocation
(
"config"
)
+
"kdeglobals"
;
if
(
configFilePath
.
isEmpty
())
{
return
;
}
KConfig
kde4config
(
configFilePath
,
KConfig
::
SimpleConfig
);
KConfigGroup
kde4generalGroup
(
&
kde4config
,
"General"
);
kde4generalGroup
.
writeEntry
(
"ColorScheme"
,
colorSchemeName
);
// fonts
QString
font
=
generalGroup
.
readEntry
(
"font"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"font"
,
font
);
}
font
=
generalGroup
.
readEntry
(
"desktopFont"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"desktopFont"
,
font
);
}
font
=
generalGroup
.
readEntry
(
"menuFont"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"menuFont"
,
font
);
}
font
=
generalGroup
.
readEntry
(
"smallestReadableFont"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"smallestReadableFont"
,
font
);
}
font
=
generalGroup
.
readEntry
(
"taskbarFont"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"taskbarFont"
,
font
);
}
font
=
generalGroup
.
readEntry
(
"toolBarFont"
,
QString
());
if
(
!
font
.
isEmpty
())
{
kde4generalGroup
.
writeEntry
(
"toolBarFont"
,
font
);
}
// TODO: does exist any way to check if a qt4 widget style is present from a qt5 app?
// kde4generalGroup.writeEntry("widgetStyle", "qtcurve");
kde4generalGroup
.
sync
();
KConfigGroup
kde4IconGroup
(
&
kde4config
,
"Icons"
);
QString
iconTheme
=
iconsGroup
.
readEntry
(
"Theme"
,
QString
());
if
(
!
iconTheme
.
isEmpty
())
{
kde4IconGroup
.
writeEntry
(
"Theme"
,
iconTheme
);
}
kde4IconGroup
.
sync
();
if
(
!
colorSchemeSrcFile
.
isEmpty
())
{
// copy all the groups in the color scheme in kdeglobals
KSharedConfigPtr
kde4ColorConfig
=
KSharedConfig
::
openConfig
(
colorSchemeSrcFile
,
KConfig
::
SimpleConfig
);
foreach
(
const
QString
&
grp
,
kde4ColorConfig
->
groupList
())
{
KConfigGroup
cg
(
kde4ColorConfig
,
grp
);
KConfigGroup
cg2
(
&
kde4config
,
grp
);
cg
.
copyTo
(
&
cg2
);
}
}
// widgets settings
KConfigGroup
kglobals4
(
&
kde4config
,
"KDE"
);
kglobals4
.
writeEntry
(
"ShowIconsInMenuItems"
,
kglobals
.
readEntry
(
"ShowIconsInMenuItems"
,
true
));
kglobals4
.
writeEntry
(
"ShowIconsOnPushButtons"
,
kglobals
.
readEntry
(
"ShowIconsOnPushButtons"
,
true
));
kglobals4
.
writeEntry
(
"contrast"
,
kglobals
.
readEntry
(
"contrast"
,
4
));
// FIXME: this should somehow check if the kde4 version of the style is installed
kde4generalGroup
.
writeEntry
(
"widgetStyle"
,
kglobals
.
readEntry
(
"widgetStyle"
,
"breeze"
));
// toolbar style
KConfigGroup
toolbars4
(
&
kde4config
,
"Toolbar style"
);
KConfigGroup
toolbars5
(
kglobalcfg
,
"Toolbar style"
);
toolbars4
.
writeEntry
(
"ToolButtonStyle"
,
toolbars5
.
readEntry
(
"ToolButtonStyle"
,
"TextBesideIcon"
));
toolbars4
.
writeEntry
(
"ToolButtonStyleOtherToolbars"
,
toolbars5
.
readEntry
(
"ToolButtonStyleOtherToolbars"
,
"TextBesideIcon"
));
}
startkde/plasma-session/startup.cpp
View file @
b9ff1a4e
...
...
@@ -28,7 +28,6 @@
#include
<KIO/DesktopExecParser>
#include
<KProcess>
#include
<KService>
#include
<Kdelibs4Migration>
#include
<QDBusConnection>
#include
<QDBusMessage>
...
...
@@ -113,12 +112,10 @@ public:
:
Phase
(
autostart
,
parent
)
{
}
void
migrateKDE4Autostart
();
void
start
()
override
{
qCDebug
(
PLASMA_SESSION
)
<<
"Phase 2"
;
migrateKDE4Autostart
();
addSubjob
(
new
AutoStartAppsJob
(
m_autostart
,
2
));
addSubjob
(
new
KDEDInitJob
());
}
...
...
@@ -309,50 +306,6 @@ void RestoreSessionJob::start()
connect
(
watcher
,
&
QDBusPendingCallWatcher
::
finished
,
watcher
,
&
QObject
::
deleteLater
);
}
void
StartupPhase2
::
migrateKDE4Autostart
()
{
// Migrate user autostart from kde4
Kdelibs4Migration
migration
;
if
(
!
migration
.
kdeHomeFound
())
{
return
;
}
const
QString
autostartFolder
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
)
+
QDir
::
separator
()
+
QStringLiteral
(
"autostart-scripts"
);
QDir
dir
(
autostartFolder
);
if
(
!
dir
.
exists
())
{
dir
.
mkpath
(
QStringLiteral
(
"."
));
}
// KDEHOME/Autostart was the default value for KGlobalSettings::autostart()
QString
oldAutostart
=
migration
.
kdeHome
()
+
QStringLiteral
(
"/Autostart"
);
// That path could be customized in kdeglobals
const
QString
oldKdeGlobals
=
migration
.
locateLocal
(
"config"
,
QStringLiteral
(
"kdeglobals"
));
if
(
!
oldKdeGlobals
.
isEmpty
())
{
oldAutostart
=
KConfig
(
oldKdeGlobals
).
group
(
"Paths"
).
readEntry
(
"Autostart"
,
oldAutostart
);
}
const
QDir
oldFolder
(
oldAutostart
);
qCDebug
(
PLASMA_SESSION
)
<<
"Copying autostart files from"
<<
oldFolder
.
path
();
const
QStringList
entries
=
oldFolder
.
entryList
(
QDir
::
Files
);
for
(
const
QString
&
file
:
entries
)
{
const
QString
src
=
oldFolder
.
absolutePath
()
+
QLatin1Char
(
'/'
)
+
file
;
const
QString
dest
=
autostartFolder
+
QLatin1Char
(
'/'
)
+
file
;
QFileInfo
info
(
src
);
bool
success
;
if
(
info
.
isSymLink
())
{
// This will only work with absolute symlink targets
success
=
QFile
::
link
(
info
.
symLinkTarget
(),
dest
);
}
else
{
success
=
QFile
::
copy
(
src
,
dest
);
}
if
(
!
success
)
{
qCWarning
(
PLASMA_SESSION
)
<<
"Error copying"
<<
src
<<
"to"
<<
dest
;
}
}
return
;
}
AutoStartAppsJob
::
AutoStartAppsJob
(
const
AutoStart
&
autostart
,
int
phase
)
:
m_autoStart
(
autostart
)
{
...
...
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