summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.h
Unidiff
Diffstat (limited to 'kabc/addressee.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.h817
1 files changed, 817 insertions, 0 deletions
diff --git a/kabc/addressee.h b/kabc/addressee.h
new file mode 100644
index 0000000..ee98e03
--- a/dev/null
+++ b/kabc/addressee.h
@@ -0,0 +1,817 @@
1/*** Warning! This file has been generated by the script makeaddressee ***/
2/*
3 This file is part of libkabc.
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21
22/*
23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk
25
26$Id$
27*/
28
29#ifndef KABC_ADDRESSEE_H
30#define KABC_ADDRESSEE_H
31
32#include <qdatetime.h>
33#include <qstring.h>
34#include <qstringlist.h>
35#include <qvaluelist.h>
36
37#include <ksharedptr.h>
38#include <kurl.h>
39
40#include "address.h"
41#include "agent.h"
42#include "geo.h"
43#include "key.h"
44#include "phonenumber.h"
45#include "picture.h"
46#include "secrecy.h"
47#include "sound.h"
48#include "timezone.h"
49
50namespace KABC {
51
52class Resource;
53
54/**
55 @short address book entry
56
57 This class represents an entry in the address book.
58
59 The data of this class is implicitly shared. You can pass this class by value.
60
61 If you need the name of a field for presenting it to the user you should use
62 the functions ending in Label(). They return a translated string which can be
63 used as label for the corresponding field.
64
65 About the name fields:
66
67 givenName() is the first name and familyName() the last name. In some
68 countries the family name comes first, that's the reason for the
69 naming. formattedName() is the full name with the correct formatting.
70 It is used as an override, when the correct formatting can't be generated
71 from the other name fields automatically.
72
73 realName() returns a fully formatted name(). It uses formattedName, if set,
74 otherwise it constucts the name from the name fields. As fallback, if
75 nothing else is set it uses name().
76
77 name() is the NAME type of RFC2426. It can be used as internal name for the
78 data enty, but shouldn't be used for displaying the data to the user.
79 */
80class Addressee
81{
82 friend QDataStream &operator<<( QDataStream &, const Addressee & );
83 friend QDataStream &operator>>( QDataStream &, Addressee & );
84
85 public:
86 typedef QValueList<Addressee> List;
87
88 /**
89 Construct an empty address book entry.
90 */
91 Addressee();
92 ~Addressee();
93
94 Addressee( const Addressee & );
95 Addressee &operator=( const Addressee & );
96
97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const;
99
100 /**
101 Return, if the address book entry is empty.
102 */
103 bool isEmpty() const;
104
105 /**
106 Set unique identifier.
107 */
108 void setUid( const QString &uid );
109 /**
110 Return unique identifier.
111 */
112 QString uid() const;
113 /**
114 Return translated label for uid field.
115 */
116 static QString uidLabel();
117
118 /**
119 Set name.
120 */
121 void setName( const QString &name );
122 /**
123 Return name.
124 */
125 QString name() const;
126 /**
127 Return translated label for name field.
128 */
129 static QString nameLabel();
130
131 /**
132 Set formatted name.
133 */
134 void setFormattedName( const QString &formattedName );
135 /**
136 Return formatted name.
137 */
138 QString formattedName() const;
139 /**
140 Return translated label for formattedName field.
141 */
142 static QString formattedNameLabel();
143
144 /**
145 Set family name.
146 */
147 void setFamilyName( const QString &familyName );
148 /**
149 Return family name.
150 */
151 QString familyName() const;
152 /**
153 Return translated label for familyName field.
154 */
155 static QString familyNameLabel();
156
157 /**
158 Set given name.
159 */
160 void setGivenName( const QString &givenName );
161 /**
162 Return given name.
163 */
164 QString givenName() const;
165 /**
166 Return translated label for givenName field.
167 */
168 static QString givenNameLabel();
169
170 /**
171 Set additional names.
172 */
173 void setAdditionalName( const QString &additionalName );
174 /**
175 Return additional names.
176 */
177 QString additionalName() const;
178 /**
179 Return translated label for additionalName field.
180 */
181 static QString additionalNameLabel();
182
183 /**
184 Set honorific prefixes.
185 */
186 void setPrefix( const QString &prefix );
187 /**
188 Return honorific prefixes.
189 */
190 QString prefix() const;
191 /**
192 Return translated label for prefix field.
193 */
194 static QString prefixLabel();
195
196 /**
197 Set honorific suffixes.
198 */
199 void setSuffix( const QString &suffix );
200 /**
201 Return honorific suffixes.
202 */
203 QString suffix() const;
204 /**
205 Return translated label for suffix field.
206 */
207 static QString suffixLabel();
208
209 /**
210 Set nick name.
211 */
212 void setNickName( const QString &nickName );
213 /**
214 Return nick name.
215 */
216 QString nickName() const;
217 /**
218 Return translated label for nickName field.
219 */
220 static QString nickNameLabel();
221
222 /**
223 Set birthday.
224 */
225 void setBirthday( const QDateTime &birthday );
226 /**
227 Return birthday.
228 */
229 QDateTime birthday() const;
230 /**
231 Return translated label for birthday field.
232 */
233 static QString birthdayLabel();
234
235 /**
236 Return translated label for homeAddressStreet field.
237 */
238 static QString homeAddressStreetLabel();
239
240 /**
241 Return translated label for homeAddressLocality field.
242 */
243 static QString homeAddressLocalityLabel();
244
245 /**
246 Return translated label for homeAddressRegion field.
247 */
248 static QString homeAddressRegionLabel();
249
250 /**
251 Return translated label for homeAddressPostalCode field.
252 */
253 static QString homeAddressPostalCodeLabel();
254
255 /**
256 Return translated label for homeAddressCountry field.
257 */
258 static QString homeAddressCountryLabel();
259
260 /**
261 Return translated label for homeAddressLabel field.
262 */
263 static QString homeAddressLabelLabel();
264
265 /**
266 Return translated label for businessAddressStreet field.
267 */
268 static QString businessAddressStreetLabel();
269
270 /**
271 Return translated label for businessAddressLocality field.
272 */
273 static QString businessAddressLocalityLabel();
274
275 /**
276 Return translated label for businessAddressRegion field.
277 */
278 static QString businessAddressRegionLabel();
279
280 /**
281 Return translated label for businessAddressPostalCode field.
282 */
283 static QString businessAddressPostalCodeLabel();
284
285 /**
286 Return translated label for businessAddressCountry field.
287 */
288 static QString businessAddressCountryLabel();
289
290 /**
291 Return translated label for businessAddressLabel field.
292 */
293 static QString businessAddressLabelLabel();
294
295 /**
296 Return translated label for homePhone field.
297 */
298 static QString homePhoneLabel();
299
300 /**
301 Return translated label for businessPhone field.
302 */
303 static QString businessPhoneLabel();
304
305 /**
306 Return translated label for mobilePhone field.
307 */
308 static QString mobilePhoneLabel();
309
310 /**
311 Return translated label for homeFax field.
312 */
313 static QString homeFaxLabel();
314
315 /**
316 Return translated label for businessFax field.
317 */
318 static QString businessFaxLabel();
319
320 /**
321 Return translated label for carPhone field.
322 */
323 static QString carPhoneLabel();
324
325 /**
326 Return translated label for isdn field.
327 */
328 static QString isdnLabel();
329
330 /**
331 Return translated label for pager field.
332 */
333 static QString pagerLabel();
334
335 /**
336 Return translated label for email field.
337 */
338 static QString emailLabel();
339
340 /**
341 Set mail client.
342 */
343 void setMailer( const QString &mailer );
344 /**
345 Return mail client.
346 */
347 QString mailer() const;
348 /**
349 Return translated label for mailer field.
350 */
351 static QString mailerLabel();
352
353 /**
354 Set time zone.
355 */
356 void setTimeZone( const TimeZone &timeZone );
357 /**
358 Return time zone.
359 */
360 TimeZone timeZone() const;
361 /**
362 Return translated label for timeZone field.
363 */
364 static QString timeZoneLabel();
365
366 /**
367 Set geographic position.
368 */
369 void setGeo( const Geo &geo );
370 /**
371 Return geographic position.
372 */
373 Geo geo() const;
374 /**
375 Return translated label for geo field.
376 */
377 static QString geoLabel();
378
379 /**
380 Set title.
381 */
382 void setTitle( const QString &title );
383 /**
384 Return title.
385 */
386 QString title() const;
387 /**
388 Return translated label for title field.
389 */
390 static QString titleLabel();
391
392 /**
393 Set role.
394 */
395 void setRole( const QString &role );
396 /**
397 Return role.
398 */
399 QString role() const;
400 /**
401 Return translated label for role field.
402 */
403 static QString roleLabel();
404
405 /**
406 Set organization.
407 */
408 void setOrganization( const QString &organization );
409 /**
410 Return organization.
411 */
412 QString organization() const;
413 /**
414 Return translated label for organization field.
415 */
416 static QString organizationLabel();
417
418 /**
419 Set note.
420 */
421 void setNote( const QString &note );
422 /**
423 Return note.
424 */
425 QString note() const;
426 /**
427 Return translated label for note field.
428 */
429 static QString noteLabel();
430
431 /**
432 Set product identifier.
433 */
434 void setProductId( const QString &productId );
435 /**
436 Return product identifier.
437 */
438 QString productId() const;
439 /**
440 Return translated label for productId field.
441 */
442 static QString productIdLabel();
443
444 /**
445 Set revision date.
446 */
447 void setRevision( const QDateTime &revision );
448 /**
449 Return revision date.
450 */
451 QDateTime revision() const;
452 /**
453 Return translated label for revision field.
454 */
455 static QString revisionLabel();
456
457 /**
458 Set sort string.
459 */
460 void setSortString( const QString &sortString );
461 /**
462 Return sort string.
463 */
464 QString sortString() const;
465 /**
466 Return translated label for sortString field.
467 */
468 static QString sortStringLabel();
469
470 /**
471 Set URL.
472 */
473 void setUrl( const KURL &url );
474 /**
475 Return URL.
476 */
477 KURL url() const;
478 /**
479 Return translated label for url field.
480 */
481 static QString urlLabel();
482
483 /**
484 Set security class.
485 */
486 void setSecrecy( const Secrecy &secrecy );
487 /**
488 Return security class.
489 */
490 Secrecy secrecy() const;
491 /**
492 Return translated label for secrecy field.
493 */
494 static QString secrecyLabel();
495
496 /**
497 Set logo.
498 */
499 void setLogo( const Picture &logo );
500 /**
501 Return logo.
502 */
503 Picture logo() const;
504 /**
505 Return translated label for logo field.
506 */
507 static QString logoLabel();
508
509 /**
510 Set photo.
511 */
512 void setPhoto( const Picture &photo );
513 /**
514 Return photo.
515 */
516 Picture photo() const;
517 /**
518 Return translated label for photo field.
519 */
520 static QString photoLabel();
521
522 /**
523 Set sound.
524 */
525 void setSound( const Sound &sound );
526 /**
527 Return sound.
528 */
529 Sound sound() const;
530 /**
531 Return translated label for sound field.
532 */
533 static QString soundLabel();
534
535 /**
536 Set agent.
537 */
538 void setAgent( const Agent &agent );
539 /**
540 Return agent.
541 */
542 Agent agent() const;
543 /**
544 Return translated label for agent field.
545 */
546 static QString agentLabel();
547
548 /**
549 Set name fields by parsing the given string and trying to associate the
550 parts of the string with according fields. This function should probably
551 be a bit more clever.
552 */
553 void setNameFromString( const QString & );
554
555 /**
556 Return the name of the addressee. This is calculated from all the name
557 fields.
558 */
559 QString realName() const;
560
561 /**
562 Return the name that consists of all name parts.
563 */
564 QString assembledName() const;
565
566 /**
567 Return email address including real name.
568
569 @param email Email address to be used to construct the full email string.
570 If this is QString::null the preferred email address is used.
571 */
572 QString fullEmail( const QString &email=QString::null ) const;
573
574 /**
575 Insert an email address. If the email address already exists in this
576 addressee it is not duplicated.
577
578 @param email Email address
579 @param preferred Set to true, if this is the preferred email address of
580 the addressee.
581 */
582 void insertEmail( const QString &email, bool preferred=false );
583
584 /**
585 Remove email address. If the email address doesn't exist, nothing happens.
586 */
587 void removeEmail( const QString &email );
588
589 /**
590 Return preferred email address. This is the first email address or the
591 last one added with @ref insertEmail() with a set preferred parameter.
592 */
593 QString preferredEmail() const;
594
595 /**
596 Return list of all email addresses.
597 */
598 QStringList emails() const;
599
600 /**
601 Set the emails to @param.
602 The first email address gets the preferred one!
603 @param list The list of email addresses.
604 */
605 void setEmails( const QStringList& list);
606
607 /**
608 Insert a phone number. If a phone number with the same id already exists
609 in this addressee it is not duplicated.
610 */
611 void insertPhoneNumber( const PhoneNumber &phoneNumber );
612
613 /**
614 Remove phone number. If no phone number with the given id exists for this
615 addresse nothing happens.
616 */
617 void removePhoneNumber( const PhoneNumber &phoneNumber );
618
619 /**
620 Return phone number, which matches the given type.
621 */
622 PhoneNumber phoneNumber( int type ) const;
623
624 /**
625 Return list of all phone numbers.
626 */
627 PhoneNumber::List phoneNumbers() const;
628
629 /**
630 Return list of phone numbers with a special type.
631 */
632 PhoneNumber::List phoneNumbers( int type ) const;
633
634 /**
635 Return phone number with the given id.
636 */
637 PhoneNumber findPhoneNumber( const QString &id ) const;
638
639 /**
640 Insert a key. If a key with the same id already exists
641 in this addressee it is not duplicated.
642 */
643 void insertKey( const Key &key );
644
645 /**
646 Remove a key. If no key with the given id exists for this
647 addresse nothing happens.
648 */
649 void removeKey( const Key &key );
650
651 /**
652 Return key, which matches the given type.
653 If @p type == Key::Custom you can specify a string
654 that should match. If you leave the string empty, the first
655 key with a custom value is returned.
656 */
657 Key key( int type, QString customTypeString = QString::null ) const;
658
659 /**
660 Return list of all keys.
661 */
662 Key::List keys() const;
663
664 /**
665 Set the list of keys
666 @param keys The keys to be set.
667 */
668 void setKeys( const Key::List& keys);
669
670 /**
671 Return list of keys with a special type.
672 If @p type == Key::Custom you can specify a string
673 that should match. If you leave the string empty, all custom
674 keys will be returned.
675 */
676 Key::List keys( int type, QString customTypeString = QString::null ) const;
677
678 /**
679 Return key with the given id.
680 */
681 Key findKey( const QString &id ) const;
682
683 /**
684 Insert an address. If an address with the same id already exists
685 in this addressee it is not duplicated.
686 */
687 void insertAddress( const Address &address );
688
689 /**
690 Remove address. If no address with the given id exists for this
691 addresse nothing happens.
692 */
693 void removeAddress( const Address &address );
694
695 /**
696 Return address, which matches the given type.
697 */
698 Address address( int type ) const;
699
700 /**
701 Return list of all addresses.
702 */
703 Address::List addresses() const;
704
705 /**
706 Return list of addresses with a special type.
707 */
708 Address::List addresses( int type ) const;
709
710 /**
711 Return address with the given id.
712 */
713 Address findAddress( const QString &id ) const;
714
715 /**
716 Insert category. If the category already exists it is not duplicated.
717 */
718 void insertCategory( const QString & );
719
720 /**
721 Remove category.
722 */
723 void removeCategory( const QString & );
724
725 /**
726 Return, if addressee has the given category.
727 */
728 bool hasCategory( const QString & ) const;
729
730 /**
731 Set categories to given value.
732 */
733 void setCategories( const QStringList & );
734
735 /**
736 Return list of all set categories.
737 */
738 QStringList categories() const;
739
740 /**
741 Insert custom entry. The entry is identified by the name of the inserting
742 application and a unique name. If an entry with the given app and name
743 already exists its value is replaced with the new given value.
744 */
745 void insertCustom( const QString &app, const QString &name,
746 const QString &value );
747
748 /**
749 Remove custom entry.
750 */
751 void removeCustom( const QString &app, const QString &name );
752
753 /**
754 Return value of custom entry, identified by app and entry name.
755 */
756 QString custom( const QString &app, const QString &name ) const;
757
758 /**
759 Set all custom entries.
760 */
761 void setCustoms( const QStringList & );
762
763 /**
764 Return list of all custom entries.
765 */
766 QStringList customs() const;
767
768 /**
769 Parse full email address. The result is given back in fullName and email.
770 */
771 static void parseEmailAddress( const QString &rawEmail, QString &fullName,
772 QString &email );
773
774 /**
775 Debug output.
776 */
777 void dump() const;
778
779 /**
780 Returns string representation of the addressee.
781 */
782 QString asString() const;
783
784 /**
785 Set resource where the addressee is from.
786 */
787 void setResource( Resource *resource );
788
789 /**
790 Return pointer to resource.
791 */
792 Resource *resource() const;
793
794 /**
795 Mark addressee as changed.
796 */
797 void setChanged( bool value );
798
799 /**
800 Return whether the addressee is changed.
801 */
802 bool changed() const;
803
804 private:
805 Addressee copy();
806 void detach();
807
808 struct AddresseeData;
809 mutable KSharedPtr<AddresseeData> mData;
810};
811
812QDataStream &operator<<( QDataStream &, const Addressee & );
813QDataStream &operator>>( QDataStream &, Addressee & );
814
815}
816
817#endif