]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
Extracted the servicemenu code from KonqPopupMenu into KonqMenuActions, and used...
[dolphin.git] / src / dolphinview.cpp
index 7311b30745e564093d42af2f8f3d562b5b123907..51dbb708caeb8fdaf972ada0b5a2f2b9a9d53d81 100644 (file)
@@ -133,12 +133,29 @@ void DolphinView::setActive(bool active)
 
     m_active = active;
 
-    updateViewportColor();
+    QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
+    if (active) {
+        // TODO: emitting urlChanged() is a hack, as the URL hasn't really changed. It
+        // bypasses the problem when having a split view and changing the active view to
+        // update the some URL dependent states. A nicer approach should be no big deal...
+        emit urlChanged(url());
+        emit selectionChanged(selectedItems());
+    } else {
+        color.setAlpha(150);
+    }
+
+    QWidget* viewport = itemView()->viewport();
+    QPalette palette;
+    palette.setColor(viewport->backgroundRole(), color);
+    viewport->setPalette(palette);
+
     update();
 
     if (active) {
         emit activated();
     }
+
+    m_controller->indicateActivationChange(active);
 }
 
 bool DolphinView::isActive() const
@@ -159,8 +176,9 @@ void DolphinView::setMode(Mode mode)
         // to go back to the root URL of the column view automatically.
         // Otherwise there it would not be possible to turn off the column view
         // without focusing the first column.
-        setUrl(m_dirLister->url());
-        m_controller->setUrl(m_dirLister->url());
+        const KUrl root = rootUrl();
+        setUrl(root);
+        m_controller->setUrl(root);
     }
 
     const KUrl viewPropsUrl = viewPropertiesUrl();
@@ -432,10 +450,14 @@ void DolphinView::reload()
 
 void DolphinView::refresh()
 {
+    const bool oldActivationState = m_active;
+    m_active = true;
+
     createView();
     applyViewProperties(m_controller->url());
     reload();
-    updateViewportColor();
+
+    setActive(oldActivationState);
 }
 
 void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
@@ -905,20 +927,4 @@ void DolphinView::applyCutItemEffect()
     }
 }
 
-void DolphinView::updateViewportColor()
-{
-    QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
-    if (m_active) {
-        emit urlChanged(url()); // Hmm, this is a hack; the url hasn't really changed.
-        emit selectionChanged(selectedItems());
-    } else {
-        color.setAlpha(0);
-    }
-
-    QWidget* viewport = itemView()->viewport();
-    QPalette palette;
-    palette.setColor(viewport->backgroundRole(), color);
-    viewport->setPalette(palette);
-}
-
 #include "dolphinview.moc"