00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DATAEXPORTDIALOG_H
00009 #define DATAEXPORTDIALOG_H
00010
00011 #include <QDialog>
00012 #include <QTextStream>
00013 #include <QSqlTableModel>
00014 #include <QFile>
00015
00016 #include "ui_dataexportdialog.h"
00017
00018 class DataViewer;
00019 class QProgressDialog;
00020 class QSqlQueryModel;
00021
00022
00026 class DataExportDialog : public QDialog
00027 {
00028 Q_OBJECT
00029 public:
00030 DataExportDialog(DataViewer * parent = 0, const QString & tableName = 0);
00031 ~DataExportDialog(){};
00032
00033 bool doExport();
00034
00035 private:
00036 const QString m_tableName;
00037 bool cancelled;
00038 QSqlQueryModel * m_data;
00039 QStringList m_header;
00040 QProgressDialog * progress;
00041
00042 QTextStream out;
00043 QString clipboard;
00044 QFile file;
00045 bool exportFile;
00046
00047 Ui::DataExportDialog ui;
00048 QMap<QString,QString> formats;
00049
00050 bool exportCSV();
00051 bool exportHTML();
00052 bool exportExcelXML();
00053 bool exportSql();
00054 bool exportPython();
00055
00056 bool openStream();
00057 bool closeStream();
00058
00059 bool setProgress(int p);
00060
00063 bool header();
00064 QString endl();
00065
00067 void checkButtonStatus();
00068
00069 private slots:
00070 void fileButton_toggled(bool);
00071 void clipboardButton_toggled(bool);
00072 void fileEdit_textChanged(const QString &);
00073 void searchButton_clicked();
00074 void cancel();
00075 void slotAccepted();
00076 };
00077
00078 #endif