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

Conflicts:
	plasma/runnermanager.cpp
This commit is contained in:
Aaron Seigo 2011-11-22 12:56:16 +01:00
commit 3c55a5489a
5 changed files with 57 additions and 19 deletions

View File

@ -988,7 +988,9 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn
//kDebug() << activity() << "setting screen to " << newScreen << newDesktop << "and type is" << type; //kDebug() << activity() << "setting screen to " << newScreen << newDesktop << "and type is" << type;
Containment *swapScreensWith(0); Containment *swapScreensWith(0);
if (type == Containment::DesktopContainment || type >= Containment::CustomContainment) { const bool isDesktopContainment = type == Containment::DesktopContainment ||
type == Containment::CustomContainment;
if (isDesktopContainment) {
// we want to listen to changes in work area if our screen changes // we want to listen to changes in work area if our screen changes
if (toolBox) { if (toolBox) {
if (screen < 0 && newScreen > -1) { if (screen < 0 && newScreen > -1) {
@ -1014,8 +1016,7 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn
} }
} }
if (newScreen < numScreens && newScreen > -1 && if (newScreen < numScreens && newScreen > -1 && isDesktopContainment) {
(type == Containment::DesktopContainment || type >= Containment::CustomContainment)) {
q->resize(corona->screenGeometry(newScreen).size()); q->resize(corona->screenGeometry(newScreen).size());
} }

View File

@ -65,10 +65,14 @@ public:
~ContainmentPrivate() ~ContainmentPrivate()
{ {
qDeleteAll(applets); // qDeleteAll is broken with Qt4.8, delete it by hand
while (!applets.isEmpty()) {
delete applets.first();
}
applets.clear(); applets.clear();
qDeleteAll(dropMenus); qDeleteAll(dropMenus);
dropMenus.clear();
} }
void createToolBox(); void createToolBox();

View File

@ -170,10 +170,11 @@ Plasma::AbstractRunner* FindMatchesJob::runner() const
return m_runner; return m_runner;
} }
DelayedJobCleaner::DelayedJobCleaner(QSet<FindMatchesJob*> jobs, ThreadWeaver::WeaverInterface *weaver) DelayedJobCleaner::DelayedJobCleaner(const QSet<FindMatchesJob *> &jobs, const QSet<AbstractRunner *> &runners)
: QObject(weaver), : QObject(Weaver::instance()),
m_weaver(weaver), m_weaver(Weaver::instance()),
m_jobs(jobs) m_jobs(jobs),
m_runners(runners)
{ {
connect(m_weaver, SIGNAL(finished()), this, SLOT(checkIfFinished())); connect(m_weaver, SIGNAL(finished()), this, SLOT(checkIfFinished()));
@ -182,6 +183,11 @@ DelayedJobCleaner::DelayedJobCleaner(QSet<FindMatchesJob*> jobs, ThreadWeaver::W
} }
} }
DelayedJobCleaner::~DelayedJobCleaner()
{
qDeleteAll(m_runners);
}
void DelayedJobCleaner::jobDone(ThreadWeaver::Job *job) void DelayedJobCleaner::jobDone(ThreadWeaver::Job *job)
{ {
FindMatchesJob *runJob = dynamic_cast<FindMatchesJob *>(job); FindMatchesJob *runJob = dynamic_cast<FindMatchesJob *>(job);

View File

@ -126,16 +126,17 @@ private:
class DelayedJobCleaner : public QObject class DelayedJobCleaner : public QObject
{ {
public: public:
DelayedJobCleaner(QSet<FindMatchesJob*> jobs, ThreadWeaver::WeaverInterface *weaver); DelayedJobCleaner(const QSet<FindMatchesJob*> &jobs, const QSet<AbstractRunner *> &runners = QSet<AbstractRunner *>());
~DelayedJobCleaner();
private Q_SLOTS: private Q_SLOTS:
void jobDone(ThreadWeaver::Job*); void jobDone(ThreadWeaver::Job*);
void checkIfFinished(); void checkIfFinished();
//connect(ThreadWeaver::instance(), SIGNAL(finished()), this, SLOT(checkIfFinished()));
private: private:
ThreadWeaver::WeaverInterface *m_weaver; ThreadWeaver::WeaverInterface *m_weaver;
QSet<FindMatchesJob*> m_jobs; QSet<FindMatchesJob*> m_jobs;
QSet<AbstractRunner *> m_runners;
}; };
} }

View File

@ -177,7 +177,7 @@ public:
KPluginInfo::List offers = RunnerManager::listRunnerInfo(); KPluginInfo::List offers = RunnerManager::listRunnerInfo();
const bool loadAll = config.readEntry("loadAll", false); const bool loadAll = config.readEntry("loadAll", false);
QStringList whiteList = config.readEntry("pluginWhiteList", QStringList()); const QStringList whiteList = config.readEntry("pluginWhiteList", QStringList());
const bool noWhiteList = whiteList.isEmpty(); const bool noWhiteList = whiteList.isEmpty();
KConfigGroup pluginConf; KConfigGroup pluginConf;
if (conf.isValid()) { if (conf.isValid()) {
@ -188,6 +188,7 @@ public:
advertiseSingleRunnerIds.clear(); advertiseSingleRunnerIds.clear();
QSet<AbstractRunner *> deadRunners;
QMutableListIterator<KPluginInfo> it(offers); QMutableListIterator<KPluginInfo> it(offers);
while (it.hasNext()) { while (it.hasNext()) {
KPluginInfo &description = it.next(); KPluginInfo &description = it.next();
@ -203,8 +204,7 @@ public:
description.load(pluginConf); description.load(pluginConf);
const bool loaded = runners.contains(runnerName); const bool loaded = runners.contains(runnerName);
const bool selected = loadAll || const bool selected = loadAll || (description.isPluginEnabled() && (noWhiteList || whiteList.contains(runnerName)));
(description.isPluginEnabled() && (noWhiteList || whiteList.contains(runnerName)));
const bool singleQueryModeEnabled = description.property("X-Plasma-AdvertiseSingleRunnerQueryMode").toBool(); const bool singleQueryModeEnabled = description.property("X-Plasma-AdvertiseSingleRunnerQueryMode").toBool();
@ -223,11 +223,35 @@ public:
} }
} else if (loaded) { } else if (loaded) {
//Remove runner //Remove runner
AbstractRunner *runner = runners.take(runnerName); deadRunners.insert(runners.take(runnerName));
#ifndef NDEBUG #ifndef NDEBUG
kDebug() << "Removing runner: " << runnerName; kDebug() << "Removing runner: " << runnerName;
#endif #endif
delete runner; }
}
if (!deadRunners.isEmpty()) {
QSet<FindMatchesJob *> deadJobs;
foreach (FindMatchesJob *job, searchJobs) {
if (deadRunners.contains(job->runner())) {
QObject::disconnect(job, SIGNAL(done(ThreadWeaver::Job*)), q, SLOT(jobDone(ThreadWeaver::Job*)));
searchJobs.remove(job);
deadJobs.insert(job);
}
}
foreach (FindMatchesJob *job, oldSearchJobs) {
if (deadRunners.contains(job->runner())) {
oldSearchJobs.remove(job);
deadJobs.insert(job);
}
}
if (deadJobs.isEmpty()) {
qDeleteAll(deadRunners);
} else {
new DelayedJobCleaner(deadJobs, deadRunners);
>>>>>>> origin/KDE/4.7
} }
} }
@ -437,7 +461,7 @@ RunnerManager::RunnerManager(KConfigGroup &c, QObject *parent)
RunnerManager::~RunnerManager() RunnerManager::~RunnerManager()
{ {
if (!qApp->closingDown() && (!d->searchJobs.isEmpty() || !d->oldSearchJobs.isEmpty())) { if (!qApp->closingDown() && (!d->searchJobs.isEmpty() || !d->oldSearchJobs.isEmpty())) {
new DelayedJobCleaner(d->searchJobs + d->oldSearchJobs, Weaver::instance()); new DelayedJobCleaner(d->searchJobs + d->oldSearchJobs);
} }
delete d; delete d;
@ -451,11 +475,13 @@ void RunnerManager::reloadConfiguration()
void RunnerManager::setAllowedRunners(const QStringList &runners) void RunnerManager::setAllowedRunners(const QStringList &runners)
{ {
qDeleteAll(d->runners);
d->runners.clear();
KConfigGroup config = d->configGroup(); KConfigGroup config = d->configGroup();
config.writeEntry("pluginWhiteList", runners); config.writeEntry("pluginWhiteList", runners);
if (!d->runners.isEmpty()) {
// this has been called with runners already created. so let's do an instant reload
d->loadRunners();
}
} }
QStringList RunnerManager::allowedRunners() const QStringList RunnerManager::allowedRunners() const