kexicsvwidgets.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KEXI_CSVWIDGETS_H
21#define KEXI_CSVWIDGETS_H
22
23#include <tqvaluevector.h>
24#include <kcombobox.h>
25
26class KLineEdit;
27class KActiveLabel;
28class TQLabel;
29
30#define KEXICSV_DEFAULT_FILE_TEXT_QUOTE "\""
31#define KEXICSV_DEFAULT_CLIPBOARD_TEXT_QUOTE ""
32#define KEXICSV_DEFAULT_FILE_DELIMITER ","
33#define KEXICSV_DEFAULT_CLIPBOARD_DELIMITER "\t"
34#define KEXICSV_DEFAULT_FILE_DELIMITER_INDEX 0
35
37TQStringList csvMimeTypes();
38
42class KexiCSVInfoLabel : public TQWidget
43{
44 public:
45 /* Sets up a new info label \a labelText label with text like "Preview of data from file:".
46 setFileName() can be used to display filename and setCommentAfterFileName() to display
47 additional comment.
48
49 The widget's layout can look like this:
50
51 \pre [icon] [labeltext] [filename] [comment]
52 */
53 KexiCSVInfoLabel( const TQString& labelText, TQWidget* parent );
54
55 void setFileName( const TQString& fileName );
56 void setLabelText( const TQString& text );
57 void setCommentText( const TQString& text );
58// void setIconForFileName();
59
61 void setIcon(const TQString& iconName);
62
63 TQLabel* leftLabel() const { return m_leftLabel; }
64 KActiveLabel* fileNameLabel() const { return m_fnameLbl; }
65 KActiveLabel* commentLabel() const { return m_commentLbl; }
66 TQFrame* separator() const { return m_separator; }
67
68 protected:
69 TQLabel *m_leftLabel, *m_iconLbl;
70 KActiveLabel *m_fnameLbl, *m_commentLbl;
71 TQFrame* m_separator;
72};
73
76class KexiCSVDelimiterWidget : public TQWidget
77{
78 TQ_OBJECT
79
80
81 public:
82 KexiCSVDelimiterWidget( bool lineEditOnBottom, TQWidget * parent = 0 );
83
84 TQString delimiter() const { return m_delimiter; }
85 void setDelimiter(const TQString& delimiter);
86
87 signals:
88 void delimiterChanged(const TQString& delimiter);
89
90 protected slots:
92 void slotDelimiterChanged(int idx);
93 void slotDelimiterChangedInternal(int idx);
94 void slotDelimiterLineEditTextChanged( const TQString & );
95 void slotDelimiterLineEditReturnPressed();
96
97 protected:
98 TQString m_delimiter;
99 TQValueVector<TQString> m_availableDelimiters;
100 KComboBox* m_combo;
101 KLineEdit* m_delimiterEdit;
102};
103
106class KexiCSVTextQuoteComboBox : public KComboBox
107{
108 public:
109 KexiCSVTextQuoteComboBox( TQWidget * parent = 0 );
110
111 TQString textQuote() const;
112
114 void setTextQuote(const TQString& textQuote);
115};
116
117#endif
A combo box widget providing a list of possible delimiters Used by CSV import and export dialogs.
void slotDelimiterChanged(int idx)
only called when a delimiter was set by user directly
A helper widget showing a short text information with an icon. See ctor for details....
void setIcon(const TQString &iconName)
sets icon pixmap to iconName. Used wher setIconForFilename was false in ctor.
A combo box widget providing a list of possible quote characters Used by CSV import and export dialog...
void setTextQuote(const TQString &textQuote)
Sets text quote. Only available are: ", ', and empty string.