clicking an available desktop containment sets the view to that containment

now it's much easier to jump to the activity you want :)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=810614
This commit is contained in:
Chani Armitage 2008-05-21 06:16:45 +00:00
parent 6b756dc236
commit 81985d2b00
3 changed files with 21 additions and 9 deletions

View File

@ -873,11 +873,16 @@ KActionCollection& Containment::Private::actions()
void Containment::Private::focusApplet(Plasma::Applet *applet) void Containment::Private::focusApplet(Plasma::Applet *applet)
{ {
kDebug();
if (focusedApplet == applet) { if (focusedApplet == applet) {
return; return;
} }
if (q->screen() == -1) {
//what's the point of having focus if you're not on screen? :)
//also, clicking a containment to switch to it makes the ZUI waay nicer.
emit q->focusRequested(q);
}
QList<QWidget *> widgets = actions().associatedWidgets(); QList<QWidget *> widgets = actions().associatedWidgets();
if (focusedApplet) { if (focusedApplet) {
foreach (QWidget *w, widgets) { foreach (QWidget *w, widgets) {

View File

@ -318,6 +318,12 @@ class PLASMA_EXPORT Containment : public Applet
*/ */
void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment); void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
/**
* Emitted when the containment wants to become active.
* Usually only used for desktop containments.
*/
void focusRequested(Plasma::Containment *containment);
public Q_SLOTS: public Q_SLOTS:
/** /**
* Informs the Corona as to what position it is in. This is informational * Informs the Corona as to what position it is in. This is informational

17
view.h
View File

@ -112,14 +112,6 @@ public:
*/ */
int effectiveDesktop() const; int effectiveDesktop() const;
/**
* Sets the containment for this view, which will also cause the view
* to track the geometry of the containment.
*
* @arg containment the containment to center the view on
*/
virtual void setContainment(Containment *containment);
/** /**
* @return the containment associated with this view, or 0 if none is * @return the containment associated with this view, or 0 if none is
*/ */
@ -164,6 +156,15 @@ Q_SIGNALS:
*/ */
void sceneRectChanged(); void sceneRectChanged();
public Q_SLOTS:
/**
* Sets the containment for this view, which will also cause the view
* to track the geometry of the containment.
*
* @arg containment the containment to center the view on
*/
virtual void setContainment(Containment *containment);
protected: protected:
/** /**
* @return a KConfigGroup in the application's config file unique to the view * @return a KConfigGroup in the application's config file unique to the view