From kde-core-devel Tue Oct 29 11:48:39 2002 From: David Faure Date: Tue, 29 Oct 2002 11:48:39 +0000 To: kde-core-devel Subject: Re: disabling kio_devices X-MARC-Message: https://marc.info/?l=kde-core-devel&m=103589220826149 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_XWnv9GFtFKJALJY" --Boundary-00=_XWnv9GFtFKJALJY Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Description: clearsigned data Content-Disposition: inline -----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----- --Boundary-00=_XWnv9GFtFKJALJY Content-Type: text/x-diff; charset="iso-8859-1"; name="konq_listview.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="konq_listview.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 #include #include +#include #include #include @@ -121,24 +122,29 @@ void ListViewBrowserExtension::updateAct QValueList selection; m_listView->listViewWidget()->selectedItems( selection ); + int canCopy = 0; + int canDel = 0; bool bInTrash = false; QValueList::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 ) --Boundary-00=_XWnv9GFtFKJALJY Content-Type: text/x-diff; charset="iso-8859-1"; name="konq_iconviewwidget.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="konq_iconviewwidget.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 #include #include +#include #include #include @@ -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( it ))->item(); - if ( (static_cast( it ))->item()->url().directory(false) == KGlobalSettings::trashPath() ) + KURL url = ( static_cast( 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 ) --Boundary-00=_XWnv9GFtFKJALJY--