* added setAlwaysIconified(bool) to allow using the

applet iconified even on the desktop (useful for Kickoff)
* added bool alwaysIconified()


svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=853100
This commit is contained in:
Alessandro Diaferia 2008-08-27 07:41:29 +00:00
parent 9d5e4b488e
commit f58ae0fbc4
2 changed files with 31 additions and 2 deletions

View File

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* Copyright (C) 2008 by Alessandro Diaferia <alediaferia@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -46,7 +47,8 @@ public:
layout(0),
proxy(0),
savedAspectRatio(Plasma::InvalidAspectRatioMode),
timer(0)
timer(0),
alwaysIconified(false)
{
}
@ -70,6 +72,7 @@ public:
QGraphicsProxyWidget *proxy;
Plasma::AspectRatioMode savedAspectRatio;
QTimer *timer;
bool alwaysIconified;
};
PopupApplet::PopupApplet(QObject *parent, const QVariantList &args)
@ -147,7 +150,12 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
if (constraints & Plasma::FormFactorConstraint) {
d->layout->removeAt(0);
switch (formFactor()) {
Plasma::FormFactor factor = formFactor();
if(d->alwaysIconified)
factor = Plasma::Vertical;
switch (factor) {
case Plasma::Planar:
case Plasma::MediaCenter: {
if (d->icon) {
@ -291,6 +299,16 @@ void PopupApplet::widgetGeometryChanged()
}
}
void PopupApplet::setAlwaysIconified(bool set)
{
d->alwaysIconified = set;
}
bool PopupApplet::alwaysIconified()
{
return d->alwaysIconified;
}
void PopupAppletPrivate::togglePopup()
{
if (dialog) {

View File

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* Copyright (C) 2008 by Alessandro Diaferia <alediaferia@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -88,6 +89,16 @@ public:
*/
void showPopup(uint displayTime = 0);
/**
* Shows the applet always as an icon, even when put on the desktop.
*/
void setAlwaysIconified(bool set);
/**
* @return true if the PopupApplet is set to be always shown as icon.
*/
bool alwaysIconified();
public Q_SLOTS:
/**
* Hides the popup.