summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxport/csvimportdialog.h
Unidiff
Diffstat (limited to 'kaddressbook/xxport/csvimportdialog.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/csvimportdialog.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/kaddressbook/xxport/csvimportdialog.h b/kaddressbook/xxport/csvimportdialog.h
new file mode 100644
index 0000000..545b5f9
--- a/dev/null
+++ b/kaddressbook/xxport/csvimportdialog.h
@@ -0,0 +1,124 @@
1/*
2 This file is part of KAddressBook.
3 Copyright (C) 2003 Tobias Koenig <tokoe@kde.org>
4 based on the code of KSpread's CSV Import Dialog
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21
22/*
23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk
25
26$Id$
27*/
28
29#ifndef CSV_IMPORT_DLG_H
30#define CSV_IMPORT_DLG_H
31
32#include <kabc/addressbook.h>
33#include <kabc/addresseelist.h>
34#include <kdialogbase.h>
35
36#include <qvaluelist.h>
37
38class KURLRequester;
39
40class QButtonGroup;
41class QComboBox;
42class QCheckBox;
43class QLineEdit;
44class QPushButton;
45class QRadioButton;
46class QTable;
47
48class CSVImportDialog : public KDialogBase
49{
50 Q_OBJECT
51
52 public:
53 CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
54 const char *name = 0 );
55 ~CSVImportDialog();
56
57 KABC::AddresseeList contacts() const;
58
59 protected slots:
60 virtual void slotOk();
61
62 private slots:
63 void returnPressed();
64 void delimiterClicked( int id );
65 void lineSelected( const QString& line );
66 void textquoteSelected( const QString& mark );
67 void textChanged ( const QString & );
68 void ignoreDuplicatesChanged( int );
69 void setFile( const QString& );
70 void urlChanged( const QString& );
71
72 void applyTemplate();
73 void saveTemplate();
74
75 private:
76 enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
77 Prefix, Suffix, NickName, Birthday,
78 HomeAddressStreet, HomeAddressLocality, HomeAddressRegion,
79 HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
80 BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
81 BusinessAddressPostalCode, BusinessAddressCountry,
82 BusinessAddressLabel,
83 HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone,
84 Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL
85 };
86
87 QTable* mTable;
88 QButtonGroup* mDelimiterBox;
89 QRadioButton* mRadioComma;
90 QRadioButton* mRadioSemicolon;
91 QRadioButton* mRadioTab;
92 QRadioButton* mRadioSpace;
93 QRadioButton* mRadioOther;
94 QLineEdit* mDelimiterEdit;
95 QComboBox* mComboLine;
96 QComboBox* mComboQuote;
97 QCheckBox* mIgnoreDuplicates;
98 KURLRequester* mUrlRequester;
99
100 void initGUI();
101 void fillTable();
102 void clearTable();
103 void fillComboBox();
104 void setText( int row, int col, const QString& text );
105 void adjustRows( int rows );
106 QString getText( int row, int col );
107 uint posToType( int pos ) const;
108 int typeToPos( uint type ) const;
109
110 bool mAdjustRows;
111 int mStartLine;
112 QChar mTextQuote;
113 QString mDelimiter;
114 QString mData;
115 QByteArray mFileArray;
116 QMap<QString, uint> mTypeMap;
117 KABC::AddressBook *mAddressBook;
118 int mCustomCounter;
119 bool mClearTypeStore;
120 QValueList<int> mTypeStore;
121
122};
123
124#endif