Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plymouth KCM
Commits
56c2a37d
Verified
Commit
56c2a37d
authored
Feb 16, 2021
by
Alexander Lohnau
💬
Browse files
Do not use deprecated KNewStuff QWidgets components
parent
d4feb744
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/kcm.cpp
View file @
56c2a37d
...
...
@@ -41,7 +41,6 @@
#include <kauthaction.h>
#include <kauthexecutejob.h>
#include <KNewStuff3/KNSCore/Engine>
#include <KNewStuff3/KNSCore/EntryInternal>
#include <KIO/CopyJob>
...
...
@@ -73,7 +72,6 @@ KCMPlymouth::KCMPlymouth(QObject *parent, const QVariantList &args)
KCMPlymouth
::~
KCMPlymouth
()
{
delete
m_newStuffDialog
.
data
();
}
void
KCMPlymouth
::
reloadModel
()
...
...
@@ -126,33 +124,20 @@ void KCMPlymouth::reloadModel()
emit
selectedPluginIndexChanged
();
}
void
KCMPlymouth
::
getNewStuff
(
QQuickItem
*
ctx
)
void
KCMPlymouth
::
onChangedEntriesChanged
(
const
QQmlListReference
&
changedEntries
)
{
if
(
!
m_newStuffDialog
)
{
m_newStuffDialog
=
new
KNS3
::
DownloadDialog
(
QLatin1String
(
"plymouth.knsrc"
));
m_newStuffDialog
->
setWindowTitle
(
i18n
(
"Download New Boot Splash Screens"
));
m_newStuffDialog
->
setWindowModality
(
Qt
::
WindowModal
);
m_newStuffDialog
->
winId
();
// so it creates the windowHandle();
connect
(
m_newStuffDialog
.
data
(),
&
KNS3
::
DownloadDialog
::
accepted
,
this
,
&
KCMPlymouth
::
reloadModel
);
connect
(
m_newStuffDialog
.
data
(),
&
KNS3
::
DownloadDialog
::
finished
,
m_newStuffDialog
.
data
(),
&
KNS3
::
DownloadDialog
::
deleteLater
);
connect
(
m_newStuffDialog
->
engine
(),
&
KNSCore
::
Engine
::
signalEntryChanged
,
this
,
[
=
](
const
KNSCore
::
EntryInternal
&
entry
)
{
if
(
!
entry
.
isValid
()
||
entry
.
status
()
!=
KNS3
::
Entry
::
Installed
)
{
return
;
}
static
QStringList
alreadyCopiedThumbnails
;
for
(
int
i
=
0
;
i
<
changedEntries
.
count
();
++
i
)
{
auto
entry
=
qobject_cast
<
KNSCore
::
EntryWrapper
*>
(
changedEntries
.
at
(
i
))
->
entry
();
if
(
entry
.
isValid
()
&&
entry
.
status
()
==
KNS3
::
Entry
::
Installed
&&
!
alreadyCopiedThumbnails
.
contains
(
entry
.
uniqueId
()))
{
alreadyCopiedThumbnails
.
append
(
entry
.
uniqueId
());
KIO
::
file_copy
(
QUrl
(
entry
.
previewUrl
(
KNSCore
::
EntryInternal
::
PreviewBig1
)),
QUrl
::
fromLocalFile
(
QString
(
entry
.
installedFiles
().
constFirst
()
+
QStringLiteral
(
".png"
))),
-
1
,
KIO
::
Overwrite
|
KIO
::
HideProgressInfo
);
});
}
if
(
ctx
&&
ctx
->
window
())
{
m_newStuffDialog
->
windowHandle
()
->
setTransientParent
(
ctx
->
window
());
}
}
m_newStuffDialog
->
show
();
reloadModel
();
}
QStandardItemModel
*
KCMPlymouth
::
themesModel
()
...
...
src/kcm.h
View file @
56c2a37d
...
...
@@ -21,10 +21,9 @@
#ifndef _KCM_PLYMOUTH_H
#define _KCM_PLYMOUTH_H
#include <KNewStuff3/KNSCore/EntryWrapper>
#include <QDir>
#include <KNewStuff3/KNS3/DownloadDialog>
#include <KQuickAddons/ConfigModule>
class
QQuickItem
;
...
...
@@ -59,7 +58,7 @@ public:
void
setBusy
(
const
bool
&
busy
);
Q_INVOKABLE
void
reloadModel
();
Q_INVOKABLE
void
getNewStuff
(
QQuickItem
*
ctx
);
Q_INVOKABLE
void
onChangedEntriesChanged
(
const
QQmlListReference
&
changedEntries
);
Q_INVOKABLE
void
uninstall
(
const
QString
&
plugin
);
public
Q_SLOTS
:
...
...
@@ -80,7 +79,6 @@ private:
QStandardItemModel
*
m_model
;
QString
m_selectedPlugin
;
bool
m_busy
=
false
;
QPointer
<
KNS3
::
DownloadDialog
>
m_newStuffDialog
;
};
#endif
src/package/contents/ui/main.qml
View file @
56c2a37d
...
...
@@ -23,6 +23,7 @@ import QtQuick.Window 2.2
import
QtQuick
.
Controls
2.3
as
QtControls
import
org
.
kde
.
kirigami
2.4
as
Kirigami
import
org
.
kde
.
kcm
1.1
as
KCM
import
org
.
kde
.
newstuff
1.62
as
NewStuff
KCM.GridViewKCM
{
KCM.ConfigModule.quickHelp
:
i18n
(
"
This module lets you choose the Plymouth boot splash screen.
"
)
...
...
@@ -73,13 +74,14 @@ KCM.GridViewKCM {
indeterminate
:
true
}
QtControls
.Button
{
id
:
getNew
Button
NewStuff
.Button
{
id
:
newStuff
Button
Layout.alignment
:
Qt
.
AlignRight
enabled
:
!
kcm
.
busy
text
:
i18n
(
"
Get New Boot Splash Screens...
"
)
icon.name
:
"
get-hot-new-stuff
"
enab
le
d
:
!
kcm
.
busy
onC
licked
:
kcm
.
getNewStuff
(
thi
s
)
configFi
le
:
"
plymouth.knsrc
"
onC
hangedEntriesChanged
:
kcm
.
onChangedEntriesChanged
(
newStuffButton
.
changedEntrie
s
)
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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