]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/folders/folderspanel.cpp
The &-shortcut from another action is not set until the action has been shown at...
[dolphin.git] / src / panels / folders / folderspanel.cpp
index 1e3bdb8a67371951c73dd7a823ac6684d6fa04f1..fae7ca6a17003cc6841a893b24d9fb2cbad917d8 100644 (file)
 
 #include "folderspanel.h"
 
-#include "dolphinmodel.h"
-#include "dolphinsortfilterproxymodel.h"
-#include "dolphinview.h"
 #include "settings/dolphinsettings.h"
 #include "dolphin_folderspanelsettings.h"
 #include "dolphin_generalsettings.h"
-#include "draganddrophelper.h"
-#include "folderexpander.h"
-#include "renamedialog.h"
 #include "paneltreeview.h"
 #include "treeviewcontextmenu.h"
 
 #include <QScrollBar>
 #include <QTimer>
 
+#include <views/draganddrophelper.h>
+#include <views/dolphinmodel.h>
+#include <views/dolphinsortfilterproxymodel.h>
+#include <views/dolphinview.h>
+#include <views/folderexpander.h>
+#include <views/renamedialog.h>
+
 FoldersPanel::FoldersPanel(QWidget* parent) :
     Panel(parent),
     m_setLeafVisible(false),
@@ -94,32 +95,28 @@ void FoldersPanel::rename(const KFileItem& item)
         const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
         m_treeView->edit(proxyIndex);
     } else {
-        KFileItemList items;
-        items.append(item);
-        QPointer<RenameDialog> dialog = new RenameDialog(this, items);
-        if (dialog->exec() == QDialog::Accepted) {
-            const QString newName = dialog->newName();
-            if (!newName.isEmpty()) {
-                KUrl newUrl = item.url();
-                newUrl.setFileName(newName);
-                KonqOperations::rename(this, item.url(), newUrl);
-            }
-        }
-        delete dialog;
+        RenameDialog* dialog = new RenameDialog(this, KFileItemList() << item);
+        dialog->setAttribute(Qt::WA_DeleteOnClose);
+        dialog->show();
+        dialog->raise();
+        dialog->activateWindow();
     }
 }
 
-void FoldersPanel::setUrl(const KUrl& url)
+bool FoldersPanel::urlChanged()
 {
-    if (!url.isValid() || (url == Panel::url())) {
-        return;
+    if (!url().isValid() || url().protocol().contains("search")) {
+        // Skip results shown by a search, as possible identical
+        // directory names are useless without parent-path information.
+        return false;
     }
 
-    Panel::setUrl(url);
     if (m_dirLister != 0) {
         m_setLeafVisible = true;
-        loadTree(url);
+        loadTree(url());
     }
+
+    return true;
 }
 
 void FoldersPanel::showEvent(QShowEvent* event)
@@ -185,7 +182,6 @@ void FoldersPanel::contextMenuEvent(QContextMenuEvent* event)
     if (index.isValid()) {
         const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index);
         item = m_dolphinModel->itemForIndex(dolphinModelIndex);
-        emit changeSelection(KFileItemList());
     }
 
     TreeViewContextMenu contextMenu(this, item);