diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
commit | e38d2351b83fa65c66ccde443777647ef5cb6cff (patch) | |
tree | 1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/translators/tellicoimporter.h | |
download | tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip |
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/translators/tellicoimporter.h')
-rw-r--r-- | src/translators/tellicoimporter.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/translators/tellicoimporter.h b/src/translators/tellicoimporter.h new file mode 100644 index 0000000..d4c6e13 --- /dev/null +++ b/src/translators/tellicoimporter.h @@ -0,0 +1,100 @@ +/*************************************************************************** + copyright : (C) 2003-2006 by Robby Stephenson + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#ifndef TELLICO_IMPORTER_H +#define TELLICO_IMPORTER_H + +class QBuffer; +class KZip; +class KArchiveDirectory; + +#include "dataimporter.h" +#include "../datavectors.h" +#include "../stringset.h" + +class QDomElement; + +namespace Tellico { + namespace Import { + +/** + * Reading the @ref Tellico data files is done by the TellicoImporter. + * + * @author Robby Stephenson + */ +class TellicoImporter : public DataImporter { +Q_OBJECT + +public: + enum Format { Unknown, Error, XML, Zip, Cancel }; + + /** + * @param url The tellico data file. + */ + TellicoImporter(const KURL& url, bool loadAllImages=true); + /** + * Constructor used to convert arbitrary text to a @ref Collection + * + * @param text The text + */ + TellicoImporter(const QString& text); + virtual ~TellicoImporter(); + + /** + * sometimes, a new document format might add data + */ + bool modifiedOriginal() const { return m_modified; } + + /** + */ + virtual Data::CollPtr collection(); + Format format() const { return m_format; } + + bool hasImages() const { return m_hasImages; } + bool loadImage(const QString& id_); + + static bool loadAllImages(const KURL& url); + +public slots: + void slotCancel(); + +private: + static bool versionConversion(uint from, uint to); + + void loadXMLData(const QByteArray& data, bool loadImages); + void loadZipData(); + + void readField(uint syntaxVersion, const QDomElement& elem); + void readEntry(uint syntaxVersion, const QDomElement& elem); + void readImage(const QDomElement& elem, bool loadImage); + void readFilter(const QDomElement& elem); + void readBorrower(const QDomElement& elem); + void addDefaultFilters(); + + Data::CollPtr m_coll; + bool m_loadAllImages; + QString m_namespace; + Format m_format; + bool m_modified : 1; + bool m_cancelled : 1; + bool m_hasImages : 1; + StringSet m_images; + + QBuffer* m_buffer; + KZip* m_zip; + const KArchiveDirectory* m_imgDir; +}; + + } // end namespace +} // end namespace +#endif |