]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
krazy fixes
[dolphin.git] / src / dolphinmainwindow.cpp
index ba3ae27873ea1acd256b0ad6168dc750fc211e06..f6688ddcec9b24cdb3b51879521601f05cfaa950 100644 (file)
@@ -84,7 +84,6 @@
 #include <QDBusMessage>
 #include <QKeyEvent>
 #include <QClipboard>
-#include <QLineEdit>
 #include <QSplitter>
 #include <QDockWidget>
 #include <kacceleratormanager.h>
@@ -236,7 +235,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
         updateEditActions();
         updateViewActions();
         updateGoActions();
-        setCaption(url.fileName());
+        setUrlAsCaption(url);
         if (m_viewTab.count() > 1) {
             m_tabBar->setTabText(m_tabIndex, tabName(url));
         }
@@ -348,6 +347,7 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
 
     ViewTab viewTab;
     viewTab.splitter = new QSplitter(this);
+    viewTab.splitter->setChildrenCollapsible(false);
     viewTab.primaryView = new DolphinViewContainer(this, viewTab.splitter, url);
     viewTab.primaryView->setActive(false);
     connectViewSignals(viewTab.primaryView);
@@ -812,7 +812,18 @@ void DolphinMainWindow::toggleShowMenuBar()
 
 void DolphinMainWindow::openTerminal()
 {
-    KToolInvocation::invokeTerminal(QString(), m_activeViewContainer->url().path());
+    QString dir(QDir::homePath());
+
+    // If the given directory is not local, it can still be the URL of an
+    // ioslave using UDS_LOCAL_PATH which to be converted first.
+    KUrl url = KIO::NetAccess::mostLocalUrl(m_activeViewContainer->url(), this);
+
+    //If the URL is local after the above conversion, set the directory.
+    if (url.isLocalFile()) {
+        dir = url.toLocalFile();
+    }
+
+    KToolInvocation::invokeTerminal(QString(), dir);
 }
 
 void DolphinMainWindow::editSettings()
@@ -981,11 +992,12 @@ void DolphinMainWindow::init()
     setAcceptDrops(true);
 
     m_viewTab[m_tabIndex].splitter = new QSplitter(this);
+    m_viewTab[m_tabIndex].splitter->setChildrenCollapsible(false);
 
     setupActions();
 
     const KUrl& homeUrl = generalSettings->homeUrl();
-    setCaption(homeUrl.fileName());
+    setUrlAsCaption(homeUrl);
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
     connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
@@ -1094,7 +1106,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
     updateGoActions();
 
     const KUrl& url = m_activeViewContainer->url();
-    setCaption(url.fileName());
+    setUrlAsCaption(url);
     if (m_viewTab.count() > 1 && m_viewTab[m_tabIndex].secondaryView != 0) {
         m_tabBar->setTabText(m_tabIndex, tabName(url));
         m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url)));
@@ -1506,7 +1518,7 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
 {
     QString name;
     if (url.equals(KUrl("file:///"))) {
-        name = "/";
+        name = '/';
     } else {
         name = url.fileName();
         if (name.isEmpty()) {
@@ -1553,6 +1565,21 @@ QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) co
     return "Tab " + QString::number(tabIndex) + ' ' + property;
 }
 
+void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
+{
+    QString caption;
+    if (url.equals(KUrl("file:///"))) {
+        caption = '/';
+    } else {
+        caption = url.fileName();
+        if (caption.isEmpty()) {
+            caption = url.protocol();
+       }
+    }
+    
+    setCaption(caption);
+}
+
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
     KIO::FileUndoManager::UiInterface()
 {