Bug 54041 - Adding file to project twice really makes file appear twice in project file list
Summary: Adding file to project twice really makes file appear twice in project file list
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-04 00:28 UTC by Dik Takken
Modified: 2003-11-18 00:34 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 Dik Takken 2003-02-04 00:28:45 UTC
Version:           3.1 (using KDE 3.1.0)
Installed from:    compiled sources
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
OS:          Linux (i686) release 2.4.18

This bug concerns Quanta 3.1, I could not choose version 3.1 while reporting this bug..

Quanta should check its list of project files for duplicates when adding a new file. When I added one file twice, I had to remove it from the project twice before it disappeared.
Comment 1 András Manţia 2003-02-05 22:08:49 UTC
Subject: Re: Adding file to project twice really makes file appear twice in project file list

I cannot reproduce it. Can you give me the exact scenario how it happened? How 
did you added the new file to project?

Comment 2 Dik Takken 2003-02-06 23:12:42 UTC
When I tried to repreduce this behaviour, it appeared to be a bit more
complicated. The exact way to reproduce this bug is as follows:

1. Add two different files to a quanta project, say 1.html and 2.html
2. Using the Quanta GUI, rename 2.html to 1.html. 
3. Using the Quanta GUI, remove 1.html. It won't disappear from the project tree.
4. Remove 1.html again, it will disappear now.

I used the "Insert Files" option from the Project menu to add the files to the
project and I used the context menu in the project treeview to rename them.

Quanta does not check if a file exists with the same name as the name the user
has chosen on renaming a file.

Sorry for being inaccurate.
Comment 3 András Manţia 2003-02-07 22:30:53 UTC
Subject: QUANTA_3_1_BRANCH: quanta

CVS commit by amantia: 

Fix renaming in the Project Tree, when there was already a file with the new name in the project.

CCMAIL: 54041-done@bugs.kde.org


  M +2 -0      ChangeLog   1.90.2.24
  M +11 -1     quanta/project/project.cpp   1.73.2.2
  M +1 -1      quanta/treeviews/uploadtreeview.cpp   1.11.2.3


--- quanta/ChangeLog  #1.90.2.23:1.90.2.24
@@ -14,4 +14,6 @@
     - fix insertion of img tags in HTML documents
     - upload/rescan project/add to new project tree view behaviour fixed (really)
+    - fix renaming of file in the Project Tree, when a file with the new name was
+      already present in the project
   - changed features:
     - "Insert in cursor position" for script actions replaces the selection if

--- quanta/quanta/project/project.cpp  #1.73.2.1:1.73.2.2
@@ -751,4 +751,14 @@ void Project::slotRenameFinished( KIO::J
       el = nl.item(i).toElement();
       tmpString = el.attribute("url");    
+      if (tmpString == newStr)
+      {
+        el.parentNode().removeChild( el );
+        break;
+      }
+    }
+    for (uint i = 0; i < nl.count(); i++ )
+    {
+      el = nl.item(i).toElement();
+      tmpString = el.attribute("url");
       oldString = tmpString;
       tmpString = tmpString.replace(QRegExp(oldStr),newStr);

--- quanta/quanta/treeviews/uploadtreeview.cpp  #1.11.2.2:1.11.2.3
@@ -59,5 +59,5 @@ int UploadTreeView::checkboxTree( QListV
   {
     itIter = it->firstChild();
-    if (!itIter) itIter = it;
+    if (!itIter && dynamic_cast<UploadTreeFile *>(it)) itIter = it;
   }
   // bitFlag structure: (0/1)all children exist (0/1)no children exist.


Comment 4 Dik Takken 2003-11-17 22:21:09 UTC
New in Quanta 3.1.4:

You can still add the same file multiple times, like so:

* Add a file to the project.
* Choose 'save as' and save the file under it's own name, overwrite.
* Quanta will ask to add it to the project, even though it's already in.
* After having it added twice, try removing the file from the project. You will have to do that twice also to get it out.
Comment 5 András Manţia 2003-11-18 00:34:56 UTC
Subject: Re:  Adding file to project twice really makes file appear twice in project file list

This case is also fixed in the upcoming 3.2. Sorry, but I don't have time to 
backport the fix to the 3.1.x line.

Andras