From 8362bf63dea22bbf6736609b0f49c152f975eb63 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 20 Jan 2010 01:29:50 +0000 Subject: Added old abandoned KDE3 version of koffice git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kexi/plugins/importexport/csv/kexicsvwidgets.h | 116 +++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 kexi/plugins/importexport/csv/kexicsvwidgets.h (limited to 'kexi/plugins/importexport/csv/kexicsvwidgets.h') diff --git a/kexi/plugins/importexport/csv/kexicsvwidgets.h b/kexi/plugins/importexport/csv/kexicsvwidgets.h new file mode 100644 index 00000000..f128b658 --- /dev/null +++ b/kexi/plugins/importexport/csv/kexicsvwidgets.h @@ -0,0 +1,116 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef KEXI_CSVWIDGETS_H +#define KEXI_CSVWIDGETS_H + +#include +#include + +class KLineEdit; +class KActiveLabel; +class QLabel; + +#define KEXICSV_DEFAULT_FILE_TEXT_QUOTE "\"" +#define KEXICSV_DEFAULT_CLIPBOARD_TEXT_QUOTE "" +#define KEXICSV_DEFAULT_FILE_DELIMITER "," +#define KEXICSV_DEFAULT_CLIPBOARD_DELIMITER "\t" +#define KEXICSV_DEFAULT_FILE_DELIMITER_INDEX 0 + +//! \return a list of mimetypes usable for handling CSV format handling +QStringList csvMimeTypes(); + +/*! @short A helper widget showing a short text information with an icon. + See ctor for details. + Used by CSV import and export dialogs. */ +class KexiCSVInfoLabel : public QWidget +{ + public: + /* Sets up a new info label \a labelText label with text like "Preview of data from file:". + setFileName() can be used to display filename and setCommentAfterFileName() to display + additional comment. + + The widget's layout can look like this: + + \pre [icon] [labeltext] [filename] [comment] + */ + KexiCSVInfoLabel( const QString& labelText, QWidget* parent ); + + void setFileName( const QString& fileName ); + void setLabelText( const QString& text ); + void setCommentText( const QString& text ); +// void setIconForFileName(); + + //! sets icon pixmap to \a iconName. Used wher setIconForFilename was false in ctor. + void setIcon(const QString& iconName); + + QLabel* leftLabel() const { return m_leftLabel; } + KActiveLabel* fileNameLabel() const { return m_fnameLbl; } + KActiveLabel* commentLabel() const { return m_commentLbl; } + QFrame* separator() const { return m_separator; } + + protected: + QLabel *m_leftLabel, *m_iconLbl; + KActiveLabel *m_fnameLbl, *m_commentLbl; + QFrame* m_separator; +}; + +//! @short A combo box widget providing a list of possible delimiters +//! Used by CSV import and export dialogs +class KexiCSVDelimiterWidget : public QWidget +{ + Q_OBJECT + + public: + KexiCSVDelimiterWidget( bool lineEditOnBottom, QWidget * parent = 0 ); + + QString delimiter() const { return m_delimiter; } + void setDelimiter(const QString& delimiter); + + signals: + void delimiterChanged(const QString& delimiter); + + protected slots: + //! only called when a delimiter was set by user directly + void slotDelimiterChanged(int idx); + void slotDelimiterChangedInternal(int idx); + void slotDelimiterLineEditTextChanged( const QString & ); + void slotDelimiterLineEditReturnPressed(); + + protected: + QString m_delimiter; + QValueVector m_availableDelimiters; + KComboBox* m_combo; + KLineEdit* m_delimiterEdit; +}; + +//! @short A combo box widget providing a list of possible quote characters +//! Used by CSV import and export dialogs +class KexiCSVTextQuoteComboBox : public KComboBox +{ + public: + KexiCSVTextQuoteComboBox( QWidget * parent = 0 ); + + QString textQuote() const; + + //! Sets text quote. Only available are: ", ', and empty string. + void setTextQuote(const QString& textQuote); +}; + +#endif -- cgit v1.2.1