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

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

SVN commit 595884 by jlee:

Port to new KSaveFile.



 M  +13 -15    poinfo.cpp  


--- trunk/KDE/kdesdk/kbabel/common/poinfo.cpp #595883:595884
@@ -168,34 +168,32 @@
     // (especially if two instances would write into the same cache file)
     KSaveFile cacheFile( _poInfoCacheName );
     
-    QDataStream* stream = cacheFile.dataStream();
-    
-    if( stream ) {
+    if ( cacheFile.open() ) {
+        QDataStream stream ( &cacheFile );
 
         // Write the cache file version
         // We choose to fix a format (Q_UINT32) for compatibility (Qt version, platforms, architectures)
-	const Q_UINT32 version = POINFOCACHE_VERSION;
-	*stream << version;
+        const Q_UINT32 version = POINFOCACHE_VERSION;
+        stream << version;
 
         // Write the version of the QDataStream
         // Here too we choose a fixed format (Q_INT32) for compatibility
-        const Q_INT32 qdatastreamVersion = stream->version();
-        *stream << qdatastreamVersion;
+        const Q_INT32 qdatastreamVersion = stream.version();
+        stream << qdatastreamVersion;
         
         Q3DictIterator<poInfoCacheItem> it( _poInfoCache ); // iterator for dict
         for ( ; it.current(); ++it ) {
-	    if( QFile::exists( it.currentKey() ) ) {
-		*stream << it.currentKey();
-                *stream << it.current();
-	    }
-	}
-        if ( !cacheFile.close() ) {
+            if( QFile::exists( it.currentKey() ) ) {
+                stream << it.currentKey();
+                stream << it.current();
+            }
+        }
+        if ( !cacheFile.finalize() ) {
             kWarning(KBABEL) << "Could not write cache file: " << _poInfoCacheName << endl;
         }
     }
     else {
-        kWarning(KBABEL) << "Could not create QDataStream for cache file: " << _poInfoCacheName << endl;
-        cacheFile.abort();
+        kWarning(KBABEL) << "Could not open cache file: " << _poInfoCacheName << endl;
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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