-rw-r--r-- | kaddressbook/typecombo.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/typecombo.h b/kaddressbook/typecombo.h index 191273d..5fbf0d3 100644 --- a/kaddressbook/typecombo.h +++ b/kaddressbook/typecombo.h | |||
@@ -1,92 +1,93 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TYPECOMBO_H | 24 | #ifndef TYPECOMBO_H |
25 | #define TYPECOMBO_H | 25 | #define TYPECOMBO_H |
26 | 26 | ||
27 | #include <kabc/phonenumber.h> | 27 | #include <kabc/phonenumber.h> |
28 | #include <kcombobox.h> | 28 | #include <kcombobox.h> |
29 | #include <klocale.h> | ||
29 | 30 | ||
30 | /** | 31 | /** |
31 | Combo box for type information of Addresses and Phone numbers. | 32 | Combo box for type information of Addresses and Phone numbers. |
32 | */ | 33 | */ |
33 | template <class T> | 34 | template <class T> |
34 | class TypeCombo : public KComboBox | 35 | class TypeCombo : public KComboBox |
35 | { | 36 | { |
36 | public: | 37 | public: |
37 | typedef typename T::List List; | 38 | typedef typename T::List List; |
38 | typedef typename T::List::Iterator Iterator; | 39 | typedef typename T::List::Iterator Iterator; |
39 | 40 | ||
40 | TypeCombo( List &list, QWidget *parent, const char *name = 0 ); | 41 | TypeCombo( List &list, QWidget *parent, const char *name = 0 ); |
41 | 42 | ||
42 | void setLineEdit( QLineEdit *edit ) { mLineEdit = edit; } | 43 | void setLineEdit( QLineEdit *edit ) { mLineEdit = edit; } |
43 | QLineEdit *lineEdit() const { return mLineEdit; } | 44 | QLineEdit *lineEdit() const { return mLineEdit; } |
44 | 45 | ||
45 | void updateTypes(); | 46 | void updateTypes(); |
46 | 47 | ||
47 | void selectType( int type ); | 48 | void selectType( int type ); |
48 | 49 | ||
49 | int selectedType(); | 50 | int selectedType(); |
50 | 51 | ||
51 | Iterator selectedElement(); | 52 | Iterator selectedElement(); |
52 | 53 | ||
53 | void insertType( const List &list, int type, | 54 | void insertType( const List &list, int type, |
54 | const T &defaultObject ); | 55 | const T &defaultObject ); |
55 | void insertTypeList( const List &list ); | 56 | void insertTypeList( const List &list ); |
56 | 57 | ||
57 | bool hasType( int type ); | 58 | bool hasType( int type ); |
58 | 59 | ||
59 | private: | 60 | private: |
60 | List &mTypeList; | 61 | List &mTypeList; |
61 | QLineEdit *mLineEdit; | 62 | QLineEdit *mLineEdit; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | template <class T> | 65 | template <class T> |
65 | #ifdef _WIN32_ | 66 | #ifdef _WIN32_ |
66 | TypeCombo<T>::TypeCombo( typename TypeCombo::List &list, QWidget *parent, | 67 | TypeCombo<T>::TypeCombo( typename TypeCombo::List &list, QWidget *parent, |
67 | #else | 68 | #else |
68 | TypeCombo<T>::TypeCombo( TypeCombo::List &list, QWidget *parent, | 69 | TypeCombo<T>::TypeCombo( TypeCombo::List &list, QWidget *parent, |
69 | 70 | ||
70 | #endif | 71 | #endif |
71 | const char *name ) | 72 | const char *name ) |
72 | : KComboBox( parent), | 73 | : KComboBox( parent), |
73 | //US my kde version has no KComboBox constructor witgh two parameters | 74 | //US my kde version has no KComboBox constructor witgh two parameters |
74 | //US : KComboBox( parent, name ), | 75 | //US : KComboBox( parent, name ), |
75 | mTypeList( list ) | 76 | mTypeList( list ) |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
79 | template <class T> | 80 | template <class T> |
80 | void TypeCombo<T>::updateTypes() | 81 | void TypeCombo<T>::updateTypes() |
81 | { | 82 | { |
82 | // Remember current item | 83 | // Remember current item |
83 | QString currentId; | 84 | QString currentId; |
84 | int current = currentItem(); | 85 | int current = currentItem(); |
85 | if ( current >= 0 ) currentId = mTypeList[ current ].id(); | 86 | if ( current >= 0 ) currentId = mTypeList[ current ].id(); |
86 | 87 | ||
87 | clear(); | 88 | clear(); |
88 | 89 | ||
89 | QMap<int,int> labelCount; | 90 | QMap<int,int> labelCount; |
90 | 91 | ||
91 | uint i; | 92 | uint i; |
92 | for( i = 0; i < mTypeList.count(); ++i ) { | 93 | for( i = 0; i < mTypeList.count(); ++i ) { |