2007-09-10 18:21:37 +00:00
|
|
|
Index: xmlgui/kxmlguiclient.cpp
|
|
|
|
===================================================================
|
|
|
|
--- xmlgui/kxmlguiclient.cpp (revision 709581)
|
|
|
|
+++ xmlgui/kxmlguiclient.cpp (working copy)
|
|
|
|
@@ -785,11 +785,11 @@
|
|
|
|
allDocuments.append( d );
|
|
|
|
}
|
2007-09-10 06:00:08 +00:00
|
|
|
|
2007-09-10 18:21:37 +00:00
|
|
|
- QList<DocStruct>::Iterator best = allDocuments.end();
|
|
|
|
+ QList<DocStruct>::const_iterator best = allDocuments.end();
|
|
|
|
uint bestVersion = 0;
|
2007-09-10 06:00:08 +00:00
|
|
|
|
2007-09-10 18:21:37 +00:00
|
|
|
- QList<DocStruct>::Iterator docIt = allDocuments.begin();
|
|
|
|
- QList<DocStruct>::Iterator docEnd = allDocuments.end();
|
|
|
|
+ QList<DocStruct>::const_iterator docIt = allDocuments.begin();
|
|
|
|
+ const QList<DocStruct>::const_iterator docEnd = allDocuments.end();
|
|
|
|
for (; docIt != docEnd; ++docIt )
|
|
|
|
{
|
|
|
|
QString versionStr = findVersionNumber( (*docIt).data );
|
|
|
|
@@ -814,19 +814,19 @@
|
|
|
|
{
|
|
|
|
if ( best != allDocuments.begin() )
|
|
|
|
{
|
|
|
|
- QList<DocStruct>::Iterator local = allDocuments.begin();
|
|
|
|
+ QList<DocStruct>::iterator local = allDocuments.begin();
|
|
|
|
+ if ( (*local).file.startsWith(KGlobal::dirs()->localkdedir()) ) {
|
2007-09-10 06:00:08 +00:00
|
|
|
|
2007-09-10 18:21:37 +00:00
|
|
|
- // load the local document and extract the action properties
|
|
|
|
- QDomDocument document;
|
|
|
|
- document.setContent( (*local).data );
|
|
|
|
+ // load the local document and extract the action properties
|
|
|
|
+ QDomDocument document;
|
|
|
|
+ document.setContent( (*local).data );
|
|
|
|
|
|
|
|
- ActionPropertiesMap properties = extractActionProperties( document );
|
|
|
|
+ ActionPropertiesMap properties = extractActionProperties( document );
|
|
|
|
|
|
|
|
- // in case the document has a ActionProperties section
|
|
|
|
- // we must not delete it but copy over the global doc
|
|
|
|
- // to the local and insert the ActionProperties section
|
|
|
|
- if ( !properties.isEmpty() )
|
|
|
|
- {
|
|
|
|
+ // in case the document has a ActionProperties section
|
|
|
|
+ // we must not delete it but copy over the global doc
|
|
|
|
+ // to the local and insert the ActionProperties section
|
|
|
|
+ if ( !properties.isEmpty() ) {
|
|
|
|
// now load the global one with the higher version number
|
|
|
|
// into memory
|
|
|
|
document.setContent( (*best).data );
|
|
|
|
@@ -845,14 +845,14 @@
|
|
|
|
f.write( utf8data.constData(), utf8data.length() );
|
|
|
|
f.close();
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ QString f = (*local).file;
|
|
|
|
+ QString backup = f + QLatin1String( ".backup" );
|
|
|
|
+ QFile::rename( f, backup );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- QString f = (*local).file;
|
|
|
|
- QString backup = f + QLatin1String( ".backup" );
|
|
|
|
- QDir dir;
|
|
|
|
- dir.rename( f, backup );
|
|
|
|
- }
|
|
|
|
}
|
|
|
|
doc = (*best).data;
|
|
|
|
return (*best).file;
|