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

List:       kde-commits
Subject:    KDE/kdevplatform/sublime
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2009-07-27 19:42:35
Message-ID: 1248723755.681815.22232.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1003169 by zwabel:

Remember the currently active view within the area, and restore at when re-activating an area.
BUG: 197598


 M  +11 -0     area.cpp  
 M  +11 -0     area.h  
 M  +7 -1      mainwindow.cpp  


--- trunk/KDE/kdevplatform/sublime/area.cpp #1003168:1003169
@@ -94,6 +94,7 @@
     QMap<Sublime::Position, int> thickness;
     QString iconName;
     QString workingSet;
+    QPointer<View> activeView;
 };
 
 
@@ -150,6 +151,16 @@
     delete d;
 }
 
+View* Area::activeView()
+{
+    return d->activeView;
+}
+
+void Area::setActiveView(View* view)
+{
+    d->activeView = view;
+}
+
 void Sublime::Area::addView(View *view, AreaIndex *index)
 {
     index->add(view);
--- trunk/KDE/kdevplatform/sublime/area.h #1003168:1003169
@@ -94,7 +94,18 @@
       * If an open document has changes, and it is the last view of that document,
       * the user may push 'Cancel', and the view will stay active. */
     void clearViews();
+
+    /**
+     * Returns the view that was last stored through setActiveView(view), or zero
+     * if the view was deleted or it was never set.
+     */
+    View* activeView();
     
+    /**
+     * Allows marking a view as active that can later be retrieved through activeView()
+     */
+    void setActiveView(View* view);
+    
     /** Closes and deletes the view, asking the user for feedback if needed.
       * Closes the document if it is the last view.
       * Does allow breaking the closing process.
--- trunk/KDE/kdevplatform/sublime/mainwindow.cpp #1003168:1003169
@@ -116,7 +116,12 @@
 
     d->area = area;
     d->reconstruct();
-    d->activateFirstVisibleView();
+    
+    if(d->area->activeView())
+        activateView(d->area->activeView());
+    else
+        d->activateFirstVisibleView();
+    
     initializeStatusBar();
     emit areaChanged(area);
     d->ignoreDockShown = false;
@@ -188,6 +193,7 @@
     d->viewContainers[view]->setCurrentWidget(view->widget());
 
     setActiveView(view);
+    d->area->setActiveView(view);
 }
 
 void MainWindow::setActiveView(View *view)
[prev in list] [next in list] [prev in thread] [next in thread] 

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