kexi

kexicsvwidgets.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 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_CSVWIDGETS_H
00021 #define KEXI_CSVWIDGETS_H
00022 
00023 #include <qvaluevector.h>
00024 #include <kcombobox.h>
00025 
00026 class KLineEdit;
00027 class KActiveLabel;
00028 class QLabel;
00029 
00030 #define KEXICSV_DEFAULT_TEXT_QUOTE "\""
00031 #define KEXICSV_DEFAULT_FILE_DELIMITER ","
00032 #define KEXICSV_DEFAULT_CLIPBOARD_DELIMITER "\t"
00033 #define KEXICSV_DEFAULT_FILE_DELIMITER_INDEX 0
00034 
00036 QStringList csvMimeTypes();
00037 
00041 class KexiCSVInfoLabel : public QWidget
00042 {
00043     public:
00044         /* Sets up a new info label \a labelText label with text like "Preview of data from file:".
00045          setFileName() can be used to display filename and setCommentAfterFileName() to display 
00046          additional comment.
00047 
00048          The widget's layout can look like this:
00049 
00050          \pre [icon] [labeltext] [filename] [comment]
00051         */
00052         KexiCSVInfoLabel( const QString& labelText, QWidget* parent );
00053 
00054         void setFileName( const QString& fileName );
00055         void setLabelText( const QString& text );
00056         void setCommentText( const QString& text );
00057 //      void setIconForFileName();
00058 
00060         void setIcon(const QString& iconName);
00061 
00062         QLabel* leftLabel() const { return m_leftLabel; }
00063         KActiveLabel* fileNameLabel() const { return m_fnameLbl; }
00064         KActiveLabel* commentLabel() const { return m_commentLbl; }
00065         QFrame* separator() const { return m_separator; }
00066 
00067     protected:
00068         QLabel *m_leftLabel, *m_iconLbl;
00069         KActiveLabel *m_fnameLbl, *m_commentLbl;
00070         QFrame* m_separator;
00071 };
00072 
00075 class KexiCSVDelimiterWidget : public QWidget
00076 {
00077     Q_OBJECT
00078 
00079     public:
00080         KexiCSVDelimiterWidget( bool lineEditOnBottom, QWidget * parent = 0 );
00081 
00082         QString delimiter() const { return m_delimiter; }
00083         void setDelimiter(const QString& delimiter);
00084 
00085     signals:
00086         void delimiterChanged(const QString& delimiter);
00087 
00088     protected slots:
00090         void slotDelimiterChanged(int idx);
00091         void slotDelimiterChangedInternal(int idx);
00092         void slotDelimiterLineEditTextChanged( const QString & );
00093         void slotDelimiterLineEditReturnPressed();
00094 
00095     protected:
00096         QString m_delimiter;
00097         QValueVector<QString> m_availableDelimiters;
00098         KComboBox* m_combo;
00099         KLineEdit* m_delimiterEdit;
00100 };
00101 
00104 class KexiCSVTextQuoteComboBox : public KComboBox
00105 {
00106     public:
00107         KexiCSVTextQuoteComboBox( QWidget * parent = 0 );
00108 
00109         QString textQuote() const;
00110 
00112         void setTextQuote(const QString& textQuote);
00113 };
00114 
00115 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys