summaryrefslogtreecommitdiffstats
path: root/knewsticker/common/xmlnewsaccess.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /knewsticker/common/xmlnewsaccess.h
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker/common/xmlnewsaccess.h')
-rw-r--r--knewsticker/common/xmlnewsaccess.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/knewsticker/common/xmlnewsaccess.h b/knewsticker/common/xmlnewsaccess.h
new file mode 100644
index 00000000..91cbf77f
--- /dev/null
+++ b/knewsticker/common/xmlnewsaccess.h
@@ -0,0 +1,86 @@
+/*
+ * xmlnewsaccess.h
+ *
+ * Copyright (c) 2001 Frerich Raabe <raabe@kde.org>
+ *
+ * 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. For licensing and distribution details, check the
+ * accompanying file 'COPYING'.
+ */
+#ifndef XMLNEWSACCESS_H
+#define XMLNEWSACCESS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qvaluelist.h>
+#include <qobject.h>
+
+#include <kio/job.h>
+#include <kurl.h>
+
+class QBuffer;
+class QDomDocument;
+class XMLNewsSource;
+
+class XMLNewsArticle
+{
+ public:
+ typedef QValueList<XMLNewsArticle> List;
+
+ XMLNewsArticle() {}
+ XMLNewsArticle(const QString &headline, const KURL &addresss);
+ XMLNewsArticle(const XMLNewsArticle &other) { (*this) = other; }
+ XMLNewsArticle &operator=(const XMLNewsArticle &other);
+
+ QString headline() const { return m_headline; }
+ void setHeadline(const QString &headline) { m_headline = headline; }
+
+ KURL address() const { return m_address; }
+ void setAddress(const KURL &address) { m_address = address; }
+
+ bool operator== (const XMLNewsArticle &a);
+ bool operator!= (const XMLNewsArticle &a) { return !operator==(a); }
+
+ private:
+ QString m_headline;
+ KURL m_address;
+};
+
+class XMLNewsSource : public QObject
+{
+ Q_OBJECT
+
+ public:
+ XMLNewsSource();
+ virtual ~XMLNewsSource();
+
+ void loadFrom(const KURL &);
+
+ virtual QString newsSourceName() const { return m_name; }
+ virtual QString link() const { return m_link; }
+ virtual QString description() const { return m_description; }
+ const XMLNewsArticle::List &articles() const { return m_articles; }
+
+ signals:
+ void loadComplete(XMLNewsSource *, bool);
+
+ protected:
+ void processData(const QByteArray &, bool = true);
+
+ QString m_name;
+ QString m_link;
+ QString m_description;
+
+ private slots:
+ void slotData(KIO::Job *, const QByteArray &);
+ void slotResult(KIO::Job *);
+
+ private:
+ XMLNewsArticle::List m_articles;
+ QBuffer *m_downloadData;
+};
+
+#endif // XMLNEWSACCESS_H