activity (desktop containment) switching

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=786809
This commit is contained in:
Chani Armitage 2008-03-17 23:49:01 +00:00
parent ac473c1b7e
commit 124f1da013
3 changed files with 28 additions and 7 deletions

View File

@ -260,7 +260,7 @@ void Containment::setContainmentType(Containment::Type type)
connect(addWidgetTool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets()));
Plasma::Widget *zoomInTool = addToolBoxTool("zoomIn", "zoom-in", i18n("Zoom In"));
connect(zoomInTool, SIGNAL(clicked()), this, SIGNAL(zoomIn()));
connect(zoomInTool, SIGNAL(clicked()), this, SLOT(zoomIn()));
Plasma::Widget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out"));
connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
@ -523,6 +523,11 @@ void Containment::toggleDesktopImmutability()
d->setLockToolText();
}
void Containment::zoomIn()
{
emit zoomIn(this);
}
void Containment::clearApplets()
{
qDeleteAll(d->applets);

View File

@ -125,6 +125,11 @@ class PLASMA_EXPORT Containment : public Applet
*/
void setContainmentType(Containment::Type type);
/**
* Returns the Corona (if any) that this Containment is hosted by
*/
Corona* corona() const;
/**
* Returns the current form factor the applets in this Containment
* are being displayed in.
@ -303,10 +308,10 @@ class PLASMA_EXPORT Containment : public Applet
void launchActivated();
/**
* Emitted when the containment requests zooming out one step.
* Emitted when the containment requests zooming in one step.
* Usually only used for desktop containments.
*/
void zoomIn();
void zoomIn(Plasma::Containment *);
/**
* Emitted when the containment requests zooming out one step.
@ -355,9 +360,10 @@ class PLASMA_EXPORT Containment : public Applet
void toggleDesktopImmutability();
/**
* Returns the Corona (if any) that this Containment is hosted by
* Make the containment request zooming in one step.
* Usually only used for desktop containments.
*/
Corona* corona() const;
void zoomIn();
protected:
/**

View File

@ -85,7 +85,11 @@ void View::setScreen(int screen)
return;
}
setContainment(corona->containmentForScreen(screen));
Containment *containment = corona->containmentForScreen(screen);
if (containment) {
d->containment = 0; //so that we don't end up on the old containment's screen
setContainment(containment);
}
}
}
@ -120,15 +124,21 @@ int View::effectiveDesktop() const
void View::setContainment(Containment *containment)
{
if (!containment) {
if (!containment || containment == d->containment) {
return;
}
int screen = -1;
if (d->containment) {
disconnect(d->containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
screen = d->containment->screen();
}
d->containment = containment;
if (screen > -1) {
containment->setScreen(screen);
}
if (containment->screen() > -1 && d->desktop < -1) {
// we want to set it to "all desktops" if we get ownership of