[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/krss/resources/libkrssresource
From: Dmitry Ivanov <vonami () gmail ! com>
Date: 2009-03-28 20:41:09
Message-ID: 1238272869.239186.28497.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 946193 by divanov:
Copy and adapt ImportItemsJob from the old rss resource.
The refactoring is basically finished, time to write more
unit tests and then replace the old resource.
M +2 -0 CMakeLists.txt
AM importitemsjob.cpp \
trunk/playground/pim/krss/resource/importitemsjob.cpp#946108 [License: GPL (v2+)] AM \
importitemsjob.h trunk/playground/pim/krss/resource/importitemsjob.h#946108 \
[License: GPL (v2+)] AM itemimportreader.cpp \
trunk/playground/pim/krss/resource/itemimportreader.cpp#946108 [License: GPL (v2+)] \
AM itemimportreader.h \
trunk/playground/pim/krss/resource/itemimportreader.h#946108 [License: GPL (v2+)] M \
+3 -1 org.kde.krss.xml M +24 -2 rssresourcebase.cpp
M +3 -1 rssresourcebase.h
--- trunk/playground/pim/krss/resources/libkrssresource/CMakeLists.txt #946192:946193
@@ -4,6 +4,8 @@
rssresourcebasejobs.cpp
importopmljob.cpp
exportopmljob.cpp
+ importitemsjob.cpp
+ itemimportreader.cpp
batchitemmodifyjob.cpp
rssitemsync.cpp
util.cpp
** trunk/playground/pim/krss/resources/libkrssresource/importitemsjob.cpp #property \
svn:mergeinfo +
** trunk/playground/pim/krss/resources/libkrssresource/importitemsjob.h #property \
svn:mergeinfo +
** trunk/playground/pim/krss/resources/libkrssresource/itemimportreader.cpp #property \
svn:mergeinfo +
** trunk/playground/pim/krss/resources/libkrssresource/itemimportreader.h #property \
svn:mergeinfo +
--- trunk/playground/pim/krss/resources/libkrssresource/org.kde.krss.xml \
#946192:946193 @@ -63,7 +63,9 @@
<arg name="path" type="s" direction="in"/>
</method>
<method name="importItems">
- <arg type="b" direction="out"/>
+ <arg type="a{sv}" direction="out">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" \
value="QVariantMap"/> + </arg>
<arg name="url" type="s" direction="in"/>
<arg name="path" type="s" direction="in"/>
</method>
--- trunk/playground/pim/krss/resources/libkrssresource/rssresourcebase.cpp \
#946192:946193 @@ -21,6 +21,7 @@
#include "rssresourcebasejobs.h"
#include "importopmljob.h"
#include "exportopmljob.h"
+#include "importitemsjob.h"
#include "libkrss/resourcemanager.h"
#include <KDE/Akonadi/CollectionFetchJob>
@@ -221,9 +222,15 @@
return QVariantMap();
}
-bool RssResourceBase::importItems( const QString& xmlUrl, const QString& path )
+QVariantMap RssResourceBase::importItems( const QString& xmlUrl, const QString& path \
) {
- return false;
+ ImportItemsJob *job = new ImportItemsJob( xmlUrl, this );
+ job->setSourceFile( path );
+ connect( job, SIGNAL( result( KJob* ) ), this, SLOT( slotItemsImported( KJob* ) \
) ); + setDelayedReply( true );
+ d->m_replies.insert( job, QDBusContext::message().createReply() );
+ job->start();
+ return QVariantMap();
}
bool RssResourceBase::retrieveItem( const Akonadi::Item &item, const \
QSet<QByteArray> &parts ) @@ -445,4 +452,19 @@
QDBusConnection::sessionBus().send( replyMessage );
}
+void RssResourceBase::slotItemsImported( KJob *job )
+{
+ if ( job->error() ) {
+ kWarning() << job->errorString();
+ }
+
+ Q_ASSERT( d->m_replies.contains( job ) );
+ QDBusMessage replyMessage = d->m_replies.take( job );
+ QVariantMap result;
+ result.insert( "error", job->error() );
+ result.insert( "errorString", job->errorString() );
+ replyMessage << result;
+ QDBusConnection::sessionBus().send( replyMessage );
+}
+
#include "rssresourcebase.moc"
--- trunk/playground/pim/krss/resources/libkrssresource/rssresourcebase.h \
#946192:946193 @@ -51,6 +51,7 @@
friend class FeedCollectionFetchJob;
friend class ImportOpmlJob;
friend class ExportOpmlJob;
+ friend class ImportItemsJob;
public:
explicit RssResourceBase( const QString& id );
@@ -76,7 +77,7 @@
QStringList subscriptions( const KRss::Feed::Id& id );
QVariantMap importOpml( const QString &path, const QString &defaultTag );
QVariantMap exportOpml( const QString &path );
- bool importItems( const QString& xmlUrl, const QString& path );
+ QVariantMap importItems( const QString& xmlUrl, const QString& path );
Q_SIGNALS:
// D-Bus interface
@@ -104,6 +105,7 @@
void slotFeedFetched( KJob *job );
void slotOpmlImported( KJob *job );
void slotOpmlExported( KJob *job );
+ void slotItemsImported( KJob *job );
private:
virtual bool flagsSynchronizable() const = 0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic