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

This commit is contained in:
David Faure 2012-06-10 15:40:31 +02:00
commit ff40c9121d
10 changed files with 80 additions and 69 deletions

View File

@ -1923,6 +1923,10 @@ void Applet::showConfigurationInterface()
KCModuleProxy *module = new KCModuleProxy(kcm); KCModuleProxy *module = new KCModuleProxy(kcm);
if (module->realModule()) { if (module->realModule()) {
connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool))); 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()); dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon());
hasPages = true; hasPages = true;
} else { } else {
@ -1935,6 +1939,10 @@ void Applet::showConfigurationInterface()
KCModule *module = service->createInstance<KCModule>(dialog, QVariantList(), &error); KCModule *module = service->createInstance<KCModule>(dialog, QVariantList(), &error);
if (module) { if (module) {
connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool))); 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()); dialog->addPage(module, service->name(), service->icon());
hasPages = true; hasPages = true;
} else { } else {

View File

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

View File

@ -33,12 +33,6 @@
#include <karchive.h> #include <karchive.h>
#include <kcomponentdata.h> #include <kcomponentdata.h>
#include <kdesktopfile.h> #include <kdesktopfile.h>
#ifndef PLASMA_NO_KIO
#include <kio/copyjob.h>
#include <kio/deletejob.h>
#include <kio/jobclasses.h>
#include <kio/job.h>
#endif
#include <kmimetype.h> #include <kmimetype.h>
#include <kplugininfo.h> #include <kplugininfo.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
@ -58,8 +52,6 @@
namespace Plasma namespace Plasma
{ {
#ifdef PLASMA_NO_KIO // Provide some convenience for dealing with folders
bool copyFolder(QString sourcePath, QString targetPath) bool copyFolder(QString sourcePath, QString targetPath)
{ {
QDir source(sourcePath); QDir source(sourcePath);
@ -118,9 +110,6 @@ bool removeFolder(QString folderPath)
return folder.rmdir(folderName); return folder.rmdir(folderName);
} }
#endif // PLASMA_NO_KIO
Package::Package() Package::Package()
: d(new PackagePrivate(PackageStructure::Ptr(0), QString())) : d(new PackagePrivate(PackageStructure::Ptr(0), QString()))
{ {
@ -569,32 +558,20 @@ bool Package::installPackage(const QString &package,
if (archivedPackage) { if (archivedPackage) {
// it's in a temp dir, so just move it over. // 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); const bool ok = copyFolder(path, targetName);
removeFolder(path); removeFolder(path);
const QString errorString("unknown");
#endif
if (!ok) { if (!ok) {
kWarning() << "Could not move package to destination:" << targetName << " : " << errorString; kWarning() << "Could not move package to destination:" << targetName;
return false; return false;
} }
} else { } else {
kDebug() << "************************** 12";
// it's a directory containing the stuff, so copy the contents rather // it's a directory containing the stuff, so copy the contents rather
// than move them // 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 bool ok = copyFolder(path, targetName);
const QString errorString("unknown"); kDebug() << "************************** 13";
#endif
if (!ok) { if (!ok) {
kWarning() << "Could not copy package to destination:" << targetName << " : " << errorString; kWarning() << "Could not copy package to destination:" << targetName;
return false; return false;
} }
} }
@ -606,9 +583,12 @@ bool Package::installPackage(const QString &package,
if (!servicePrefix.isEmpty()) { if (!servicePrefix.isEmpty()) {
// and now we register it as a service =) // and now we register it as a service =)
kDebug() << "************************** 1";
QString metaPath = targetName + "/metadata.desktop"; QString metaPath = targetName + "/metadata.desktop";
kDebug() << "************************** 2";
KDesktopFile df(metaPath); KDesktopFile df(metaPath);
KConfigGroup cg = df.desktopGroup(); KConfigGroup cg = df.desktopGroup();
kDebug() << "************************** 3";
// Q: should not installing it as a service disqualify it? // Q: should not installing it as a service disqualify it?
// Q: i don't think so since KServiceTypeTrader may not be // Q: i don't think so since KServiceTypeTrader may not be
@ -620,14 +600,9 @@ bool Package::installPackage(const QString &package,
QString serviceName = servicePrefix + meta.pluginName(); QString serviceName = servicePrefix + meta.pluginName();
QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop"); QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop");
#ifndef PLASMA_NO_KIO kDebug() << "************************** 4";
KIO::FileCopyJob *job = KIO::file_copy(metaPath, service, -1, KIO::HideProgressInfo);
const bool ok = job->exec();
const QString errorString = job->errorString();
#else
const bool ok = QFile::copy(metaPath, service); const bool ok = QFile::copy(metaPath, service);
const QString errorString("unknown"); kDebug() << "************************** 5";
#endif
if (ok) { if (ok) {
// the icon in the installed file needs to point to the icon in the // the icon in the installed file needs to point to the icon in the
// installation dir! // installation dir!
@ -639,8 +614,9 @@ bool Package::installPackage(const QString &package,
cg.writeEntry("Icon", iconPath); cg.writeEntry("Icon", iconPath);
} }
} else { } 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";
} }
return true; return true;
@ -669,14 +645,8 @@ bool Package::uninstallPackage(const QString &pluginName,
kWarning() << "Unable to remove " << service; 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); ok = removeFolder(targetName);
const QString errorString("unknown"); const QString errorString("unknown");
#endif
if (!ok) { if (!ok) {
kWarning() << "Could not delete package from:" << targetName << " : " << errorString; kWarning() << "Could not delete package from:" << targetName << " : " << errorString;
return false; return false;
@ -711,12 +681,7 @@ bool Package::registerPackage(const PackageMetadata &data, const QString &iconPa
iconPath.right(iconPath.length() - iconPath.lastIndexOf("/"))); iconPath.right(iconPath.length() - iconPath.lastIndexOf("/")));
cg.writeEntry("Icon", installedIcon); cg.writeEntry("Icon", installedIcon);
installedIcon = KStandardDirs::locateLocal("icon", installedIcon); installedIcon = KStandardDirs::locateLocal("icon", installedIcon);
#ifndef PLASMA_NO_KIO
KIO::FileCopyJob *job = KIO::file_copy(iconPath, installedIcon, -1, KIO::HideProgressInfo);
job->exec();
#else
QFile::copy(iconPath, installedIcon); QFile::copy(iconPath, installedIcon);
#endif
} }
return true; return true;

View File

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

View File

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

View File

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

View File

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

View File

@ -26,6 +26,7 @@
#include "config-plasma.h" #include "config-plasma.h"
#include <QFile> #include <QFile>
#include <QGraphicsWidget>
#include <QTimer> #include <QTimer>
#include <kdebug.h> #include <kdebug.h>
@ -93,7 +94,7 @@ void ServicePrivate::associatedWidgetDestroyed(QObject *obj)
void ServicePrivate::associatedGraphicsWidgetDestroyed(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 PackageMetadata &metadata) void ServicePrivate::publish(AnnouncementMethods methods, const QString &name, const PackageMetadata &metadata)
@ -275,12 +276,22 @@ void Service::disassociateWidget(QWidget *widget)
} }
void Service::associateWidget(QGraphicsWidget *widget, const QString &operation) 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) { if (!widget) {
return; return;
} }
disassociateWidget(widget); disassociateItem(widget);
d->associatedGraphicsWidgets.insert(widget, operation); d->associatedGraphicsWidgets.insert(widget, operation);
connect(widget, SIGNAL(destroyed(QObject*)), connect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
@ -288,7 +299,7 @@ void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
widget->setEnabled(!d->disabledOperations.contains(operation)); widget->setEnabled(!d->disabledOperations.contains(operation));
} }
void Service::disassociateWidget(QGraphicsWidget *widget) void Service::disassociateItem(QGraphicsObject *widget)
{ {
if (!widget) { if (!widget) {
return; return;
@ -343,7 +354,7 @@ void Service::setOperationEnabled(const QString &operation, bool enable)
} }
{ {
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsWidgets); QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsWidgets);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
if (it.value() == operation) { if (it.value() == operation) {
@ -380,7 +391,7 @@ void Service::setOperationsScheme(QIODevice *xml)
} }
{ {
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsWidgets); QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsWidgets);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
it.key()->setEnabled(d->config->hasGroup(it.value())); it.key()->setEnabled(d->config->hasGroup(it.value()));

View File

@ -30,7 +30,7 @@
#include <plasma/plasma.h> #include <plasma/plasma.h>
#include "packagemetadata.h" #include "packagemetadata.h"
class QGraphicsWidget; class QGraphicsObject;
class QIODevice; class QIODevice;
class QWidget; class QWidget;
@ -201,27 +201,41 @@ public:
Q_INVOKABLE void disassociateWidget(QWidget *widget); Q_INVOKABLE void disassociateWidget(QWidget *widget);
/** /**
* Assoicates a widget with an operation, which allows the service to * This method only exists to maintain binary compatibility.
* automatically manage, for example, the enabled state of a widget.
* *
* This will remove any previous associations the widget had with * @see associateItem
* operations on this engine.
*
* @param widget the QGraphicsItem to associate with the service
* @param operation the operation to associate the widget with
*/ */
Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation); Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
/** /**
* Disassociates a widget if it has been associated with an operation * This method only exists to maintain binary compatibility.
* on this service.
* *
* This will not change the enabled state of the widget. * @see disassociateItem
*
* @param widget the QGraphicsWidget to disassociate.
*/ */
Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget); 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 * @return a parameter map for the given description
* @param description the configuration values to turn into the parameter map * @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[pa]=
Comment[pl]=Prosta wtyczka testowa Comment[pl]=Prosta wtyczka testowa
Comment[pt]=Um 'plugin' de exemplo para testes 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[ro]=Modul fictiv pentru testare
Comment[ru]=Расширение для тестирования Comment[ru]=Расширение для тестирования
Comment[se]=Geahččalanlassemodula Comment[se]=Geahččalanlassemodula