[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: disabling kio_devices
From: David Faure <david () mandrakesoft ! com>
Date: 2002-10-29 11:48:39
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 29 October 2002 12:21, Stephan Kulow wrote:
> They aren't even there. But you can still drag over the trash yourself.
I mean the Cut, Delete, Trash and Shred actions, in the RMB or in konq's menus.
They are also the ones responsible for Shift+Del to work.
Here's my contribution: see attached patches (untested, except that they compile).
- --
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9vnWY72KcVAmwbhARArsQAJ9epiXK8HUX0HG4s+jD/9HNPjlTkgCgkRt/
KGxy2bDY9Try4fVa3HgEesE=
=FsKU
-----END PGP SIGNATURE-----
["konq_listview.diff" (text/x-diff)]
Index: konq_listview.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/listview/konq_listview.cc,v
retrieving revision 1.192
diff -u -p -r1.192 konq_listview.cc
--- konq_listview.cc 2002/10/02 05:06:00 1.192
+++ konq_listview.cc 2002/10/29 11:47:22
@@ -30,6 +30,7 @@
#include <konq_drag.h>
#include <kpropertiesdialog.h>
#include <kstdaction.h>
+#include <kprotocolinfo.h>
#include <qapplication.h>
#include <qclipboard.h>
@@ -121,24 +122,29 @@ void ListViewBrowserExtension::updateAct
QValueList<KonqBaseListViewItem*> selection;
m_listView->listViewWidget()->selectedItems( selection );
+ int canCopy = 0;
+ int canDel = 0;
bool bInTrash = false;
QValueList<KonqBaseListViewItem*>::ConstIterator it = selection.begin();
KFileItem * firstSelectedItem = 0L;
for (; it != selection.end(); ++it )
{
- if ( (*it)->item()->url().directory(false) == KGlobalSettings::trashPath() )
- bInTrash = true;
+ canCopy++;
if ( ! firstSelectedItem )
- firstSelectedItem = (*it)->item();
- }
+ firstSelectedItem = (*it)->item();
- bool hasSelection = selection.count() > 0;
+ KURL url = (*it)->item()->url();
+ if ( url.directory(false) == KGlobalSettings::trashPath() )
+ bInTrash = true;
+ if ( KProtocolInfo::supportsDeleting( url ) )
+ canDel++;
+ }
- emit enableAction( "copy", hasSelection );
- emit enableAction( "cut", hasSelection );
- emit enableAction( "trash", hasSelection && !bInTrash && m_listView->url().isLocalFile() );
- emit enableAction( "del", hasSelection );
- emit enableAction( "shred", hasSelection );
+ emit enableAction( "copy", canCopy > 0 );
+ emit enableAction( "cut", canDel > 0 );
+ emit enableAction( "trash", canDel > 0 && !bInTrash && m_listView->url().isLocalFile() );
+ emit enableAction( "del", canDel > 0 );
+ emit enableAction( "shred", canDel > 0 );
KFileItemList lstItems;
if ( firstSelectedItem )
["konq_iconviewwidget.diff" (text/x-diff)]
Index: konq_iconviewwidget.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_iconviewwidget.cc,v
retrieving revision 1.215
diff -u -p -r1.215 konq_iconviewwidget.cc
--- konq_iconviewwidget.cc 2002/10/08 16:29:27 1.215
+++ konq_iconviewwidget.cc 2002/10/29 11:45:30
@@ -44,6 +44,7 @@
#include <kiconeffect.h>
#include <kurldrag.h>
#include <kstandarddirs.h>
+#include <kprotocolinfo.h>
#include <assert.h>
#include <unistd.h>
@@ -1114,8 +1115,9 @@ void KonqIconViewWidget::disableIcons( c
void KonqIconViewWidget::slotSelectionChanged()
{
- // This code is very related to TreeViewBrowserExtension::updateActions
- bool cutcopy, del;
+ // This code is very related to ListViewBrowserExtension::updateActions
+ int canCopy = 0;
+ int canDel = 0;
bool bInTrash = false;
int iCount = 0;
KFileItem * firstSelectedItem = 0L;
@@ -1125,20 +1127,24 @@ void KonqIconViewWidget::slotSelectionCh
if ( it->isSelected() )
{
iCount++;
+ canCopy++;
+
if ( ! firstSelectedItem )
firstSelectedItem = (static_cast<KFileIVI *>( it ))->item();
- if ( (static_cast<KFileIVI *>( it ))->item()->url().directory(false) == \
KGlobalSettings::trashPath() ) + KURL url = ( static_cast<KFileIVI *>( it \
) )->item()->url(); + if ( url.directory(false) == \
KGlobalSettings::trashPath() ) bInTrash = true;
+ if ( KProtocolInfo::supportsDeleting( url ) )
+ canDel++;
}
}
- cutcopy = del = ( iCount > 0 );
- emit enableAction( "cut", cutcopy );
- emit enableAction( "copy", cutcopy );
- emit enableAction( "trash", del && !bInTrash && m_url.isLocalFile() );
- emit enableAction( "del", del );
- emit enableAction( "shred", del );
+ emit enableAction( "cut", canDel > 0 );
+ emit enableAction( "copy", canCopy > 0 );
+ emit enableAction( "trash", canDel > 0 && !bInTrash && m_url.isLocalFile() );
+ emit enableAction( "del", canDel > 0 );
+ emit enableAction( "shred", canDel > 0 );
KFileItemList lstItems;
if ( firstSelectedItem )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic