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

List:       kde-commits
Subject:    branches/work/akregator/onlinesync/akregator/src
From:       Didier Hoarau <did.hoarau () gmail ! com>
Date:       2008-02-28 22:17:34
Message-ID: 1204237054.222793.12424.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 780370 by dhoarau:

Account configuration


 M  +4 -3      CMakeLists.txt  
 D             feedsync/CMakeLists.txt  
 M  +7 -7      feedsync/akregator.cpp  
 M  +45 -27    feedsync/googlereader.cpp  
 M  +10 -4     feedsync/googlereader.h  
 M  +0 -11     feedsync/main.cpp  
 M  +11 -11    feedsync/opml.cpp  
 M  +6 -6      feedsync/subscriptionlist.cpp  
 M  +1 -1      feedsync/syncrss.cpp  
 M  +32 -23    feedsync/ui/configurationdialog.cpp  
 M  +3 -3      feedsync/ui/configurationdialog.h  
 A             feedsync/ui/configurationdialogadd.cpp   [License: UNKNOWN]
 A             feedsync/ui/configurationdialogadd.h   [License: UNKNOWN]
 A             feedsync/ui/configurationdialogadd.ui  
 D             feedsync/ui/configurationdialoggooglereader.ui  
 D             feedsync/ui/mainwindow.cpp  
 D             feedsync/ui/mainwindow.h  
 M  +1 -1      mainwidget.cpp  


--- branches/work/akregator/onlinesync/akregator/src/CMakeLists.txt #780369:780370
@@ -2,7 +2,6 @@
 
 add_subdirectory( about ) 
 add_subdirectory( icons )
-# add_subdirectory( feedsync ) 
 
 
 add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
@@ -107,9 +106,11 @@
                    feedsync/akregator.cpp 
                    feedsync/googlereader.cpp 
                    feedsync/opml.cpp 
-                   feedsync/ui/mainwindow.cpp 
-                   feedsync/ui/configurationdialog.cpp )
+                   feedsync/ui/configurationdialog.cpp 
+                   feedsync/ui/configurationdialogadd.cpp )
 kde4_add_ui_files(feedsync_SRCS feedsync/ui/configurationdialog.ui)
+kde4_add_ui_files(feedsync_SRCS feedsync/ui/configurationdialogadd.ui)
+
 kde4_add_library(feedsync ${feedsync_SRCS})
 target_link_libraries(feedsync ${KDE4_KDE3SUPPORT_LIBS})
 target_link_libraries(feedsync ${KDE4_KDEUI_LIBS})
--- branches/work/akregator/onlinesync/akregator/src/feedsync/akregator.cpp #780369:780370
@@ -3,31 +3,31 @@
 #include <kdebug.h>
 
 Akregator::Akregator() {
-    kDebug() << "Akregator - Constructor";
+    kDebug();
     _subscriptionList = new SubscriptionList();
 }
 
 Akregator::~Akregator() {
-    kDebug() << "Akregator - Destructor";
+    kDebug();
     delete _subscriptionList;
 }
 
 SubscriptionList * Akregator::getSubscriptionList() {
-    kDebug() << "Akregator - getSubscriptionList";
+    kDebug();
 }
 
 void Akregator::load() {
-    kDebug() << "Akregator - load";
+    kDebug();
 }
 
 void Akregator::add(SubscriptionList * list) {
-    kDebug() << "Akregator - add";
+    kDebug();
 }
 
 void Akregator::update(SubscriptionList * list) {
-    kDebug() << "Akregator - update";
+    kDebug();
 }
 
 void Akregator::remove(SubscriptionList * list) {
-    kDebug() << "Akregator - remove";
+    kDebug();
 }
--- branches/work/akregator/onlinesync/akregator/src/feedsync/googlereader.cpp #780369:780370
@@ -3,43 +3,56 @@
 #include <kdebug.h>
 #include <QDomDocument>
 
-GoogleReader::GoogleReader() {
-    kDebug() << "GoogleReader - Constructor";
+GoogleReader::GoogleReader() 
+{
+    kDebug();
     _subscriptionList = new SubscriptionList();
 }
 
-GoogleReader::~GoogleReader() {
-    kDebug() << "GoogleReader - Destructor";
+GoogleReader::~GoogleReader() 
+{
+    kDebug();
     delete _subscriptionList;
 }
 
-SubscriptionList * GoogleReader::getSubscriptionList() {
-    kDebug() << "GoogleReader - getSubscriptionList";
+SubscriptionList * GoogleReader::getSubscriptionList() const 
+{
     return _subscriptionList;
 }
 
-QString GoogleReader::getUser() {
-    kDebug() << "GoogleReader - getUser";
-    return QString("");
+QString GoogleReader::getUser() const 
+{
+    return _user;
 }
 
-QString GoogleReader::getPassword() {
-    kDebug() << "GoogleReader - getPassword";
-    return QString("");
+QString GoogleReader::getPassword() const 
+{
+    return _password;
 }
 
-QString GoogleReader::getSID() {
-    kDebug() << "GoogleReader - getSID";
+void GoogleReader::setUser(QString user) 
+{
+    _user=user;
+}
+
+void GoogleReader::setPassword(QString password) 
+{
+    _password=password;
+}
+
+QString GoogleReader::getSID() const 
+{
     return _sid;
 }
 
-void GoogleReader::receiceAuthentication() {
-    kDebug() << "GoogleReader - receiceAuthentication";
+void GoogleReader::receiceAuthentication() 
+{
+    kDebug();
     QByteArray m_data = http->readAll();
     QString text(m_data.data());
     text = text.right(text.length()-text.indexOf("SID=")-4);
     _sid = text.left(text.indexOf("\n"));
-    kDebug() << "GoogleReader - receiceAuthentication - SID:" << _sid.left(10)+QString("...");
+    kDebug() << "SID:" << _sid.left(10)+QString("...");
 
     // Query
     QHttpRequestHeader header("GET", "http://www.google.com/reader/api/0/subscription/list");
@@ -51,8 +64,9 @@
     connect(http, SIGNAL(done(bool)), this, SLOT(receiveSubsriptionList()));
 }
 
-void GoogleReader::receiveSubsriptionList() {
-    kDebug() << "GoogleReader - receiveSubsriptionList";
+void GoogleReader::receiveSubsriptionList() 
+{
+    kDebug();
 
     // Part: receive the subscription list
 
@@ -85,8 +99,9 @@
     emit loadDone();
 }
 
-void GoogleReader::load() {
-    kDebug() << "GoogleReader - load";
+void GoogleReader::load() 
+{
+    kDebug();
 
     // 1st part: Authentication
 
@@ -106,14 +121,17 @@
 
 }
 
-void GoogleReader::add(SubscriptionList * list) {
-    kDebug() << "GoogleReader - add";
+void GoogleReader::add(SubscriptionList * list) 
+{
+    kDebug();
 }
 
-void GoogleReader::update(SubscriptionList * list) {
-    kDebug() << "GoogleReader - update";
+void GoogleReader::update(SubscriptionList * list) 
+{
+    kDebug();
 }
 
-void GoogleReader::remove(SubscriptionList * list) {
-    kDebug() << "GoogleReader - remove";
+void GoogleReader::remove(SubscriptionList * list) 
+{
+    kDebug();
 }
--- branches/work/akregator/onlinesync/akregator/src/feedsync/googlereader.h #780369:780370
@@ -15,7 +15,9 @@
  public:
     GoogleReader();
     ~GoogleReader();
-    SubscriptionList * getSubscriptionList();
+    SubscriptionList * getSubscriptionList() const;
+    void setUser(QString user);
+    void setPassword(QString password);
     void load();
     void add(SubscriptionList * list);
     void update(SubscriptionList * list);
@@ -28,12 +30,16 @@
  private:
     QHttp *http;
     QString _sid;
-    QString getSID();
-    QString getUser();
-    QString getPassword();
+    QString getSID() const;
+    QString getUser() const;
+    QString getPassword() const;
     SubscriptionList * _subscriptionList;
     bool waitmutex;
+    QString _user;
+    QString _password;
 
+
+
  signals:
     void loadDone();
 };
--- branches/work/akregator/onlinesync/akregator/src/feedsync/main.cpp #780369:780370
@@ -5,7 +5,6 @@
 
 #include "syncrss.h"
 #include "ui/configurationdialog.h"
-#include "ui/mainwindow.h"
 
 int main (int argc, char *argv[])
 {
@@ -34,15 +33,5 @@
     // Test sync mecanism
     // SyncRss rssapp;
 
-    // Test config files
-    //     KConfig config("akregator_feedsync");
-    //     KConfigGroup generalGroup( &config, "FeedSyncSource_GoogleReader_did.hoarau" );
-    //     generalGroup.writeEntry( "Account", QString("GoogleReader") );
-    //     generalGroup.writeEntry( "Account", QString("GoogleReader") );
-    //     generalGroup.writeEntry( "Account", QString("GoogleReader") );
-    //     generalGroup.config()->sync();
-
-    kDebug() << "OK";
-
     // app->exec();
 }
--- branches/work/akregator/onlinesync/akregator/src/feedsync/opml.cpp #780369:780370
@@ -6,32 +6,32 @@
 #include <QDomDocument>
 
 Opml::Opml(QFile * file) {
-    kDebug() << "Opml - Constructor";
+    kDebug();
     _subscriptionList = new SubscriptionList();
     _xmlFile = file;
 }
 
 Opml::~Opml() {
-    kDebug() << "Opml - Destructor";
+    kDebug();
     delete _subscriptionList;
 }
 
 SubscriptionList * Opml::getSubscriptionList() {
-    kDebug() << "Opml - getSubscriptionList";
+    kDebug();
     return _subscriptionList;
 }
 
 void Opml::load() {
-    kDebug() << "Opml - load";
+    kDebug();
 
     // Read the XML
     _xmlDoc = new QDomDocument("opml");
     if (!_xmlFile->open(QIODevice::ReadOnly)) {
-        kDebug() << "Opml - getSubscriptionList - File Error";
+        kDebug() << "File Error";
         return;
     }
     if (!_xmlDoc->setContent(_xmlFile)) {
-        kDebug() << "Opml - getSubscriptionList - File Error";
+        kDebug() << "File Error";
         _xmlFile->close();
         return;
     }
@@ -66,7 +66,7 @@
 }
 
 void Opml::add(SubscriptionList * list) {
-    kDebug() << "Opml - add";
+    kDebug();
     QDomNode nodeList = _xmlDoc->documentElement().firstChild().nextSibling();
 
     QString m_rss;
@@ -84,10 +84,10 @@
         nodeList.appendChild(m_element);
     }
 
-    // Test save
+    // TODO Test save
     QFile file;
     QTextStream out;
-    file.setFileName("/home/didier/out.xml");
+    file.setFileName("~/out.xml");
     if (!file.open(QIODevice::WriteOnly))
         return;
     out.setDevice(&file);
@@ -96,9 +96,9 @@
 }
 
 void Opml::update(SubscriptionList * list) {
-    kDebug() << "Opml - update";
+    kDebug();
 }
 
 void Opml::remove(SubscriptionList * list) {
-    kDebug() << "Opml - remove";
+    kDebug();
 }
--- branches/work/akregator/onlinesync/akregator/src/feedsync/subscriptionlist.cpp #780369:780370
@@ -4,12 +4,12 @@
 
 SubscriptionList::SubscriptionList()
 {
-    kDebug() << "SubscriptionList - Constructor";
+    kDebug();
 }
 
 SubscriptionList::~SubscriptionList()
 {
-    kDebug() << "SubscriptionList - Destructor";
+    kDebug();
 }
 
 void SubscriptionList::add(QString iRss, QString iName, QString iCat) 
@@ -21,7 +21,7 @@
 }
 
 SubscriptionList * SubscriptionList::compare(SubscriptionList * iOther, int diffType) {
-    kDebug() << "SubscriptionList - compare";
+    kDebug();
 
     SubscriptionList * diffList = new SubscriptionList();
 
@@ -37,7 +37,7 @@
                      || (diffType == SubscriptionList::Updated) ) 
                 {
                     diffList->add(m_rss,iOther->getName(m_rss),iOther->getCat(m_rss));
-                    kDebug() << "SubscriptionList - compare (U)" 
+                    kDebug() << "(U)" 
                             << "RSS:" << m_rss.left(10)
                             << "Name:" << iOther->getName(m_rss).left(10)
                             << "Cat:" << iOther->getCat(m_rss).left(10);
@@ -49,7 +49,7 @@
                     || (diffType == SubscriptionList::AllDifference) ) 
             {
                 diffList->add(m_rss,this->getName(m_rss),this->getCat(m_rss));
-                kDebug() << "SubscriptionList - compare (-)" 
+                kDebug() << "(-)" 
                             << "RSS:" << m_rss.left(10)
                             << "Name:" << this->getName(m_rss).left(10)
                             << "Cat:" << this->getCat(m_rss).left(10);
@@ -66,7 +66,7 @@
             {
                 // Added
                 diffList->add(m_rss,iOther->getName(m_rss),iOther->getCat(m_rss));
-                kDebug() << "SubscriptionList - compare (+)" 
+                kDebug() << "(+)" 
                             << "RSS:" << m_rss.left(10)
                             << "Name:" << iOther->getName(m_rss).left(10)
                             << "Cat:" << iOther->getCat(m_rss).left(10);
--- branches/work/akregator/onlinesync/akregator/src/feedsync/syncrss.cpp #780369:780370
@@ -16,7 +16,7 @@
 }
 
 void SyncRss::exec() {
-    kDebug() << "SyncRss - exec";
+    kDebug();
     loadedcount = 0;
 
     // m_gr = new GoogleReader();
--- branches/work/akregator/onlinesync/akregator/src/feedsync/ui/configurationdialog.cpp #780369:780370
@@ -1,54 +1,63 @@
 #include "ui_configurationdialog.h"
 #include "configurationdialog.h"
+#include "configurationdialogadd.h"
 
+#include <kdebug.h>
+
 namespace feedsync
 {
 
 ConfigurationDialog::ConfigurationDialog( QWidget *parent)
 {
+    kDebug();
+
     // UI setup
     QWidget *widget = new QWidget( this );
     ui.setupUi(widget);
     setMainWidget( widget );
     setCaption( i18n("Online reader") );
-    // setButtons( KDialog::Close );
 
     // Init
     ui.list_readerList->setColumnCount(2);
     QStringList deleteTags;
-        deleteTags.append("Never");
-        deleteTags.append("Always");
-        deleteTags.append("Ask");
+        deleteTags.append( i18n("Never") );
+        deleteTags.append( i18n("Always") );
+        deleteTags.append( i18n("Ask") );
     ui.cb_deleteFeeds->addItems(deleteTags);
-
-    // Test
     QStringList title;
-        title.append("Type");
-        title.append("Description");
+        title.append( i18n("Type") );
+        title.append( i18n("Description") );
     ui.list_readerList->setHeaderLabels(title);
 
-    QList<QTreeWidgetItem *> items;
-    QStringList line;
-        line.append("Google Reader");
-        line.append("user_login");
-    items.append(new QTreeWidgetItem((QTreeWidget*)0, line));
-    QStringList line2;
-        line2.append("OPML File");
-        line2.append("http://website.com/feeds.opml");
-    items.append(new QTreeWidgetItem((QTreeWidget*)0, line2));
-    ui.list_readerList->insertTopLevelItems(0, items);
+    // Slots
+    connect( ui.b_add, SIGNAL( clicked() ), this, SLOT( slotButtonAddClicked() ) );
+
+    // Read configuration
+    KConfig config("akregator_feedsyncrc");
+    foreach ( const QString& groupname, config.groupList() ) {
+        if (groupname.left(15)=="FeedSyncSource_") {
+            kDebug() << groupname;
+            KConfigGroup generalGroup( &config, groupname );
+            QList<QTreeWidgetItem *> items;
+            QStringList line;
+                line.append("Google Reader");
+                line.append( generalGroup.readEntry( "Account", QString() ) );
+            items.append(new QTreeWidgetItem((QTreeWidget*)0,line));
+            ui.list_readerList->insertTopLevelItems(0, items);
+        }
+    }
 }
 
 ConfigurationDialog::~ConfigurationDialog()
 {
-
+    kDebug();
 }
 
-void ConfigurationDialog::slotButtonClicked() 
+void ConfigurationDialog::slotButtonAddClicked()
 {
-/*    KMessageBox::information( this, 
-                              i18n("You pressed the button!" ),
-                              i18n( "Hooray!" ) );*/
+    kDebug();
+    ConfigurationDialogAdd * addDlg = new ConfigurationDialogAdd();
+    addDlg->show();
 }
 
 }
--- branches/work/akregator/onlinesync/akregator/src/feedsync/ui/configurationdialog.h #780369:780370
@@ -22,11 +22,11 @@
         ConfigurationDialog( QWidget *parent=0 );
         ~ConfigurationDialog();
 
-    private slots:
-        void slotButtonClicked();
-
     private:
         Ui::ConfigurationDialog ui;
+
+    private slots:
+        void slotButtonAddClicked();
 };
  
 }
--- branches/work/akregator/onlinesync/akregator/src/mainwidget.cpp #780369:780370
@@ -1231,7 +1231,7 @@
 void Akregator::MainWidget::slotFeedSyncManage()
 {
     using namespace feedsync;
-    kDebug() << "slotFeedSyncManage";
+    kDebug();
     ConfigurationDialog * dlg = new ConfigurationDialog();
     dlg->show();
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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