]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Konq popupmenu fix: we don't show the "Create new" submenu over subdirs in an iconvie...
authorDavid Faure <faure@kde.org>
Mon, 13 Oct 2008 21:54:03 +0000 (21:54 +0000)
committerDavid Faure <faure@kde.org>
Mon, 13 Oct 2008 21:54:03 +0000 (21:54 +0000)
but let's show it in the case of the hiearchical details view ("folders expandable" option), since you can indeed see the new file/dir in that case. Peter: problem solved with itemsExpandable().
CCMAIL: peter.penz@gmx.at

svn path=/trunk/KDE/kdebase/apps/; revision=871109

src/dolphinpart.cpp
src/dolphinview.cpp
src/dolphinview.h

index 85ca9e473d229ed8787e06daa00aad867ebb9c7a..05bc2216a58d3a806de6532831fdad0d09ac3582 100644 (file)
@@ -107,7 +107,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
             this, SLOT(slotRequestUrlChange(KUrl)));
     connect(m_view, SIGNAL(modeChanged()),
             this, SIGNAL(viewModeChanged())); // relay signal
-    
+
     // Watch for changes that should result in updates to the
     // status bar text.
     connect(m_dirLister, SIGNAL(deleteItem(const KFileItem&)),
@@ -393,6 +393,13 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
         if (addDel)
             editActions.append(actionCollection()->action("delete"));
         actionGroups.insert("editactions", editActions);
+
+        // Normally KonqPopupMenu only shows the "Create new" subdir in the current view
+        // since otherwise the created file would not be visible.
+        // But in treeview mode we should allow it.
+        if (m_view->itemsExpandable())
+            popupFlags |= KParts::BrowserExtension::ShowCreateDirectory;
+
     }
 
     // TODO: We should change the signature of the slots (and signals) for being able
index 25d0cc1995d60a60e164b0cb6764fa6a7293998c..daadf77304d2e06d8e1987a9607a75a9d19f30d2 100644 (file)
@@ -1310,7 +1310,7 @@ void DolphinView::pasteToUrl(const KUrl& url)
 }
 
 void DolphinView::updateZoomLevel(int oldZoomLevel)
-{       
+{
     const int newZoomLevel = ZoomLevelInfo::zoomLevelForIconSize(itemView()->iconSize());
     if (oldZoomLevel != newZoomLevel) {
         m_controller->setZoomLevel(newZoomLevel);
@@ -1321,10 +1321,15 @@ void DolphinView::updateZoomLevel(int oldZoomLevel)
 KUrl::List DolphinView::simplifiedSelectedUrls() const
 {
     KUrl::List list = selectedUrls();
-    if ((m_detailsView != 0) && m_detailsView->itemsExpandable()) {
+    if (itemsExpandable() ) {
         list = KonqOperations::simplifiedUrlList(list);
     }
     return list;
 }
 
+bool DolphinView::itemsExpandable() const
+{
+    return (m_detailsView != 0) && m_detailsView->itemsExpandable();
+}
+
 #include "dolphinview.moc"
index 910e324ea6724cd240d67379889921960481af63..d2d97aec27a7b924081361cf482bc5f43c0fc7fc 100644 (file)
@@ -334,6 +334,12 @@ public:
     void setTabsForFilesEnabled(bool tabsForFiles);
     bool isTabsForFilesEnabled() const;
 
+    /**
+     * Returns true if the current view allows folders to be expanded,
+     * i.e. presents a hierarchical view to the user.
+     */
+    bool itemsExpandable() const;
+
 public slots:
     /**
      * Changes the directory to \a url. If the current directory is equal to