Bug 126870 - kompare creates a new directory insteed of new file
Summary: kompare creates a new directory insteed of new file
Status: CONFIRMED
Alias: None
Product: kompare
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Kompare developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-07 00:08 UTC by Alex Kern
Modified: 2022-03-13 22:18 UTC (History)
3 users (show)

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 Alex Kern 2006-05-07 00:08:45 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    SuSE RPMs
OS:                Linux

here is the patch 

--- komparemodellist.cpp	2006-05-07 00:03:39.000000000 +0200
+++ komparemodellist.cpp.new	2006-05-07 00:03:20.000000000 +0200
@@ -361,9 +361,10 @@
 		KIO::UDSEntry entry;
 		if ( !KIO::NetAccess::stat( KURL( destination ).path(), entry, (QWidget*)parent() ) )
 		{
-			if ( !KIO::NetAccess::mkdir( KURL( destination ).path(), (QWidget*)parent() ) )
+			if ( !KIO::NetAccess::stat( KURL( destination ).directory(), entry, (QWidget*)parent() ) &&
+				!KIO::NetAccess::mkdir( KURL( destination ).directory(), (QWidget*)parent() ) )
 			{
-				emit error( i18n( "<qt>Could not create destination directory <b>%1</b>.\nThe file has not been saved.</qt>" ) );
+				emit error( i18n( "<qt>Could not create destination directory <b>%1</b>.\nThe file has not been saved.</qt>" ).arg( KURL( destination ).directory() ) );
 				return false;
 			}
 		}
@@ -382,7 +383,7 @@
 	}
 	else
 	{
-		//model->slotSetModified( false );
+		model->slotSetModified( false );
 		temp->unlink();
 		delete temp;
 	}
Comment 1 FiNeX 2009-01-04 16:37:20 UTC
This patch has never been applied. Is it valid for KDE 4 version of kompare?
Exactly what is the problem? How is it reproducible?

Thanks!
Comment 2 Otto Bruggeman 2009-02-24 02:23:01 UTC
SVN commit 930684 by bruggie:

Many changes related to passing filename information from the part to
the modellist. The Kompare::Infostruct was already in place to update
everyone about changes but it was not used to communicate between the
part and model this commit fixes that. 

The real reason for this commit is that it fixes saving remote files. 
Do not give a local URL and pretend it is a remote URL, does not work. 
KIO::NetAccess::upload then simply does nothing because the file 
already exists.  

Refresh is fixed now. Refetch the files and dont reuse the local files
to determine the differences. Now that saving remote works it showed the
old result again. Some had already seen this, now it was easy to figure
out where it came from.

Fixed a silly copy and paste error where for the destination directory
source was used. Always fun these bugs.

Updated the caption in the titlebar to now have a " -- " to separate the
files so it is more clear which files/directories are compared. I read
somewhere in a bugreport people did not like this so fixed as well.

BUG:76904
BUG:81088
CCBUG:126870 Patch applied, second hunk not since this is not related



 M  +58 -29    komparepart/kompare_part.cpp  
 M  +74 -71    libdiff2/komparemodellist.cpp  
 M  +12 -15    libdiff2/komparemodellist.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=930684
Comment 3 Kevin Kofler 2009-02-24 03:03:16 UTC
SVN commit 930700 by kkofler:

Many changes related to passing filename information from the part to
the modellist. The Kompare::Infostruct was already in place to update
everyone about changes but it was not used to communicate between the
part and model this commit fixes that. 

The real reason for this commit is that it fixes saving remote files. 
Do not give a local URL and pretend it is a remote URL, does not work. 
KIO::NetAccess::upload then simply does nothing because the file 
already exists.  

Refresh is fixed now. Refetch the files and dont reuse the local files
to determine the differences. Now that saving remote works it showed the
old result again. Some had already seen this, now it was easy to figure
out where it came from.

Fixed a silly copy and paste error where for the destination directory
source was used. Always fun these bugs.

Updated the caption in the titlebar to now have a " -- " to separate the
files so it is more clear which files/directories are compared. I read
somewhere in a bugreport people did not like this so fixed as well.

CCBUG:76904
CCBUG:81088
CCBUG:126870 Patch applied, second hunk not since this is not related

backport revision 930684 by bruggie from trunk

 M  +57 -28    komparepart/kompare_part.cpp  
 M  +74 -71    libdiff2/komparemodellist.cpp  
 M  +12 -15    libdiff2/komparemodellist.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=930700
Comment 4 Kevin Kofler 2009-03-05 09:35:58 UTC
Is this one fixed by the above commit? If not, what's missing?
Comment 5 Otto Bruggeman 2009-03-05 09:59:36 UTC
It should be fixed by this commit since he created the patch and said it worked for him. It is the second hunk regarding the mandatory saving on exit bug when there are applied hunks even though it has been saved and such that is not fixed yet, i think we can now close this a duplicate of one of those bugs since that is the last remaining issue here.

BTW a fix for this would be to also track a unsaved state per difference that is not Differnence::Unchanged. unset it by default and when the hunk is applied change it to true, then iterate over the differences to see if it needs saving and change the model state accordingly. When saving you change all unsaved to false and set the model accordingly. When doing this you can really know if it still needs to be saved.

Anyway close as duplicate and then we have one less bug open for kompare.
Comment 6 Otto Bruggeman 2009-03-11 00:59:48 UTC
Should be fixed now in trunk. Will get back ported if people confirm the fix.
Comment 7 Carl Schwan 2022-03-13 22:18:09 UTC
Git commit f465f1a36fab13087778258e9db9569f112b6818 by Carl Schwan, on behalf of Demitrius Belai.
Committed on 13/03/2022 at 22:18.
Pushed by carlschwan into branch 'master'.

Fix directory creation on destination

When a file not exists on destination directory, Kompare needs to create it. However, Kompare creates a directory instead. 
Related: bug 441131

M  +3    -2    src/komparemodellist.cpp

https://invent.kde.org/sdk/libkomparediff2/commit/f465f1a36fab13087778258e9db9569f112b6818