Index: kmainwidget.cpp =================================================================== --- kmainwidget.cpp (revision 523670) +++ kmainwidget.cpp (working copy) @@ -1112,9 +1112,21 @@ } //check if destination already exists - if(KIO::NetAccess::exists(destURL, false, this)) + if(exists(destURL)) { - if (KMessageBox::warningYesNo(this,i18n("Destination file \n%1\nalready exists.\nDo you want to overwrite it?").arg( destURL.prettyURL()), QString::null, i18n("Overwrite"), i18n("Do Not Overwrite") ) + if(b_expertMode) + { + QString fileName = destURL.fileName(); + fileName = fileName.left(fileName.find('.') + 1); + QString fileExt = destURL.fileName(); + fileExt = fileExt.right(fileExt.length() - fileName.length() + 1); + int c=0; + do{ + destURL.setFileName(fileName + QString::number(++c) + fileExt); + }while(exists(destURL)); + bDestisMalformed=false; + } + else if (KMessageBox::warningYesNo(this,i18n("Destination file \n%1\nalready exists.\nDo you want to overwrite it?").arg( destURL.prettyURL()), QString::null, i18n("Overwrite"), i18n("Do Not Overwrite") ) == KMessageBox::Yes) { bDestisMalformed=false; @@ -1155,6 +1167,12 @@ #endif } +bool KMainWidget::exists(const KURL& destURL) +{ + return( KIO::NetAccess::exists(destURL, false, this) || + myTransferList->findByDest(destURL) != 0L ); +} + void KMainWidget::addTransfers( const KURL::List& src, const QString& destDir ) { Index: transferlist.cpp =================================================================== --- transferlist.cpp (revision 523670) +++ transferlist.cpp (working copy) @@ -224,7 +224,19 @@ return 0L; } +Transfer * TransferList::findByDest(const KURL& _dest) +{ + TransferIterator it(this); + for (; it.current(); ++it) { + if (it.current()->getDest() == _dest) { + return it.current(); + } + } + + return 0L; +} + void TransferList::readTransfers(const KURL& file) { QString tmpFile; Index: transferlist.h =================================================================== --- transferlist.h (revision 523670) +++ transferlist.h (working copy) @@ -76,6 +76,7 @@ } bool updateStatus(int counter); Transfer * find(const KURL& _src); + Transfer * findByDest(const KURL& _dest); bool areTransfersQueuedOrScheduled(); void readTransfers(const KURL& file); Index: kmainwidget.h =================================================================== --- kmainwidget.h (revision 523670) +++ kmainwidget.h (working copy) @@ -194,6 +194,7 @@ private: QString getSaveDirectoryFor( const QString& filename ) const; bool sanityChecksSuccessful( const KURL& url ); + bool exists(const KURL& destURL); TransferList * myTransferList; KHelpMenu *menuHelp;