when a popupapplet is in the panel automatically switch between full
view and icons wiew when the containment size is enough to display all the applet svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=861877
This commit is contained in:
parent
874870aaee
commit
b424645a31
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008 by Montel Laurent <montel@kde.org>
|
* Copyright 2008 by Montel Laurent <montel@kde.org>
|
||||||
|
* Copyright 2008 by Marco Martin <notmart@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -160,14 +161,32 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsLinearLayout *lay = dynamic_cast<QGraphicsLinearLayout *>(layout());
|
QGraphicsLinearLayout *lay = dynamic_cast<QGraphicsLinearLayout *>(layout());
|
||||||
|
Plasma::FormFactor f = formFactor();
|
||||||
|
|
||||||
if (constraints & Plasma::FormFactorConstraint) {
|
if (constraints & Plasma::FormFactorConstraint ||
|
||||||
|
(constraints & Plasma::SizeConstraint && (f == Plasma::Vertical || f == Plasma::Horizontal))) {
|
||||||
if (lay) {
|
if (lay) {
|
||||||
lay->removeAt(0);
|
lay->removeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((formFactor() != Plasma::Vertical && formFactor() != Plasma::Horizontal) &&
|
QSizeF minimum;
|
||||||
d->icon) {
|
QSizeF containmentSize;
|
||||||
|
|
||||||
|
QGraphicsWidget *gWidget = graphicsWidget();
|
||||||
|
|
||||||
|
if (gWidget) {
|
||||||
|
minimum = gWidget->minimumSize();
|
||||||
|
} else if (widget()) {
|
||||||
|
minimum = widget()->minimumSizeHint();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (containment()) {
|
||||||
|
containmentSize = containment()->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->icon &&
|
||||||
|
((f != Plasma::Vertical && f != Plasma::Horizontal) ||
|
||||||
|
((f == Plasma::Vertical && containmentSize.width() >= minimum.width()) ||(f == Plasma::Horizontal && containmentSize.height() >= minimum.height())))) {
|
||||||
// we only switch to expanded if we aren't horiz/vert constrained and
|
// we only switch to expanded if we aren't horiz/vert constrained and
|
||||||
// this applet has an icon.
|
// this applet has an icon.
|
||||||
// otherwise, we leave it up to the applet itself to figure it out
|
// otherwise, we leave it up to the applet itself to figure it out
|
||||||
@ -190,7 +209,6 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||||||
//get the margins
|
//get the margins
|
||||||
QSizeF marginSize = size() - contentsRect().size();
|
QSizeF marginSize = size() - contentsRect().size();
|
||||||
|
|
||||||
QGraphicsWidget *gWidget = graphicsWidget();
|
|
||||||
if (gWidget) {
|
if (gWidget) {
|
||||||
if (lay) {
|
if (lay) {
|
||||||
lay->addItem(gWidget);
|
lay->addItem(gWidget);
|
||||||
@ -238,7 +256,7 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||||||
|
|
||||||
connect(d->dialog, SIGNAL(dialogResized()), this, SLOT(dialogSizeChanged()));
|
connect(d->dialog, SIGNAL(dialogResized()), this, SLOT(dialogSizeChanged()));
|
||||||
connect(d->dialog, SIGNAL(dialogVisible(bool)), this , SLOT(dialogStatusChanged(bool)));
|
connect(d->dialog, SIGNAL(dialogVisible(bool)), this , SLOT(dialogStatusChanged(bool)));
|
||||||
QGraphicsWidget *gWidget = graphicsWidget();
|
setMinimumSize(QSize(0, 0));
|
||||||
if (gWidget) {
|
if (gWidget) {
|
||||||
Corona *corona = qobject_cast<Corona *>(gWidget->scene());
|
Corona *corona = qobject_cast<Corona *>(gWidget->scene());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user