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

List:       kde-commits
Subject:    [kdepim/akregator_port] akregator2/src: Open edit dialog after adding a feed
From:       Frank Osterfeld <osterfeld () kde ! org>
Date:       2013-03-02 16:42:01
Message-ID: 20130302164201.C4B9FA604F () git ! kde ! org
[Download RAW message or body]

Git commit 19e221dd07aeaa4d186089fd9c9c29cc00cbda47 by Frank Osterfeld.
Committed on 02/03/2013 at 17:19.
Pushed by osterfeld into branch 'akregator_port'.

Open edit dialog after adding a feed

M  +17   -39   akregator2/src/createfeedcommand.cpp
M  +1    -1    akregator2/src/createfeedcommand.h

http://commits.kde.org/kdepim/19e221dd07aeaa4d186089fd9c9c29cc00cbda47

diff --git a/akregator2/src/createfeedcommand.cpp b/akregator2/src/createfeedcommand.cpp
index 9f17b02..20ddad2 100644
--- a/akregator2/src/createfeedcommand.cpp
+++ b/akregator2/src/createfeedcommand.cpp
@@ -23,6 +23,7 @@
 */
 
 #include "createfeedcommand.h"
+#include "editfeedcommand.h"
 
 #include "addfeeddialog.h"
 #include "editfeedcommand.h"
@@ -59,7 +60,7 @@ public:
 
     void doCreate();
     void creationDone( KJob* );
-    void modificationDone( KJob* );
+    void modificationDone();
 
     Akonadi::Session* m_session;
     QString m_url;
@@ -129,53 +130,30 @@ void CreateFeedCommand::Private::doCreate()
     Akonadi::CollectionCreateJob* job = new Akonadi::CollectionCreateJob( feed );
     q->connect( job, SIGNAL(finished(KJob*)), q, SLOT(creationDone(KJob*)) );
     job->start();
-
-    //PENDING(frank): the following should go to a FeedModifyCommand
-#ifdef KRSS_PORT_DISABLED
-
-    Feed* const feed = afd->feed();
-    delete afd;
-
-    if ( !feed )
-    {
-        q->emitResult();
-        return;
-    }
-
-    QPointer<FeedPropertiesDialog> dlg = new FeedPropertiesDialog( q->parentWidget(), "edit_feed" );
-    dlg->setFeed( feed );
-    dlg->selectFeedName();
-
-    if ( !m_autoexec && ( dlg->exec() != QDialog::Accepted || !thisPointer ) )
-    {
-        delete feed;
-    }
-    else
-    {
-        m_parentFolder = m_parentFolder ? m_parentFolder : m_rootFolder;
-        m_parentFolder->insertChild( feed, m_after );
-        if ( m_feedListView )
-            m_feedListView->ensureNodeVisible( feed );
-    }
-
-    delete dlg;
-    q->emitResult();
-#endif //KRSS_PORT_DISABLED
-
 }
 
 void CreateFeedCommand::Private::creationDone( KJob* job )
 {
     if ( job->error() )
         q->setErrorAndEmitResult( i18n("Could not add feed: %1", job->errorString()) );
-    else
-        q->emitResult();
+    else {
+        Akonadi::CollectionCreateJob* createJob = qobject_cast<Akonadi::CollectionCreateJob*>( job );
+        Q_ASSERT( createJob );
+        EditFeedCommand* cmd = new EditFeedCommand( q );
+        connect( cmd, SIGNAL(finished()), q, SLOT(modificationDone()) );
+        cmd->setParentWidget( q->parentWidget() );
+        cmd->setCollection( createJob->collection() );
+        cmd->setSession( m_session );
+        cmd->start();
+    }
 }
 
-void CreateFeedCommand::Private::modificationDone( KJob* j )
+void CreateFeedCommand::Private::modificationDone()
 {
-    if ( j->error() )
-        q->setErrorAndEmitResult( i18n("Could not edit feed: %1", j->errorString()) );
+    EditFeedCommand* cmd = qobject_cast<EditFeedCommand*>( q->sender() );
+    Q_ASSERT( cmd );
+    if ( cmd->error() )
+        q->setErrorAndEmitResult( i18n("Could not edit feed: %1", cmd->errorString()) );
     else
         q->emitResult();
 }
diff --git a/akregator2/src/createfeedcommand.h b/akregator2/src/createfeedcommand.h
index 1d8a42c..2958276 100644
--- a/akregator2/src/createfeedcommand.h
+++ b/akregator2/src/createfeedcommand.h
@@ -59,7 +59,7 @@ private:
     Private* const d;
     Q_PRIVATE_SLOT( d, void doCreate() )
     Q_PRIVATE_SLOT( d, void creationDone( KJob* ) )
-    Q_PRIVATE_SLOT( d, void modificationDone( KJob* ) )
+    Q_PRIVATE_SLOT( d, void modificationDone() )
 
 };
 

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

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