Bug 60187

Summary: rename overwrites existing files
Product: quanta Reporter: Robbin Bonthond <rbonthond>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Robbin Bonthond 2003-06-21 14:30:00 UTC
Version:           3.1.2 (using KDE KDE 3.1.2)
Installed from:    Gentoo Packages
OS:          Linux

renaming a file in the project tree overwrites existing files without any warning, error, or question.

just killled 3 hours work..
Comment 1 András Manţia 2003-06-22 17:06:56 UTC
Subject: Re:  New: rename overwrites existing files

> just killled 3 hours work..
I'm sorry to hear this, I will fix the problem as soon as it's possible!

Andras

Comment 2 Robbin Bonthond 2003-06-23 00:24:22 UTC
no problem, just started to work with quanta, and I must say that I really, really like this tool.  
 
You guys have done a great job ! 
 
I am developing a web-application in perl (together with http://template-toolkit.org/), and I 
first tried to setup the project in kdevelop/gideon, but switched to quanta since there was no 
html editor available in gideon. What I noticed is that there is a lot of overlap between 
kdevelop/gideon and quanta? Could quanta (html development) be a plug-in for gideon 
(coding development) ? 
 
Robbin 
Comment 3 András Manţia 2003-06-23 11:55:33 UTC
Subject: quanta

CVS commit by amantia: 

"Roaming user fixes" can be present in 3.1.3, so enable them. 
Warn about existing files on rename (#60187).

CCMAIL: 60187-done@bugs.kde.org


  M +1 -0      ChangeLog   1.180
  M +11 -3     quanta/project/project.cpp   1.97
  M +2 -2      quanta/quanta_init.cpp   1.294


--- quanta/ChangeLog  #1.179:1.180
@@ -49,4 +49,5 @@
       clipboard and selection
     - don't close quanta, if the user cancelled the toolbar saving [#59952]
+    - warn about existing files on rename [#60187]
 
   - new features:

--- quanta/quanta/quanta_init.cpp  #1.293:1.294
@@ -585,5 +585,5 @@ void QuantaApp::saveOptions()
     m_config->writeEntry("PHP Debugger Port", phpDebugPort );
     m_config->writeEntry("Top folders", fTab->topURLList.toStringList());
-#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,90)
+#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,3)
     m_config->writePathEntry("List of opened files", m_doc->openedFiles().toStringList());
 #else
@@ -799,5 +799,5 @@ void QuantaApp::openLastFiles()
   m_config->setGroup("General Options");
 
-#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,90)
+#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,3)
   QStringList urls = m_config->readPathListEntry("List of opened files");
 #else

--- quanta/quanta/project/project.cpp  #1.96:1.97
@@ -876,6 +876,13 @@ void Project::slotRename(const KURL& url
       oldURL = QExtFileInfo::toRelative(url, baseURL);
       newURL = QExtFileInfo::toRelative(newUrl, baseURL);
+      bool proceed = true;
+      if (QExtFileInfo::exists(newUrl))
+      {
+        QString s = (newUrl.isLocalFile()) ? newUrl.path() : newUrl.prettyURL();
+        proceed = KMessageBox::warningYesNo(this, i18n("<qt>The file <b>%1</b> already exists.<br>Do you want to overwrite it?</qt>").arg(s),i18n("Overwrite")) == KMessageBox::Yes;
+      }
+      if (proceed)
+      {
       //start the rename job
-
       KIO::SimpleJob *job = KIO::rename( url, newUrl, true );
       connect( job, SIGNAL( result( KIO::Job *) ), SLOT( slotRenameFinished( KIO::Job *) ));
@@ -880,4 +887,5 @@ void Project::slotRename(const KURL& url
       KIO::SimpleJob *job = KIO::rename( url, newUrl, true );
       connect( job, SIGNAL( result( KIO::Job *) ), SLOT( slotRenameFinished( KIO::Job *) ));
+      }
     }
   }


Comment 4 András Manţia 2003-06-23 12:07:22 UTC
Subject: Re:  rename overwrites existing files

Merging with Gideon is a nice idea, but I don't see it possible in the near 
feature. Maybe we can reconsider this for KDE 4. Currently Gideon is still 
under heavy developement, and the final. stable version should come out 
together with KDE 3.2. Quanta is already quite mature, and personally I don't 
want to struggle with finding a way to reuse the current code in Gideon, but 
I would like to work on enhanching it. Of course, if somebody volunteers the 
work can be down.