SVN commit 1200094 by aseigo: * non-PVD *relies* on desktop == -1 to work; don't get cute and set the desktop value when not in PVD! * if opening fails, make sure we get containments for all screens and all desktops * leave the state caching to the KActivityInfo class M +10 -14 activity.cpp M +1 -1 activity.h --- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.cpp #1200093:1200094 @@ -55,7 +55,6 @@ m_name = m_info->name(); m_icon = m_info->icon(); - m_state = m_info->state(); connect(m_info, SIGNAL(infoChanged()), this, SLOT(activityChanged())); connect(m_info, SIGNAL(stateChanged(KActivityInfo::State)), this, SLOT(activityStateChanged(KActivityInfo::State))); @@ -90,7 +89,6 @@ void Activity::activityStateChanged(KActivityInfo::State state) { - m_state = state; emit stateChanged(); } @@ -130,7 +128,7 @@ KActivityInfo::State Activity::state() { - return m_state; + return m_info->state(); } void Activity::remove() @@ -154,11 +152,6 @@ Plasma::Containment* Activity::containmentForScreen(int screen, int desktop) { - //desktop -1 and 0 should share the same containment (for when PVD is changed) - if (desktop == -1) { - desktop = 0; - } - Plasma::Containment *containment = m_containments.value(QPair(screen, desktop)); if (!containment) { kDebug() << "adding containment for" << screen << desktop; @@ -212,14 +205,17 @@ opened(); } + checkScreens(); +} + +void Activity::checkScreens() +{ //ensure there's a containment for every screen & desktop. int numScreens = Kephal::ScreenUtils::numScreens(); - int numDesktops = 0; - if (AppSettings::perVirtualDesktopViews()) { - numDesktops = KWindowSystem::numberOfDesktops(); - } + int numDesktops = AppSettings::perVirtualDesktopViews() ? KWindowSystem::numberOfDesktops() : 0; + for (int screen = 0; screen < numScreens; ++screen) { - if (numDesktops) { + if (numDesktops > 0) { for (int desktop = 0; desktop < numDesktops; ++desktop) { activateContainment(screen, desktop); } @@ -398,7 +394,7 @@ if (m_containments.isEmpty()) { //TODO check if we need more for screens/desktops kDebug() << "open failed (bad file?). creating new containment"; - containmentForScreen(0, 0); + checkScreens(); } m_corona->requireConfigSync(); --- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.h #1200093:1200094 @@ -142,12 +142,12 @@ void activateContainment(int screen, int desktop); void insertContainment(Plasma::Containment* cont, bool force=false); void insertContainment(Plasma::Containment* containment, int screen, int desktop); + void checkScreens(); QString m_id; QString m_name; QString m_icon; QString m_plugin; - KActivityInfo::State m_state; QHash, Plasma::Containment*> m_containments; KActivityInfo *m_info; KActivityConsumer *m_activityConsumer;