00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef CSV_IMPORT_DLG_H
00023 #define CSV_IMPORT_DLG_H
00024
00025 #include <tdeabc/addressbook.h>
00026 #include <tdeabc/addresseelist.h>
00027 #include <kdialogbase.h>
00028
00029 #include <tqvaluelist.h>
00030
00031 class KURLRequester;
00032
00033 class TQButtonGroup;
00034 class TQComboBox;
00035 class TQCheckBox;
00036 class TQLineEdit;
00037 class TQPushButton;
00038 class TQRadioButton;
00039 class TQTable;
00040
00041 class CSVImportDialog : public KDialogBase
00042 {
00043 Q_OBJECT
00044
00045
00046 public:
00047 CSVImportDialog( TDEABC::AddressBook *ab, TQWidget *parent,
00048 const char *name = 0 );
00049 ~CSVImportDialog();
00050
00051 TDEABC::AddresseeList contacts() const;
00052
00053 protected slots:
00054 virtual void slotOk();
00055
00056 private slots:
00057 void returnPressed();
00058 void delimiterClicked( int id );
00059 void lineSelected( const TQString& line );
00060 void textquoteSelected( const TQString& mark );
00061 void textChanged ( const TQString & );
00062 void ignoreDuplicatesChanged( int );
00063 void setFile( const TQString& );
00064 void urlChanged( const TQString& );
00065 void codecChanged();
00066
00067 void applyTemplate();
00068 void saveTemplate();
00069
00070 private:
00071 enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
00072 Prefix, Suffix, NickName, Birthday,
00073 HomeAddressStreet, HomeAddressLocality, HomeAddressRegion,
00074 HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
00075 BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
00076 BusinessAddressPostalCode, BusinessAddressCountry,
00077 BusinessAddressLabel,
00078 HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone,
00079 Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL
00080 };
00081
00082 TQTable* mTable;
00083 TQButtonGroup* mDelimiterBox;
00084 TQRadioButton* mRadioComma;
00085 TQRadioButton* mRadioSemicolon;
00086 TQRadioButton* mRadioTab;
00087 TQRadioButton* mRadioSpace;
00088 TQRadioButton* mRadioOther;
00089 TQLineEdit* mDelimiterEdit;
00090 TQLineEdit* mDatePatternEdit;
00091 TQComboBox* mComboLine;
00092 TQComboBox* mComboQuote;
00093 TQCheckBox* mIgnoreDuplicates;
00094 TQComboBox* mCodecCombo;
00095 TQWidget* mPage;
00096 KURLRequester* mUrlRequester;
00097
00098 void initGUI();
00099 void fillTable();
00100 void clearTable();
00101 void fillComboBox();
00102 void setText( int row, int col, const TQString& text );
00103 void adjustRows( int rows );
00104 void resizeColumns();
00105 TQString getText( int row, int col );
00106 uint posToType( int pos ) const;
00107 int typeToPos( uint type ) const;
00108
00109 void reloadCodecs();
00110 TQTextCodec *currentCodec();
00111 TQPtrList<TQTextCodec> mCodecs;
00112
00113 bool mAdjustRows;
00114 int mStartLine;
00115 TQChar mTextQuote;
00116 TQString mDelimiter;
00117 TQByteArray mFileArray;
00118 TQMap<TQString, uint> mTypeMap;
00119 TDEABC::AddressBook *mAddressBook;
00120 int mCustomCounter;
00121 bool mClearTypeStore;
00122 TQValueList<int> mTypeStore;
00123 };
00124
00125 #endif