summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-28 08:57:25 (UTC)
committer zautrix <zautrix>2005-10-28 08:57:25 (UTC)
commitf284eafbe4274cb97ec25f375544b924ae04ac09 (patch) (unidiff)
treebc754eac9882740463a447099944cbb590bad7f6
parentd934f3fe2a62f6a696992335124c4434cd77d990 (diff)
downloadkdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.zip
kdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.tar.gz
kdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.tar.bz2
cimmit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt4
-rw-r--r--kabc/phonenumber.cpp26
-rw-r--r--kabc/phonenumber.h3
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp34
-rw-r--r--kaddressbook/phoneeditwidget.h79
5 files changed, 134 insertions, 12 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index 2ae6eb9..dcf43c1 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -766,72 +766,72 @@
766{ "Backup Failed!","Backup Problem!" }, 766{ "Backup Failed!","Backup Problem!" },
767{ "Try again now","Versuche jetzt nochmal" }, 767{ "Try again now","Versuche jetzt nochmal" },
768{ "Try again later","Versuche später nochmal" }, 768{ "Try again later","Versuche später nochmal" },
769{ "Try again tomorrow","Versuche morgen nochmal" }, 769{ "Try again tomorrow","Versuche morgen nochmal" },
770{ "Disable backup","Schalte Backup ab" }, 770{ "Disable backup","Schalte Backup ab" },
771{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 771{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
772{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 772{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
773{ "Choose action","Wähle Aktion" }, 773{ "Choose action","Wähle Aktion" },
774{ "&Configure KA/Pi...","Konfiguriere KA/Pi..." }, 774{ "&Configure KA/Pi...","Konfiguriere KA/Pi..." },
775{ "Global Settings...","Globale Einstellungen..." }, 775{ "Global Settings...","Globale Einstellungen..." },
776{ "Spouse","Ehegatte" }, 776{ "Spouse","Ehegatte" },
777{ "Notes","Notizen" }, 777{ "Notes","Notizen" },
778{ "Messanger","Messanger" }, 778{ "Messanger","Messanger" },
779{ "Assistant","Assistent" }, 779{ "Assistant","Assistent" },
780{ "Manager","Manager" }, 780{ "Manager","Manager" },
781{ "Secrecy","Sichtbar" }, 781{ "Secrecy","Sichtbar" },
782{ "male","männlich" }, 782{ "male","männlich" },
783{ "female","weiblich" }, 783{ "female","weiblich" },
784{ "Hide!","Verbergen!" }, 784{ "Hide!","Verbergen!" },
785{ "Show!","Anzeigen!" }, 785{ "Show!","Anzeigen!" },
786{ "Details","Details" }, 786{ "Details","Details" },
787{ "Search:","Suche:" }, 787{ "Search:","Suche:" },
788{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" }, 788{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
789{ "Pi-Sync Port Error","Pi-Sync Port Fehler" }, 789{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
790{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" }, 790{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
791{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" }, 791{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
792{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" }, 792{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
793{ "Pi-Sync Error","Pi-Sync Fehler" }, 793{ "Pi-Sync Error","Pi-Sync Fehler" },
794{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" }, 794{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
795{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" }, 795{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
796{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." }, 796{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
797{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, 797{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
798{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, 798{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
799{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, 799{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
800{ "Receiving file from remote...","Empfange entfernte Datei..." }, 800{ "Receiving file from remote...","Empfange entfernte Datei..." },
801{ "Sending back synced file...","Sende synchronisierte Datei zurück..." }, 801{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
802{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, 802{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
803{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, 803{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
804{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, 804{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
805{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, 805{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
806{ "Writing back file ...","Schreibe Datei zurück..." }, 806{ "Writing back file ...","Schreibe Datei zurück..." },
807{ "Sending back file ...","Sende Datei zurück..." }, 807{ "Sending back file ...","Sende Datei zurück..." },
808{ "Eeek, there I am ticklish!","Huch, da bin ich kitzlig!" }, 808{ "Eeek, there I am ticklish!","Huch, da bin ich kitzlig!" },
809{ "Save using LOCAL storage","Speichere nutze LOCAL Pfad" }, 809{ "Save using LOCAL storage","Speichere nutze LOCAL Pfad" },
810{ "...and %1 more\ncontact(s) selected","...und noch %1 Kontakte\n mehr ausgewählt" }, 810{ "...and %1 more\ncontact(s) selected","...und noch %1 Kontakte\n mehr ausgewählt" },
811{ "Do you really\nwant to delete the\nsetected contact(s)?\n\n","Möchten Sie wirklich\ndie ausgewählten\nKontakte löschen?\n\n" }, 811{ "Do you really\nwant to delete the\nsetected contact(s)?\n\n","Möchten Sie wirklich\ndie ausgewählten\nKontakte löschen?\n\n" },
812{ "%1 contacts\nsuccessfully\nimported.","%1 Kontakte\nerfolgreich\nimportiert." }, 812{ "%1 contacts\nsuccessfully\nimported.","%1 Kontakte\nerfolgreich\nimportiert." },
813{ "Import this contact?","Importiere diesen Kontakt?" }, 813{ "Import this contact?","Importiere diesen Kontakt?" },
814{ "Import all!","Importiere alle!" }, 814{ "Import all!","Importiere alle!" },
815{ "Loading addressbook data ... please wait","Lade Adressbuchdaten ... bitte warten" }, 815{ "Loading addressbook data ... please wait","Lade Adressbuchdaten ... bitte warten" },
816{ "Import Format","Import Format" }, 816{ "Import Format","Import Format" },
817{ "Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages.","Wähle Import Format!\nDefault und Standard ist Utf8.\nLatin1 kann das richtige für\nWesteuropäische Sprachen sein." }, 817{ "Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages.","Wähle Import Format!\nDefault und Standard ist Utf8.\nLatin1 kann das richtige für\nWesteuropäische Sprachen sein." },
818{ "Home2","Privat2" }, 818{ "Home2","Privat2" },
819{ "Work2","Arbeit2" }, 819{ "Work2","Arbeit2" },
820{ "Fax (Work)","Fax (Arbeit)" }, 820{ "Fax (Work)","Fax (Arbeit)" },
821{ "Fax (Home)","Fax (Privat)" }, 821{ "Fax (Home)","Fax (Privat)" },
822{ "Assistent","Sekretär(in)" }, 822{ "Assistent","Sekretär(in)" },
823{ "Company","Firma" }, 823{ "Company","Firma" },
824{ "Mobile2 (work)","Handy2 (Arbeit)" }, 824{ "Mobile2 (work)","Handy2 (Arbeit)" },
825{ "Mobile2 (car)","Handy2 (Auto)" }, 825{ "Mobile2 (car)","Handy2 (Auto)" },
826{ "Callback","Rückruf" }, 826{ "Callback","Rückruf" },
827{ "Fax (Other)","Fax (Anderes)" }, 827{ "Fax (Other)","Fax (Anderes)" },
828{ "Primary","Bevorzugt" }, 828{ "Primary","Bevorzugt" },
829{ "Mobile (Home)","Handy (Privat)" }, 829{ "Mobile (Home)","Handy (Privat)" },
830{ "","" }, 830{ "Unfiled","Nicht zugeordnet" },
831{ "","" }, 831{ "Format.n.:","Format.N.:" },
832{ "","" }, 832{ "","" },
833{ "","" }, 833{ "","" },
834{ "","" }, 834{ "","" },
835{ "","" }, 835{ "","" },
836{ "","" }, 836{ "","" },
837{ "","" }, \ No newline at end of file 837{ "","" }, \ No newline at end of file
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 0d46ba7..eee25a5 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -161,128 +161,154 @@ bool PhoneNumber::contains( const PhoneNumber &p )
161 161
162void PhoneNumber::setId( const QString &id ) 162void PhoneNumber::setId( const QString &id )
163{ 163{
164 mId = id; 164 mId = id;
165} 165}
166 166
167QString PhoneNumber::id() const 167QString PhoneNumber::id() const
168{ 168{
169 return mId; 169 return mId;
170} 170}
171 171
172void PhoneNumber::setNumber( const QString &number ) 172void PhoneNumber::setNumber( const QString &number )
173{ 173{
174 mNumber = number; 174 mNumber = number;
175} 175}
176 176
177QString PhoneNumber::number() const 177QString PhoneNumber::number() const
178{ 178{
179 return mNumber; 179 return mNumber;
180} 180}
181 181
182void PhoneNumber::setType( int type ) 182void PhoneNumber::setType( int type )
183{ 183{
184 mType = type; 184 mType = type;
185} 185}
186 186
187int PhoneNumber::type() const 187int PhoneNumber::type() const
188{ 188{
189 return mType; 189 return mType;
190} 190}
191 191
192QString PhoneNumber::typeLabel() const 192QString PhoneNumber::typeLabel() const
193{ 193{
194 QString label; 194 QString label;
195 bool first = true; 195 bool first = true;
196 196
197 TypeList list = typeList(); 197 TypeList list = typeList();
198 198
199 TypeList::Iterator it; 199 TypeList::Iterator it;
200 for ( it = list.begin(); it != list.end(); ++it ) { 200 for ( it = list.begin(); it != list.end(); ++it ) {
201 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { 201 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) {
202 label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); 202 label.append( ( first ? "" : "/" ) + typeLabel( *it ) );
203 if ( first ) 203 if ( first )
204 first = false; 204 first = false;
205 } 205 }
206 } 206 }
207 207
208 return label; 208 return label;
209} 209}
210 210
211QString PhoneNumber::label() const 211QString PhoneNumber::label() const
212{ 212{
213 return typeLabel( type() ); 213 return typeLabel( type() );
214} 214}
215 215
216PhoneNumber::TypeList PhoneNumber::typeList() 216PhoneNumber::TypeList PhoneNumber::typeList()
217{ 217{
218 TypeList list; 218 TypeList list;
219 219
220 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video 220 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
221 << Bbs << Modem << Car << Isdn << Pcs << Pager; 221 << Bbs << Modem << Car << Isdn << Pcs << Pager;
222 222
223 return list; 223 return list;
224} 224}
225PhoneNumber::TypeList PhoneNumber::supportedTypeList()
226{
227 static TypeList list;
228 if ( list.count() == 0 )
229 list << (Home| Pref) << (Work| Pref) << Cell << Home << Work << Car << (Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< (Pcs|Pref)<< Pcs<< Pager << Isdn << Video << Msg << Pref << Voice;
230 return list;
231}
232QStringList PhoneNumber::supportedTypeListNames()
233{
234 static QStringList list;
235 if ( list.count() == 0 )
236 list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("Home2")<< i18n("Work2") << i18n("Mobile2 (Work)") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("SIP") << i18n("VoIP") << i18n("Pager") << i18n("ISDN") << i18n("Video") << i18n("Callback") << i18n("Primary")<< i18n("Other");
237 return list;
238}
239
240int PhoneNumber::typeListIndex4Type(int type )
241{
242 TypeList list = supportedTypeList();
243 int i = 0;
244 while ( i < list.count() ) {
245 if ( list [i] == type )
246 return i;
247 ++i;
248 }
249 return list.count()-1;
250}
225 251
226QString PhoneNumber::label( int type ) 252QString PhoneNumber::label( int type )
227{ 253{
228 return typeLabel( type ); 254 return typeLabel( type );
229} 255}
230 256
231QString PhoneNumber::typeLabel( int type ) 257QString PhoneNumber::typeLabel( int type )
232{ 258{
233 if ((type & Cell) == Cell) 259 if ((type & Cell) == Cell)
234 return i18n("Mobile"); 260 return i18n("Mobile");
235 if ((type & Home) == Home) { 261 if ((type & Home) == Home) {
236 if ((type & Pref) == Pref) 262 if ((type & Pref) == Pref)
237 return i18n("Home"); 263 return i18n("Home");
238 if ((type & Fax) == Fax) 264 if ((type & Fax) == Fax)
239 return i18n("Fax (Home)"); 265 return i18n("Fax (Home)");
240 return i18n("Home2"); 266 return i18n("Home2");
241 } 267 }
242 268
243 if ((type & Work) == Work) { 269 if ((type & Work) == Work) {
244 if ((type & Pref) == Pref) 270 if ((type & Pref) == Pref)
245 return i18n("Work"); 271 return i18n("Work");
246 if ((type & Fax) == Fax) 272 if ((type & Fax) == Fax)
247 return i18n("Fax (Work)"); 273 return i18n("Fax (Work)");
248 if ((type & Msg) == Msg) { 274 if ((type & Msg) == Msg) {
249 if ((type & Voice) == Voice) 275 if ((type & Voice) == Voice)
250 return i18n("Assistent"); 276 return i18n("Assistent");
251 return i18n("Company"); 277 return i18n("Company");
252 } 278 }
253 return i18n("Work2"); 279 return i18n("Work2");
254 } 280 }
255 if ((type & Pcs) == Pcs) { 281 if ((type & Pcs) == Pcs) {
256 if ((type & Pref) == Pref) 282 if ((type & Pref) == Pref)
257 return i18n("SIP"); 283 return i18n("SIP");
258 return i18n("VoIP"); 284 return i18n("VoIP");
259 } 285 }
260 if ((type & Car) == Car) 286 if ((type & Car) == Car)
261 return i18n("Mobile2 (Work)"); 287 return i18n("Mobile2 (Work)");
262 if ((type & Pager) == Pager) 288 if ((type & Pager) == Pager)
263 return i18n("Pager"); 289 return i18n("Pager");
264 if ((type & Isdn) == Isdn) 290 if ((type & Isdn) == Isdn)
265 return i18n("ISDN"); 291 return i18n("ISDN");
266 if ((type & Video) == Video) 292 if ((type & Video) == Video)
267 return i18n("Video"); 293 return i18n("Video");
268 294
269 if ((type & Msg) == Msg) 295 if ((type & Msg) == Msg)
270 return i18n("Callback"); 296 return i18n("Callback");
271 if ((type & Fax) == Fax) 297 if ((type & Fax) == Fax)
272 return i18n("Fax (Other)"); 298 return i18n("Fax (Other)");
273 299
274 if ((type & Pref) == Pref) 300 if ((type & Pref) == Pref)
275 return i18n("Primary"); 301 return i18n("Primary");
276 302
277 303
278 return i18n("Other"); 304 return i18n("Other");
279 305
280 306
281#if 0 307#if 0
282 308
283 309
284 310
285 QString typeString; 311 QString typeString;
286 312
287 313
288 if ((type & Cell) == Cell) 314 if ((type & Cell) == Cell)
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index b9d6a17..feeba6c 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -87,84 +87,87 @@ class PhoneNumber
87 Destructor. 87 Destructor.
88 */ 88 */
89 ~PhoneNumber(); 89 ~PhoneNumber();
90 90
91 bool operator==( const PhoneNumber & ) const; 91 bool operator==( const PhoneNumber & ) const;
92 bool operator!=( const PhoneNumber & ) const; 92 bool operator!=( const PhoneNumber & ) const;
93 93
94 bool contains( const PhoneNumber &p ); 94 bool contains( const PhoneNumber &p );
95 /** 95 /**
96 Sets the unique identifier. 96 Sets the unique identifier.
97 */ 97 */
98 void setId( const QString &id ); 98 void setId( const QString &id );
99 99
100 /** 100 /**
101 Returns the unique identifier. 101 Returns the unique identifier.
102 */ 102 */
103 QString id() const; 103 QString id() const;
104 104
105 /** 105 /**
106 Sets the number. 106 Sets the number.
107 */ 107 */
108 void setNumber( const QString & ); 108 void setNumber( const QString & );
109 109
110 /** 110 /**
111 Returns the number. 111 Returns the number.
112 */ 112 */
113 QString number() const; 113 QString number() const;
114 114
115 /** 115 /**
116 Sets the type. Multiple types can be specified by combining them by 116 Sets the type. Multiple types can be specified by combining them by
117 a logical or. 117 a logical or.
118 */ 118 */
119 void setType( int ); 119 void setType( int );
120 120
121 /** 121 /**
122 Returns the type. Can be a multiple types combined by a logical or. 122 Returns the type. Can be a multiple types combined by a logical or.
123 */ 123 */
124 int type() const; 124 int type() const;
125 125
126 /** 126 /**
127 Returns a translated string of all types the address has. 127 Returns a translated string of all types the address has.
128 */ 128 */
129 QString typeLabel() const; 129 QString typeLabel() const;
130 130
131 /** 131 /**
132 Returns the translated label for phone number depending on its type. 132 Returns the translated label for phone number depending on its type.
133 */ 133 */
134 QString label() const; 134 QString label() const;
135 135
136 /** 136 /**
137 Returns a list of all available types 137 Returns a list of all available types
138 */ 138 */
139 static TypeList typeList(); 139 static TypeList typeList();
140 140
141 /** 141 /**
142 Returns the translated label for phone number type. 142 Returns the translated label for phone number type.
143 */ 143 */
144 static QString typeLabel( int type ); 144 static QString typeLabel( int type );
145 145
146 /** 146 /**
147 Returns the translated label for phone number type. 147 Returns the translated label for phone number type.
148 @obsolete 148 @obsolete
149 */ 149 */
150 static QString label( int type ); 150 static QString label( int type );
151 static TypeList supportedTypeList();
152 static QStringList supportedTypeListNames();
153 static int typeListIndex4Type(int type );
151 bool simplifyNumber(); 154 bool simplifyNumber();
152 void simplifyType(); 155 void simplifyType();
153 void makeCompat(); 156 void makeCompat();
154 int getCompatType( int type ); 157 int getCompatType( int type );
155 158
156 private: 159 private:
157 void init(); 160 void init();
158 161
159 QString mId; 162 QString mId;
160 163
161 int mType; 164 int mType;
162 QString mNumber; 165 QString mNumber;
163}; 166};
164 167
165QDataStream &operator<<( QDataStream &, const PhoneNumber & ); 168QDataStream &operator<<( QDataStream &, const PhoneNumber & );
166QDataStream &operator>>( QDataStream &, PhoneNumber & ); 169QDataStream &operator>>( QDataStream &, PhoneNumber & );
167 170
168} 171}
169 172
170#endif 173#endif
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 310d628..9814cd5 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -93,296 +93,314 @@ AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
93 mCategoryDialog = 0; 93 mCategoryDialog = 0;
94 mCategoryEditDialog = 0; 94 mCategoryEditDialog = 0;
95 95
96 // Load the empty addressee as defaults 96 // Load the empty addressee as defaults
97 load(); 97 load();
98 98
99 mDirty = false; 99 mDirty = false;
100} 100}
101 101
102AddresseeEditorWidget::~AddresseeEditorWidget() 102AddresseeEditorWidget::~AddresseeEditorWidget()
103{ 103{
104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
105} 105}
106 106
107void AddresseeEditorWidget::contactsSelectionChanged() 107void AddresseeEditorWidget::contactsSelectionChanged()
108{ 108{
109 KABC::Addressee::List list = selectedContacts(); 109 KABC::Addressee::List list = selectedContacts();
110 110
111 mAddressee = list[ 0 ]; 111 mAddressee = list[ 0 ];
112 load(); 112 load();
113} 113}
114 114
115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
116{ 116{
117 mAddressee = addr; 117 mAddressee = addr;
118 load(); 118 load();
119} 119}
120 120
121const KABC::Addressee &AddresseeEditorWidget::addressee() 121const KABC::Addressee &AddresseeEditorWidget::addressee()
122{ 122{
123 return mAddressee; 123 return mAddressee;
124} 124}
125 125
126void AddresseeEditorWidget::textChanged( const QString& ) 126void AddresseeEditorWidget::textChanged( const QString& )
127{ 127{
128 emitModified(); 128 emitModified();
129} 129}
130 130
131void AddresseeEditorWidget::initGUI() 131void AddresseeEditorWidget::initGUI()
132{ 132{
133 QVBoxLayout *layout = new QVBoxLayout( this ); 133 QVBoxLayout *layout = new QVBoxLayout( this );
134 134
135 mTabWidget = new QTabWidget( this ); 135 mTabWidget = new QTabWidget( this );
136 layout->addWidget( mTabWidget ); 136 layout->addWidget( mTabWidget );
137 137
138 setupTab1(); 138 setupTab1();
139 setupTab1_1(); 139 setupTab1_1();
140 setupTab2(); 140 setupTab2();
141 setupTab2_1(); 141 setupTab2_1();
142 setupTab3(); 142 setupTab3();
143 setupTab3_1(); 143 setupTab3_1();
144 144
145 mNameEdit->setFocus(); 145 mNameEdit->setFocus();
146 146
147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), 147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
148 SLOT( pageChanged(QWidget*) ) ); 148 SLOT( pageChanged(QWidget*) ) );
149} 149}
150 150
151void AddresseeEditorWidget::setupTab1() 151void AddresseeEditorWidget::setupTab1()
152{ 152{
153 // This is the General tab 153 // This is the General tab
154 QWidget *tab1 = new QWidget( mTabWidget ); 154 QWidget *tab1 = new QWidget( mTabWidget );
155 155
156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); 156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); 157 bool horLayout = false;
158 int maxCol = 1;
159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
160 horLayout = true;
161 maxCol = 3;
162 }
163 QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol );
164
158 layout->setMargin( KDialogBase::marginHintSmall() ); 165 layout->setMargin( KDialogBase::marginHintSmall() );
159 layout->setSpacing( KDialogBase::spacingHintSmall() ); 166 layout->setSpacing( KDialogBase::spacingHintSmall() );
160 167
161 QLabel *label; 168 QLabel *label;
162 KSeparator* bar; 169 KSeparator* bar;
163 QPushButton *button; 170 QPushButton *button;
164 171
165 ////////////////////////////////// 172 //////////////////////////////////
166 // Upper left group (person info) 173 // Upper left group (person info)
167 174
168 // Person icon 175 // Person icon
169 /* LR 176 /* LR
170 label = new QLabel( tab1 ); 177 label = new QLabel( tab1 );
171//US ambiguous call. Add one more parameter 178//US ambiguous call. Add one more parameter
172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
174 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 181 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
175 */ 182 */
176 // First name 183 // First name
177 button = new QPushButton( i18n( "Name..." ), tab1 ); 184 button = new QPushButton( i18n( "Name..." ), tab1 );
178//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 185//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
179 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 186 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
181 SLOT( nameTextChanged( const QString& ) ) ); 188 SLOT( nameTextChanged( const QString& ) ) );
182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
183 190
184 mNameLabel = new KSqueezedTextLabel( tab1 ); 191 mNameLabel = new KSqueezedTextLabel( tab1 );
185 mNameLabel->hide(); 192 mNameLabel->hide();
186 193
187 layout->addWidget( button, 0, 0 ); 194 layout->addWidget( button, 0, 0 );
188 layout->addWidget( mNameEdit, 0, 1 ); 195 layout->addWidget( mNameEdit, 0, 1 );
189 layout->addWidget( mNameLabel, 0, 1 ); 196 layout->addWidget( mNameLabel, 0, 1 );
190 197
191 button = new QPushButton( i18n( "Role:" ), tab1 ); 198 button = new QPushButton( i18n( "Role:" ), tab1 );
192 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); 199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
193 //label = new QLabel( i18n( "Role:" ), tab1 ); 200 //label = new QLabel( i18n( "Role:" ), tab1 );
194 mRoleEdit = new KLineEdit( tab1 ); 201 mRoleEdit = new KLineEdit( tab1 );
195 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
196 SLOT( textChanged( const QString& ) ) ); 203 SLOT( textChanged( const QString& ) ) );
197 //label->setBuddy( mRoleEdit ); 204 //label->setBuddy( mRoleEdit );
198 layout->addWidget( button, 1, 0 ); 205 layout->addWidget( button, 1, 0 );
199 layout->addWidget( mRoleEdit, 1, 1 ); 206 layout->addWidget( mRoleEdit, 1, 1 );
200 207
201 // Organization 208 // Organization
202 button = new QPushButton( i18n( "Organization:" ), tab1 ); 209 button = new QPushButton( i18n( "Organization:" ), tab1 );
203 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); 210 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
204 //label = new QLabel( i18n( "Organization:" ), tab1 ); 211 //label = new QLabel( i18n( "Organization:" ), tab1 );
205 mOrgEdit = new KLineEdit( tab1 ); 212 mOrgEdit = new KLineEdit( tab1 );
206 //label->setBuddy( mOrgEdit ); 213 //label->setBuddy( mOrgEdit );
207 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 214 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
208 SLOT( textChanged( const QString& ) ) ); 215 SLOT( textChanged( const QString& ) ) );
209 layout->addWidget( button, 2, 0 ); 216 if ( horLayout ) {
210 layout->addWidget( mOrgEdit, 2, 1 ); 217 layout->addWidget( button, 1, 2 );
218 layout->addWidget( mOrgEdit, 1, 3 );
219
220 } else {
221 layout->addWidget( button, 2, 0 );
222 layout->addWidget( mOrgEdit, 2, 1 );
223 }
211 224
212 // File as (formatted name) 225 // File as (formatted name)
213 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 226 label = new QLabel( i18n( "Format.n.:" ), tab1 );
214 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 227 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
215 layout->addWidget( label, 3, 0 ); 228 if ( horLayout ) {
216 layout->addWidget( mFormattedNameLabel, 3, 1 ); 229 layout->addWidget( label, 0,2 );
230 layout->addWidget( mFormattedNameLabel, 0, 3 );
231 } else {
232 layout->addWidget( label, 3, 0 );
233 layout->addWidget( mFormattedNameLabel, 3, 1 );
234 }
217 /* LR 235 /* LR
218 // Left hand separator. This separator doesn't go all the way 236 // Left hand separator. This separator doesn't go all the way
219 // across so the dialog still flows from top to bottom 237 // across so the dialog still flows from top to bottom
220 bar = new KSeparator( KSeparator::HLine, tab1 ); 238 bar = new KSeparator( KSeparator::HLine, tab1 );
221 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 239 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
222 */ 240 */
223 ////////////////////////////////////// 241 //////////////////////////////////////
224 242
225 /* LR 243 /* LR
226 // Phone numbers (upper right) 244 // Phone numbers (upper right)
227 label = new QLabel( tab1 ); 245 label = new QLabel( tab1 );
228//US loadIcon call is ambiguous. Add one more parameter 246//US loadIcon call is ambiguous. Add one more parameter
229//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 247//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
230 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 248 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
231//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 249//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
232 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 250 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
233 */ 251 */
234 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 252 mPhoneEditWidget = new PhoneEditWidget( tab1 );
235 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 253 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
236//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 254//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
237 int iii; 255 int iii;
238#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
239 iii = 7; 257 iii = 7;
240#else 258#else
241 iii = 8; 259 iii = 8;
242#endif 260#endif
243 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); 261 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol );
244 ++iii; 262 ++iii;
245 /* LR 263 /* LR
246 bar = new KSeparator( KSeparator::HLine, tab1 ); 264 bar = new KSeparator( KSeparator::HLine, tab1 );
247//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 265//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
248 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 266 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
249 */ 267 */
250/*US 268/*US
251 ////////////////////////////////////// 269 //////////////////////////////////////
252 // Addresses (lower left) 270 // Addresses (lower left)
253 label = new QLabel( tab1 ); 271 label = new QLabel( tab1 );
254//US loadIcon call is ambiguous. Add one more parameter 272//US loadIcon call is ambiguous. Add one more parameter
255//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 273//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
256 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 274 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
257 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 275 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
258 276
259 mAddressEditWidget = new AddressEditWidget( tab1 ); 277 mAddressEditWidget = new AddressEditWidget( tab1 );
260 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 278 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
261 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 279 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
262 280
263 ////////////////////////////////////// 281 //////////////////////////////////////
264 // Email / Web (lower right) 282 // Email / Web (lower right)
265 label = new QLabel( tab1 ); 283 label = new QLabel( tab1 );
266//US loadIcon call is ambiguous. Add one more parameter 284//US loadIcon call is ambiguous. Add one more parameter
267//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 285//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
268 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 286 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
269 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 287 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
270 288
271 mEmailWidget = new EmailEditWidget( tab1 ); 289 mEmailWidget = new EmailEditWidget( tab1 );
272 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 290 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
273 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 291 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
274 292
275 // add the separator 293 // add the separator
276 bar = new KSeparator( KSeparator::HLine, tab1 ); 294 bar = new KSeparator( KSeparator::HLine, tab1 );
277 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 295 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
278 296
279 label = new QLabel( tab1 ); 297 label = new QLabel( tab1 );
280//US loadIcon call is ambiguous. Add one more parameter 298//US loadIcon call is ambiguous. Add one more parameter
281//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 299//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
282 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 300 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
283 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 301 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
284 302
285 label = new QLabel( i18n( "URL:" ), tab1 ); 303 label = new QLabel( i18n( "URL:" ), tab1 );
286 mURLEdit = new KLineEdit( tab1 ); 304 mURLEdit = new KLineEdit( tab1 );
287 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 305 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
288 SLOT( textChanged( const QString& ) ) ); 306 SLOT( textChanged( const QString& ) ) );
289 label->setBuddy( mURLEdit ); 307 label->setBuddy( mURLEdit );
290 layout->addWidget( label, 8, 4 ); 308 layout->addWidget( label, 8, 4 );
291 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 309 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
292 310
293 label = new QLabel( i18n( "&IM address:" ), tab1 ); 311 label = new QLabel( i18n( "&IM address:" ), tab1 );
294 mIMAddressEdit = new KLineEdit( tab1 ); 312 mIMAddressEdit = new KLineEdit( tab1 );
295 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 313 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
296 SLOT( textChanged( const QString& ) ) ); 314 SLOT( textChanged( const QString& ) ) );
297 label->setBuddy( mIMAddressEdit ); 315 label->setBuddy( mIMAddressEdit );
298 layout->addWidget( label, 9, 4 ); 316 layout->addWidget( label, 9, 4 );
299 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 317 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
300 318
301 layout->addColSpacing( 6, 50 ); 319 layout->addColSpacing( 6, 50 );
302 320
303 bar = new KSeparator( KSeparator::HLine, tab1 ); 321 bar = new KSeparator( KSeparator::HLine, tab1 );
304 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 322 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
305*/ 323*/
306 /////////////////////////////////////// 324 ///////////////////////////////////////
307 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 325 QHBox *categoryBox = new QHBox( tab1 ,"cato");
308 categoryBox->setSpacing( KDialogBase::spacingHint() ); 326 categoryBox->setSpacing( KDialogBase::spacingHint() );
309 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 327 categoryBox->setMargin( KDialogBase::marginHintSmall() );
310 328
311 // Categories 329 // Categories
312 button = new QPushButton( i18n( "Categories" ), categoryBox ); 330 button = new QPushButton( i18n( "Categories" ), categoryBox );
313 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 331 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
314 332
315 mCategoryEdit = new KLineEdit( categoryBox ); 333 mCategoryEdit = new KLineEdit( categoryBox );
316 mCategoryEdit->setReadOnly( true ); 334 mCategoryEdit->setReadOnly( true );
317 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 335 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
318 SLOT( textChanged( const QString& ) ) ); 336 SLOT( textChanged( const QString& ) ) );
319 337
320 mSecrecyWidget = new SecrecyWidget( categoryBox ); 338 mSecrecyWidget = new SecrecyWidget( categoryBox );
321 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 339 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
322 340
323//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 341//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
324 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); 342 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
325 343
326 // Build the layout and add to the tab widget 344 // Build the layout and add to the tab widget
327 layout->activate(); // required 345 layout->activate(); // required
328 346
329 mTabWidget->addTab( tab1, i18n( "&General" ) ); 347 mTabWidget->addTab( tab1, i18n( "&General" ) );
330} 348}
331 349
332void AddresseeEditorWidget::setRole2FN() 350void AddresseeEditorWidget::setRole2FN()
333{ 351{
334 if ( mRoleEdit->text().isEmpty() ) return; 352 if ( mRoleEdit->text().isEmpty() ) return;
335 mFormattedNameType = NameEditDialog::CustomName; 353 mFormattedNameType = NameEditDialog::CustomName;
336 mAddressee.setFormattedName( mRoleEdit->text() ); 354 mAddressee.setFormattedName( mRoleEdit->text() );
337 mFormattedNameLabel->setText( mRoleEdit->text() ); 355 mFormattedNameLabel->setText( mRoleEdit->text() );
338 mDirty = true; 356 mDirty = true;
339} 357}
340void AddresseeEditorWidget::setCompany2FN() 358void AddresseeEditorWidget::setCompany2FN()
341{ 359{
342 if ( mOrgEdit->text().isEmpty() ) return; 360 if ( mOrgEdit->text().isEmpty() ) return;
343 mFormattedNameType = NameEditDialog::CustomName; 361 mFormattedNameType = NameEditDialog::CustomName;
344 mAddressee.setFormattedName( mOrgEdit->text() ); 362 mAddressee.setFormattedName( mOrgEdit->text() );
345 mFormattedNameLabel->setText( mOrgEdit->text() ); 363 mFormattedNameLabel->setText( mOrgEdit->text() );
346 mDirty = true; 364 mDirty = true;
347} 365}
348 366
349void AddresseeEditorWidget::setupTab1_1() 367void AddresseeEditorWidget::setupTab1_1()
350{ 368{
351 // This is the Address tab 369 // This is the Address tab
352 QWidget *tab1_1 = new QWidget( mTabWidget ); 370 QWidget *tab1_1 = new QWidget( mTabWidget );
353 371
354//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 372//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
355 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 373 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
356 layout->setMargin( KDialogBase::marginHintSmall() ); 374 layout->setMargin( KDialogBase::marginHintSmall() );
357 layout->setSpacing( KDialogBase::spacingHintSmall() ); 375 layout->setSpacing( KDialogBase::spacingHintSmall() );
358 376
359 QLabel *label; 377 QLabel *label;
360 KSeparator* bar; 378 KSeparator* bar;
361 QPushButton *button; 379 QPushButton *button;
362 380
363/*US 381/*US
364 ////////////////////////////////// 382 //////////////////////////////////
365 // Upper left group (person info) 383 // Upper left group (person info)
366 384
367 // Person icon 385 // Person icon
368 label = new QLabel( tab1 ); 386 label = new QLabel( tab1 );
369//US ambiguous call. Add one more parameter 387//US ambiguous call. Add one more parameter
370//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 388//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
371 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 389 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
372 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 390 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
373 391
374 // First name 392 // First name
375 button = new QPushButton( i18n( "Name..." ), tab1 ); 393 button = new QPushButton( i18n( "Name..." ), tab1 );
376 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 394 QToolTip::add( button, i18n( "Edit the contact's name" ) );
377 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 395 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
378 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 396 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
379 SLOT( nameTextChanged( const QString& ) ) ); 397 SLOT( nameTextChanged( const QString& ) ) );
380 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 398 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
381 399
382#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
383 mNameLabel = new KSqueezedTextLabel( tab1 ); 401 mNameLabel = new KSqueezedTextLabel( tab1 );
384 mNameLabel->hide(); 402 mNameLabel->hide();
385#else //KAB_EMBEDDED 403#else //KAB_EMBEDDED
386qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 404qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
387#endif //KAB_EMBEDDED 405#endif //KAB_EMBEDDED
388 406
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 7fe4bc0..0241cf0 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,147 +1,222 @@
1#ifndef PHONEEDITWIDGET_H 1#ifndef PHONEEDITWIDGET_H
2#define PHONEEDITWIDGET_H 2#define PHONEEDITWIDGET_H
3/* 3/*
4 This file is part of KAddressBook. 4 This file is part of KAddressBook.
5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27#include <kiconloader.h>
28#include <qpushbutton.h>
29#include <qlayout.h>
30
27 31
28#include "addresseeconfig.h" 32#include "addresseeconfig.h"
29#include "typecombo.h" 33#include "typecombo.h"
30 34
31class QButtonGroup; 35class QButtonGroup;
32class QCheckBox; 36class QCheckBox;
33 37
38#include <klineedit.h>
39#include <kcombobox.h>
34class KListView; 40class KListView;
35class KLineEdit;
36class KComboBox;
37 41
38typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; 42typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
39 43
40/** 44/**
41 Widget for editing phone numbers. 45 Widget for editing phone numbers.
42*/ 46*/
43class PhoneEditWidget : public QWidget 47class PhoneEditWidget : public QWidget
44{ 48{
45 Q_OBJECT 49 Q_OBJECT
46 50
47 public: 51 public:
48 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 52 PhoneEditWidget( QWidget *parent, const char *name = 0 );
49 ~PhoneEditWidget(); 53 ~PhoneEditWidget();
50 54
51 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 55 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
52 KABC::PhoneNumber::List phoneNumbers(); 56 KABC::PhoneNumber::List phoneNumbers();
53 57
54 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 58 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
55 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 59 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
56 60
57 signals: 61 signals:
58 void modified(); 62 void modified();
59 63
60 private slots: 64 private slots:
61 void edit(); 65 void edit();
62 66
63 void updatePrefEdit(); 67 void updatePrefEdit();
64 void updateSecondEdit(); 68 void updateSecondEdit();
65 void updateThirdEdit(); 69 void updateThirdEdit();
66 void updateFourthEdit(); 70 void updateFourthEdit();
67 71
68 void slotPrefEditChanged(); 72 void slotPrefEditChanged();
69 void slotSecondEditChanged(); 73 void slotSecondEditChanged();
70 void slotThirdEditChanged(); 74 void slotThirdEditChanged();
71 void slotFourthEditChanged(); 75 void slotFourthEditChanged();
72 76
73 protected: 77 protected:
74 void updateLineEdits(); 78 void updateLineEdits();
75 void updateCombos(); 79 void updateCombos();
76 80
77 private: 81 private:
78 void updateEdit( PhoneTypeCombo *combo ); 82 void updateEdit( PhoneTypeCombo *combo );
79 void updatePhoneNumber( PhoneTypeCombo *combo ); 83 void updatePhoneNumber( PhoneTypeCombo *combo );
80 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); 84 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
81 85
82 PhoneTypeCombo *mPrefCombo; 86 PhoneTypeCombo *mPrefCombo;
83 PhoneTypeCombo *mSecondCombo; 87 PhoneTypeCombo *mSecondCombo;
84 PhoneTypeCombo *mThirdCombo; 88 PhoneTypeCombo *mThirdCombo;
85 PhoneTypeCombo *mFourthCombo; 89 PhoneTypeCombo *mFourthCombo;
86 90
87 KLineEdit *mPrefEdit; 91 KLineEdit *mPrefEdit;
88 KLineEdit *mSecondEdit; 92 KLineEdit *mSecondEdit;
89 KLineEdit *mThirdEdit; 93 KLineEdit *mThirdEdit;
90 KLineEdit *mFourthEdit; 94 KLineEdit *mFourthEdit;
91 95
92 KABC::PhoneNumber::List mPhoneList; 96 KABC::PhoneNumber::List mPhoneList;
93}; 97};
94 98
95/** 99/**
96 Dialog for editing lists of phonenumbers. 100 Dialog for editing lists of phonenumbers.
97*/ 101*/
98class PhoneEditDialog : public KDialogBase 102class PhoneEditDialog : public KDialogBase
99{ 103{
100 Q_OBJECT 104 Q_OBJECT
101 105
102 public: 106 public:
103 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); 107 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
104 ~PhoneEditDialog(); 108 ~PhoneEditDialog();
105 109
106 const KABC::PhoneNumber::List &phoneNumbers(); 110 const KABC::PhoneNumber::List &phoneNumbers();
107 bool changed() const; 111 bool changed() const;
108 112
109 protected slots: 113 protected slots:
110 void slotAddPhoneNumber(); 114 void slotAddPhoneNumber();
111 void slotRemovePhoneNumber(); 115 void slotRemovePhoneNumber();
112 void slotEditPhoneNumber(); 116 void slotEditPhoneNumber();
113 void slotSelectionChanged(); 117 void slotSelectionChanged();
114 118
115 private: 119 private:
116 KABC::PhoneNumber::List mPhoneNumberList; 120 KABC::PhoneNumber::List mPhoneNumberList;
117 KABC::PhoneNumber::TypeList mTypeList; 121 KABC::PhoneNumber::TypeList mTypeList;
118 KComboBox *mTypeBox; 122 KComboBox *mTypeBox;
119 KListView *mListView; 123 KListView *mListView;
120 124
121 QPushButton *mRemoveButton; 125 QPushButton *mRemoveButton;
122 QPushButton *mEditButton; 126 QPushButton *mEditButton;
123 127
124 bool mChanged; 128 bool mChanged;
125}; 129};
126 130
127/** 131/**
128 Dialog for editing phone number types. 132 Dialog for editing phone number types.
129*/ 133*/
130class PhoneTypeDialog : public KDialogBase 134class PhoneTypeDialog : public KDialogBase
131{ 135{
132 Q_OBJECT 136 Q_OBJECT
133public: 137public:
134 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); 138 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
135 139
136 KABC::PhoneNumber phoneNumber(); 140 KABC::PhoneNumber phoneNumber();
137 141
138private: 142private:
139 KABC::PhoneNumber mPhoneNumber; 143 KABC::PhoneNumber mPhoneNumber;
140 KABC::PhoneNumber::TypeList mTypeList; 144 KABC::PhoneNumber::TypeList mTypeList;
141 145
142 QButtonGroup *mGroup; 146 QButtonGroup *mGroup;
143 QCheckBox *mPreferredBox; 147 QCheckBox *mPreferredBox;
144 KLineEdit *mNumber; 148 KLineEdit *mNumber;
145}; 149};
150class PhoneTypeNumberEdit : public QWidget
151{
152 Q_OBJECT
153public:
154 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 )
155 {
156 QHBoxLayout * lay = new QHBoxLayout( this );
157 lay->setSpacing( KDialogBase::spacingHintSmall() );
158 lay->setMargin( KDialogBase::marginHintSmall() );
159 mMinusButton = new QPushButton ( this );
160 mMinusButton->setPixmap ( SmallIcon("minus"));
161 mCombo = new KComboBox( this );
162 mNumber = new KLineEdit( this );
163 lay->addWidget( mMinusButton );
164 lay->addWidget( mCombo );
165 lay->addWidget( mNumber );
166 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
167 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
168 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
169 }
170
171 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
172 {
173 mPhoneNumber = phoneNumber;
174 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
175 mCombo->setCurrentItem( index );
176 mNumber->setText( mPhoneNumber.number() );
177 show();
178
179 }
180 KABC::PhoneNumber phoneNumber()
181 {
182 mPhoneNumber.setNumber( mNumber->text() );
183 int index = mCombo->currentItem();
184 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
185 return mPhoneNumber;
186
187 }
188 private slots:
189 void typeExternalChanged( int oldType, int newType )
190 {
191 if ( mPhoneNumber.type() == newType ) {
192 mPhoneNumber.setType(oldType);
193 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
194 mCombo->setCurrentItem( index );
195 }
196
197 }
198 void deleteNumber()
199 {
200 hide();
201 }
202 void comboTypeChange( int index )
203 {
204 int old = mPhoneNumber.type();
205 int newT = PhoneNumber::supportedTypeList()[index];
206 if ( old != newT ) {
207 mPhoneNumber.setType(newT );
208 emit typeChange ( old, newT );
209 }
210
211 }
212 signals:
213void typeChange( int oldType, int newType );
214
215private:
216 KABC::PhoneNumber mPhoneNumber;
217 QPushButton* mMinusButton;
218 KComboBox *mCombo;
219 KLineEdit *mNumber;
220};
146 221
147#endif 222#endif