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

List:       kde-core-devel
Subject:    Re: disabling kio_devices
From:       Stephan Kulow <coolo () kde ! org>
Date:       2002-10-29 12:53:52
[Download RAW message or body]

Am Tuesday 29 October 2002 12:09 schrieb David Faure:
> On Tuesday 29 October 2002 00:00, Stephan Kulow wrote:
> > OK, please check the attached patch. It disallows the move of trash
> > and delete for protocols that do not support deleting.
>
> The _del change is ok, but the doFileCopy change isn't - it should do this
> test only if _moving_, not if _copying_.
> So I suggest to move the "filtering" under the "case QDropEvent::Move :"
> near the end of doFileCopy().

It's not as easy as I don't want the "do you really want to move to Trash"
message if it's not going to move it. See my next revision of the patch.

Greetings, Stephan

["libkonq.patch" (text/x-diff)]

Index: konq_operations.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_operations.cc,v
retrieving revision 1.103
diff -u -3 -p -u -r1.103 konq_operations.cc
--- konq_operations.cc	2002/09/27 18:04:04	1.103
+++ konq_operations.cc	2002/10/29 12:51:06
@@ -191,8 +191,17 @@ void KonqOperations::copy( QWidget * par
      (void) new KonqCommandRecorder( \
method==MOVE?KonqCommand::MOVE:KonqCommand::LINK, selectedURLs, destUrl, job );  };
 
-void KonqOperations::_del( int method, const KURL::List & selectedURLs, int \
confirmation ) +void KonqOperations::_del( int method, const KURL::List & \
_selectedURLs, int confirmation )  {
+    KURL::List selectedURLs;
+    for (KURL::List::ConstIterator it = _selectedURLs.begin(); it != \
_selectedURLs.end(); ++it) +        if (KProtocolInfo::supportsDeleting(*it))
+            selectedURLs.append(*it);
+    if (selectedURLs.isEmpty()) {
+        delete this;
+        return;
+    }
+
   m_method = method;
   if ( confirmation == SKIP_CONFIRMATION || askDeleteConfirmation( selectedURLs, \
confirmation ) )  {
@@ -538,9 +547,15 @@ void KonqOperations::doFileCopy()
     assert(m_info); // setDropInfo - and asyncDrop - should have been called before \
asyncDrop  KURL::List lst = m_info->lst;
     QDropEvent::Action action = m_info->action;
-    if ( m_destURL.path( 1 ) == KGlobalSettings::trashPath() )
+
+    KURL::List mlst;
+    for (KURL::List::ConstIterator it = lst.begin(); it != lst.end(); ++it)
+        if ( KProtocolInfo::supportsDeleting( *it ) )
+             mlst.append(*it);
+
+    if ( !mlst.isEmpty() && m_destURL.path( 1 ) == KGlobalSettings::trashPath() )
     {
-        if ( askDeleteConfirmation( lst, DEFAULT_CONFIRMATION ) )
+        if ( askDeleteConfirmation( mlst, DEFAULT_CONFIRMATION ) )
             action = QDropEvent::Move;
         else
         {
@@ -606,7 +621,9 @@ void KonqOperations::doFileCopy()
     KIO::Job * job = 0;
     switch ( action ) {
     case QDropEvent::Move :
-        job = KIO::move( lst, m_destURL );
+        if (mlst.isEmpty())
+            return;
+        job = KIO::move( mlst, m_destURL );
         job->setMetaData( m_info->metaData );
         setOperation( job, MOVE, lst, m_destURL );
         (void) new KonqCommandRecorder( KonqCommand::MOVE, lst, m_destURL, job );



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

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