/usr/include/kabc/addressee.h is in kdepimlibs5-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | /*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
2013 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KABC_ADDRESSEE_H
#define KABC_ADDRESSEE_H
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
#include <QtCore/QSharedDataPointer>
#include <kurl.h>
#include "kabc/address.h"
#include "kabc/geo.h"
#include "kabc/key.h"
#include "kabc/phonenumber.h"
#include "kabc/picture.h"
#include "kabc/secrecy.h"
#include "kabc/sound.h"
#include "kabc/timezone.h"
#include "kabc/addresseelist.h" // for typedef QList<Addressee> List;
namespace KABC {
#ifndef KDEPIM_NO_KRESOURCES
class Resource;
#endif
class SortMode;
/**
@short address book entry
This class represents an entry in the address book.
The data of this class is implicitly shared. You can pass this class by value.
If you need the name of a field for presenting it to the user you should use
the functions ending in Label(). They return a translated string which can be
used as label for the corresponding field.
About the name fields:
givenName() is the first name and familyName() the last name. In some
countries the family name comes first, that's the reason for the
naming. formattedName() is the full name with the correct formatting.
It is used as an override, when the correct formatting can't be generated
from the other name fields automatically.
realName() returns a fully formatted name(). It uses formattedName, if set,
otherwise it constucts the name from the name fields. As fallback, if
nothing else is set it uses name().
name() is the NAME type of RFC2426. It can be used as internal name for the
data enty, but shouldn't be used for displaying the data to the user.
*/
class KABC_EXPORT Addressee
{
friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
public:
/**
A list of addressee objects
*/
typedef AddresseeList List;
/**
A map from unique identifier to addressee.
@see uid()
*/
typedef QMap<QString, Addressee> Map;
/**
Construct an empty address book entry.
*/
Addressee();
/**
Destroys the address book entry.
*/
~Addressee();
/**
Copy constructor.
*/
Addressee( const Addressee & );
/**
Assignment operator.
@return a reference to @c this
*/
Addressee &operator=( const Addressee & );
/**
Equality operator.
@return @c true if @c this and the given addressee are equal,
otherwise @c false
*/
bool operator==( const Addressee & ) const;
/**
Not-equal operator.
@return @c true if @c this and the given addressee are not equal,
otherwise @c false
*/
bool operator!=( const Addressee & ) const;
/**
Return, if the address book entry is empty.
*/
bool isEmpty() const;
/**
Set unique identifier.
@param uid the KABC unique identifier
*/
void setUid( const QString &uid );
/**
Return unique identifier.
*/
QString uid() const;
/**
Return translated label for uid field.
*/
static QString uidLabel();
/**
Set name.
*/
void setName( const QString &name );
/**
Return name.
*/
QString name() const;
/**
Return translated label for name field.
*/
static QString nameLabel();
/**
Set formatted name.
*/
void setFormattedName( const QString &formattedName );
/**
Return formatted name.
*/
QString formattedName() const;
/**
Return translated label for formattedName field.
*/
static QString formattedNameLabel();
/**
Set family name.
*/
void setFamilyName( const QString &familyName );
/**
Return family name.
*/
QString familyName() const;
/**
Return translated label for familyName field.
*/
static QString familyNameLabel();
/**
Set given name.
*/
void setGivenName( const QString &givenName );
/**
Return given name.
*/
QString givenName() const;
/**
Return translated label for givenName field.
*/
static QString givenNameLabel();
/**
Set additional names.
*/
void setAdditionalName( const QString &additionalName );
/**
Return additional names.
*/
QString additionalName() const;
/**
Return translated label for additionalName field.
*/
static QString additionalNameLabel();
/**
Set honorific prefixes.
*/
void setPrefix( const QString &prefix );
/**
Return honorific prefixes.
*/
QString prefix() const;
/**
Return translated label for prefix field.
*/
static QString prefixLabel();
/**
Set honorific suffixes.
*/
void setSuffix( const QString &suffix );
/**
Return honorific suffixes.
*/
QString suffix() const;
/**
Return translated label for suffix field.
*/
static QString suffixLabel();
/**
Set nick name.
*/
void setNickName( const QString &nickName );
/**
Return nick name.
*/
QString nickName() const;
/**
Return translated label for nickName field.
*/
static QString nickNameLabel();
/**
Set birthday.
*/
void setBirthday( const QDateTime &birthday );
/**
Return birthday.
*/
QDateTime birthday() const;
/**
Return translated label for birthday field.
*/
static QString birthdayLabel();
/**
Return translated label for homeAddressStreet field.
*/
static QString homeAddressStreetLabel();
/**
Return translated label for homeAddressPostOfficeBox field.
*/
static QString homeAddressPostOfficeBoxLabel();
/**
Return translated label for homeAddressLocality field.
*/
static QString homeAddressLocalityLabel();
/**
Return translated label for homeAddressRegion field.
*/
static QString homeAddressRegionLabel();
/**
Return translated label for homeAddressPostalCode field.
*/
static QString homeAddressPostalCodeLabel();
/**
Return translated label for homeAddressCountry field.
*/
static QString homeAddressCountryLabel();
/**
Return translated label for homeAddressLabel field.
*/
static QString homeAddressLabelLabel();
/**
Return translated label for businessAddressStreet field.
*/
static QString businessAddressStreetLabel();
/**
Return translated label for businessAddressPostOfficeBox field.
*/
static QString businessAddressPostOfficeBoxLabel();
/**
Return translated label for businessAddressLocality field.
*/
static QString businessAddressLocalityLabel();
/**
Return translated label for businessAddressRegion field.
*/
static QString businessAddressRegionLabel();
/**
Return translated label for businessAddressPostalCode field.
*/
static QString businessAddressPostalCodeLabel();
/**
Return translated label for businessAddressCountry field.
*/
static QString businessAddressCountryLabel();
/**
Return translated label for businessAddressLabel field.
*/
static QString businessAddressLabelLabel();
/**
Return translated label for homePhone field.
*/
static QString homePhoneLabel();
/**
Return translated label for businessPhone field.
*/
static QString businessPhoneLabel();
/**
Return translated label for mobilePhone field.
*/
static QString mobilePhoneLabel();
/**
Return translated label for homeFax field.
*/
static QString homeFaxLabel();
/**
Return translated label for businessFax field.
*/
static QString businessFaxLabel();
/**
Return translated label for carPhone field.
*/
static QString carPhoneLabel();
/**
Return translated label for isdn field.
*/
static QString isdnLabel();
/**
Return translated label for pager field.
*/
static QString pagerLabel();
/**
Return translated label for email field.
*/
static QString emailLabel();
/**
Set mail client.
*/
void setMailer( const QString &mailer );
/**
Return mail client.
*/
QString mailer() const;
/**
Return translated label for mailer field.
*/
static QString mailerLabel();
/**
Set time zone.
*/
void setTimeZone( const TimeZone &timeZone );
/**
Return time zone.
*/
TimeZone timeZone() const;
/**
Return translated label for timeZone field.
*/
static QString timeZoneLabel();
/**
Set geographic position.
*/
void setGeo( const Geo &geo );
/**
Return geographic position.
*/
Geo geo() const;
/**
Return translated label for geo field.
*/
static QString geoLabel();
/**
Set title.
*/
void setTitle( const QString &title );
/**
Return title.
*/
QString title() const;
/**
Return translated label for title field.
*/
static QString titleLabel();
/**
Set role.
*/
void setRole( const QString &role );
/**
Return role.
*/
QString role() const;
/**
Return translated label for role field.
*/
static QString roleLabel();
/**
Set organization.
*/
void setOrganization( const QString &organization );
/**
Return organization.
*/
QString organization() const;
/**
Return translated label for organization field.
*/
static QString organizationLabel();
/**
Set department.
*/
void setDepartment( const QString &department );
/**
Return department.
*/
QString department() const;
/**
Return translated label for department field.
*/
static QString departmentLabel();
/**
Set note.
*/
void setNote( const QString ¬e );
/**
Return note.
*/
QString note() const;
/**
Return translated label for note field.
*/
static QString noteLabel();
/**
Set product identifier.
*/
void setProductId( const QString &productId );
/**
Return product identifier.
*/
QString productId() const;
/**
Return translated label for productId field.
*/
static QString productIdLabel();
/**
Set revision date.
*/
void setRevision( const QDateTime &revision );
/**
Return revision date.
*/
QDateTime revision() const;
/**
Return translated label for revision field.
*/
static QString revisionLabel();
/**
Set sort string.
*/
void setSortString( const QString &sortString );
/**
Return sort string.
*/
QString sortString() const;
/**
Return translated label for sortString field.
*/
static QString sortStringLabel();
/**
Set homepage.
*/
void setUrl( const KUrl &url );
/**
Return homepage.
*/
KUrl url() const;
/**
Return translated label for url field.
*/
static QString urlLabel();
/**
Set security class.
*/
void setSecrecy( const Secrecy &secrecy );
/**
Return security class.
*/
Secrecy secrecy() const;
/**
Return translated label for secrecy field.
*/
static QString secrecyLabel();
/**
Set logo.
*/
void setLogo( const Picture &logo );
/**
Return logo.
*/
Picture logo() const;
/**
Return translated label for logo field.
*/
static QString logoLabel();
/**
Set photo.
*/
void setPhoto( const Picture &photo );
/**
Return photo.
*/
Picture photo() const;
/**
Return translated label for photo field.
*/
static QString photoLabel();
/**
Set sound.
*/
void setSound( const Sound &sound );
/**
Return sound.
*/
Sound sound() const;
/**
Return translated label for sound field.
*/
static QString soundLabel();
/**
Set name fields by parsing the given string and trying to associate the
parts of the string with according fields. This function should probably
be a bit more clever.
*/
void setNameFromString( const QString & );
/**
Return the name of the addressee. This is calculated from all the name
fields.
*/
QString realName() const;
/**
Return the name that consists of all name parts.
*/
QString assembledName() const;
/**
Return email address including real name.
@param email Email address to be used to construct the full email string.
If this is QString() the preferred email address is used.
*/
QString fullEmail( const QString &email=QString() ) const;
/**
Insert an email address. If the email address already exists in this
addressee it is not duplicated.
@param email Email address
@param preferred Set to true, if this is the preferred email address of
the addressee.
*/
void insertEmail( const QString &email, bool preferred=false );
/**
Remove email address. If the email address doesn't exist, nothing happens.
@param email Email address to remove
*/
void removeEmail( const QString &email );
/**
Return preferred email address. This is the first email address or the
last one added with insertEmail() with a set preferred parameter.
*/
QString preferredEmail() const;
/**
Return list of all email addresses.
*/
QStringList emails() const;
/**
Set the emails to @p list.
The first email address gets the preferred one!
@param list The list of email addresses.
*/
void setEmails( const QStringList& list);
/**
Insert a phone number. If a phone number with the same id already exists
in this addressee it is not duplicated.
@param phoneNumber The telephone number to insert to the addressee
*/
void insertPhoneNumber( const PhoneNumber &phoneNumber );
/**
Remove phone number. If no phone number with the given id exists for this
addresse nothing happens.
@param phoneNumber The telephone number to remove from the addressee
*/
void removePhoneNumber( const PhoneNumber &phoneNumber );
/**
Return phone number, which matches the given type.
@param type The type of phone number to get
*/
PhoneNumber phoneNumber( PhoneNumber::Type type ) const;
/**
Return list of all phone numbers.
*/
PhoneNumber::List phoneNumbers() const;
/**
Return list of phone numbers with a special type.
@param type The type of phone number to get
*/
PhoneNumber::List phoneNumbers( PhoneNumber::Type type ) const;
/**
Return phone number with the given id.
@param id The identifier of the phone number to look for.
See PhoneNumber::id()
*/
PhoneNumber findPhoneNumber( const QString &id ) const;
/**
Insert a key. If a key with the same id already exists
in this addressee it is not duplicated.
@param key The key to insert
*/
void insertKey( const Key &key );
/**
Remove a key. If no key with the given id exists for this
addresse nothing happens.
@param key The key to remove
*/
void removeKey( const Key &key );
/**
Return key, which matches the given type.
If @p type == Key::Custom you can specify a string
that should match. If you leave the string empty, the first
key with a custom value is returned.
@param type The type of key to look for
@param customTypeString A string to match custom keys against when
@p type is @c Key::Custom
*/
Key key( Key::Type type, QString customTypeString = QString() ) const;
/**
Return list of all keys.
*/
Key::List keys() const;
/**
Set the list of keys
@param keys The keys to be set.
*/
void setKeys( const Key::List& keys);
/**
Return list of keys with a special type.
If @p type == Key::Custom you can specify a string
that should match. If you leave the string empty, all custom
keys will be returned.
@param type The type of key to look for
@param customTypeString A string to match custom keys against when
@p type is @c Key::Custom
*/
Key::List keys( Key::Type type, QString customTypeString = QString() ) const;
/**
Return key with the given id.
@param id The identifier of the key to look for. See Key::id()
*/
Key findKey( const QString &id ) const;
/**
Insert an address. If an address with the same id already exists
in this addressee it is not duplicated.
@param address The address to insert
*/
void insertAddress( const Address &address );
/**
Remove address. If no address with the given id exists for this
addresse nothing happens.
@param address The address to remove
*/
void removeAddress( const Address &address );
/**
Return address, which matches the given type.
@param type The type of address to look for
*/
Address address( Address::Type type ) const;
/**
Return list of all addresses.
*/
Address::List addresses() const;
/**
Return list of addresses with a special type.
@param type The type of addresses to look for
*/
Address::List addresses( Address::Type type ) const;
/**
Return address with the given id.
@param id The identifier of the address to look for. See Address::id()
*/
Address findAddress( const QString &id ) const;
/**
Insert category. If the category already exists it is not duplicated.
*/
void insertCategory( const QString & );
/**
Remove category.
*/
void removeCategory( const QString & );
/**
Return, if addressee has the given category.
*/
bool hasCategory( const QString & ) const;
/**
Set categories to given value.
*/
void setCategories( const QStringList & );
/**
Return list of all set categories.
*/
QStringList categories() const;
/**
Insert custom entry. The entry is identified by the name of the inserting
application and a unique name. If an entry with the given app and name
already exists its value is replaced with the new given value.
An empty value isn't allowed (nothing happens if this is called with
any of the three arguments being empty)
@param app Name of the application inserting this custom entry
@param name Name of this application specific custom entry
@param value Value of this application specific custom entry
*/
void insertCustom( const QString &app, const QString &name,
const QString &value );
/**
Remove custom entry.
@param app Name of the application which has inserted this custom entry
@param name Name of this application specific custom entry
*/
void removeCustom( const QString &app, const QString &name );
/**
Return value of custom entry, identified by app and entry name.
@param app Name of the application which has inserted this custom entry
@param name Name of this application specific custom entry
*/
QString custom( const QString &app, const QString &name ) const;
/**
Set all custom entries.
*/
void setCustoms( const QStringList & );
/**
Return list of all custom entries.
The format of the custom entries is 'app-key:value' and the list is sorted
alphabetically by 'app-key'.
*/
QStringList customs() const;
/**
Parse full email address. The result is given back in fullName and email.
@param rawEmail The input string to parse for name and email
@param fullName The name part of the @p rawEmail input, if it contained one
@param email The email part of the @p rawEmail input, if it contained one
*/
static void parseEmailAddress( const QString &rawEmail, QString &fullName,
QString &email );
/**
Returns string representation of the addressee.
*/
QString toString() const;
#ifndef KDEPIM_NO_KRESOURCES
/**
Set resource where the addressee is from.
@param resource The Resource the addressee is from
*/
void setResource( Resource *resource );
/**
Return pointer to resource.
*/
Resource *resource() const;
#endif
/**
Mark addressee as changed.
@param value Sets the status indicating changed data
*/
void setChanged( bool value );
/**
Return whether the addressee is changed.
*/
bool changed() const;
/**
Sets the sort mode implementation.
Comparing to addressee objects is delegated to an instance
of a subclass of KABC::SortMode.
@param mode The sort mode implementator to use
*/
static void setSortMode( KABC::SortMode *mode );
/**
Return whether this addressee is "less-than" a given one
@param addr The addressee object to compare with
@see setSortMode()
*/
bool operator< ( const Addressee &addr ) const;
/**
Returns the MIME type used for Addressees
*/
static QString mimeType();
private:
class Private;
QSharedDataPointer<Private> d;
};
#ifdef kabc_EXPORTS
KDE_DUMMY_QHASH_FUNCTION( Addressee )
#endif
KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
}
#define KABC_ADDRESSEE_METATYPE_DEFINED 1
Q_DECLARE_METATYPE( KABC::Addressee )
#endif
|