[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim-runtime/akregator_port] plugins: Move krss from playground. There are still some issues with
From: Dmitry Ivanov <vonami () gmail ! com>
Date: 2012-03-31 15:16:46
Message-ID: 20120331151646.1A3EDA60A9 () git ! kde ! org
[Download RAW message or body]
Git commit 2d85d3d4a5a82c39ad145b9ebd3a4da463df4216 by Dmitry Ivanov.
Committed on 17/07/2009 at 15:22.
Pushed by osterfeld into branch 'akregator_port'.
Move krss from playground. There are still some issues with #includes
but it builds fine (will fix it later).
svn path=/branches/work/akonadi-ports/kdepim/; revision=998342
A +9 -0 plugins/CMakeLists.txt
A +109 -0 plugins/akonadi_serializer_rss.cpp [License: GPL (v2+)]
A +41 -0 plugins/akonadi_serializer_rss.desktop
A +45 -0 plugins/akonadi_serializer_rss.h [License: GPL (v2+)]
http://commits.kde.org/kdepim-runtime/2d85d3d4a5a82c39ad145b9ebd3a4da463df4216
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
new file mode 100644
index 0000000..f807908
--- /dev/null
+++ b/plugins/CMakeLists.txt
@@ -0,0 +1,9 @@
+set(akonadi_serializer_rss_SRCS
+ akonadi_serializer_rss.cpp
+)
+
+kde4_add_plugin(akonadi_serializer_rss ${akonadi_serializer_rss_SRCS})
+target_link_libraries(akonadi_serializer_rss ${KDE4_KIO_LIBS} \
${KDEPIMLIBS_AKONADI_LIBS} krss) +
+install(TARGETS akonadi_serializer_rss DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES akonadi_serializer_rss.desktop DESTINATION \
"${DATA_INSTALL_DIR}/akonadi/plugins/serializer")
diff --git a/plugins/akonadi_serializer_rss.cpp b/plugins/akonadi_serializer_rss.cpp
new file mode 100644
index 0000000..6bfe699
--- /dev/null
+++ b/plugins/akonadi_serializer_rss.cpp
@@ -0,0 +1,109 @@
+/*
+ Copyright (C) 2008 Dmitry Ivanov <vonami@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "akonadi_serializer_rss.h"
+
+#include <krss/item.h>
+#include <krss/rssitem.h>
+
+#include <akonadi/item.h>
+
+#include <QtCore/qplugin.h>
+
+using namespace KRss;
+
+bool SerializerPluginRss::deserialize( Akonadi::Item& item, const QByteArray& label, \
QIODevice& data, int version ) +{
+ Q_UNUSED( version )
+
+ if ( label != Akonadi::Item::FullPayload && label != KRss::Item::HeadersPart &&
+ label != KRss::Item::ContentPart )
+ return false;
+
+ RssItem rssItem;
+ if ( item.hasPayload<RssItem>() ) {
+ rssItem = item.payload<RssItem>();
+ }
+
+ if ( label == Akonadi::Item::FullPayload ) {
+ m_serializer.deserialize( rssItem, data.readAll(), RssItemSerializer::Full \
); + }
+ else if ( label == KRss::Item::HeadersPart ) {
+ m_serializer.deserialize( rssItem, data.readAll(), \
RssItemSerializer::Headers ); + }
+ else if ( label == KRss::Item::ContentPart ) {
+ m_serializer.deserialize( rssItem, data.readAll(), \
RssItemSerializer::Content ); + }
+
+ item.setPayload<RssItem>( rssItem );
+ return true;
+}
+
+void SerializerPluginRss::serialize( const Akonadi::Item& item, const QByteArray& \
label, QIODevice& data, int &version ) +{
+ Q_UNUSED( version )
+
+ if ( label != Akonadi::Item::FullPayload && label != KRss::Item::HeadersPart &&
+ label != KRss::Item::ContentPart )
+ return;
+
+ if ( item.mimeType() != Item::mimeType() || !item.hasPayload<RssItem>() )
+ return;
+
+ const RssItem rssItem = item.payload<RssItem>();
+ QByteArray array;
+
+ if ( label == Akonadi::Item::FullPayload ) {
+ m_serializer.serialize( rssItem, array, RssItemSerializer::Full );
+ }
+ else if ( label == KRss::Item::HeadersPart ) {
+ m_serializer.serialize( rssItem, array, RssItemSerializer::Headers );
+ }
+ else if ( label == KRss::Item::ContentPart ) {
+ m_serializer.serialize( rssItem, array, RssItemSerializer::Content );
+ }
+
+ data.write( array );
+}
+
+QSet<QByteArray> SerializerPluginRss::parts( const Akonadi::Item& item ) const
+{
+ QSet<QByteArray> partIdentifiers;
+
+ if ( item.hasPayload<RssItem>() ) {
+ const RssItem rssItem = item.payload<RssItem>();
+
+ if ( rssItem.headersLoaded() ) {
+ partIdentifiers << KRss::Item::HeadersPart ;
+ }
+
+ if ( rssItem.contentLoaded() ) {
+ partIdentifiers << KRss::Item::ContentPart;
+ }
+
+ if ( rssItem.headersLoaded() && rssItem.contentLoaded() ) {
+ partIdentifiers << Akonadi::Item::FullPayload;
+ }
+ }
+
+ return partIdentifiers;
+}
+
+Q_EXPORT_PLUGIN2( akonadi_serializer_rss, SerializerPluginRss )
+
+#include "akonadi_serializer_rss.moc"
diff --git a/plugins/akonadi_serializer_rss.desktop \
b/plugins/akonadi_serializer_rss.desktop new file mode 100644
index 0000000..e6b6638
--- /dev/null
+++ b/plugins/akonadi_serializer_rss.desktop
@@ -0,0 +1,41 @@
+[Misc]
+Name=RSS serializer
+Name[de]=RSS-Serialisierung
+Name[el]= ρομηθευτής RSS
+Name[en_GB]=RSS serialiser
+Name[es]=Envíos en serie de RSS
+Name[et]=RSS-i jadasti
+Name[fr]=Sérialiseur de flux RSS
+Name[ga]=Srathóir RSS
+Name[gl]=Serializador RSS
+Name[ja]=RSS 用シリアライザ
+Name[km]=ការបោះពុម្ព RSS
+Name[nds]=RSS-Reegmnoduul
+Name[pt]=Serializador de RSS
+Name[pt_BR]=Serializador de RSS
+Name[sv]=RSS-serialisering
+Name[tr]=RSS sıralandırıcı
+Name[uk]=Серіалізатор RSS
+Name[x-test]=xxRSS serializerxx
+Comment=An Akonadi serializer plugin for RSS articles
+Comment[de]=Akonadi-Modul zur Serialisierung von RSS-Artikeln
+Comment[el]=Ένα πρόσθετο προσφοράς άρθρων για το \
Akonadi +Comment[en_GB]=An Akonadi serialiser plugin for RSS articles
+Comment[es]=Un complemento para los envíos en serie de Akonadi para los artículos \
RSS +Comment[et]=Akonadi RSS-artiklite jadastamisplugin
+Comment[fr]=Un module de mise en série d'Akonadi pour des articles RSS
+Comment[ga]=Breiseán srathóra Akonadi le haghaidh alt RSS
+Comment[gl]=Unha extensión de Akonadi para serializar artículos RSS
+Comment[ja]=RSS の記事のための Akonadi シリアライザプラグイン
+Comment[km]=កម្មវិធីជំនួយបោះពុម្ពរបស់ \
Akonadi សម្រាប់អត្ថបទ RSS +Comment[nds]=En \
Akonadi-Inreegmoduul för RSS-Artikeln +Comment[pt]=Um 'plugin' de serialização do \
Akonadi para artigos de RSS +Comment[pt_BR]=Um plug-in de serialização do Akonadi \
para artigos de RSS +Comment[sv]=Ett insticksprogram till Akonadi för serialisering \
av RSS-artiklar +Comment[tr]=RSS yazıları için bir Akonadi sıralandırıcısı
+Comment[uk]=Додаток серіалізатора Akonadi для статей \
RSS +Comment[x-test]=xxAn Akonadi serializer plugin for RSS articlesxx
+
+[Plugin]
+Type=application/rss+xml
+X-KDE-Library=akonadi_serializer_rss
diff --git a/plugins/akonadi_serializer_rss.h b/plugins/akonadi_serializer_rss.h
new file mode 100644
index 0000000..ce8a863
--- /dev/null
+++ b/plugins/akonadi_serializer_rss.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2008 Dmitry Ivanov <vonami@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef AKONADI_SERIALIZER_RSS
+#define AKONADI_SERIALIZER_RSS
+
+#include <krss/rssitemserializer.h>
+
+#include <akonadi/itemserializerplugin.h>
+
+class QIODevice;
+
+class SerializerPluginRss : public QObject, public Akonadi::ItemSerializerPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( Akonadi::ItemSerializerPlugin )
+
+public:
+ bool deserialize( Akonadi::Item& item, const QByteArray& label, QIODevice& data, \
int version); + void serialize( const Akonadi::Item& item, const QByteArray& \
label, QIODevice& data, int& version); + QSet<QByteArray> parts( const \
Akonadi::Item& item ) const; +
+private:
+#ifdef KRSS_ENABLE_PROTOBUF_SERIALIZER
+ KRss::ProtobufRssItemSerializerImpl m_serializer;
+#else
+ KRss::RssItemSerializer m_serializer;
+#endif
+};
+
+#endif /* AKONADI_SERIALIZER_RSS */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic