[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    kdebase
From:       David Faure <faure () kde ! org>
Date:       2004-10-19 20:37:46
Message-ID: 20041019203746.15DFB16C17 () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Don't show delete/trash/cut/rename when parent dir isn't writable.

Can someone (Michael, Alexx) set the flag from the listview? Getting
hold of the parent KFileItem there isn't obvious.

CCMAIL: kfm-devel@kde.org


  M +44 -30    konqueror/iconview/konq_iconview.cc   1.478
  M +4 -4      libkonq/konq_popupmenu.cc   1.204


--- kdebase/libkonq/konq_popupmenu.cc  #1.203:1.204
@@ -336,6 +336,6 @@ void KonqPopupMenu::setup(KonqPopupFlags
     bool sReading       = true;
     bool sWriting       = true;
-    bool sDeleting      = true;
-    bool sMoving        = true;
+    bool sDeleting      = ( d->m_itemFlags & KParts::BrowserExtension::NoDeletion ) \
== 0; +    bool sMoving        = sDeleting;
     m_sMimeType         = m_lstItems.first()->mimetype();
     QString mimeGroup   = m_sMimeType.left(m_sMimeType.find('/'));
@@ -535,6 +535,6 @@ void KonqPopupMenu::setup(KonqPopupFlags
             if (!currentDir )
             {
-                if ( m_lstItems.count() == 1 && sWriting && !isIntoTrash )
-                    addAction("rename");
+                if ( m_lstItems.count() == 1 && sWriting && sDeleting && \
!isIntoTrash ) +                    addAction( "rename" );
 
                 if ( sMoving && !isIntoTrash )

--- kdebase/konqueror/iconview/konq_iconview.cc  #1.477:1.478
@@ -790,7 +790,10 @@ void KonqKfmIconView::slotDragFinished()
 void KonqKfmIconView::slotContextMenuRequested(QIconViewItem* _item, const QPoint& \
_global)  {
-    if (  m_pIconView->selectedFileItems().count() == 0 )
+    const KFileItemList items = m_pIconView->selectedFileItems();
+    if ( items.isEmpty() )
         return;
+
     KParts::BrowserExtension::PopupFlags popupFlags = \
KParts::BrowserExtension::DefaultPopupItems; +
     KFileIVI* i = static_cast<KFileIVI*>(_item);
     if (i)
@@ -796,11 +799,22 @@ void KonqKfmIconView::slotContextMenuReq
     if (i)
         i->setSelected( true, true /* don't touch other items */ );
-    emit m_extension->popupMenu( 0L, _global, m_pIconView->selectedFileItems(), \
KParts::URLArgs(), popupFlags); +
+    KFileItem * rootItem = m_dirLister->rootItem();
+    KURL parentDirURL = rootItem->url();
+    // Check if parentDirURL applies to the selected items (usually yes, but not \
with search results) +    QPtrListIterator<KFileItem> kit( items );
+    for ( ; kit.current(); ++kit )
+        if ( kit.current()->url().directory( 1 ) != rootItem->url().path() )
+            parentDirURL = KURL();
+    // If rootItem is the parent of the selected items, then we can use isWritable() \
on it. +    if ( !parentDirURL.isEmpty() && !rootItem->isWritable() )
+        popupFlags |= KParts::BrowserExtension::NoDeletion;
+
+    emit m_extension->popupMenu( 0L, _global, items, KParts::URLArgs(), popupFlags);
 }
 
 void KonqKfmIconView::slotMouseButtonPressed(int _button, QIconViewItem* _item, \
const QPoint&)  {
-    if ( _button == RightButton )
-        if(!_item)
+    if ( _button == RightButton && !_item )
         {
             // Right click on viewport


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic