kexi

kexicsvexportwizard.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005,2006 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXI_CSVEXPORTEIZARD_H
00021 #define KEXI_CSVEXPORTEIZARD_H
00022 
00023 #include <kwizard.h>
00024 
00025 class QCheckBox;
00026 class QGroupBox;
00027 class KPushButton;
00028 class KexiMainWindow;
00029 class KexiStartupFileDialog;
00030 class KexiCSVDelimiterWidget;
00031 class KexiCSVTextQuoteComboBox;
00032 class KexiCSVInfoLabel;
00033 class KexiCharacterEncodingComboBox;
00034 namespace KexiDB {
00035     class TableOrQuerySchema;
00036 }
00037 
00040 class KexiCSVExportWizard : public KWizard
00041 {
00042     Q_OBJECT
00043 
00044     public:
00046         enum Mode { Clipboard, File };
00047 
00049         class Options {
00050             public:
00051                 Options();
00052                 Mode mode;
00053                 int itemId; 
00054                 QString forceDelimiter; 
00055         };
00056 
00057         KexiCSVExportWizard( const Options& options, KexiMainWindow* mainWin, 
00058             QWidget * parent = 0, const char * name = 0 );
00059 
00060         virtual ~KexiCSVExportWizard();
00061 
00062         bool cancelled() const;
00063 
00064         virtual void showPage ( QWidget * page );
00065 
00066     protected slots:
00067         virtual void next();
00068         virtual void done(int result);
00069         void slotShowOptionsButtonClicked();
00070         void slotDefaultsButtonClicked();
00071 
00072     protected:
00074         virtual void layOutButtonRow( QHBoxLayout * layout );
00075 
00077         bool exportData();
00078 
00080         QString defaultDelimiter() const;
00081 
00083         QString defaultTextQuote() const;
00084 
00089         bool readBoolEntry(const char *key, bool defaultValue);
00090 
00092         QString readEntry(const char *key, const QString& defaultValue = QString::null);
00093 
00098         void writeEntry(const char *key, bool value);
00099 
00101         void writeEntry(const char *key, const QString& value);
00102 
00104         void deleteEntry(const char *key);
00105 
00106         Options m_options;
00107 //      Mode m_mode;
00108 //      int m_itemId;
00109         KexiMainWindow* m_mainWin;
00110         KexiStartupFileDialog* m_fileSavePage;
00111         QWidget* m_exportOptionsPage;
00112         KPushButton *m_showOptionsButton;
00113         KPushButton *m_defaultsBtn;
00114         QGroupBox* m_exportOptionsSection;
00115         KexiCSVInfoLabel *m_infoLblFrom, *m_infoLblTo;
00116         KexiCSVDelimiterWidget* m_delimiterWidget;
00117         KexiCSVTextQuoteComboBox* m_textQuote;
00118         KexiCharacterEncodingComboBox *m_characterEncodingCombo;
00119         QCheckBox* m_addColumnNamesCheckBox, *m_alwaysUseCheckBox;
00120         KexiDB::TableOrQuerySchema* m_tableOrQuery;
00121         int m_rowCount; 
00122         bool m_rowCountDetermined : 1;
00123         bool m_cancelled : 1;
00124 };
00125 
00126 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys