]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
allow Konqueror to open also files inside a new tab, not only directories
[dolphin.git] / src / dolphinmainwindow.cpp
index f551232a79cac53da45c2d15b8c248f30202a6e0..afa6ea43f71b5f67d4428e5581054db6207eb428 100644 (file)
@@ -37,7 +37,6 @@
 #include "metadatawidget.h"
 #include "mainwindowadaptor.h"
 #include "treeviewsidebarpage.h"
-#include "viewpropertiesdialog.h"
 #include "viewproperties.h"
 
 #ifndef Q_OS_WIN
@@ -102,7 +101,7 @@ DolphinMainWindow::DolphinMainWindow(int id) :
     new MainWindowAdaptor(this);
     QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this);
 
-    KonqFileUndoManager* undoManager = KonqFileUndoManager::self();
+    KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
     connect(undoManager, SIGNAL(undoAvailable(bool)),
@@ -133,7 +132,7 @@ void DolphinMainWindow::toggleViews()
     m_viewTab[m_tabIndex].secondaryView = container;
 }
 
-void DolphinMainWindow::slotDoingOperation(KonqFileUndoManager::CommandType commandType)
+void DolphinMainWindow::slotDoingOperation(KIO::FileUndoManager::CommandType commandType)
 {
     clearStatusBar();
     m_undoCommandTypes.append(commandType);
@@ -160,8 +159,8 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls,
                                  const KUrl& destination)
 {
     DolphinDropController dropController(this);
-    connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
-            this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
+    connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
+            this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType)));
     dropController.dropUrls(urls, destination);
 }
 
@@ -387,31 +386,31 @@ void DolphinMainWindow::slotUndoAvailable(bool available)
     }
 
     if (available && (m_undoCommandTypes.count() > 0)) {
-        const KonqFileUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
+        const KIO::FileUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
         DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
         switch (command) {
-        case KonqFileUndoManager::COPY:
+        case KIO::FileUndoManager::Copy:
             statusBar->setMessage(i18nc("@info:status", "Copy operation completed."),
                                   DolphinStatusBar::OperationCompleted);
             break;
-        case KonqFileUndoManager::MOVE:
+        case KIO::FileUndoManager::Move:
             statusBar->setMessage(i18nc("@info:status", "Move operation completed."),
                                   DolphinStatusBar::OperationCompleted);
             break;
-        case KonqFileUndoManager::LINK:
+        case KIO::FileUndoManager::Link:
             statusBar->setMessage(i18nc("@info:status", "Link operation completed."),
                                   DolphinStatusBar::OperationCompleted);
             break;
-        case KonqFileUndoManager::TRASH:
+        case KIO::FileUndoManager::Trash:
             statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."),
                                   DolphinStatusBar::OperationCompleted);
             break;
-        case KonqFileUndoManager::RENAME:
+        case KIO::FileUndoManager::Rename:
             statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."),
                                   DolphinStatusBar::OperationCompleted);
             break;
 
-        case KonqFileUndoManager::MKDIR:
+        case KIO::FileUndoManager::Mkdir:
             statusBar->setMessage(i18nc("@info:status", "Created folder."),
                                   DolphinStatusBar::OperationCompleted);
             break;
@@ -434,8 +433,8 @@ void DolphinMainWindow::slotUndoTextChanged(const QString& text)
 void DolphinMainWindow::undo()
 {
     clearStatusBar();
-    KonqFileUndoManager::self()->uiInterface()->setParentWidget(this);
-    KonqFileUndoManager::self()->undo();
+    KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
+    KIO::FileUndoManager::self()->undo();
 }
 
 void DolphinMainWindow::cut()
@@ -500,11 +499,15 @@ void DolphinMainWindow::toggleSplitView()
         m_viewTab[m_tabIndex].secondaryView->view()->reload();
         m_viewTab[m_tabIndex].secondaryView->setActive(false);
         m_viewTab[m_tabIndex].secondaryView->show();
+
+        setActiveViewContainer(m_viewTab[m_tabIndex].secondaryView);
     } else if (m_activeViewContainer == m_viewTab[m_tabIndex].primaryView) {
         // remove secondary view
         m_viewTab[m_tabIndex].secondaryView->close();
         m_viewTab[m_tabIndex].secondaryView->deleteLater();
         m_viewTab[m_tabIndex].secondaryView = 0;
+
+        setActiveViewContainer(m_viewTab[m_tabIndex].primaryView);
     } else {
         // The secondary view is active, hence from a users point of view
         // the content of the secondary view should be moved to the primary view.
@@ -515,9 +518,10 @@ void DolphinMainWindow::toggleSplitView()
         m_viewTab[m_tabIndex].primaryView->deleteLater();
         m_viewTab[m_tabIndex].primaryView = m_viewTab[m_tabIndex].secondaryView;
         m_viewTab[m_tabIndex].secondaryView = 0;
+
+        setActiveViewContainer(m_viewTab[m_tabIndex].primaryView);
     }
 
-    setActiveViewContainer(m_viewTab[m_tabIndex].primaryView);
     updateViewActions();
 }
 
@@ -557,13 +561,6 @@ void DolphinMainWindow::editLocation()
     lineEdit->setSelection(0, text.length());
 }
 
-void DolphinMainWindow::adjustViewProperties()
-{
-    clearStatusBar();
-    ViewPropertiesDialog dlg(m_activeViewContainer->view());
-    dlg.exec();
-}
-
 void DolphinMainWindow::goBack()
 {
     clearStatusBar();
@@ -808,6 +805,8 @@ void DolphinMainWindow::init()
             this, SLOT(closeTab(int)));
     connect(m_tabBar, SIGNAL(contextMenu(int, const QPoint&)),
             this, SLOT(openTabContextMenu(int, const QPoint&)));
+    connect(m_tabBar, SIGNAL(newTabRequest()),
+            this, SLOT(openNewTab()));
     m_tabBar->blockSignals(true);  // signals get unblocked after at least 2 tabs are open
 
     QWidget* centralWidget = new QWidget(this);
@@ -969,10 +968,6 @@ void DolphinMainWindow::setupActions()
     editLocation->setShortcut(Qt::Key_F6);
     connect(editLocation, SIGNAL(triggered()), this, SLOT(editLocation()));
 
-    KAction* adjustViewProps = actionCollection()->addAction("view_properties");
-    adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
-    connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(adjustViewProperties()));
-
     // setup 'Go' menu
     KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
     KShortcut backShortcut = backAction->shortcut();
@@ -1150,8 +1145,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(slotRequestItemInfo(KFileItem)));
     connect(view, SIGNAL(activated()),
             this, SLOT(toggleActiveView()));
-    connect(view, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
-            this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
+    connect(view, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
+            this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType)));
     connect(view, SIGNAL(tabRequested(const KUrl&)),
             this, SLOT(openNewTab(const KUrl&)));
 
@@ -1187,7 +1182,7 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
 }
 
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
-    KonqFileUndoManager::UiInterface()
+    KIO::FileUndoManager::UiInterface()
 {
 }
 
@@ -1202,7 +1197,7 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
         DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar();
         statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
     } else {
-        KonqFileUndoManager::UiInterface::jobError(job);
+        KIO::FileUndoManager::UiInterface::jobError(job);
     }
 }