Merge remote-tracking branch 'origin/KDE/4.8' into frameworks

Conflicts:
	CMakeLists.txt
	interfaces/terminal/example/CMakeLists.txt
	kdecore/CMakeLists.txt
	kdeui/actions/ktogglefullscreenaction.cpp
	kdeui/widgets/khelpmenu.cpp
	kio/kio/accessmanager.cpp
	kio/kio/accessmanagerreply_p.cpp
	nepomuk/core/nepomukmainmodel.cpp
	nepomuk/core/resourcedata.cpp
	nepomuk/core/resourcemanager.cpp
	nepomuk/query/andterm_p.h
	nepomuk/query/comparisonterm.cpp
	nepomuk/query/comparisonterm_p.h
	nepomuk/query/literalterm.cpp
	nepomuk/query/literalterm_p.h
	nepomuk/query/negationterm.cpp
	nepomuk/query/negationterm_p.h
	nepomuk/query/optionalterm.cpp
	nepomuk/query/optionalterm_p.h
	nepomuk/query/orterm.cpp
	nepomuk/query/orterm_p.h
	nepomuk/query/query.cpp
	nepomuk/query/resourceterm.cpp
	nepomuk/query/resourceterm_p.h
	nepomuk/query/resourcetypeterm.cpp
	nepomuk/query/resourcetypeterm_p.h
	nepomuk/query/term_p.h
	plasma/package.cpp
	plasma/private/service_p.h
	plasma/runnermanager.cpp
	staging/kwidgets/autotests/kiconloader_unittest.cpp
	tier1/kcoreaddons/src/caching/kshareddatacache.cpp
	tier1/kdbusaddons/src/kdbusinterprocesslock.cpp
	tier1/solid/src/solid/backends/fstab/fstabmanager.cpp
	tier1/solid/src/solid/backends/wmi/wmicdrom.cpp
	tier1/solid/src/solid/backends/wmi/wmidevice.cpp
	tier1/solid/src/solid/backends/wmi/wmimanager.cpp
	tier1/solid/src/solid/backends/wmi/wmiopticaldisc.cpp
This commit is contained in:
Stephen Kelly 2012-06-16 13:11:07 +02:00
commit 9d49500245
10 changed files with 203 additions and 61 deletions

View File

@ -1365,6 +1365,10 @@ void Applet::showConfigurationInterface()
KCModuleProxy *module = new KCModuleProxy(kcm);
if (module->realModule()) {
connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool)));
connect(dialog, SIGNAL(okClicked()),
module->realModule(), SLOT(save()));
connect(dialog, SIGNAL(applyClicked()),
module->realModule(), SLOT(save()));
dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon());
hasPages = true;
} else {
@ -1377,6 +1381,10 @@ void Applet::showConfigurationInterface()
KCModule *module = service->createInstance<KCModule>(dialog, QVariantList(), &error);
if (module) {
connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool)));
connect(dialog, SIGNAL(okClicked()),
module, SLOT(save()));
connect(dialog, SIGNAL(applyClicked()),
module, SLOT(save()));
dialog->addPage(module, service->name(), service->icon());
hasPages = true;
} else {

View File

@ -56,7 +56,7 @@ Comment[nn]=KRunner-tillegg
Comment[pa]=
Comment[pl]=Wtyczka KRunnera
Comment[pt]='Plugin' do KRunner
Comment[pt_BR]=Plug-in do KRunner
Comment[pt_BR]=Plugin do KRunner
Comment[ro]=Modul KRunner
Comment[ru]=Расширение KRunner
Comment[se]=KRunner-lassemodula

View File

@ -35,18 +35,16 @@
#include <kdesktopfile.h>
#include <kmimetype.h>
#include <kservicetypetrader.h>
#include <ktar.h>
#include <kzip.h>
#include "config-plasma.h"
#ifndef PLASMA_NO_KIO
#include <kio/copyjob.h>
#include <kio/deletejob.h>
#include <kio/jobclasses.h>
#include <kio/job.h>
#include <qstandardpaths.h>
#endif
#include <kplugininfo.h>
#include <kstandarddirs.h>
#include <ktar.h>
#include <ktempdir.h>
#include <ktemporaryfile.h>
#include <kzip.h>
#include <kdebug.h>
#include "packagestructure.h"
#include "pluginloader.h"
@ -56,8 +54,6 @@
namespace Plasma
{
#ifdef PLASMA_NO_KIO // Provide some convenience for dealing with folders
bool copyFolder(QString sourcePath, QString targetPath)
{
QDir source(sourcePath);
@ -116,8 +112,6 @@ bool removeFolder(QString folderPath)
return folder.rmdir(folderName);
}
#endif // PLASMA_NO_KIO
Package::Package(PackageStructure *structure)
: d(new PackagePrivate())
{
@ -127,6 +121,26 @@ Package::Package(PackageStructure *structure)
}
}
Package::Package()
: d(new PackagePrivate(PackageStructure::Ptr(0), QString()))
{
}
Package::Package(const QString &packageRoot, const QString &package,
PackageStructure::Ptr structure)
: d(new PackagePrivate(structure, packageRoot + '/' + package))
{
}
Package::Package(const QString &packagePath, PackageStructure::Ptr structure)
: d(new PackagePrivate(structure, packagePath))
{
d->structure = structure;
if (d->structure) {
d->structure.data()->initPackage(this);
}
}
Package::Package(const Package &other)
: d(other.d)
{
@ -809,32 +823,20 @@ bool PackagePrivate::installPackage(const QString &package, const QString &packa
if (archivedPackage) {
// it's in a temp dir, so just move it over.
#ifndef PLASMA_NO_KIO
KIO::CopyJob *job = KIO::move(KUrl(path), KUrl(targetName), KIO::HideProgressInfo);
const bool ok = job->exec();
const QString errorString = job->errorString();
#else
const bool ok = copyFolder(path, targetName);
removeFolder(path);
const QString errorString("unknown");
#endif
if (!ok) {
kWarning() << "Could not move package to destination:" << targetName << " : " << errorString;
kWarning() << "Could not move package to destination:" << targetName;
return false;
}
} else {
kDebug() << "************************** 12";
// it's a directory containing the stuff, so copy the contents rather
// than move them
#ifndef PLASMA_NO_KIO
KIO::CopyJob *job = KIO::copy(KUrl(path), KUrl(targetName), KIO::HideProgressInfo);
const bool ok = job->exec();
const QString errorString = job->errorString();
#else
const bool ok = copyFolder(path, targetName);
const QString errorString("unknown");
#endif
kDebug() << "************************** 13";
if (!ok) {
kWarning() << "Could not copy package to destination:" << targetName << " : " << errorString;
kWarning() << "Could not copy package to destination:" << targetName;
return false;
}
}
@ -846,9 +848,12 @@ bool PackagePrivate::installPackage(const QString &package, const QString &packa
if (!servicePrefix.isEmpty()) {
// and now we register it as a service =)
kDebug() << "************************** 1";
QString metaPath = targetName + "/metadata.desktop";
kDebug() << "************************** 2";
KDesktopFile df(metaPath);
KConfigGroup cg = df.desktopGroup();
kDebug() << "************************** 3";
// Q: should not installing it as a service disqualify it?
// Q: i don't think so since KServiceTypeTrader may not be
@ -859,15 +864,19 @@ bool PackagePrivate::installPackage(const QString &package, const QString &packa
const QString serviceName = servicePrefix + meta.pluginName() + ".desktop";
<<<<<<< HEAD
QString service = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kde5/services/") + serviceName;
#ifndef PLASMA_NO_KIO
KIO::FileCopyJob *job = KIO::file_copy(QUrl::fromLocalFile(metaPath), QUrl::fromLocalFile(service), -1, KIO::HideProgressInfo);
const bool ok = job->exec();
const QString errorString = job->errorString();
#else
=======
QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop");
kDebug() << "************************** 4";
>>>>>>> origin/KDE/4.8
const bool ok = QFile::copy(metaPath, service);
const QString errorString("unknown");
#endif
kDebug() << "************************** 5";
if (ok) {
// the icon in the installed file needs to point to the icon in the
// installation dir!
@ -879,8 +888,9 @@ bool PackagePrivate::installPackage(const QString &package, const QString &packa
cg.writeEntry("Icon", iconPath);
}
} else {
kWarning() << "Could not register package as service (this is not necessarily fatal):" << serviceName << " : " << errorString;
kWarning() << "Could not register package as service (this is not necessarily fatal):" << serviceName;
}
kDebug() << "************************** 7";
}
QDBusInterface sycoca("org.kde.kded5", "/kbuildsycoca");
@ -919,14 +929,8 @@ bool PackagePrivate::uninstallPackage(const QString &packageName, const QString
kWarning() << "Unable to remove " << service;
}
#ifndef PLASMA_NO_KIO
KIO::DeleteJob *job = KIO::del(KUrl(targetName));
ok = job->exec();
const QString errorString = job->errorString();
#else
ok = removeFolder(targetName);
const QString errorString("unknown");
#endif
if (!ok) {
kWarning() << "Could not delete package from:" << targetName << " : " << errorString;
return false;
@ -944,7 +948,99 @@ PackagePrivate::PackagePrivate()
externalPaths(false),
valid(false)
{
<<<<<<< HEAD
contentsPrefixPaths << "contents/";
=======
QString serviceName("plasma-applet-" + data.pluginName());
QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop");
if (data.pluginName().isEmpty()) {
return false;
}
data.write(service);
KDesktopFile config(service);
KConfigGroup cg = config.desktopGroup();
const QString type = data.type().isEmpty() ? "Service" : data.type();
cg.writeEntry("Type", type);
const QString serviceTypes = data.serviceType().isNull() ? "Plasma/Applet,Plasma/Containment" : data.serviceType();
cg.writeEntry("X-KDE-ServiceTypes", serviceTypes);
cg.writeEntry("X-KDE-PluginInfo-EnabledByDefault", true);
QFile icon(iconPath);
if (icon.exists()) {
//FIXME: the '/' search will break on non-UNIX. do we care?
QString installedIcon("plasma_applet_" + data.pluginName() +
iconPath.right(iconPath.length() - iconPath.lastIndexOf("/")));
cg.writeEntry("Icon", installedIcon);
installedIcon = KStandardDirs::locateLocal("icon", installedIcon);
QFile::copy(iconPath, installedIcon);
}
return true;
}
bool Package::createPackage(const PackageMetadata &metadata,
const QString &source,
const QString &destination,
const QString &icon) // static
{
Q_UNUSED(icon)
if (!metadata.isValid()) {
kWarning() << "Metadata file is not complete";
return false;
}
// write metadata in a temporary file
KTemporaryFile metadataFile;
if (!metadataFile.open()) {
return false;
}
metadata.write(metadataFile.fileName());
// put everything into a zip archive
KZip creation(destination);
creation.setCompression(KZip::NoCompression);
if (!creation.open(QIODevice::WriteOnly)) {
return false;
}
creation.addLocalFile(metadataFile.fileName(), "metadata.desktop");
creation.addLocalDirectory(source, "contents");
creation.close();
return true;
}
PackagePrivate::PackagePrivate(const PackageStructure::Ptr st, const QString &p)
: structure(st),
service(0)
{
if (structure) {
if (p.isEmpty()) {
structure->setPath(structure->defaultPackageRoot());
} else {
structure->setPath(p);
}
}
valid = structure && !structure->path().isEmpty();
}
PackagePrivate::PackagePrivate(const PackageStructure::Ptr st, const QString &packageRoot, const QString &path)
: structure(st),
service(0)
{
if (structure) {
if (packageRoot.isEmpty()) {
structure->setPath(structure->defaultPackageRoot()%"/"%path);
} else {
structure->setPath(packageRoot%"/"%path);
}
}
valid = structure && !structure->path().isEmpty();
>>>>>>> origin/KDE/4.8
}
PackagePrivate::PackagePrivate(const PackagePrivate &other)

View File

@ -24,7 +24,7 @@
#include "service.h"
#include <QGraphicsWidget>
#include <QHash>
#include <QMap>
#include <QMultiHash>
#include <QWidget>
#include <QSet>
@ -114,7 +114,7 @@ public:
DNSSD::PublicService *publicService;
ServiceProvider *serviceProvider;
QMultiHash<QWidget *, QString> associatedWidgets;
QMultiHash<QGraphicsWidget *, QString> associatedGraphicsWidgets;
QMultiHash<QGraphicsObject *, QString> associatedGraphicsWidgets;
QSet<QString> disabledOperations;
};

View File

@ -293,6 +293,11 @@ bool QueryMatch::operator==(const QueryMatch &other) const
return (d == other.d);
}
bool QueryMatch::operator!=(const QueryMatch &other) const
{
return (d != other.d);
}
void QueryMatch::run(const RunnerContext &context) const
{
//kDebug() << "we run the term" << context->query() << "whose type is" << context->mimetype();

View File

@ -85,6 +85,7 @@ class PLASMA_EXPORT QueryMatch
~QueryMatch();
QueryMatch &operator=(const QueryMatch &other);
bool operator==(const QueryMatch &other) const;
bool operator!=(const QueryMatch &other) const;
bool operator<(const QueryMatch &other) const;

View File

@ -254,6 +254,11 @@ public:
}
}
if (!singleRunnerWasLoaded) {
// in case we deleted it up above
clearSingleRunner();
}
#ifndef NDEBUG
kDebug() << "All runners loaded, total:" << runners.count();
#endif
@ -817,7 +822,9 @@ void RunnerManager::reset()
qDeleteAll(d->oldSearchJobs);
d->oldSearchJobs.clear();
} else {
Weaver::instance()->dequeue();
Q_FOREACH(FindMatchesJob *job, d->searchJobs) {
Weaver::instance()->dequeue(job);
}
d->oldSearchJobs += d->searchJobs;
}

View File

@ -24,6 +24,7 @@
#include "config-plasma.h"
#include <QFile>
#include <QGraphicsWidget>
#include <QTimer>
#include <kdebug.h>
@ -77,7 +78,7 @@ void ServicePrivate::associatedWidgetDestroyed(QObject *obj)
void ServicePrivate::associatedGraphicsWidgetDestroyed(QObject *obj)
{
associatedGraphicsWidgets.remove(static_cast<QGraphicsWidget*>(obj));
associatedGraphicsWidgets.remove(static_cast<QGraphicsObject*>(obj));
}
void ServicePrivate::publish(AnnouncementMethods methods, const QString &name, const KPluginInfo &metadata)
@ -276,12 +277,22 @@ void Service::disassociateWidget(QWidget *widget)
}
void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
{
associateItem(widget, operation);
}
void Service::disassociateWidget(QGraphicsWidget *widget)
{
disassociateItem(widget);
}
void Service::associateItem(QGraphicsObject *widget, const QString &operation)
{
if (!widget) {
return;
}
disassociateWidget(widget);
disassociateItem(widget);
d->associatedGraphicsWidgets.insert(widget, operation);
connect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
@ -289,7 +300,7 @@ void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
widget->setEnabled(!d->disabledOperations.contains(operation));
}
void Service::disassociateWidget(QGraphicsWidget *widget)
void Service::disassociateItem(QGraphicsObject *widget)
{
if (!widget) {
return;
@ -344,7 +355,7 @@ void Service::setOperationEnabled(const QString &operation, bool enable)
}
{
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsWidgets);
QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsWidgets);
while (it.hasNext()) {
it.next();
if (it.value() == operation) {
@ -381,7 +392,7 @@ void Service::setOperationsScheme(QIODevice *xml)
}
{
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsWidgets);
QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsWidgets);
while (it.hasNext()) {
it.next();
it.key()->setEnabled(d->config->hasGroup(it.value()));

View File

@ -29,7 +29,7 @@
#include <plasma/plasma_export.h>
#include <plasma/plasma.h>
class QGraphicsWidget;
class QGraphicsObject;
class QIODevice;
class QWidget;
class QUrl;
@ -179,27 +179,41 @@ public:
Q_INVOKABLE void disassociateWidget(QWidget *widget);
/**
* Assoicates a widget with an operation, which allows the service to
* automatically manage, for example, the enabled state of a widget.
* This method only exists to maintain binary compatibility.
*
* This will remove any previous associations the widget had with
* operations on this engine.
*
* @param widget the QGraphicsItem to associate with the service
* @param operation the operation to associate the widget with
* @see associateItem
*/
Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
/**
* Disassociates a widget if it has been associated with an operation
* on this service.
* This method only exists to maintain binary compatibility.
*
* This will not change the enabled state of the widget.
*
* @param widget the QGraphicsWidget to disassociate.
* @see disassociateItem
*/
Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
/**
* Associates a graphics item with an operation, which allows the service to
* automatically manage, for example, the enabled state of the item.
*
* This will remove any previous associations the item had with
* operations on this engine.
*
* @param item the QGraphicsObject to associate with the service
* @param operation the operation to associate the item with
*/
Q_INVOKABLE void associateItem(QGraphicsObject *item, const QString &operation);
/**
* Disassociates a graphics item if it has been associated with an operation
* on this service.
*
* This will not change the enabled state of the item.
*
* @param widget the QGraphicsItem to disassociate.
*/
Q_INVOKABLE void disassociateItem(QGraphicsObject *widget);
/**
* @return a parameter map for the given description
* @param description the configuration values to turn into the parameter map

View File

@ -100,7 +100,7 @@ Comment[nl]=Een dummy plugin voor testen
Comment[pa]=
Comment[pl]=Prosta wtyczka testowa
Comment[pt]=Um 'plugin' de exemplo para testes
Comment[pt_BR]=Um plug-in fictício para testes
Comment[pt_BR]=Um plugin fictício para testes
Comment[ro]=Modul fictiv pentru testare
Comment[ru]=Расширение для тестирования
Comment[se]=Geahččalanlassemodula