kaddressbook Library API Documentation

csvimportdialog.h

00001 /*
00002    This file is part of KAddressBook.
00003    Copyright (C) 2003 Tobias Koenig <tokoe@kde.org>
00004                  based on the code of KSpread's CSV Import Dialog 
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #ifndef CSV_IMPORT_DLG_H
00023 #define CSV_IMPORT_DLG_H
00024 
00025 #include <kabc/addressbook.h>
00026 #include <kabc/addresseelist.h>
00027 #include <kdialogbase.h>
00028 
00029 #include <qvaluelist.h>
00030 
00031 class KURLRequester;
00032 
00033 class QButtonGroup;
00034 class QComboBox;
00035 class QCheckBox;
00036 class QLineEdit;
00037 class QPushButton;
00038 class QRadioButton;
00039 class QTable;
00040 
00041 class CSVImportDialog : public KDialogBase
00042 {
00043   Q_OBJECT
00044 
00045   public:
00046     CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
00047                      const char *name = 0 );
00048     ~CSVImportDialog();
00049 
00050     KABC::AddresseeList contacts() const;
00051 
00052   protected slots:
00053     virtual void slotOk();
00054 
00055   private slots:
00056     void returnPressed();
00057     void delimiterClicked( int id );
00058     void lineSelected( const QString& line );
00059     void textquoteSelected( const QString& mark );
00060     void textChanged ( const QString & );
00061     void ignoreDuplicatesChanged( int );
00062     void setFile( const QString& );
00063     void urlChanged( const QString& );
00064 
00065     void applyTemplate();
00066     void saveTemplate();
00067 
00068   private:
00069     enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
00070            Prefix, Suffix, NickName, Birthday,
00071            HomeAddressStreet, HomeAddressLocality, HomeAddressRegion, 
00072            HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
00073            BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
00074            BusinessAddressPostalCode, BusinessAddressCountry, 
00075            BusinessAddressLabel,
00076            HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone,
00077            Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL
00078          };
00079 
00080     QTable* mTable;
00081     QButtonGroup* mDelimiterBox;
00082     QRadioButton* mRadioComma;
00083     QRadioButton* mRadioSemicolon;
00084     QRadioButton* mRadioTab;
00085     QRadioButton* mRadioSpace;
00086     QRadioButton* mRadioOther;
00087     QLineEdit* mDelimiterEdit;
00088     QLineEdit* mDatePatternEdit;
00089     QComboBox* mComboLine;
00090     QComboBox* mComboQuote;
00091     QCheckBox* mIgnoreDuplicates;
00092     QWidget* mPage;
00093     KURLRequester* mUrlRequester;
00094 
00095     void initGUI();
00096     void fillTable();
00097     void clearTable();
00098     void fillComboBox();
00099     void setText( int row, int col, const QString& text );
00100     void adjustRows( int rows );
00101     QString getText( int row, int col );
00102     uint posToType( int pos ) const;
00103     int typeToPos( uint type ) const;
00104 
00105     bool mAdjustRows;
00106     int mStartLine;
00107     QChar mTextQuote;
00108     QString mDelimiter;
00109     QString mData;
00110     QByteArray mFileArray;
00111     QMap<QString, uint> mTypeMap;
00112     KABC::AddressBook *mAddressBook;
00113     int mCustomCounter;
00114     bool mClearTypeStore;
00115     QValueList<int> mTypeStore;
00116 };
00117 
00118 #endif
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:51 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003