Commit ed606eeb authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Use native KNS components

We do not need to take the extra path to c++
anymore and can just use the QML components.

For the UI reloading an explicit method call got added.
parent 7a5f5514
......@@ -26,7 +26,6 @@
#include <KConfigDialog>
#include <KNotification>
#include <kuiserverjobtracker.h>
#include <KNewStuff3/KNS3/DownloadDialog>
#include <KRun>
#include <KStandardShortcut>
......@@ -144,7 +143,6 @@ void ComicApplet::init()
ComicApplet::~ComicApplet()
{
delete mSavingDir;
delete m_newStuffDialog;
}
void ComicApplet::dataUpdated( const QString &source, const Plasma::DataEngine::Data &data )
......@@ -212,18 +210,11 @@ void ComicApplet::updateView()
updateContextMenu();
}
void ComicApplet::getNewComics()
void ComicApplet::loadProviders()
{
if (!mEngine) {
return;
}
if (!m_newStuffDialog) {
m_newStuffDialog = new KNS3::DownloadDialog( QStringLiteral("comic.knsrc") );
KNS3::DownloadDialog *strong = m_newStuffDialog.data();
strong->setTitle(i18nc("@title:window", "Download Comics"));
connect(m_newStuffDialog.data(), SIGNAL(finished(int)), mEngine, SLOT(loadProviders()));
if (mEngine) {
QMetaObject::invokeMethod(mEngine, "loadProviders");
}
m_newStuffDialog.data()->show();
}
void ComicApplet::positionFullView(QWindow *window)
......
......@@ -32,10 +32,6 @@ class QSortFilterProxyModel;
class QTimer;
class SavingDir;
namespace KNS3 {
class DownloadDialog;
}
class ComicApplet : public Plasma::Applet, public Plasma::DataEngineConsumer
{
Q_OBJECT
......@@ -149,7 +145,7 @@ Q_SIGNALS:
Q_INVOKABLE void goJump() { slotGoJump();}
Q_INVOKABLE void shop() { slotShop();}
Q_INVOKABLE void tabChanged(const QString &newIdentifier) { slotTabChanged(newIdentifier);}
Q_INVOKABLE void getNewComics();
Q_INVOKABLE void loadProviders();
Q_INVOKABLE void positionFullView(QWindow *window);
private:
......@@ -199,7 +195,6 @@ Q_SIGNALS:
QSizeF mLastSize;
QSizeF mIdealSize;
Plasma::DataEngine *mEngine;
QPointer<KNS3::DownloadDialog> m_newStuffDialog;
//Tabs
bool mTabAdded;
......
......@@ -8,6 +8,7 @@ import QtQuick 2.0
import QtQuick.Controls 2.5 as Controls
import QtQuick.Layouts 1.1 as Layouts
import org.kde.newstuff 1.62 as NewStuff
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.5 as Kirigami
......@@ -66,10 +67,11 @@ Kirigami.FormLayout {
}
}
Controls.Button {
icon.name: "get-hot-new-stuff"
NewStuff.Button {
id: ghnsButton
text: i18nc("@action:button", "Get New Comics...")
onClicked: plasmoid.nativeInterface.getNewComics();
configFile: "comic.knsrc"
onChangedEntriesChanged : plasmoid.nativeInterface.loadProviders();
}
Controls.CheckBox {
......
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