Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 5e1b6508 authored by Zren (Chris Holland)'s avatar Zren (Chris Holland)

Add wallpaperplugin.knsrc + QML function to open GHNS dialog

CCBUG: 386621

Differential Revision: https://phabricator.kde.org/D12040
parent ddebf50e
......@@ -8,6 +8,7 @@ endif (KF5TextEditor_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-shellprivate.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-shellprivate.h)
set(plasmashellprivateplugin_SRCS
wallpaperplugin/wallpaperplugin.cpp
widgetexplorer/kcategorizeditemsviewmodels.cpp
widgetexplorer/plasmaappletitemmodel.cpp
widgetexplorer/openwidgetassistant.cpp
......@@ -42,7 +43,11 @@ if (KF5TextEditor_FOUND)
endif (KF5TextEditor_FOUND)
install(TARGETS plasmashellprivateplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/shell)
install(FILES widgetexplorer/plasmoids.knsrc DESTINATION ${KDE_INSTALL_CONFDIR})
install(FILES
wallpaperplugin/wallpaperplugin.knsrc
widgetexplorer/plasmoids.knsrc
DESTINATION ${KDE_INSTALL_CONFDIR}
)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/shell)
......@@ -25,6 +25,7 @@
#include <QQmlEngine>
#include "wallpaperplugin/wallpaperplugin.h"
#include "widgetexplorer/widgetexplorer.h"
#include <plasma/containment.h>
......@@ -37,6 +38,7 @@ void PlasmaShellPrivatePlugin::registerTypes(const char *uri)
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.shell"));
qmlRegisterType<Plasma::Containment>();
qmlRegisterType<WallpaperPlugin>(uri, 2, 0, "WallpaperPlugin");
qmlRegisterType<WidgetExplorer>(uri, 2, 0, "WidgetExplorer");
#if KF5TextEditor_FOUND
qmlRegisterType<InteractiveConsoleItem>(uri, 2, 0, "InteractiveConsoleWindow");
......
/*
* Copyright (C) 2018 Chris Holland <zrenfire@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library/Lesser General Public License
* version 2, or (at your option) any later version, as published by the
* Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library/Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "wallpaperplugin.h"
#include <QQuickItem>
#include <QQuickWindow>
#include <KNewStuff3/KNS3/DownloadDialog>
#include <klocalizedstring.h>
#include <Plasma/Theme>
WallpaperPlugin::WallpaperPlugin(QObject *parent)
: QObject(parent)
{
}
WallpaperPlugin::~WallpaperPlugin()
{
}
void WallpaperPlugin::getNewWallpaperPlugin(QQuickItem *ctx)
{
if (!m_newStuffDialog) {
m_newStuffDialog = new KNS3::DownloadDialog( QString::fromLatin1("wallpaperplugin.knsrc") );
m_newStuffDialog->setTitle(i18n("Download Wallpaper Plugins"));
}
if (ctx && ctx->window()) {
m_newStuffDialog->setWindowModality(Qt::WindowModal);
m_newStuffDialog->winId(); // so it creates the windowHandle();
m_newStuffDialog->windowHandle()->setTransientParent(ctx->window());
}
m_newStuffDialog->show();
}
/*
* Copyright (C) 2018 Chris Holland <zrenfire@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library/Lesser General Public License
* version 2, or (at your option) any later version, as published by the
* Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library/Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef WALLPAPERPLUGIN_H
#define WALLPAPERPLUGIN_H
#include <QObject>
#include <QPointer>
class QQuickItem;
namespace KNS3 {
class DownloadDialog;
}
class WallpaperPlugin : public QObject
{
Q_OBJECT
public:
explicit WallpaperPlugin(QObject* parent = nullptr);
~WallpaperPlugin() override;
Q_INVOKABLE void getNewWallpaperPlugin(QQuickItem *ctx = nullptr);
private:
QPointer<KNS3::DownloadDialog> m_newStuffDialog;
};
#endif
[KNewStuff3]
Name=Wallpaper Plugins
ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=Plasma Wallpaper Plugin
StandardResource=tmp
InstallationCommand=kpackagetool5 --type Plasma/Wallpaper --install %f
UninstallCommand=kpackagetool5 --type Plasma/Wallpaper --remove %f
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