You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
3.4 KiB
138 lines
3.4 KiB
15 years ago
|
/*
|
||
13 years ago
|
This file is part of libtdepim.
|
||
15 years ago
|
|
||
|
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
|
||
|
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
|
||
|
|
||
|
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 KIMPORTDIALOG_H
|
||
|
#define KIMPORTDIALOG_H
|
||
|
|
||
15 years ago
|
#include <tqintdict.h>
|
||
|
#include <tqstringlist.h>
|
||
|
#include <tqspinbox.h>
|
||
|
#include <tqptrvector.h>
|
||
|
#include <tqvaluevector.h>
|
||
15 years ago
|
|
||
|
#include <kdialogbase.h>
|
||
|
|
||
15 years ago
|
class TQTable;
|
||
|
class TQListView;
|
||
15 years ago
|
|
||
|
class KImportDialog;
|
||
|
class KComboBox;
|
||
|
|
||
|
class KImportColumn
|
||
|
{
|
||
|
public:
|
||
|
enum { FormatUndefined = 0, FormatPlain, FormatUnquoted, FormatBracketed, FormatLast };
|
||
|
|
||
15 years ago
|
KImportColumn(KImportDialog *dlg, const TQString &header, int count = 0);
|
||
15 years ago
|
virtual ~KImportColumn() {}
|
||
|
|
||
15 years ago
|
TQString header() const { return m_header; }
|
||
15 years ago
|
|
||
15 years ago
|
TQValueList<int> formats();
|
||
|
TQString formatName(int format);
|
||
15 years ago
|
int defaultFormat();
|
||
|
|
||
15 years ago
|
TQString convert();
|
||
|
// virtual void convert(const TQString &value,int format) = 0;
|
||
|
TQString preview(const TQString &value,int format);
|
||
15 years ago
|
|
||
|
void addColId(int i);
|
||
|
void removeColId(int i);
|
||
|
|
||
15 years ago
|
TQValueList<int> colIdList();
|
||
15 years ago
|
|
||
|
protected:
|
||
|
|
||
|
private:
|
||
|
int m_maxCount, m_refCount;
|
||
|
|
||
15 years ago
|
TQString m_header;
|
||
|
TQValueList<int> mFormats;
|
||
15 years ago
|
int mDefaultFormat;
|
||
|
|
||
15 years ago
|
TQValueList<int> mColIds;
|
||
15 years ago
|
|
||
|
KImportDialog *mDialog;
|
||
|
};
|
||
|
|
||
|
class KImportDialog : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
14 years ago
|
KImportDialog(TQWidget* parent);
|
||
15 years ago
|
|
||
|
public slots:
|
||
15 years ago
|
bool setFile(const TQString& file);
|
||
15 years ago
|
|
||
15 years ago
|
TQString cell(uint row);
|
||
15 years ago
|
|
||
|
void addColumn(KImportColumn *);
|
||
|
|
||
|
protected:
|
||
|
void readFile( int rows = 10 );
|
||
|
|
||
|
void fillTable();
|
||
|
void registerColumns();
|
||
|
int findFormat(int column);
|
||
|
|
||
|
virtual void convertRow() {}
|
||
|
|
||
|
protected slots:
|
||
|
void separatorClicked(int id);
|
||
15 years ago
|
void formatSelected(TQListViewItem* item);
|
||
|
void headerSelected(TQListViewItem* item);
|
||
|
void assignColumn(TQListViewItem *);
|
||
15 years ago
|
void assignColumn();
|
||
|
void assignTemplate();
|
||
|
void removeColumn();
|
||
|
void applyConverter();
|
||
|
void tableSelected();
|
||
15 years ago
|
void slotUrlChanged(const TQString & );
|
||
15 years ago
|
void saveTemplate();
|
||
|
|
||
|
private:
|
||
|
void updateFormatSelection(int column);
|
||
15 years ago
|
void setCellText(int row, int col, const TQString& text);
|
||
15 years ago
|
|
||
15 years ago
|
void setData( uint row, uint col, const TQString &text );
|
||
|
TQString data( uint row, uint col );
|
||
15 years ago
|
|
||
15 years ago
|
TQListView *mHeaderList;
|
||
|
TQSpinBox *mStartRow;
|
||
|
TQSpinBox *mEndRow;
|
||
|
TQTable *mTable;
|
||
15 years ago
|
|
||
|
KComboBox *mFormatCombo;
|
||
|
KComboBox *mSeparatorCombo;
|
||
|
|
||
15 years ago
|
TQString mSeparator;
|
||
15 years ago
|
int mCurrentRow;
|
||
15 years ago
|
TQString mFile;
|
||
|
TQIntDict<KImportColumn> mColumnDict;
|
||
|
TQIntDict<uint> mTemplateDict;
|
||
|
TQMap<int,int> mFormats;
|
||
|
TQPtrList<KImportColumn> mColumns;
|
||
|
TQPtrVector<TQValueVector<TQString> > mData;
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif
|