Bug 90446 - kdevelop's new file dialog overwrites existing files
Summary: kdevelop's new file dialog overwrites existing files
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: file create (show other bugs)
Version: 3.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-29 09:45 UTC by Robert Johansson
Modified: 2004-10-17 16:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Johansson 2004-09-29 09:45:43 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Compiled From Sources
Compiler:          Pentium III 800 MHz 
OS:                Linux

Reproduce:
* In kdevelop, choose file > new, or click the new file icon.
* Enter a directory and a filename that already exists
* Click OK
* The file will now be overwritten without warning!

Suggestion:
In case the file already exists, show a dialog telling the user so. The option to overwrite should not even exist.
The "new file dialog" is not the place for file management!
Comment 1 Robert Johansson 2004-09-29 09:47:38 UTC
Oh I forgot, this concerns kdevelop version 3.1
Comment 2 Jens Dagerbo 2004-10-17 16:46:20 UTC
CVS commit by dagerbo: 

Don't overwrite existing files

CCMAIL: 90446-done@bugs.kde.org


  M +14 -0     filecreate_newfile.cpp   1.14.2.1
  M +1 -0      filecreate_newfile.h   1.4.2.1


--- kdevelop/parts/filecreate/filecreate_newfile.cpp  #1.14:1.14.2.1
@@ -25,4 +25,6 @@
 #include <klocale.h>
 #include <kdebug.h>
+#include <kmessagebox.h>
+
 
 namespace FileCreate {
@@ -144,3 +146,15 @@ namespace FileCreate {
   }
 
+        void NewFileChooser::accept()
+        {
+                QFileInfo file( url().path() );
+                if ( file.exists() )
+                {
+                        KMessageBox::sorry( 0, i18n("A file with this name already exists."), i18n("File Exists") );
+                        return;
+                }
+                KDialogBase::accept();
+        }
+
 }
+

--- kdevelop/parts/filecreate/filecreate_newfile.h  #1.4:1.4.2.1
@@ -43,4 +43,5 @@ namespace FileCreate {
   protected:
     void addType(const FileType * filetype);
+        void accept();
 
     QGridLayout *m_grid;