]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphintabwidget.cpp
Fix scrolling during inline renaming causes rename of wrong file
[dolphin.git] / src / dolphintabwidget.cpp
index bcd4a49fdfea89df84cedf27131b875d54f5291b..d9b7d7e13eb2176fc8bd86f49544a1869bd349c4 100644 (file)
@@ -33,7 +33,7 @@
 DolphinTabWidget::DolphinTabWidget(QWidget* parent) :
     QTabWidget(parent),
     m_placesSelectorVisible(true),
-    m_previousTab(-1)
+    m_previousTab(0)
 {
     connect(this, &DolphinTabWidget::tabCloseRequested,
             this, static_cast<void (DolphinTabWidget::*)(int)>(&DolphinTabWidget::closeTab));
@@ -284,7 +284,7 @@ void DolphinTabWidget::tabDropEvent(int index, QDropEvent* event)
 {
     if (index >= 0) {
         DolphinView* view = tabPageAt(index)->activeViewContainer()->view();
-        view->dropUrls(view->url(), event);
+        view->dropUrls(view->url(), event, view);
     }
 }
 
@@ -304,15 +304,15 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
 
 void DolphinTabWidget::currentTabChanged(int index)
 {
-    DolphinViewContainer* viewContainer = tabPageAt(index)->activeViewContainer();
-    viewContainer->setActive(true);
+    // previous tab deactivation
+    if (DolphinTabPage* tabPage = tabPageAt(m_previousTab)) {
+        tabPage->setActive(false);
+    }
+    DolphinTabPage* tabPage = tabPageAt(index);
+    DolphinViewContainer* viewContainer = tabPage->activeViewContainer();
     emit activeViewChanged(viewContainer);
     emit currentUrlChanged(viewContainer->url());
-    viewContainer->view()->setFocus();
-
-    if (tabPageAt(m_previousTab)) {
-        tabPageAt(m_previousTab)->activeViewContainer()->setActive(false);
-    }
+    tabPage->setActive(true);
     m_previousTab = index;
 }