Remove ComponentInstaller
When a dataengine failed to load it would ask PackageKit to install it but it's generally not how we want to distribute plasmoid infrastructure these days and didn't work. Differential Revision: https://phabricator.kde.org/D16301
This commit is contained in:
parent
e6f6bf9624
commit
38098e96e3
@ -14,7 +14,6 @@ find_package(Qt5Widgets REQUIRED)
|
|||||||
# add_definitions( -DKDESRCDIR=${CMAKE_CURRENT_SOURCE_DIR} )
|
# add_definitions( -DKDESRCDIR=${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
|
|
||||||
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
||||||
set(PLASMA_NO_PACKAGEKIT TRUE)
|
|
||||||
set(PLASMA_NO_PACKAGE_EXTRADATA TRUE)
|
set(PLASMA_NO_PACKAGE_EXTRADATA TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -8,25 +8,15 @@ add_subdirectory(packagestructure)
|
|||||||
set(CMAKE_AUTOMOC_RELAXED_MODE ON)
|
set(CMAKE_AUTOMOC_RELAXED_MODE ON)
|
||||||
|
|
||||||
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
||||||
set(PLASMA_NO_PACKAGEKIT TRUE)
|
|
||||||
set(PLASMA_NO_PACKAGE_EXTRADATA TRUE)
|
set(PLASMA_NO_PACKAGE_EXTRADATA TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT HAVE_X11)
|
|
||||||
set(PLASMA_NO_PACKAGEKIT TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#find_package(KdepimLibs 4.5.60)
|
#find_package(KdepimLibs 4.5.60)
|
||||||
#find_package(Gpgme)
|
#find_package(Gpgme)
|
||||||
#set_package_properties(KDEPIMLIBS PROPERTIES DESCRIPTION "KDE PIM libraries"
|
#set_package_properties(KDEPIMLIBS PROPERTIES DESCRIPTION "KDE PIM libraries"
|
||||||
# URL "http://www.kde.org" TYPE OPTIONAL
|
# URL "http://www.kde.org" TYPE OPTIONAL
|
||||||
# PURPOSE "Needed for building several Plasma DataEngines")
|
# PURPOSE "Needed for building several Plasma DataEngines")
|
||||||
|
|
||||||
if(NOT PLASMA_NO_PACKAGEKIT)
|
|
||||||
add_definitions(-DPLASMA_ENABLE_PACKAGEKIT_SUPPORT=1)
|
|
||||||
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} Qt5::DBus)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-plasma.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-plasma.h)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-plasma.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-plasma.h)
|
||||||
|
|
||||||
#FIXME: gpgme++ is in kdepimlibs, must move somewhere else!
|
#FIXME: gpgme++ is in kdepimlibs, must move somewhere else!
|
||||||
@ -41,7 +31,6 @@ set(Plasma_LIB_SRCS
|
|||||||
plasma.cpp
|
plasma.cpp
|
||||||
pluginloader.cpp
|
pluginloader.cpp
|
||||||
version.cpp
|
version.cpp
|
||||||
private/componentinstaller.cpp
|
|
||||||
|
|
||||||
#applets,containments,corona
|
#applets,containments,corona
|
||||||
applet.cpp
|
applet.cpp
|
||||||
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2011 Kevin Kofler <kevin.kofler@chello.at>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* 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 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 "private/componentinstaller_p.h"
|
|
||||||
|
|
||||||
#include <QSet>
|
|
||||||
#include <QDBusInterface>
|
|
||||||
#include <QDBusPendingCall>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLatin1String>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
class ComponentInstallerPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
#ifdef PLASMA_ENABLE_PACKAGEKIT_SUPPORT
|
|
||||||
QSet<QString> alreadyPrompted;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
class ComponentInstallerSingleton
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ComponentInstaller self;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(ComponentInstallerSingleton, privateComponentInstallerSelf)
|
|
||||||
|
|
||||||
ComponentInstaller *ComponentInstaller::self()
|
|
||||||
{
|
|
||||||
return &privateComponentInstallerSelf()->self;
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentInstaller::ComponentInstaller()
|
|
||||||
: d(new ComponentInstallerPrivate)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentInstaller::~ComponentInstaller()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ComponentInstaller::installMissingComponent(const QString &type,
|
|
||||||
const QString &name,
|
|
||||||
QWidget *parent, bool force)
|
|
||||||
{
|
|
||||||
#ifdef PLASMA_ENABLE_PACKAGEKIT_SUPPORT
|
|
||||||
QString searchString = type + QLatin1Char('-') + name;
|
|
||||||
|
|
||||||
if (!force) {
|
|
||||||
if (d->alreadyPrompted.contains(searchString)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
d->alreadyPrompted.insert(searchString);
|
|
||||||
|
|
||||||
QDBusInterface packageKit(QStringLiteral("org.freedesktop.PackageKit"),
|
|
||||||
QStringLiteral("/org/freedesktop/PackageKit"),
|
|
||||||
QStringLiteral("org.freedesktop.PackageKit.Modify"));
|
|
||||||
// We don't check packageKit.isValid() because the service is activated on
|
|
||||||
// demand, so it will show up as "not valid".
|
|
||||||
WId wid = 0;
|
|
||||||
if (parent) {
|
|
||||||
wid = parent->winId();
|
|
||||||
}
|
|
||||||
QStringList resources;
|
|
||||||
resources.append(searchString);
|
|
||||||
packageKit.asyncCall(QStringLiteral("InstallResources"), (unsigned int) wid,
|
|
||||||
QLatin1String("plasma-service"), resources, QString());
|
|
||||||
#else
|
|
||||||
Q_UNUSED(type);
|
|
||||||
Q_UNUSED(name);
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
Q_UNUSED(force);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Plasma
|
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2011 Kevin Kofler <kevin.kofler@chello.at>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* 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 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 PLASMA_COMPONENTINSTALLER_H
|
|
||||||
#define PLASMA_COMPONENTINSTALLER_H
|
|
||||||
|
|
||||||
class QString;
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
class ComponentInstallerPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class ComponentInstaller plasma/private/componentinstaller_p.h
|
|
||||||
*
|
|
||||||
* @short This class provides a generic API for installation of components.
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* Plasma::ComponentInstaller allows searching for a missing data or script
|
|
||||||
* engine by name, and allowing the user to install the missing service.
|
|
||||||
* Currently, PackageKit is supported as the mechanism to install components,
|
|
||||||
* but more mechanisms could be supported in the future through the same API.
|
|
||||||
*
|
|
||||||
* @since 4.8
|
|
||||||
*/
|
|
||||||
class ComponentInstaller
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Singleton pattern accessor.
|
|
||||||
*/
|
|
||||||
static ComponentInstaller *self();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs a missing component asynchronously.
|
|
||||||
*
|
|
||||||
* By default, this method will cache requested components and not
|
|
||||||
* prompt again for the same engine in the same session. The force
|
|
||||||
* parameter can be used to disable this mechanism, e.g. when the user
|
|
||||||
* just installed a new widget written in a scripting language, and so
|
|
||||||
* is likely to want the script engine installed after all.
|
|
||||||
*
|
|
||||||
* In the case of on-demand installation, this will unfortunately not
|
|
||||||
* allow the call which triggered the missing component lookup to
|
|
||||||
* succeed, but we cannot afford to block all of Plasma until the
|
|
||||||
* mechanism is done installing the service.
|
|
||||||
*
|
|
||||||
* This function does nothing if PackageKit integration was disabled at
|
|
||||||
* compile time.
|
|
||||||
*
|
|
||||||
* @param type the type of the component, should be "scriptengine" or
|
|
||||||
* "dataengine"
|
|
||||||
* @param name the name of the component
|
|
||||||
* @param parent a parent widget, used to set the wid for PackageKit
|
|
||||||
* @param force whether to always prompt, even if recently prompted
|
|
||||||
*/
|
|
||||||
void installMissingComponent(const QString &type, const QString &name,
|
|
||||||
QWidget *parent = nullptr, bool force = false);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* Default constructor. The singleton method self() is the
|
|
||||||
* preferred access mechanism.
|
|
||||||
*/
|
|
||||||
ComponentInstaller();
|
|
||||||
~ComponentInstaller();
|
|
||||||
|
|
||||||
ComponentInstallerPrivate *const d;
|
|
||||||
|
|
||||||
friend class ComponentInstallerSingleton;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Plasma
|
|
||||||
|
|
||||||
#endif // multiple inclusion guard
|
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "datacontainer.h"
|
#include "datacontainer.h"
|
||||||
#include "pluginloader.h"
|
#include "pluginloader.h"
|
||||||
#include "private/componentinstaller_p.h"
|
|
||||||
#include "private/dataengine_p.h"
|
#include "private/dataengine_p.h"
|
||||||
#include "private/datacontainer_p.h"
|
#include "private/datacontainer_p.h"
|
||||||
#include "scripting/scriptengine.h"
|
#include "scripting/scriptengine.h"
|
||||||
@ -134,9 +133,6 @@ Plasma::DataEngine *DataEngineManager::loadEngine(const QString &name)
|
|||||||
DataEngine *engine = PluginLoader::self()->loadDataEngine(name);
|
DataEngine *engine = PluginLoader::self()->loadDataEngine(name);
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name;
|
qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name;
|
||||||
// Try installing the engine. However, it's too late for this request.
|
|
||||||
ComponentInstaller::self()->installMissingComponent(QStringLiteral("dataengine"), name);
|
|
||||||
|
|
||||||
return d->nullEngine();
|
return d->nullEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "dataengine.h"
|
#include "dataengine.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "private/componentinstaller_p.h"
|
|
||||||
#include "scripting/appletscript.h"
|
#include "scripting/appletscript.h"
|
||||||
#include "scripting/dataenginescript.h"
|
#include "scripting/dataenginescript.h"
|
||||||
#include "debug_p.h"
|
#include "debug_p.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user