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

List:       kde-commits
Subject:    kdeextragear-3/kdetv/libkdetv
From:       Dirk Ziegelmeier <dziegel () gmx ! de>
Date:       2004-05-02 9:49:12
Message-ID: 20040502094912.A1ECA9A82 () office ! kde ! org
[Download RAW message or body]

CVS commit by dziegel: 

Safer loading of channels - you don't loose your current
channels any more if loading fails.


  M +32 -35    channelstore.cpp   1.35
  M +15 -0     kdetvchannelplugin.h   1.6


--- kdeextragear-3/kdetv/libkdetv/channelstore.cpp  #1.34:1.35
@@ -74,25 +74,15 @@ bool ChannelStore::load( const QString &
     if (file.isEmpty()) return false;
 
-    /*
-     * If we load using a temp store, the DCOP names for the channels are not set.
-     * This happens because the DCOP names are in use by the temp store.
-     */
-    // ChannelStore tmp(_ktv, this, "tempStore");
+    ChannelStore tmp(_ktv, this, "tempStore");
 
     _silentModifications = true;
-    //    bool rc = ChannelIO::load( _ktv, &tmp, file, fmt );
-    _channels.clear(); 
-    bool rc = ChannelIO::load( _ktv, this, _metaInfo, file, fmt );
+    bool rc = ChannelIO::load( _ktv, &tmp, &tmp.getMetaInfo(), file, fmt );
     _silentModifications = false;
-
-    /*
     if (rc) {
         _channels.clear(); 
         addChannels(tmp);
+        emit loaded();
     }
-    */
 
-    if (rc)
-        emit loaded();
     return rc;
 }
@@ -100,11 +90,15 @@ bool ChannelStore::load( const QString &
 bool ChannelStore::load( QIODevice* dev, const QString& fmt )
 {
+    ChannelStore tmp(_ktv, this, "tempStore");
+
     _silentModifications = true;
-    _channels.clear(); 
-    bool rc = ChannelIO::load( _ktv, this, _metaInfo, dev, fmt );
+    bool rc = ChannelIO::load( _ktv, &tmp, &tmp.getMetaInfo(), dev, fmt );
     _silentModifications = false;
-
-    if (rc)
+    if (rc) {
+        _channels.clear(); 
+        addChannels(tmp);
         emit loaded();
+    }
+
     return rc;
 }
@@ -195,4 +189,7 @@ void ChannelStore::addChannels( const Ch
         addChannel(channel);
     }
+
+    *_metaInfo = nstore.getMetaInfo();
+
     _silentModifications = false;
     emit loaded();

--- kdeextragear-3/kdetv/libkdetv/kdetvchannelplugin.h  #1.5:1.6
@@ -28,4 +28,7 @@
 #include <qptrlist.h>
 #include <qdatetime.h>
+
+#include <kdebug.h>
+
 #include "kdetvpluginbase.h"
 
@@ -57,4 +60,16 @@ public:
         }
 
+        ChannelFileMetaInfo& operator= (ChannelFileMetaInfo& other)
+        {
+            _contributor = other._contributor;
+            _country     = other._country;
+            _region      = other._region;
+            _type        = other._type;
+            _comment     = other._comment;
+            _lastUpdate  = other._lastUpdate;
+
+            return *this;
+        }
+
                 QString   _contributor, _country, _region, _type, _comment;
         QDateTime _lastUpdate;


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

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