* make the error presentation look nicer. hopefully now frerich won't feel so compelled to pop up a dialog box.

* invalidate the managing layout on geometry changes, which is what i expected it to do in the first place. calling setGeometry and then updateGeometry is just damaged

CCMAIL:raabe@kde.org

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=732526
This commit is contained in:
Aaron J. Seigo 2007-11-04 05:31:18 +00:00
parent c8e196295f
commit af2752eb1c

View File

@ -30,6 +30,7 @@
#include <QPainter>
#include <QSize>
#include <QStyleOptionGraphicsItem>
#include <QTextDocument>
#include <QTimer>
#include <QUiLoader>
@ -606,7 +607,7 @@ QString visibleFailureText(const QString& reason)
if (reason.isEmpty()) {
text = i18n("This object could not be created.");
} else {
text = i18n("This object could not be created for the following reason:<p>%1</p>", reason);
text = i18n("This object could not be created for the following reason:<p><b>%1</b></p>", reason);
}
return text;
@ -631,9 +632,12 @@ void Applet::setFailedToLaunch(bool failed, const QString& reason)
setDrawStandardBackground(true);
Layout* failureLayout = new BoxLayout(BoxLayout::TopToBottom, this);
failureLayout->setMargin(0);
d->failureText = new LineEdit(this, scene());
d->failureText->setFlags(0);
d->failureText = new LineEdit(this);
d->failureText->setStyled(false);
d->failureText->document()->setTextWidth(200);
d->failureText->setHtml(visibleFailureText(reason));
//FIXME: this needs to get the colour from the theme's colour scheme
d->failureText->setDefaultTextColor(Qt::white);
failureLayout->addItem(d->failureText);
setGeometry(QRectF(geometry().topLeft(), d->failureText->sizeHint()));
} else {
@ -1139,6 +1143,10 @@ void Applet::setGeometry(const QRectF& geometry)
if (layout()) {
layout()->setGeometry(QRectF(QPoint(0, 0), contentSize()));
}
if (managingLayout()) {
managingLayout()->invalidate();
}
}
setPos(geometry.topLeft());