Bug 102332

Summary: KPDF doesn't ask when overwriting a existing file
Product: [Applications] kpdf Reporter: Iñaki Baz Castillo <ibc>
Component: generalAssignee: Albert Astals Cid <aacid>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.4   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Iñaki Baz Castillo 2005-03-24 01:24:53 UTC
Version:           0.4 (using KDE 3.4.0, Debian Package 4:3.4.0-0pre1 (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8)
OS:                Linux (i686) release 2.6.7-ck6

Open a PDF file and go to "Save as..." and select another existing PDF file. KPDF won't ask you for overwriting the old file, so it is something inusual in KDE. Maybe a bug?
Comment 1 Albert Astals Cid 2005-03-24 21:11:06 UTC
CVS commit by aacid: 

When saving a file ask if we are going to overwrite a existing file
BUG: 102332


  M +6 -0      part.cpp   1.33


--- kdegraphics/kpdf/part.cpp  #1.32:1.33
@@ -557,4 +557,10 @@ void Part::slotSaveFileAs()
     if ( saveURL.isValid() && !saveURL.isEmpty() )
     {
+        if ( KIO::NetAccess::exists( saveURL, false, widget() ) )
+        {
+            if (KMessageBox::questionYesNo( widget(), i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?").arg(saveURL.filename())) != KMessageBox::Yes)
+                return;
+        }
+
         if ( !KIO::NetAccess::file_copy( url(), saveURL, -1, true ) )
             KMessageBox::information( 0, i18n("File could not be saved in '%1'. Try to save it to another location.").arg( saveURL.prettyURL() ) );