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

List:       kde-commits
Subject:    branches/work/akregator/onlinesync/akregator/src/feedsync
From:       Didier Hoarau <did.hoarau () gmail ! com>
Date:       2008-04-03 21:59:05
Message-ID: 1207259945.243707.5459.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 793404 by dhoarau:

Confirmation dialog added


 M  +42 -4     feedsync.cpp  
 M  +3 -0      feedsync.h  


--- branches/work/akregator/onlinesync/akregator/src/feedsync/feedsync.cpp \
#793403:793404 @@ -3,6 +3,7 @@
 #include <QTimer>
 #include <QFile>
 #include <QThread>
+#include <QMessageBox>
 #include <QDomElement>
 #include <QDomDocument>
 #include <kdebug.h>
@@ -48,8 +49,6 @@
     return m_agg;
 }
 
-// TODO Akregator temporarylly replaced by an OPML file
-// TODO Delete the object that contains the password to avoid memory dump
 void FeedSync::sync() {
 
     kDebug();
@@ -81,6 +80,7 @@
         kDebug() << "Error loading configuration";
     }
 
+
     // TODO Handle error cases
 
     // TODO Handle failures
@@ -100,19 +100,57 @@
 
     if (_loadedAggrCount==2) {
         // Now: Add
-        _aggrGet->add(_aggrGet->getSubscriptionList()->compare(_aggrSend->getSubscriptionList(),SubscriptionList::Added));
 +        tmp_addlist = _aggrGet->getSubscriptionList()->compare( \
_aggrSend->getSubscriptionList(), SubscriptionList::Added ); +        \
_aggrGet->add(tmp_addlist);  }
 }
 
 void FeedSync::slotAddDone() {
     kDebug();
-    _aggrGet->remove(_aggrGet->getSubscriptionList()->compare(_aggrSend->getSubscriptionList(),SubscriptionList::Removed));
 +
+    // Now: delete
+
+    // Check if there are feeds to delete
+    SubscriptionList::RemovePolicy m_removepolicy = SubscriptionList::Nothing;
+    SubscriptionList * m_checkremove = \
_aggrGet->getSubscriptionList()->compare(_aggrSend->getSubscriptionList(),SubscriptionList::Removed,SubscriptionList::Feed);
 +    if (m_checkremove->count()>0) {
+        // Get the type of synchronization
+        QMessageBox msgBox;
+        msgBox.setText(QString("Some categories and feeds have been marked for \
removal. Do you want to delete them?")); +        \
msgBox.setIcon(QMessageBox::Information); +        QPushButton *noRemove  = \
msgBox.addButton(QString("Remove nothing"), QMessageBox::ActionRole); +        \
QPushButton *catRemove = msgBox.addButton(QString("Remove only categories"), \
QMessageBox::ActionRole); +        QPushButton *feedRemove  = \
msgBox.addButton(QString("Remove feeds"), QMessageBox::ActionRole); +        \
msgBox.exec(); +        // Remove feed
+        if (msgBox.clickedButton() == (QAbstractButton*) feedRemove) {
+            kDebug() << "Remove feeds";
+            m_removepolicy = SubscriptionList::Feed;
+        // Remove only categories
+        } else if (msgBox.clickedButton() == (QAbstractButton*) catRemove) {
+            kDebug() << "Remove categories";
+            m_removepolicy = SubscriptionList::Category;
+        // Remove nothing
+        } else {
+            kDebug() << "Remove nothing";
+            m_removepolicy = SubscriptionList::Nothing;
+        }
+    }
+
+    // Remove
+    tmp_removelist = _aggrGet->getSubscriptionList()->compare( \
_aggrSend->getSubscriptionList() ,SubscriptionList::Removed, m_removepolicy ); +   \
_aggrGet->remove(tmp_removelist); +
+    // Clean
+    delete m_checkremove;
 }
 
 void FeedSync::slotRemoveDone() {
     kDebug();
     delete _aggrSend;
     delete _aggrGet;
+    delete tmp_removelist;
+    delete tmp_addlist;
 }
 
 void FeedSync::error() {
--- branches/work/akregator/onlinesync/akregator/src/feedsync/feedsync.h \
#793403:793404 @@ -3,6 +3,7 @@
 
 #include <QObject>
 
+class SubscriptionList;
 class KConfigGroup;
 
 namespace feedsync {
@@ -31,6 +32,8 @@
     void error();
     int _syncstep;
     int _loadedAggrCount;
+    SubscriptionList * tmp_removelist;
+    SubscriptionList * tmp_addlist;
 };
 
 }


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

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