Merge branch 'KDE/4.7'

Conflicts:
	CMakeLists.txt
	cmake/modules/FindNepomuk.cmake
	kdecore/tests/kservicetest.cpp
	kdeui/util/kkeyserver.h
	kio/kio/accessmanagerreply_p.h
	kio/kio/hostinfo.cpp
	kioslave/http/http.h
	kioslave/http/httpauthentication.cpp
	kioslave/http/httpauthentication.h
	kioslave/http/tests/httpauthenticationtest.cpp
	kioslave/http/tests/httpheaderdispositiontest.cpp
	kparts/browseropenorsavequestion.cpp
	plasma/data/services/plasma.protocol
	plasma/wallpaper.cpp
	plasma/widgets/videowidget.h
	solid/solid/backends/wmi/wmiquery.cpp
This commit is contained in:
Aaron Seigo 2011-10-31 15:25:10 +01:00
commit 8eb06eee32
35 changed files with 228 additions and 91 deletions

View File

@ -9,7 +9,7 @@
* 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
* GNU Library 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
@ -101,7 +101,7 @@ class PLASMA_EXPORT AbstractRunner : public QObject
*
* Each runner is executed in its own thread. Whenever the user input changes this
* method is called again. Thus, it needs to be thread-safe. Also, all matches need
* to be reported once this method returns. Asyncroneous runners therefore need
* to be reported once this method returns. Asynchronous runners therefore need
* to make use of a local event loop to wait for all matches.
*
* It is recommended to use local status data in async runners. The simplest way is

View File

@ -687,14 +687,16 @@ void ContainmentPrivate::addAppletActions(KMenu &desktopMenu, Applet *applet, QE
}
}
QAction *configureApplet = applet->d->actions->action("configure");
if (configureApplet && configureApplet->isEnabled()) {
desktopMenu.addAction(configureApplet);
}
if (!applet->d->failed) {
QAction *configureApplet = applet->d->actions->action("configure");
if (configureApplet && configureApplet->isEnabled()) {
desktopMenu.addAction(configureApplet);
}
QAction *runAssociatedApplication = applet->d->actions->action("run associated application");
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
QAction *runAssociatedApplication = applet->d->actions->action("run associated application");
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
}
}
KMenu *containmentMenu = new KMenu(i18nc("%1 is the name of the containment", "%1 Options", q->name()), &desktopMenu);

View File

@ -39,6 +39,7 @@ Name[km]=សម្រាំង
Name[kn]=
Name[ko]=
Name[ku]=Berhevok
Name[lt]=Rinkinys
Name[lv]=Kolekcija
Name[ml]=
Name[ms]=Koleksi

View File

@ -18,15 +18,18 @@ Description[el]=Ένα πρωτόκολλο υπηρεσιών Plasma
Description[es]=Un protocolo para los servicios de Plasma
Description[et]=Plasma teenuste protokoll
Description[eu]=Plasma zerbitzuentzako protokolo bat
Description[fi]=Plasma-palvelujen protokolla
Description[fi]=Plasma-palvelujen yhteyskäytäntö
Description[fr]=Un protocole pour les services Plasma
Description[hr]=Protokol za servise u Plasmi
Description[hu]=Protokoll a Plazma-szolgáltatáshoz
Description[ia]=un protocollo per servicios de Plasma
Description[is]=Samskiptamáti fyrir Plasma-þjónustur
Description[it]=Un protocollo per servizi plasma
Description[ja]=Plasma サービスのためのプロトコル
Description[kk]=Plasma қызметінің протоколы
Description[km]=ពិធីការ​សម្រាប់​សេវា​កម្ម​ប្លាស្មា
Description[ko]=Plasma 서비스 프로토콜
Description[lv]=Plasma servisu protokols
Description[nb]=En protokoll for plasma-tjenester
Description[nds]=En Protokoll för Plasma-Deensten
Description[nl]=Een protocol voor Plasma-services
@ -42,10 +45,12 @@ Description[sr@ijekavian]=Протокол за плазма сервисе
Description[sr@ijekavianlatin]=Protokol za plasma servise
Description[sr@latin]=Protokol za plasma servise
Description[sv]=Ett protokoll för Plasma-tjänster
Description[th]=โพรโทคอลสำหรับใช้กับบริการของพลาสมา
Description[tr]=Plasma servisleri için bir protokol
Description[ug]=پلازما(Plasma) مۇلازىمىتىنىڭ كېلىشىمى
Description[uk]=Протокол для служб Плазми
Description[x-test]=xxA protocol for Plasma servicesxx
Description[zh_CN]=Plasma 服务协议
Description[zh_TW]=Plasma 服務協定
helper=true

View File

@ -71,7 +71,7 @@ Comment[ta]=பிளாஸ்மா தரவு இயந்திரம்
Comment[tg]=Системаи маълумотии Plasma
Comment[th]=
Comment[tr]=Plasma Veri Motoru
Comment[ug]=Plasma سانلىق مەلۇمات ماتورى
Comment[ug]=Plasma سانلىق-مەلۇمات ماتورى
Comment[uk]=Рушій даних Плазми
Comment[wa]=Moteur di dnêyes di Plasma
Comment[x-test]=xxPlasma Data Enginexx

View File

@ -16,6 +16,7 @@ Comment[es]=Servicio de Plasma
Comment[et]=Plasma teenus
Comment[eu]=Plasma zerbitzua
Comment[fi]=Plasma-palvelu
Comment[fr]=Service Plasma
Comment[gl]=Servizo do Plasma
Comment[hr]=Servis u Plasmi
Comment[hu]=Plazma-szolgáltatás
@ -27,6 +28,7 @@ Comment[kk]=Plasma қызметі
Comment[km]=
Comment[ko]=Plasma
Comment[lt]=Plasma tarnyba
Comment[lv]=Plasma serviss
Comment[nb]=Plasma-tjeneste
Comment[nds]=Plasma-Deenst
Comment[nl]=Plasma-service

View File

@ -16,6 +16,7 @@ Comment[es]=Caja de herramientas de Plasma
Comment[et]=Plasma tööriistakast
Comment[eu]=Plasma tresna-kutxa
Comment[fi]=Plasma-työkalurivi
Comment[fr]=Boîte à outils Plasma
Comment[gl]=Barra de ferramentas do Plasma
Comment[hr]=Plasma alatni okvir
Comment[hu]=Plazma-eszközkészlet
@ -28,6 +29,7 @@ Comment[km]=ប្រអប់​ឧបករណ៍​ប្លាស្មា
Comment[ko]=Plasma
Comment[ku]=Qutiya amûrên Plasma
Comment[lt]=Pasma įrankinė
Comment[lv]=Plasma rīkkopa
Comment[nb]=Plasma-verktøykasse
Comment[nds]=Plasma-Warktüüchkist
Comment[nl]=Plasma-hulpmiddelen

View File

@ -31,8 +31,6 @@ DataContainer::DataContainer(QObject *parent)
: QObject(parent),
d(new DataContainerPrivate(this))
{
d->storageTimer = new QTimer(this);
QObject::connect(d->storageTimer, SIGNAL(timeout()), this, SLOT(store()));
}
DataContainer::~DataContainer()
@ -61,7 +59,7 @@ void DataContainer::setData(const QString &key, const QVariant &value)
//setData() since the last time it was stored. This
//gives us only one singleShot timer.
if (isStorageEnabled() || !needsToBeStored()) {
d->storageTimer->start(180000);
d->storageTimer.start(180000, this);
}
setNeedsToBeStored(true);
@ -330,11 +328,24 @@ void DataContainer::setNeedsUpdate(bool update)
void DataContainer::checkUsage()
{
if (d->relays.count() < 1 &&
receivers(SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data))) < 1) {
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
kDebug() << objectName() << "is unused";
emit becameUnused(objectName());
if (!d->checkUsageTimer.isActive()) {
d->checkUsageTimer.start(10, this);
}
}
void DataContainer::timerEvent(QTimerEvent * event)
{
if (event->timerId() == d->checkUsageTimer.timerId()) {
if (d->relays.count() < 1 &&
receivers(SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data))) < 1) {
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
kDebug() << objectName() << "is unused";
emit becameUnused(objectName());
}
d->checkUsageTimer.stop();
} else if (event->timerId() == d->storageTimer.timerId()) {
d->store();
d->storageTimer.stop();
}
}

View File

@ -245,6 +245,11 @@ class PLASMA_EXPORT DataContainer : public QObject
**/
void checkUsage();
/**
* @reimp from QObject
*/
void timerEvent(QTimerEvent * event);
private:
friend class SignalRelay;
friend class DataContainerPrivate;
@ -253,7 +258,6 @@ class PLASMA_EXPORT DataContainer : public QObject
Q_PRIVATE_SLOT(d, void storeJobFinished(KJob *job))
Q_PRIVATE_SLOT(d, void populateFromStoredData(KJob *job))
Q_PRIVATE_SLOT(d, void store())
Q_PRIVATE_SLOT(d, void retrieve())
};

View File

@ -197,7 +197,7 @@ void DataEngine::setData(const QString &source, const QString &key, const QVaria
s->setData(key, value);
if (isNew) {
if (isNew && source != d->waitingSourceRequest) {
emit sourceAdded(source);
}
@ -219,7 +219,7 @@ void DataEngine::setData(const QString &source, const Data &data)
++it;
}
if (isNew) {
if (isNew && source != d->waitingSourceRequest) {
emit sourceAdded(source);
}
@ -330,10 +330,10 @@ void DataEngine::removeAllSources()
QMutableHashIterator<QString, Plasma::DataContainer*> it(d->sources);
while (it.hasNext()) {
it.next();
const QString source = it.key();
Plasma::DataContainer *s = it.value();
emit sourceRemoved(it.key());
it.remove();
emit sourceRemoved(source);
s->disconnect(this);
delete s;
}
}
@ -701,6 +701,7 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
/*kDebug() << "DataEngine " << q->objectName()
<< ": could not find DataContainer " << sourceName
<< " will create on request" << endl;*/
waitingSourceRequest = sourceName;
if (q->sourceRequestEvent(sourceName)) {
s = source(sourceName, false);
if (s) {
@ -710,8 +711,10 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
*newSource = true;
}
QObject::connect(s, SIGNAL(becameUnused(QString)), q, SLOT(removeSource(QString)));
emit q->sourceAdded(sourceName);
}
}
waitingSourceRequest.clear();
}
return s;

View File

@ -83,7 +83,10 @@ class PLASMA_EXPORT DataEngine : public QObject
* This method is called when the DataEngine is started. When this
* method is called the DataEngine is fully constructed and ready to be
* used. This method should be reimplemented by DataEngine subclasses
* which have the need to perform a startup routine.
* which need to perform a startup routine.
*
* The default implementation does nothing. Reimplementations in
* subclasses don't need to call this one.
**/
virtual void init();

View File

@ -88,7 +88,7 @@ void DialogPrivate::scheduleBorderCheck(bool triggeredByResize)
QObject::connect(moveTimer, SIGNAL(timeout()), q, SLOT(checkBorders()));
}
moveTimer->start(triggeredByResize ? 0 : 200);
moveTimer->start(0);
}
void DialogPrivate::themeChanged()

View File

@ -321,7 +321,7 @@ void FrameSvg::resizeFrame(const QSizeF &size)
}
if (size.isEmpty()) {
kDebug() << "Invalid size" << size;
//kDebug() << "Invalid size" << size;
return;
}

View File

@ -348,6 +348,10 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
}
//kDebug() << "about to switch to a popup";
if (!qWidget && !gWidget) {
delete dialogPtr.data();
return;
}
//there was already a dialog? don't make the switch again
if (dialogPtr) {
@ -372,7 +376,9 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
dialog->d->appletPtr = q;
dialogPtr = dialog;
dialog->setAspectRatioMode(savedAspectRatio);
if (icon) {
dialog->setAspectRatioMode(savedAspectRatio);
}
//no longer use Qt::Popup since that seems to cause a lot of problem when you drag
//stuff out of your Dialog (extenders). Monitor WindowDeactivate events so we can
@ -423,7 +429,7 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
void PopupAppletPrivate::appletActivated()
{
internalTogglePopup();
internalTogglePopup(true);
}
QSizeF PopupApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
@ -696,7 +702,7 @@ void PopupAppletPrivate::iconSizeChanged(int group)
}
}
void PopupAppletPrivate::internalTogglePopup()
void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
{
if (autohideTimer) {
autohideTimer->stop();
@ -707,6 +713,11 @@ void PopupAppletPrivate::internalTogglePopup()
Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) {
q->setFocus(Qt::ShortcutFocusReason);
if (!fromActivatedSignal) {
QObject::disconnect(q, SIGNAL(activate()), q, SLOT(appletActivated()));
emit q->activate();
QObject::connect(q, SIGNAL(activate()), q, SLOT(appletActivated()));
}
return;
}
@ -727,6 +738,11 @@ void PopupAppletPrivate::internalTogglePopup()
q->graphicsWidget() == static_cast<Applet*>(q)->d->extender.data() &&
static_cast<Applet*>(q)->d->extender.data()->isEmpty()) {
// we have nothing to show, so let's not.
if (!fromActivatedSignal) {
QObject::disconnect(q, SIGNAL(activate()), q, SLOT(appletActivated()));
emit q->activate();
QObject::connect(q, SIGNAL(activate()), q, SLOT(appletActivated()));
}
return;
}
@ -736,7 +752,9 @@ void PopupAppletPrivate::internalTogglePopup()
KWindowSystem::setOnAllDesktops(dialog->winId(), true);
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
dialog->setAspectRatioMode(savedAspectRatio);
if (icon) {
dialog->setAspectRatioMode(savedAspectRatio);
}
if (q->location() != Floating) {
dialog->animatedShow(locationToDirection(q->location()));

View File

@ -20,11 +20,13 @@
#ifndef PLASMA_DATACONTAINER_P_H
#define PLASMA_DATACONTAINER_P_H
#include <QtCore/QTimerEvent>
#include <QtCore/QTime>
#include "servicejob.h"
#include "storage_p.h"
#include <QtCore/QTimerEvent>
#include <QtCore/QTime>
#include <QtCore/QBasicTimer>
class QTimer;
namespace Plasma
@ -38,11 +40,11 @@ public:
DataContainerPrivate(DataContainer *container)
: q(container),
storage(NULL),
storageCount(0),
dirty(false),
cached(false),
enableStorage(false),
isStored(true),
storageCount(0)
isStored(true)
{
}
@ -71,14 +73,15 @@ public:
DataEngine::Data data;
QMap<QObject *, SignalRelay *> relayObjects;
QMap<uint, SignalRelay *> relays;
QTimer *storageTimer;
QTime updateTs;
Storage* storage;
QBasicTimer storageTimer;
QBasicTimer checkUsageTimer;
int storageCount;
bool dirty : 1;
bool cached : 1;
bool enableStorage : 1;
bool isStored : 1;
int storageCount;
};
class SignalRelay : public QObject

View File

@ -118,6 +118,7 @@ class DataEnginePrivate
QString serviceName;
Package *package;
Service *publishedService;
QString waitingSourceRequest;
};
} // Plasma namespace

View File

@ -35,7 +35,7 @@ public:
~PopupAppletPrivate();
void iconSizeChanged(int group);
void internalTogglePopup();
void internalTogglePopup(bool fromActivatedSignal = false);
void hideTimedPopup();
void clearPopupLostFocus();
void dialogSizeChanged();

View File

@ -32,6 +32,8 @@
class StorageJob : public Plasma::ServiceJob
{
Q_OBJECT
Q_PROPERTY(QVariantHash data READ data WRITE setData)
public:
StorageJob(const QString& destination,
const QString& operation,

View File

@ -314,6 +314,16 @@ QRect Style::subControlRect(ComplexControl control, const QStyleOptionComplex *o
}
}
int Style::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
switch (hint) {
case SH_RequestSoftwareInputPanel:
return RSIP_OnMouseClick;
default:
return QCommonStyle::styleHint(hint, option, widget, returnData);
}
}
int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
if (Theme::defaultTheme()->useNativeWidgetStyle()) {

View File

@ -45,6 +45,7 @@ public:
~Style();
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
int styleHint(StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const;
protected:
void drawComplexControl(ComplexControl control,

View File

@ -46,6 +46,8 @@ public:
void newRenderCompleted(const WallpaperRenderRequest &render, const QImage &image);
void setupScriptSupport();
void renderWallpaper(const QString &sourceImagePath, const QImage &image, const QSize &size,
Wallpaper::ResizeMethod resizeMethod, const QColor &color);
static PackageStructure::Ptr s_packageStructure;
@ -70,16 +72,16 @@ public:
class LoadImageThread : public QObject, public QRunnable
{
Q_OBJECT
private:
QString m_filePath;
Q_SIGNALS:
void done(const QImage &pixmap);
public:
LoadImageThread(const QString &filePath);
void run();
public:
LoadImageThread(const QString &filePath);
void run();
Q_SIGNALS:
void done(const QImage &pixmap);
private:
QString m_filePath;
};
} // namespace Plasma

View File

@ -115,12 +115,12 @@ void WallpaperRenderThread::run()
QImage result(m_request.size, QImage::Format_ARGB32_Premultiplied);
result.fill(m_request.color.rgba());
if (m_request.file.isEmpty() || !QFile::exists(m_request.file)) {
if (m_request.file.isEmpty() && m_request.providedImage.isNull() && !QFile::exists(m_request.file)) {
if (!m_abort) {
emit done(m_request, result);
}
kDebug() << "oh, fuck it";
kDebug() << "wrong request or file does not exist";
deleteLater();
return;
}
@ -134,7 +134,11 @@ void WallpaperRenderThread::run()
// set image size
QSize imgSize(1, 1);
if (scalable) {
if (!m_request.providedImage.isNull()) {
img = m_request.providedImage;
kDebug() << "going to resize the img" << img.size();
imgSize = imgSize.expandedTo(img.size());
} else if (scalable) {
// scalable: image can be of any size
imgSize = imgSize.expandedTo(m_request.size);
} else {
@ -223,7 +227,6 @@ void WallpaperRenderThread::run()
QSvgRenderer svg(m_request.file);
if (m_abort) {
deleteLater();
kDebug() << "oh, fuck it 2";
return;
}
svg.render(&p);
@ -234,7 +237,6 @@ void WallpaperRenderThread::run()
if (m_abort) {
deleteLater();
kDebug() << "oh, fuck it 3";
return;
}
@ -243,7 +245,6 @@ void WallpaperRenderThread::run()
for (int y = pos.y(); y < m_request.size.height(); y += scaledSize.height()) {
p.drawImage(QPoint(x, y), img);
if (m_abort) {
kDebug() << "oh, fuck it 4";
deleteLater();
return;
}
@ -256,7 +257,6 @@ void WallpaperRenderThread::run()
// signal we're done
if (!m_abort) {
kDebug() << "*****************************************************";
emit done(m_request, result);
}

View File

@ -42,6 +42,7 @@ public:
}
QWeakPointer<QObject> requester;
QImage providedImage;
QString file;
QSize size;
Wallpaper::ResizeMethod resizeMethod;

View File

@ -64,7 +64,7 @@ Name[ta]=பொதியின் மூலத்தரவு சோதனைக
Name[tg]=Файли санҷишии стсетмаи metadata
Name[th]=
Name[tr]=Paket metadata test dosyası
Name[ug]=بوغچا مېتا سانلىق مەلۇمات سىناق ھۆججەت
Name[ug]=بوغچا مېتا سانلىق-مەلۇمات سىناق ھۆججەت
Name[uk]=Файл перевірки метаданих пакунка
Name[wa]=Fitchî d' asprouvaedje des meta-dnêyes do pacaedje
Name[x-test]=xxPackage metadata test filexx

View File

@ -14,6 +14,7 @@ Name[et]=Test
Name[eu]=Proba
Name[fa]=آزمون
Name[fi]=Testi
Name[fr]=Test
Name[gl]=Proba
Name[hr]=Test
Name[hu]=Teszt
@ -26,6 +27,7 @@ Name[km]=សាកល្បង
Name[ko]=
Name[ku]=Bicaribîne
Name[lt]=Testas
Name[lv]=Tests
Name[nb]=Test
Name[nds]=Utproberen
Name[nl]=Test
@ -45,7 +47,7 @@ Name[sr@latin]=Proba
Name[sv]=Test
Name[th]=
Name[tr]=Deneme
Name[ug]=سىنا
Name[ug]=سىناق
Name[uk]=Тест
Name[wa]=Sayî
Name[x-test]=xxTestxx
@ -65,6 +67,7 @@ Comment[es]=Un complemento de pruebas
Comment[et]=Libaplugin testimiseks
Comment[eu]=Probatarako gezurretazko plugin bat
Comment[fi]=Tyhjä testausliitännäinen
Comment[fr]=Un module factice de test
Comment[gl]=Un engadido para probas
Comment[hr]=Lažan priključak za testiranje
Comment[hu]=Üres bővítmény teszteléshez
@ -77,6 +80,7 @@ Comment[km]=កម្មវិធី​ជំនួយ​ដំបូង​ស
Comment[ko]=
Comment[ku]=Pêvekekî hêsan ji bo ceribandinê
Comment[lt]=Netikras priedas testavimui
Comment[lv]=Testēšanai paredzēts spraudnis
Comment[nb]=Et attrapp-programtillegg for testing
Comment[nds]=En Platzholler-Moduul för't Utproberen
Comment[nl]=Een dummy plugin voor testen

View File

@ -11,7 +11,7 @@ Name[ca]=Motor de dades de prova
Name[ca@valencia]=Motor de dades de prova
Name[cs]=Testovací datový nástroj
Name[da]=Test datamotor
Name[de]=Test-Datentreiber
Name[de]=Test-Datenmodul
Name[el]=Μηχανή δεδομένων ελέγχου
Name[en_GB]=Test Data Engine
Name[eo]=Testa Datuma motoro

View File

@ -442,6 +442,16 @@ QSizeF Wallpaper::targetSizeHint() const
return d->targetSize;
}
void Wallpaper::render(const QImage &image, const QSize &size,
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
{
if (image.isNull()) {
return;
}
d->renderWallpaper(QString(), image, size, resizeMethod, color);
}
void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
{
@ -450,23 +460,30 @@ void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
return;
}
resizeMethod = qBound(ScaledResize, resizeMethod, LastResizeMethod);
if (d->lastResizeMethod != resizeMethod) {
d->lastResizeMethod = resizeMethod;
emit renderHintsChanged();
d->renderWallpaper(sourceImagePath, QImage(), size, resizeMethod, color);
}
void WallpaperPrivate::renderWallpaper(const QString &sourceImagePath, const QImage &image, const QSize &size,
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
{
resizeMethod = qBound(Wallpaper::ScaledResize, resizeMethod, Wallpaper::LastResizeMethod);
if (lastResizeMethod != resizeMethod) {
lastResizeMethod = resizeMethod;
emit q->renderHintsChanged();
}
if (d->cacheRendering) {
if (cacheRendering) {
QFileInfo info(sourceImagePath);
QString cache = d->cacheKey(sourceImagePath, size, resizeMethod, color);
if (d->findInCache(cache, info.lastModified().toTime_t())) {
QString cache = cacheKey(sourceImagePath, size, resizeMethod, color);
if (findInCache(cache, info.lastModified().toTime_t())) {
return;
}
}
WallpaperRenderRequest request;
d->renderToken = request.token;
request.requester = this;
renderToken = request.token;
request.requester = q;
request.providedImage = image;
request.file = sourceImagePath;
request.size = size;
request.resizeMethod = resizeMethod;

View File

@ -486,6 +486,22 @@ class PLASMA_EXPORT Wallpaper : public QObject
Wallpaper::ResizeMethod resizeMethod = ScaledResize,
const QColor &color = QColor(0, 0, 0));
/**
* Renders the wallpaper asyncronously with the given parameters. When the rendering is
* complete, the renderCompleted signal is emitted.
*
* @param image the raw QImage
* @param size the size to render the image as
* @param resizeMethod the method to use when resizing the image to fit size, @see
* ResizeMethod
* @param color the color to use to pad the rendered image if it doesn't take up the
* entire size with the given ResizeMethod
* @since 4.7.4
*/
void render(const QImage &image, const QSize &size,
Wallpaper::ResizeMethod resizeMethod = ScaledResize,
const QColor &color = QColor(0, 0, 0));
/**
* Sets whether or not to cache on disk the results of calls to render. If the wallpaper
* changes often or is innexpensive to render, then it's probably best not to cache them.

View File

@ -60,6 +60,8 @@ public:
void execute(const QString &fileName);
void finishExecute();
void scheduleExecutionEnd();
void minimumWidthChanged();
void minimumHeightChanged();
DeclarativeWidget *q;
@ -152,18 +154,19 @@ void DeclarativeWidgetPrivate::finishExecute()
lay->addItem(widget);
} else {
q->setLayout(0);
qreal width = 0;
qreal height = 0;
qreal minimumWidth = 0;
qreal minimumHeight = 0;
if (object) {
width = object->property("width").toReal();
height = object->property("height").toReal();
minimumWidth = object->property("minimumWidth").toReal();
minimumHeight = object->property("minimumHeight").toReal();
object->setProperty("width", q->size().width());
object->setProperty("height", q->size().height());
QObject::connect(object, SIGNAL(minimumWidthChanged()), q, SLOT(minimumWidthChanged()));
QObject::connect(object, SIGNAL(minimumHeightChanged()), q, SLOT(minimumHeightChanged()));
}
//FIXME: find a better way to have a minimum size
if (width > 0 && height > 0) {
q->setMinimumSize(width, height);
if (minimumWidth > 0 && minimumHeight > 0) {
q->setMinimumSize(minimumWidth, minimumHeight);
} else {
q->setMinimumSize(-1, -1);
}
@ -171,7 +174,17 @@ void DeclarativeWidgetPrivate::finishExecute()
emit q->finished();
}
void DeclarativeWidgetPrivate::minimumWidthChanged()
{
qreal minimumWidth = root->property("minimumWidth").toReal();
q->setMinimumWidth(minimumWidth);
}
void DeclarativeWidgetPrivate::minimumHeightChanged()
{
qreal minimumHeight = root->property("minimumHeight").toReal();
q->setMinimumHeight(minimumHeight);
}
DeclarativeWidget::DeclarativeWidget(QGraphicsWidget *parent)
: QGraphicsWidget(parent),

View File

@ -129,6 +129,8 @@ private:
Q_PRIVATE_SLOT(d, void finishExecute())
Q_PRIVATE_SLOT(d, void scheduleExecutionEnd())
Q_PRIVATE_SLOT(d, void minimumWidthChanged())
Q_PRIVATE_SLOT(d, void minimumHeightChanged())
};
} // namespace Plasma

View File

@ -189,6 +189,8 @@ void LineEdit::focusInEvent(QFocusEvent *event)
// as of Qt 4.7, apparently we have a bug here in QGraphicsProxyWidget
nativeWidget()->setFocus(event->reason());
}
emit focusChanged(true);
}
void LineEdit::focusOutEvent(QFocusEvent *event)
@ -215,6 +217,8 @@ void LineEdit::focusOutEvent(QFocusEvent *event)
}
QGraphicsProxyWidget::focusOutEvent(event);
emit focusChanged(false);
}
} // namespace Plasma

View File

@ -133,6 +133,11 @@ Q_SIGNALS:
* @since 4.4
*/
void textChanged(const QString &text);
/**
* Emitted when the widget receives or loses focus
* @since 4.7
*/
void focusChanged(bool focused);
private:
Q_PRIVATE_SLOT(d, void setPalette())

View File

@ -111,6 +111,25 @@ public:
}
}
void syncFrame()
{
if (background) {
//resize all panels
background->setElementPrefix("pressed");
background->resizeFrame(q->size());
syncActiveRect();
background->setElementPrefix("normal");
background->resizeFrame(q->size());
hoverAnimation->setProperty("startPixmap", background->framePixmap());
background->setElementPrefix("active");
background->resizeFrame(activeRect.size());
hoverAnimation->setProperty("targetPixmap", background->framePixmap());
}
}
void syncActiveRect();
void syncBorders();
@ -193,6 +212,7 @@ PushButton::PushButton(QGraphicsWidget *parent)
connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
d->initTheming();
d->syncFrame();
}
PushButton::~PushButton()
@ -325,23 +345,9 @@ void PushButton::resizeEvent(QGraphicsSceneResizeEvent *event)
{
d->setPixmap();
if (d->background) {
//resize all panels
d->background->setElementPrefix("pressed");
d->background->resizeFrame(size());
d->syncFrame();
d->syncActiveRect();
d->background->setElementPrefix("normal");
d->background->resizeFrame(size());
d->hoverAnimation->setProperty("startPixmap", d->background->framePixmap());
d->background->setElementPrefix("active");
d->background->resizeFrame(d->activeRect.size());
d->hoverAnimation->setProperty("targetPixmap", d->background->framePixmap());
}
QGraphicsProxyWidget::resizeEvent(event);
QGraphicsProxyWidget::resizeEvent(event);
}
void PushButton::paint(QPainter *painter,

View File

@ -112,7 +112,6 @@ void TextEdit::setNativeWidget(KTextEdit *nativeWidget)
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
nativeWidget->setFrameShape(QFrame::NoFrame);
nativeWidget->setTextBackgroundColor(Qt::transparent);
nativeWidget->viewport()->setAutoFillBackground(false);
nativeWidget->verticalScrollBar()->setStyle(d->style.data());
nativeWidget->horizontalScrollBar()->setStyle(d->style.data());

View File

@ -145,14 +145,14 @@ public:
/**
* @param interval milliseconds the tick signal will be emitted
* @since 4.8
* @since 4.7.1
*/
void setTickInterval(qint64 interval);
/**
* @return milliseconds the tick signal will be emitted
* @see tickInterval()
* @since 4.8
* @since 4.7.1
*/
qint64 tickInterval() const;