]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Fix for show_filter_bar action of tools-menu, which is not correctly set (when the...
[dolphin.git] / src / dolphinmainwindow.cpp
index e14cb1c2d36fa95424bd368a14064b8708b3541e..75d0a059f766ecb13b79ace19a7c818f0bc23cc5 100644 (file)
@@ -278,6 +278,8 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
     viewTab.primaryView->view()->reload();
 
     m_viewTab.append(viewTab);
+    
+    actionCollection()->action("close_tab")->setEnabled(true);
 }
 
 void DolphinMainWindow::toggleActiveView()
@@ -637,7 +639,6 @@ void DolphinMainWindow::quickView()
 
     QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.plasma", "/Previewer", "", "openFile");
     foreach (const KUrl& url, urls) {
-        QList<QVariant> args;
         msg.setArguments(QList<QVariant>() << url.prettyUrl());
         QDBusConnection::sessionBus().send(msg);
     }
@@ -701,7 +702,7 @@ void DolphinMainWindow::closeTab(int index)
     if (index == m_tabIndex) {
         // The tab that should be closed is the active tab. Activate the
         // previous tab before closing the tab.
-        setActiveTab((index > 0) ? index - 1 : 1);
+        m_tabBar->setCurrentIndex((index > 0) ? index - 1 : 1);
     }
 
     // delete tab
@@ -724,6 +725,7 @@ void DolphinMainWindow::closeTab(int index)
     // closing the last tab is not possible
     if (m_viewTab.count() == 1) {
         m_tabBar->removeTab(0);
+        actionCollection()->action("close_tab")->setEnabled(false);
     } else {
         m_tabBar->blockSignals(false);
     }
@@ -772,6 +774,11 @@ void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons butt
     }
 }
 
+void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& canDecode)
+{
+    canDecode = KUrl::List::canDecode(event->mimeData());
+}
+
 void DolphinMainWindow::init()
 {
     DolphinSettings& settings = DolphinSettings::instance();
@@ -816,6 +823,8 @@ void DolphinMainWindow::init()
             this, SLOT(openTabContextMenu(int, const QPoint&)));
     connect(m_tabBar, SIGNAL(newTabRequest()),
             this, SLOT(openNewTab()));
+    connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
+            this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
     m_tabBar->blockSignals(true);  // signals get unblocked after at least 2 tabs are open
 
     QWidget* centralWidget = new QWidget(this);
@@ -846,6 +855,9 @@ void DolphinMainWindow::init()
     }
     updateViewActions();
 
+    QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
+    showFilterBarAction->setChecked(generalSettings->filterBar());
+
     if (firstRun) {
         // assure a proper default size if Dolphin runs the first time
         resize(750, 500);
@@ -913,6 +925,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* closeTab = new QAction(KIcon("tab-close"), i18nc("@action:inmenu File", "Close Tab"), this);
     closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
+    closeTab->setEnabled(false);
     connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
     actionCollection()->addAction("close_tab", closeTab);