00001 #ifndef __RECORDTABLEDATA_H__
00002 #define __RECORDTABLEDATA_H__
00003
00004 #include <QAbstractListModel>
00005 #include <QModelIndex>
00006 #include <QVariant>
00007 #include <QObject>
00008 #include <QtXml>
00009
00010
00011 class recordtabledata : public QObject
00012 {
00013 Q_OBJECT
00014
00015 public:
00016 recordtabledata(QObject *pobj=0);
00017 virtual ~recordtabledata();
00018
00019
00020 QString get_text(int pos) const;
00021
00022
00023 QString get_field(QString name, int pos) const;
00024
00025
00026 void set_field(QString name, QString value, int pos);
00027
00028
00029 QMap<QString, QString> get_fields(int pos) const;
00030
00031
00032 QMap<QString, QString> get_record_img(int pos) const;
00033
00034
00035 void init(QDomElement dommodel);
00036
00037
00038 void clear(void);
00039
00040
00041 int size(void);
00042
00043
00044 QDomDocument export_data_to_dom(void);
00045
00046 int insert_new_record(int mode, int pos,
00047 QString name,
00048 QString author,
00049 QString url,
00050 QString tags,
00051 QString text);
00052 void edit_record(int pos,
00053 QString name,
00054 QString author,
00055 QString url,
00056 QString tags);
00057 void delete_record(int i);
00058 void delete_records(QVector<int> delidx);
00059
00060 void moveup(int pos);
00061 void movedn(int pos);
00062
00063 private:
00064
00065 void setup_data_from_dom(QDomElement *dommodel);
00066
00067 typedef QMap<QString, QString> reclintype;
00068 QList< reclintype > table;
00069
00070 };
00071
00072 #endif
00073