Committed on 08/12/2011 at 19:05.
Pushed by dfaure into branch 'frameworks'.
Merge remote-tracking branch 'origin/KDE/4.7' into origin-frameworks
Conflicts:
experimental/libkactivities/
plasma/applet.h
plasma/theme.cpp
staging/libkcoreaddons/src/jobs/kjob.cpp
M +10 -8 kdecore/kernel/kstandarddirs.cpp
M +1 -1 kdecore/tests/kmimetypetest.cpp
M +4 -4 khtml/html/htmltokenizer.cpp
M +0 -2 kutils/kpluginselector.cpp
M +16 -15 plasma/applet.cpp
M +1 -1 plasma/applet.h
M +1 -1 plasma/containment.cpp
M +3 -9 plasma/dialog.cpp
M +1 -2 plasma/private/applet_p.h
M +1 -2 plasma/private/tooltip.cpp
M +56 -28 plasma/theme.cpp
M +6 -0 plasma/theme.h
M +23 -20 plasma/tooltipmanager.cpp
A +6 -0 staging/libkcoreaddons/src/jobs/kjob.cpp [License: LGPL (v2)]
http://commits.kde.org/kdelibs/070a708aeac3ca811e1ac29d079cb7753aa7fa30
diff --cc plasma/private/applet_p.h
index 1d927cf,3faf5b3..1c99f20
--- a/plasma/private/applet_p.h
+++ b/plasma/private/applet_p.h
@@@ -111,9 -121,11 +111,8 @@@ public
void updateRect(const QRectF &rect);
void setFocus();
void cleanUpAndDelete();
- void createMessageOverlay(bool usePopup = true);
- void positionMessageOverlay();
- void destroyMessageOverlay();
void addGlobalShortcutsPage(KConfigDialog *dialog);
void addPublishPage(KConfigDialog *dialog);
- void clearShortcutEditorPtr();
void configDialogFinished();
KConfigDialog *generateGenericConfigDialog();
void addStandardConfigurationPages(KConfigDialog *dialog);
@@@ -166,10 -192,10 +165,10 @@@
KAction *activationAction;
// configuration
- KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
+ QWeakPointer<KKeySequenceWidget> shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
ItemStatus itemStatus;
- QString remoteLocation;
+ KUrl remoteLocation;
Ui::publishWidget publishUI;
// the applet can change size policy by itself, so save the old one for eventual restore
diff --cc plasma/theme.cpp
index 3bad6d2,3427315..cbfcd42
--- a/plasma/theme.cpp
+++ b/plasma/theme.cpp
@@@ -158,6 -166,8 +166,7 @@@ public
static const char *defaultTheme;
static const char *systemColorsTheme;
static const char *themeRcFile;
- static PackageStructure::Ptr packageStructure;
+ static EffectWatcher *s_blurEffectWatcher;
Theme *q;
QString themeName;
diff --cc staging/libkcoreaddons/src/jobs/kjob.cpp
index f028ba7,0000000..2858909
mode 100644,000000..100644
--- a/staging/libkcoreaddons/src/jobs/kjob.cpp
+++ b/staging/libkcoreaddons/src/jobs/kjob.cpp
@@@ -1,364 -1,0 +1,370 @@@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
+ David Faure <faure@kde.org>
+ Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kjob.h"
+#include "kjob_p.h"
+
+#include "kjobuidelegate.h"
+
+#include <QEventLoop>
+#include <QMap>
+#include <QMetaType>
+#include <QTimer>
+
+bool KJobPrivate::_k_kjobUnitEnumRegistered = false;
+KJobPrivate::KJobPrivate()
+ : q_ptr(0), uiDelegate(0), error(KJob::NoError),
+ progressUnit(KJob::Bytes), percentage(0),
+ suspended(false), capabilities(KJob::NoCapabilities),
+ speedTimer(0), isAutoDelete(true), eventLoop(0), isFinished(false)
+{
+ if (!_k_kjobUnitEnumRegistered) {
+ _k_kjobUnitEnumRegistered = qRegisterMetaType<KJob::Unit>("KJob::Unit");
+ }
+}
+
+KJobPrivate::~KJobPrivate()
+{
+}
+
+KJob::KJob(QObject *parent)
+ : QObject(parent), d_ptr(new KJobPrivate)
+{
+ d_ptr->q_ptr = this;
+ // Don't exit while this job is running
+#pragma message ("KDE5 TODO: Revert ref-counting when it is in Qt5")
+ //KGlobal::ref();
+}
+
+KJob::KJob(KJobPrivate &dd, QObject *parent)
+ : QObject(parent), d_ptr(&dd)
+{
+ d_ptr->q_ptr = this;
+ // Don't exit while this job is running
+ //KGlobal::ref();
+}
+
+KJob::~KJob()
+{
++ if (!d_ptr->isFinished) {
++ Q_EMIT finished(this);
++ }
++
+ delete d_ptr->speedTimer;
+ delete d_ptr->uiDelegate;
+ delete d_ptr;
+
+ //KGlobal::deref();
+}
+
+void KJob::setUiDelegate( KJobUiDelegate *delegate )
+{
+ Q_D(KJob);
+ if ( delegate == 0 || delegate->setJob( this ) )
+ {
+ delete d->uiDelegate;
+ d->uiDelegate = delegate;
+
+ if ( d->uiDelegate )
+ {
+ d->uiDelegate->connectJob( this );
+ }
+ }
+}
+
+KJobUiDelegate *KJob::uiDelegate() const
+{
+ return d_func()->uiDelegate;
+}
+
+KJob::Capabilities KJob::capabilities() const
+{
+ return d_func()->capabilities;
+}
+
+bool KJob::isSuspended() const
+{
+ return d_func()->suspended;
+}
+
+bool KJob::kill( KillVerbosity verbosity )
+{
++ Q_D(KJob);
+ if ( doKill() )
+ {
+ setError( KilledJobError );
+
+ if ( verbosity!=Quietly )
+ {
+ emitResult();
+ }
+ else
+ {
+ // If we are displaying a progress dialog, remove it first.
++ d->isFinished = true;
+ Q_EMIT finished(this);
+
+ if ( isAutoDelete() )
+ deleteLater();
+ }
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool KJob::suspend()
+{
+ Q_D(KJob);
+ if ( !d->suspended )
+ {
+ if ( doSuspend() )
+ {
+ d->suspended = true;
+ Q_EMIT suspended(this);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool KJob::resume()
+{
+ Q_D(KJob);
+ if ( d->suspended )
+ {
+ if ( doResume() )
+ {
+ d->suspended = false;
+ Q_EMIT resumed(this);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool KJob::doKill()
+{
+ return false;
+}
+
+bool KJob::doSuspend()
+{
+ return false;
+}
+
+bool KJob::doResume()
+{
+ return false;
+}
+
+void KJob::setCapabilities( KJob::Capabilities capabilities )
+{
+ Q_D(KJob);
+ d->capabilities = capabilities;
+}
+
+bool KJob::exec()
+{
+ Q_D(KJob);
+ // Usually this job would delete itself, via deleteLater() just after
+ // emitting result() (unless configured otherwise). Since we use an event
+ // loop below, that event loop will process the deletion event and we'll
+ // have been deleted when exec() returns. This crashes, so temporarily
+ // suspend autodeletion and manually do it afterwards.
+ const bool wasAutoDelete = isAutoDelete();
+ setAutoDelete( false );
+
+ Q_ASSERT( ! d->eventLoop );
+
+ QEventLoop loop( this );
+ d->eventLoop = &loop;
+
+ start();
+ if( !d->isFinished ) {
+ d->eventLoop->exec(QEventLoop::ExcludeUserInputEvents);
+ }
+ d->eventLoop = 0;
+
+ if ( wasAutoDelete ) {
+ deleteLater();
+ }
+ return ( d->error == NoError );
+}
+
+int KJob::error() const
+{
+ return d_func()->error;
+}
+
+QString KJob::errorText() const
+{
+ return d_func()->errorText;
+}
+
+QString KJob::errorString() const
+{
+ return d_func()->errorText;
+}
+
+qulonglong KJob::processedAmount(Unit unit) const
+{
+ return d_func()->processedAmount[unit];
+}
+
+qulonglong KJob::totalAmount(Unit unit) const
+{
+ return d_func()->totalAmount[unit];
+}
+
+unsigned long KJob::percent() const
+{
+ return d_func()->percentage;
+}
+
+void KJob::setError( int errorCode )
+{
+ Q_D(KJob);
+ d->error = errorCode;
+}
+
+void KJob::setErrorText( const QString &errorText )
+{
+ Q_D(KJob);
+ d->errorText = errorText;
+}
+
+void KJob::setProcessedAmount(Unit unit, qulonglong amount)
+{
+ Q_D(KJob);
+ bool should_emit = (d->processedAmount[unit] != amount);
+
+ d->processedAmount[unit] = amount;
+
+ if ( should_emit )
+ {
+ Q_EMIT processedAmount(this, unit, amount);
+ if (unit==d->progressUnit) {
+ Q_EMIT processedSize(this, amount);
+ emitPercent(d->processedAmount[unit], d->totalAmount[unit]);
+ }
+ }
+}
+
+void KJob::setTotalAmount(Unit unit, qulonglong amount)
+{
+ Q_D(KJob);
+ bool should_emit = (d->totalAmount[unit] != amount);
+
+ d->totalAmount[unit] = amount;
+
+ if ( should_emit )
+ {
+ Q_EMIT totalAmount(this, unit, amount);
+ if (unit==d->progressUnit) {
+ Q_EMIT totalSize(this, amount);
+ emitPercent(d->processedAmount[unit], d->totalAmount[unit]);
+ }
+ }
+}
+
+void KJob::setPercent( unsigned long percentage )
+{
+ Q_D(KJob);
+ if ( d->percentage!=percentage )
+ {
+ d->percentage = percentage;
+ Q_EMIT percent( this, percentage );
+ }
+}
+
+void KJob::emitResult()
+{
+ Q_D(KJob);
+ d->isFinished = true;
+
+ if ( d->eventLoop ) {
+ d->eventLoop->quit();
+ }
+
+ // If we are displaying a progress dialog, remove it first.
+ Q_EMIT finished( this );
+
+ Q_EMIT result( this );
+
+ if ( isAutoDelete() )
+ deleteLater();
+}
+
+void KJob::emitPercent( qulonglong processedAmount, qulonglong totalAmount )
+{
+ Q_D(KJob);
+ // calculate percents
+ if (totalAmount) {
+ unsigned long oldPercentage = d->percentage;
+ d->percentage = (unsigned long)(( (float)(processedAmount) / (float)(totalAmount) ) * 100.0);
+ if ( d->percentage != oldPercentage ) {
+ Q_EMIT percent( this, d->percentage );
+ }
+ }
+}
+
+void KJob::emitSpeed(unsigned long value)
+{
+ Q_D(KJob);
+ if (!d->speedTimer) {
+ d->speedTimer = new QTimer(this);
+ connect(d->speedTimer, SIGNAL(timeout()), SLOT(_k_speedTimeout()));
+ }
+
+ Q_EMIT speed(this, value);
+ d->speedTimer->start(5000); // 5 seconds interval should be enough
+}
+
+void KJobPrivate::_k_speedTimeout()
+{
+ Q_Q(KJob);
+ // send 0 and stop the timer
+ // timer will be restarted only when we receive another speed event
+ Q_EMIT q->speed(q, 0);
+ speedTimer->stop();
+}
+
+bool KJob::isAutoDelete() const
+{
+ Q_D(const KJob);
+ return d->isAutoDelete;
+}
+
+void KJob::setAutoDelete( bool autodelete )
+{
+ Q_D(KJob);
+ d->isAutoDelete = autodelete;
+}
+
+#include "moc_kjob.cpp"
0 comments:
Post a Comment