csvdialog.h
1/* This file is part of the KDE project
2 Copyright (C) 1999 David Faure <faure@kde.org>
3 Copyright (C) 2004 Nicolas GOUTTE <goutte@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef CSVDIALOG_H
22#define CSVDIALOG_H
23
24#include <tqstringlist.h>
25
26#include <kdialogbase.h>
27
28class DialogUI;
29
30class CSVDialog : public KDialogBase
31{
32 TQ_OBJECT
33
34public:
35 enum Header
36 {
37 TEXT,
38 NUMBER,
39 DATE,
40 CURRENCY,
41 COMMANUMBER,
42 POINTNUMBER
43 };
44
45 CSVDialog(TQWidget* parent, TQByteArray& fileArray, const TQString seperator);
46 ~CSVDialog();
47
48 int getRows();
49 int getCols();
50 int getHeader(int col);
51 TQString getText(int row, int col);
52
53private:
54 void loadSettings();
55 void saveSettings();
56 void fillTable();
57 void fillComboBox();
58 void setText(int row, int col, const TQString& text);
59 void adjustRows(int iRows);
60 void adjustCols(int iCols);
61 bool checkUpdateRange();
62 TQTextCodec* getCodec(void) const;
63
64 bool m_adjustRows;
65 bool m_adjustCols;
66 int m_startRow;
67 int m_startCol;
68 int m_endRow;
69 int m_endCol;
70 TQChar m_textquote;
71 TQString m_delimiter;
72 bool m_ignoreDups;
73 TQByteArray m_fileArray;
74 DialogUI * m_dialog;
75 TQTextCodec* m_codec;
76 TQStringList m_formatList;
77
78private slots:
79 void returnPressed();
80 void formatChanged( const TQString& );
81 void delimiterClicked(int id);
82 void textquoteSelected(const TQString& mark);
83 void currentCellChanged(int, int col);
84 void textChanged ( const TQString & );
85 void ignoreDuplicatesChanged( int );
86 void updateClicked();
87 void encodingChanged ( const TQString & );
88};
89
90#endif