konqy F2 file renaming bug
Simon Hausmann
hausmann at kde.org
Thu May 9 20:30:28 BST 2002
On Thu, May 09, 2002 at 12:48:01AM +0200, David Faure wrote:
> > What should I do ? (my order: 3,1,2)
>
> With Simon we decided for something like (IIRC)
> 4) let KonqOperations::rename take an object and slot to connect
> to, and to call if the rename failed.
> The KonqOperations object connects to the Job's copyingDone() or whatever
> the signal is called, and has a new bool. If copyingDone is emitted the bool
> is changed to "it worked". In slotResult if the bool is still "didn't work" then
> that slot (passed to rename in the first line of this unclear explanation ;)
> is called - and the iconview or listview can fix the text of the item
> (calling slotRefreshItem on it I guess).
Yup.
> Simon..... how much of that did you do?
Argh, I completely forgot about finishing it :-(
I did the error handling so far but I didn't get around doing the
signal/slot connection and the iconview/listview handling.
Simon
-------------- next part --------------
Index: konq_operations.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_operations.cc,v
retrieving revision 1.96
diff -u -p -b -r1.96 konq_operations.cc
--- konq_operations.cc 2002/04/29 15:52:43 1.96
+++ konq_operations.cc 2002/05/09 19:28:37
@@ -55,7 +55,8 @@
KBookmarkManager * KonqBookmarkManager::s_bookmarkManager;
KonqOperations::KonqOperations( QWidget *parent )
- : QObject( parent, "KonqOperations" ), m_info(0L), m_pasteInfo(0L)
+ : QObject( parent, "KonqOperations" ), m_info(0L), m_pasteInfo(0L),
+ m_isRenameOperation( false ), m_renameSucceeded( false )
{
}
@@ -625,6 +626,7 @@ void KonqOperations::rename( QWidget * p
KIO::Job * job = KIO::moveAs( oldurl, newurl, !oldurl.isLocalFile() );
KonqOperations * op = new KonqOperations( parent );
op->setOperation( job, MOVE, lst, newurl );
+ op->m_isRenameOperation = true;
(void) new KonqCommandRecorder( KonqCommand::MOVE, lst, newurl, job );
// if old trash then update config file and emit
if(oldurl.isLocalFile() && oldurl.path(1) == KGlobalSettings::trashPath() ) {
@@ -643,9 +645,12 @@ void KonqOperations::setOperation( KIO::
m_method = method;
//m_srcURLs = src;
m_destURL = dest;
- if ( job )
+ if ( job ) {
connect( job, SIGNAL( result( KIO::Job * ) ),
SLOT( slotResult( KIO::Job * ) ) );
+ connect( job, SIGNAL( copyingDone( KIO::Job *, const KURL &, const KURL &, bool, bool ) ),
+ this, SLOT( copyingDone() ) );
+ }
else // for link
slotResult( 0L );
}
@@ -705,7 +710,17 @@ void KonqOperations::slotResult( KIO::Jo
KDirNotify_stub allDirNotify("*", "KDirNotify*");
allDirNotify.FilesChanged( lst );
}
+ if ( m_isRenameOperation && !m_renameSucceeded ) {
+ emit renameOperationFailed();
+ }
delete this;
}
+void KonqOperations::copyingDone()
+{
+ m_renameSucceeded = true;
+}
+
#include <konq_operations.moc>
+/* vim: et sw=4 ts=4
+ */
Index: konq_operations.h
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_operations.h,v
retrieving revision 1.25
diff -u -p -b -r1.25 konq_operations.h
--- konq_operations.h 2002/03/29 01:49:23 1.25
+++ konq_operations.h 2002/05/09 19:28:37
@@ -91,6 +91,8 @@ public:
signals:
void statFinished( const KFileItem * item );
+ void renameOperationFailed();
+
protected:
enum { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
bool askDeleteConfirmation( const KURL::List & selectedURLs, int confirmation );
@@ -129,6 +131,8 @@ protected slots:
void slotKIOPaste();
void doFileCopy();
+ void copyingDone();
+
private:
int m_method;
//KURL::List m_srcURLs;
@@ -136,6 +140,10 @@ private:
// for doDrop
DropInfo * m_info;
KIOPasteInfo * m_pasteInfo;
+ bool m_isRenameOperation : 1;
+ bool m_renameSucceeded : 1;
};
#endif
+/* vim: et sw=4 ts=4
+ */
More information about the kfm-devel
mailing list