]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Use K_GLOBAL_STATIC for the previously committed workaround to bypass a X11-issue...
[dolphin.git] / src / dolphinmainwindow.cpp
index e58b81740730e8566740dc0fb6c18e28913b2427..e72c52bfc25f0f5d5b4c220d5ecd5c6e46efe04f 100644 (file)
@@ -114,9 +114,13 @@ DolphinMainWindow::DolphinMainWindow(int id) :
     m_actionHandler(0),
     m_remoteEncoding(0),
     m_settingsDialog(0),
-    m_captionStatJob(0),
     m_lastHandleUrlStatJob(0)
 {
+    // Workaround for a X11-issue in combination with KModifierInfo
+    // (see DolphinContextMenu::initializeModifierKeyInfo() for
+    // more information):
+    DolphinContextMenu::initializeModifierKeyInfo();
+
     setObjectName("Dolphin#");
 
     m_viewTab.append(ViewTab());
@@ -335,15 +339,6 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
     emit selectionChanged(selection);
 }
 
-void DolphinMainWindow::slotWheelMoved(int wheelDelta)
-{
-    if (wheelDelta > 0) {
-        activatePrevTab();
-    } else {
-        activateNextTab();
-    }
-}
-
 void DolphinMainWindow::slotRequestItemInfo(const KFileItem& item)
 {
     emit requestItemInfo(item);
@@ -1167,14 +1162,6 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event)
     }
 }
 
-void DolphinMainWindow::slotCaptionStatFinished(KJob* job)
-{
-    m_captionStatJob = 0;
-    const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult();
-    const QString name = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME);
-    setCaption(name);
-}
-
 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
 {
     newFileMenu()->setEnabled(isFolderWritable);
@@ -1241,8 +1228,6 @@ void DolphinMainWindow::init()
             this, SLOT(openNewTab()));
     connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
             this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
-    connect(m_tabBar, SIGNAL(wheelDelta(int)),
-            this, SLOT(slotWheelMoved(int)));
     connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
             this, SLOT(closeTab(int)));
     connect(m_tabBar, SIGNAL(tabMoved(int, int)),
@@ -1789,26 +1774,18 @@ QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) co
 
 void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
 {
-    delete m_captionStatJob;
-    m_captionStatJob = 0;
-
-    if (url.protocol() == QLatin1String("file")) {
-        QString caption;
-        if (url.equals(KUrl("file:///"))) {
-            caption = '/';
-        } else {
-            caption = url.fileName();
-            if (caption.isEmpty()) {
-                caption = url.protocol();
-            }
+    QString caption;
+    if (!url.isLocalFile()) {
+        caption.append(url.protocol() + " - ");
+        if (url.hasHost()) {
+            caption.append(url.host() + " - ");
         }
-
-        setCaption(caption);
-    } else {
-        m_captionStatJob = KIO::stat(url, KIO::HideProgressInfo);
-        connect(m_captionStatJob, SIGNAL(result(KJob*)),
-                this, SLOT(slotCaptionStatFinished(KJob*)));
     }
+
+    const QString fileName = url.fileName().isEmpty() ? "/" : url.fileName();
+    caption.append(fileName);
+
+    setCaption(caption);
 }
 
 QString DolphinMainWindow::squeezedText(const QString& text) const