[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/shells/mobile/shell
From:       Marco Martin <notmart () gmail ! com>
Date:       2010-12-02 23:13:54
Message-ID: 20101202231354.5EE2DAC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202981 by mart:

previousActivity working


 M  +14 -12    plasmaapp.cpp  


--- trunk/playground/base/plasma/shells/mobile/shell/plasmaapp.cpp #1202980:1202981
@@ -316,28 +316,30 @@
 
 void PlasmaApp::previousActivity()
 {
-    QMap<int, Plasma::Containment*>::const_iterator it = \
m_containments.constFind(m_currentContainment->id()); +    const int \
totalContainments = m_corona->totalContainments(); +    int currentId = \
m_currentContainment->id();  
-    if (it == m_containments.constEnd()) {
-        return;
-    }
+    Plasma::Containment *nextContainment = m_currentContainment;
+    bool loop = false;
+    while (!nextContainment || nextContainment->location() != Plasma::Desktop ||
+          nextContainment == m_currentContainment ||
+          nextContainment == m_alternateContainment) {
+        currentId = (m_corona->totalContainments() + currentId - 1) % \
m_corona->totalContainments(); +        nextContainment = \
m_corona->restoreContainment(currentId);  
-    bool loop = false;
-    while (it.value() == m_currentContainment || it.value() == \
                m_alternateContainment ||
-           it.value()->location() != Plasma::Desktop) {
-        if (it == m_containments.constBegin()) {
-            it = m_containments.constEnd();
+        if (currentId == 0) {
             if (loop) {
-                return;
+                break;
             } else {
                 loop = true;
             }
         }
-        --it;
     }
 
-    changeActivity(it.value());
+    if (nextContainment) {
+        changeActivity(nextContainment);
 }
+}
 
 void PlasmaApp::changeActivity(Plasma::Containment *containment)
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic