27 #include <tdeabc/phonenumber.h>
28 #include <kcombobox.h>
37 typedef typename T::List List;
38 typedef typename T::List::Iterator Iterator;
40 TypeCombo( List &list, TQWidget *parent,
const char *name = 0 );
42 void setLineEdit( TQLineEdit *edit ) { mLineEdit = edit; }
43 TQLineEdit *lineEdit()
const {
return mLineEdit; }
47 void selectType(
int type );
51 Iterator selectedElement();
53 void insertType(
const List &list,
int type,
54 const T &defaultObject );
55 void insertTypeList(
const List &list );
57 bool hasType(
int type );
61 TQLineEdit *mLineEdit;
67 : KComboBox( parent, name ),
77 int current = currentItem();
78 if ( current >= 0 ) currentId = mTypeList[ current ].id();
82 TQMap<int,int> labelCount;
85 for ( i = 0; i < mTypeList.count(); ++i ) {
86 int type = ( mTypeList[ i ].type() & ~( T::Pref ) );
87 TQString label = mTypeList[ i ].typeLabel( type );
89 if ( labelCount.contains( type ) ) {
90 count = labelCount[ type ] + 1;
92 labelCount[ type ] = count;
94 label = i18n(
"label (number)",
"%1 (%2)").arg( label )
95 .arg( TQString::number( count ) );
101 if ( !currentId.isEmpty() ) {
102 for ( i = 0; i < mTypeList.count(); ++i ) {
103 if ( mTypeList[ i ].
id() == currentId ) {
115 for ( i = 0; i < mTypeList.count(); ++i ) {
116 if ( (mTypeList[ i ].type() & ~T::Pref) == type ) {
126 return mTypeList[ currentItem() ].type();
132 return mTypeList.at( currentItem() );
137 const T &defaultObject )
140 for ( i = 0; i < list.count(); ++i ) {
141 if ( list[ i ].type() == type ) {
142 mTypeList.append( list[ i ] );
146 if ( i == list.count() ) {
147 mTypeList.append( defaultObject );
155 for ( i = 0; i < list.count(); ++i ) {
157 for ( j = 0; j < mTypeList.count(); ++j ) {
158 if ( list[ i ].
id() == mTypeList[ j ].
id() )
break;
160 if ( j == mTypeList.count() ) {
161 mTypeList.append( list[ i ] );
169 for ( uint i = 0; i < mTypeList.count(); ++i ) {
170 if ( ( mTypeList[ i ].type() & ~T::Pref ) == type )
Combo box for type information of Addresses and Phone numbers.