summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-10-29 16:39:40 (UTC)
committer zautrix <zautrix>2005-10-29 16:39:40 (UTC)
commit898dbabef6d747447999add46201315d04f85f63 (patch) (unidiff)
treefb247cbbd99ca6918400547e16484a58a8ba1523 /libkcal
parent1360f8e3b5da58b561f868643d2d5f04b874cee7 (diff)
downloadkdepimpi-898dbabef6d747447999add46201315d04f85f63.zip
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.gz
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.bz2
commit
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/person.cpp8
-rw-r--r--libkcal/person.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/libkcal/person.cpp b/libkcal/person.cpp
index aca28c2..858805d 100644
--- a/libkcal/person.cpp
+++ b/libkcal/person.cpp
@@ -40,25 +40,31 @@ Person::Person( const QString &name, const QString &email )
40{ 40{
41 setName(name); 41 setName(name);
42 setEmail(email); 42 setEmail(email);
43} 43}
44 44
45 45
46bool KCal::operator==( const Person& p1, const Person& p2 ) 46bool KCal::operator==( const Person& p1, const Person& p2 )
47{ 47{
48 return ( p1.name() == p2.name() && 48 return ( p1.name() == p2.name() &&
49 p1.email() == p2.email() ); 49 p1.email() == p2.email() );
50} 50}
51 51
52 52QString Person::realName() const
53{
54 int ccc = mName.find (',');
55 if ( ccc < 0 )
56 return mName;
57 return mName.mid( ccc+1 ).stripWhiteSpace() + " " + mName.left( ccc ).stripWhiteSpace();
58}
53QString Person::fullName() const 59QString Person::fullName() const
54{ 60{
55 if( mName.isEmpty() ) { 61 if( mName.isEmpty() ) {
56 return mEmail; 62 return mEmail;
57 } else { 63 } else {
58 if( mEmail.isEmpty() ) 64 if( mEmail.isEmpty() )
59 return mName; 65 return mName;
60 else 66 else
61 return mName + " <" + mEmail + ">"; 67 return mName + " <" + mEmail + ">";
62 } 68 }
63} 69}
64 70
diff --git a/libkcal/person.h b/libkcal/person.h
index c46c5f0..3cec153 100644
--- a/libkcal/person.h
+++ b/libkcal/person.h
@@ -26,24 +26,25 @@ namespace KCal {
26 26
27class Person 27class Person
28{ 28{
29 public: 29 public:
30 Person() {} 30 Person() {}
31 Person( const QString &fullName ); 31 Person( const QString &fullName );
32 Person( const QString &name, const QString &email ); 32 Person( const QString &name, const QString &email );
33 33
34 QString fullName( ) const; 34 QString fullName( ) const;
35 35
36 void setName(const QString &); 36 void setName(const QString &);
37 QString name() const { return mName; } 37 QString name() const { return mName; }
38 QString realName() const;
38 39
39 void setEmail(const QString &); 40 void setEmail(const QString &);
40 QString email() const { return mEmail; } 41 QString email() const { return mEmail; }
41 42
42 private: 43 private:
43 QString mName; 44 QString mName;
44 QString mEmail; 45 QString mEmail;
45}; 46};
46 47
47 bool operator==( const Person& p1, const Person& p2 ); 48 bool operator==( const Person& p1, const Person& p2 );
48} 49}
49 50