[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete
From:       Jaison Lee <lee.jaison () gmail ! com>
Date:       2006-10-16 0:49:55
Message-ID: 1160959795.339748.22700.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 595878 by jlee:

Port to new KSaveFile.



 M  +6 -6      kopete/config/identity/globalidentitiesmanager.cpp  
 M  +5 -5      libkopete/contactlist/xmlcontactstorage.cpp  
 M  +4 -4      plugins/highlight/highlightconfig.cpp  
 M  +10 -10    plugins/history/converter.cpp  
 M  +5 -5      plugins/history/historylogger.cpp  


--- trunk/KDE/kdenetwork/kopete/kopete/config/identity/globalidentitiesmanager.cpp \
#595877:595878 @@ -181,19 +181,19 @@
 
 	QString globalIdentitiesListFileName = KStandardDirs::locateLocal( "appdata", \
QString::fromUtf8("global-identities.xml") );  KSaveFile \
                globalIdentitiesListFile(globalIdentitiesListFileName);
-	if( globalIdentitiesListFile.status() == 0 )
+	if( globalIdentitiesListFile.open() )
 	{
-		QTextStream *stream = globalIdentitiesListFile.textStream();
-		stream->setCodec(QTextCodec::codecForName("UTF-8"));
-		toXML().save( *stream, 4 );
+		QTextStream stream (&globalIdentitiesListFile);
+		stream.setCodec(QTextCodec::codecForName("UTF-8"));
+		toXML().save( stream, 4 );
 
-		if ( globalIdentitiesListFile.close() )
+		if ( globalIdentitiesListFile.finalize() )
 		{
 			return;
 		}
 		else
 		{
-			kDebug(14000) << k_funcinfo << "Failed to write global identities list, error \
code is: " << globalIdentitiesListFile.status() << endl; +			kDebug(14000) << \
k_funcinfo << "Failed to write global identities list, error code is: " << \
globalIdentitiesListFile.error() << endl;  }
 	}
 	else
--- trunk/KDE/kdenetwork/kopete/libkopete/contactlist/xmlcontactstorage.cpp \
#595877:595878 @@ -243,7 +243,7 @@
     }
 
     KSaveFile contactListFile( filename );
-    if( contactListFile.status() != 0 )
+    if( !contactListFile.open() )
     {
         d->isValid = false;
         d->errorMessage = i18n( "Could not open contact list file." );
@@ -284,11 +284,11 @@
     }
 #endif
 
-    QTextStream *stream = contactListFile.textStream();
-    stream->setCodec(QTextCodec::codecForName("UTF-8"));
-    doc.save( *stream, 4 );
+    QTextStream stream ( &contactListFile );
+    stream.setCodec(QTextCodec::codecForName("UTF-8"));
+    doc.save( stream, 4 );
 
-    if ( !contactListFile.close() )
+    if ( !contactListFile.finalize() )
     {
         d->isValid = false;
         d->errorMessage = i18n( "Could not write contact list to a file." );
--- trunk/KDE/kdenetwork/kopete/plugins/highlight/highlightconfig.cpp #595877:595878
@@ -152,10 +152,10 @@
 	QString fileName = KStandardDirs::locateLocal( "appdata", QString::fromLatin1( \
"highlight.xml" ) );  
 	KSaveFile file( fileName );
-	if( file.status() == 0 )
+	if( file.open() )
 	{
-		QTextStream *stream = file.textStream();
-		stream->setCodec(QTextCodec::codecForName("UTF-8"));
+		QTextStream stream ( &file );
+		stream.setCodec(QTextCodec::codecForName("UTF-8"));
 
 		QString xml = QString::fromLatin1(
 			"<?xml version=\"1.0\"?>\n"
@@ -189,7 +189,7 @@
 
 		xml += QString::fromLatin1( "</highlight-plugin>\n" );
 
-		*stream << xml;
+		stream << xml;
 	}
 }
 
--- trunk/KDE/kdenetwork/kopete/plugins/history/converter.cpp #595877:595878
@@ -221,12 +221,12 @@
 											date.toString(".yyyyMM");
 									KSaveFile file(  KStandardDirs::locateLocal( "data", QString::fromLatin1( \
                "kopete/logs/" ) + name +
 									                                             QString::fromLatin1( ".xml" ) \
                )  );
-									if( file.status() == 0 )
+									if( file.open() )
 									{
-										QTextStream *stream = file.textStream();
-										//stream->setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
-										doc.save( *stream , 1 );
-										file.close();
+										QTextStream stream ( &file );
+										//stream.setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
+										doc.save( stream , 1 );
+										file.finalize();
 									}
 								}
 
@@ -284,12 +284,12 @@
 								date.toString(".yyyyMM");
 						KSaveFile file( KStandardDirs::locateLocal( "data", QString::fromLatin1( \
                "kopete/logs/" ) + name +
 						                                            QString::fromLatin1( ".xml" ) )  \
                );
-						if( file.status() == 0 )
+						if( file.open() )
 						{
-							QTextStream *stream = file.textStream();
-							//stream->setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
-							doc.save( *stream ,1 );
-							file.close();
+							QTextStream stream ( &file );
+							//stream.setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
+							doc.save( stream ,1 );
+							file.finalize();
 						}
 					}
 
--- trunk/KDE/kdenetwork/kopete/plugins/history/historylogger.cpp #595877:595878
@@ -315,12 +315,12 @@
 	t.start(); //mesure the time needed to save.
 
 	KSaveFile file( m_toSaveFileName );
-	if( file.status() == 0 )
+	if( file.open() )
 	{
-		QTextStream *stream = file.textStream();
-		//stream->setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
-		m_toSaveDocument.save( *stream, 1 );
-		file.close();
+		QTextStream stream ( &file );
+		//stream.setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
+		m_toSaveDocument.save( stream, 1 );
+		file.finalize();
 
 		m_saveTimerTime=qMin(t.elapsed()*1000, 300000);
 		    //a time 1000 times supperior to the time needed to save.  but with a upper \
limit of 5 minutes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic