kchart

csvimportdialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999 David Faure <faure@kde.org>
00003    Copyright (C) 2004 Nicolas GOUTTE <goutte@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef CSVIMPORTDIALOG_H
00022 #define CSVIMPORTDIALOG_H
00023 
00024 #include <qstringlist.h>
00025 
00026 #include <kdialogbase.h>
00027 
00028 class DialogUI;
00029 
00030 class CSVImportDialog : public KDialogBase
00031 {
00032     Q_OBJECT
00033 public:
00034     enum Header
00035     {
00036         TEXT,       
00037         NUMBER,     
00038         DATE,       
00039         CURRENCY,   
00040         COMMANUMBER,
00041         POINTNUMBER 
00042     };
00043 
00044     CSVImportDialog(QWidget* parent, QByteArray& fileArray);
00045     ~CSVImportDialog();
00046 
00047     bool     firstRowContainHeaders();
00048     bool     firstColContainHeaders();
00049     int      rows();
00050     int      cols();
00051     int      headerType(int col);
00052     QString  text(int row, int col);
00053 
00054 private:
00055     void fillTable();
00056     void fillComboBox();
00057     void setText(int row, int col, const QString& text);
00058     void adjustRows(int iRows);
00059     void adjustCols(int iCols);
00060     bool checkUpdateRange();
00061     QTextCodec* getCodec(void) const;
00062 
00063     // The real contents of the dialog
00064     DialogUI  *m_dialog;
00065 
00066     bool       m_adjustRows;
00067     bool       m_adjustCols;
00068     int        m_startRow;
00069     int        m_startCol;
00070     int        m_endRow;
00071     int        m_endCol;
00072     QChar      m_textquote;
00073     QString    m_delimiter;
00074     bool       m_ignoreDups;
00075     QByteArray m_fileArray;
00076     QTextCodec *m_codec;
00077     QStringList m_formatList; 
00078 
00079 private slots:
00080     void returnPressed();
00081     void formatChanged( const QString& );
00082     void delimiterClicked(int id);
00083     void textquoteSelected(const QString& mark);
00084     void currentCellChanged(int, int col);
00085     void textChanged ( const QString & );
00086     void ignoreDuplicatesChanged( int );
00087     void updateClicked();
00088     void encodingChanged ( const QString & );
00089 };
00090 
00091 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys