-rw-r--r-- | libkdepim/addresseeview.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 5c69010..b4717d7 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp | |||
@@ -56,58 +56,61 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) | |||
56 | setLinkUnderline( false ); | 56 | setLinkUnderline( false ); |
57 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 57 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
58 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 58 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
59 | 59 | ||
60 | //US QStyleSheet *sheet = styleSheet(); | 60 | //US QStyleSheet *sheet = styleSheet(); |
61 | //US QStyleSheetItem *link = sheet->item( "a" ); | 61 | //US QStyleSheetItem *link = sheet->item( "a" ); |
62 | //US link->setColor( KGlobalSettings::linkColor() ); | 62 | //US link->setColor( KGlobalSettings::linkColor() ); |
63 | 63 | ||
64 | } | 64 | } |
65 | 65 | ||
66 | void AddresseeView::setSource(const QString& n) | 66 | void AddresseeView::setSource(const QString& n) |
67 | { | 67 | { |
68 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 68 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
69 | 69 | ||
70 | if ( n.left( 6 ) == "mailto" ) | 70 | if ( n.left( 6 ) == "mailto" ) |
71 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 71 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
72 | else if ( n.left( 7 ) == "phoneto" ) | 72 | else if ( n.left( 7 ) == "phoneto" ) |
73 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 73 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
74 | else if ( n.left( 5 ) == "faxto" ) | 74 | else if ( n.left( 5 ) == "faxto" ) |
75 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 75 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
76 | else if ( n.left( 5 ) == "smsto" ) | 76 | else if ( n.left( 5 ) == "smsto" ) |
77 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 77 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
78 | else if ( n.left( 7 ) == "pagerto" ) | 78 | else if ( n.left( 7 ) == "pagerto" ) |
79 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 79 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
80 | else if ( n.left( 5 ) == "sipto" ) | ||
81 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | ||
80 | 82 | ||
81 | } | 83 | } |
82 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 84 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
83 | { | 85 | { |
84 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 86 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
85 | bool kemailAvail = eah->isEmailAppAvailable(); | 87 | bool kemailAvail = eah->isEmailAppAvailable(); |
86 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 88 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
87 | bool kfaxAvail = eah->isFaxAppAvailable(); | 89 | bool kfaxAvail = eah->isFaxAppAvailable(); |
88 | bool ksmsAvail = eah->isSMSAppAvailable(); | 90 | bool ksmsAvail = eah->isSMSAppAvailable(); |
89 | bool kpagerAvail = eah->isPagerAppAvailable(); | 91 | bool kpagerAvail = eah->isPagerAppAvailable(); |
92 | bool ksipAvail = eah->isSIPAppAvailable(); | ||
90 | 93 | ||
91 | 94 | ||
92 | mAddressee = addr; | 95 | mAddressee = addr; |
93 | // clear view | 96 | // clear view |
94 | setText( QString::null ); | 97 | setText( QString::null ); |
95 | 98 | ||
96 | if ( mAddressee.isEmpty() ) | 99 | if ( mAddressee.isEmpty() ) |
97 | return; | 100 | return; |
98 | 101 | ||
99 | QString name = ( mAddressee.assembledName().isEmpty() ? | 102 | QString name = ( mAddressee.assembledName().isEmpty() ? |
100 | mAddressee.formattedName() : mAddressee.assembledName() ); | 103 | mAddressee.formattedName() : mAddressee.assembledName() ); |
101 | 104 | ||
102 | QString dynamicPart; | 105 | QString dynamicPart; |
103 | 106 | ||
104 | QStringList emails = mAddressee.emails(); | 107 | QStringList emails = mAddressee.emails(); |
105 | QStringList::ConstIterator emailIt; | 108 | QStringList::ConstIterator emailIt; |
106 | QString type = i18n( "Email" ); | 109 | QString type = i18n( "Email" ); |
107 | emailIt = emails.begin(); | 110 | emailIt = emails.begin(); |
108 | if ( emailIt != emails.end() ) { | 111 | if ( emailIt != emails.end() ) { |
109 | if ( kemailAvail ) { | 112 | if ( kemailAvail ) { |
110 | dynamicPart += QString( | 113 | dynamicPart += QString( |
111 | "<tr><td align=\"right\"><b>%1</b></td>" | 114 | "<tr><td align=\"right\"><b>%1</b></td>" |
112 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 115 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
113 | .arg( type ) | 116 | .arg( type ) |
@@ -138,48 +141,51 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
138 | QString sms; | 141 | QString sms; |
139 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 142 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
140 | phonetype = (*phoneIt).type(); | 143 | phonetype = (*phoneIt).type(); |
141 | if (ksmsAvail && | 144 | if (ksmsAvail && |
142 | ( | 145 | ( |
143 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 146 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
144 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 147 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
145 | ) | 148 | ) |
146 | ) | 149 | ) |
147 | { | 150 | { |
148 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 151 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
149 | .arg( (*phoneIt).number() ); | 152 | .arg( (*phoneIt).number() ); |
150 | 153 | ||
151 | } | 154 | } |
152 | else | 155 | else |
153 | sms = ""; | 156 | sms = ""; |
154 | 157 | ||
155 | extension = QString::null; | 158 | extension = QString::null; |
156 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 159 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
157 | if (kfaxAvail) extension = "faxto:"; | 160 | if (kfaxAvail) extension = "faxto:"; |
158 | } | 161 | } |
159 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 162 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
160 | if (kpagerAvail) extension = "pagerto:"; | 163 | if (kpagerAvail) extension = "pagerto:"; |
161 | } | 164 | } |
165 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | ||
166 | if (ksipAvail) extension = "sipto:"; | ||
167 | } | ||
162 | else if (kphoneAvail) { | 168 | else if (kphoneAvail) { |
163 | extension = "phoneto:"; | 169 | extension = "phoneto:"; |
164 | } | 170 | } |
165 | else | 171 | else |
166 | extension = QString::null; | 172 | extension = QString::null; |
167 | 173 | ||
168 | if ( !extension.isEmpty() ) { | 174 | if ( !extension.isEmpty() ) { |
169 | dynamicPart += QString( | 175 | dynamicPart += QString( |
170 | "<tr><td align=\"right\"><b>%1</b></td>" | 176 | "<tr><td align=\"right\"><b>%1</b></td>" |
171 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 177 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
172 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 178 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
173 | .arg( extension ) | 179 | .arg( extension ) |
174 | .arg( (*phoneIt).number() ) | 180 | .arg( (*phoneIt).number() ) |
175 | .arg( (*phoneIt).number() ) | 181 | .arg( (*phoneIt).number() ) |
176 | .arg( sms ); | 182 | .arg( sms ); |
177 | 183 | ||
178 | } else { | 184 | } else { |
179 | dynamicPart += QString( | 185 | dynamicPart += QString( |
180 | "<tr><td align=\"right\"><b>%1</b></td>" | 186 | "<tr><td align=\"right\"><b>%1</b></td>" |
181 | "<td align=\"left\">%2 %3</td></tr>" ) | 187 | "<td align=\"left\">%2 %3</td></tr>" ) |
182 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 188 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
183 | .arg( (*phoneIt).number() ) | 189 | .arg( (*phoneIt).number() ) |
184 | .arg( sms ); | 190 | .arg( sms ); |
185 | } | 191 | } |