author | zautrix <zautrix> | 2004-07-03 16:54:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 16:54:31 (UTC) |
commit | 6c035951faeaea6d7651e5fd028c7fd2a674cdfc (patch) (unidiff) | |
tree | f55c6dd1f4457a5c3d387e6511d596438988955e | |
parent | 1da48d95d970233f0d1ea9a7fba5c98cfcf24798 (diff) | |
download | kdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.zip kdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.tar.gz kdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.tar.bz2 |
Added connection to KM when clicking on email
-rw-r--r-- | libkdepim/addresseeview.cpp | 18 | ||||
-rw-r--r-- | libkdepim/addresseeview.h | 2 | ||||
-rw-r--r-- | libkdepim/kincidenceformatter.cpp | 6 |
3 files changed, 22 insertions, 4 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index deafd34..70fc57c 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp | |||
@@ -22,84 +22,100 @@ | |||
22 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | 34 | ||
35 | 35 | ||
36 | #include "addresseeview.h" | 36 | #include "addresseeview.h" |
37 | 37 | ||
38 | |||
39 | #ifndef DESKTOP_VERSION | ||
40 | #include <qtopia/qcopenvelope_qws.h> | ||
41 | #endif | ||
42 | |||
43 | |||
44 | |||
38 | using namespace KPIM; | 45 | using namespace KPIM; |
39 | 46 | ||
40 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 47 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
41 | //US : KTextBrowser( parent, name ) | 48 | //US : KTextBrowser( parent, name ) |
42 | : QTextBrowser( parent, name ) | 49 | : QTextBrowser( parent, name ) |
43 | 50 | ||
44 | 51 | ||
45 | { | 52 | { |
46 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 53 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
47 | setLinkUnderline( false ); | 54 | setLinkUnderline( false ); |
48 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 55 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
49 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 56 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
50 | 57 | ||
51 | //US QStyleSheet *sheet = styleSheet(); | 58 | //US QStyleSheet *sheet = styleSheet(); |
52 | //US QStyleSheetItem *link = sheet->item( "a" ); | 59 | //US QStyleSheetItem *link = sheet->item( "a" ); |
53 | //US link->setColor( KGlobalSettings::linkColor() ); | 60 | //US link->setColor( KGlobalSettings::linkColor() ); |
54 | 61 | ||
55 | } | 62 | } |
63 | void AddresseeView::setSource(const QString& n) | ||
64 | { | ||
65 | //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1()); | ||
66 | #ifndef DESKTOP_VERSION | ||
67 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); | ||
68 | e << n.mid(7); | ||
69 | #endif | ||
56 | 70 | ||
71 | } | ||
57 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 72 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
58 | { | 73 | { |
59 | mAddressee = addr; | 74 | mAddressee = addr; |
60 | 75 | ||
61 | // clear view | 76 | // clear view |
62 | setText( QString::null ); | 77 | setText( QString::null ); |
63 | 78 | ||
64 | if ( mAddressee.isEmpty() ) | 79 | if ( mAddressee.isEmpty() ) |
65 | return; | 80 | return; |
66 | 81 | ||
67 | QString name = ( mAddressee.formattedName().isEmpty() ? | 82 | QString name = ( mAddressee.formattedName().isEmpty() ? |
68 | mAddressee.assembledName() : mAddressee.formattedName() ); | 83 | mAddressee.assembledName() : mAddressee.formattedName() ); |
69 | 84 | ||
70 | QString dynamicPart; | 85 | QString dynamicPart; |
71 | 86 | ||
72 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); | 87 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); |
73 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 88 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
74 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 89 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
75 | dynamicPart += QString( | 90 | dynamicPart += QString( |
76 | "<tr><td align=\"right\"><b>%1</b></td>" | 91 | "<tr><td align=\"right\"><b>%1</b></td>" |
77 | "<td align=\"left\">%2</td></tr>" ) | 92 | "<td align=\"left\">%2</td></tr>" ) |
78 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | 93 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) |
79 | .arg( (*phoneIt).number() ); | 94 | .arg( (*phoneIt).number() ); |
80 | } | 95 | } |
81 | 96 | ||
82 | QStringList emails = mAddressee.emails(); | 97 | QStringList emails = mAddressee.emails(); |
83 | QStringList::ConstIterator emailIt; | 98 | QStringList::ConstIterator emailIt; |
84 | QString type = i18n( "Email" ); | 99 | QString type = i18n( "Email" ); |
85 | for ( emailIt = emails.begin(); emailIt != emails.end(); ++emailIt ) { | 100 | for ( emailIt = emails.begin(); emailIt != emails.end(); ++emailIt ) { |
86 | dynamicPart += QString( | 101 | dynamicPart += QString( |
87 | "<tr><td align=\"right\"><b>%1</b></td>" | 102 | "<tr><td align=\"right\"><b>%1</b></td>" |
88 | "<td align=\"left\"><a href=\"mailto:%2\">%3</a></td></tr>" ) | 103 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
89 | .arg( type ) | 104 | .arg( type ) |
105 | .arg( name ) | ||
90 | .arg( *emailIt ) | 106 | .arg( *emailIt ) |
91 | .arg( *emailIt ); | 107 | .arg( *emailIt ); |
92 | type = i18n( "Other" ); | 108 | type = i18n( "Other" ); |
93 | } | 109 | } |
94 | 110 | ||
95 | if ( !mAddressee.url().url().isEmpty() ) { | 111 | if ( !mAddressee.url().url().isEmpty() ) { |
96 | dynamicPart += QString( | 112 | dynamicPart += QString( |
97 | "<tr><td align=\"right\"><b>%1</b></td>" | 113 | "<tr><td align=\"right\"><b>%1</b></td>" |
98 | "<td align=\"left\">%2</td></tr>" ) | 114 | "<td align=\"left\">%2</td></tr>" ) |
99 | .arg( i18n( "Homepage" ) ) | 115 | .arg( i18n( "Homepage" ) ) |
100 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 116 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
101 | .arg( mAddressee.url().url() ); | 117 | .arg( mAddressee.url().url() ); |
102 | //qDebug("AddresseeView::setAddressee has to be verified."); | 118 | //qDebug("AddresseeView::setAddressee has to be verified."); |
103 | } | 119 | } |
104 | 120 | ||
105 | KABC::Address::List addresses = mAddressee.addresses(); | 121 | KABC::Address::List addresses = mAddressee.addresses(); |
diff --git a/libkdepim/addresseeview.h b/libkdepim/addresseeview.h index 598ef0d..1865fc4 100644 --- a/libkdepim/addresseeview.h +++ b/libkdepim/addresseeview.h | |||
@@ -28,33 +28,33 @@ | |||
28 | #include <qtextbrowser.h> | 28 | #include <qtextbrowser.h> |
29 | 29 | ||
30 | namespace KPIM { | 30 | namespace KPIM { |
31 | 31 | ||
32 | //US class AddresseeView : public KTextBrowser | 32 | //US class AddresseeView : public KTextBrowser |
33 | class AddresseeView : public QTextBrowser | 33 | class AddresseeView : public QTextBrowser |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | AddresseeView( QWidget *parent = 0, const char *name = 0 ); | 36 | AddresseeView( QWidget *parent = 0, const char *name = 0 ); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | Sets the addressee object. The addressee is displayed immediately. | 39 | Sets the addressee object. The addressee is displayed immediately. |
40 | 40 | ||
41 | @param addr The addressee object. | 41 | @param addr The addressee object. |
42 | */ | 42 | */ |
43 | void setAddressee( const KABC::Addressee& addr ); | 43 | void setAddressee( const KABC::Addressee& addr ); |
44 | 44 | void setSource(const QString& n); | |
45 | /** | 45 | /** |
46 | Returns the current addressee object. | 46 | Returns the current addressee object. |
47 | */ | 47 | */ |
48 | KABC::Addressee addressee() const; | 48 | KABC::Addressee addressee() const; |
49 | 49 | ||
50 | private: | 50 | private: |
51 | KABC::Addressee mAddressee; | 51 | KABC::Addressee mAddressee; |
52 | QString mText; | 52 | QString mText; |
53 | void addTag(const QString & tag,const QString & text); | 53 | void addTag(const QString & tag,const QString & text); |
54 | class AddresseeViewPrivate; | 54 | class AddresseeViewPrivate; |
55 | AddresseeViewPrivate *d; | 55 | AddresseeViewPrivate *d; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | #endif | 60 | #endif |
diff --git a/libkdepim/kincidenceformatter.cpp b/libkdepim/kincidenceformatter.cpp index 4815519..2f41409 100644 --- a/libkdepim/kincidenceformatter.cpp +++ b/libkdepim/kincidenceformatter.cpp | |||
@@ -235,60 +235,62 @@ void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | |||
235 | mText.append(tmpStr); | 235 | mText.append(tmpStr); |
236 | } | 236 | } |
237 | else | 237 | else |
238 | { | 238 | { |
239 | str += text + "</" + tag + ">"; | 239 | str += text + "</" + tag + ">"; |
240 | mText.append(str); | 240 | mText.append(str); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 244 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
245 | { | 245 | { |
246 | QPtrList<Attendee> attendees = event->attendees(); | 246 | QPtrList<Attendee> attendees = event->attendees(); |
247 | if (attendees.count()) { | 247 | if (attendees.count()) { |
248 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 248 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
249 | addTag("h3",i18n("Organizer")); | 249 | addTag("h3",i18n("Organizer")); |
250 | mText.append("<ul><li>"); | 250 | mText.append("<ul><li>"); |
251 | #ifndef KORG_NOKABC | 251 | #if 0 |
252 | //ndef KORG_NOKABC | ||
252 | 253 | ||
253 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 254 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
254 | KABC::Addressee::List addressList; | 255 | KABC::Addressee::List addressList; |
255 | addressList = add_book->findByEmail(event->organizer()); | 256 | addressList = add_book->findByEmail(event->organizer()); |
256 | KABC::Addressee o = addressList.first(); | 257 | KABC::Addressee o = addressList.first(); |
257 | if (!o.isEmpty() && addressList.size()<2) { | 258 | if (!o.isEmpty() && addressList.size()<2) { |
258 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 259 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
259 | mText += o.formattedName(); | 260 | mText += o.formattedName(); |
260 | mText += "</a>\n"; | 261 | mText += "</a>\n"; |
261 | } else { | 262 | } else { |
262 | mText.append(event->organizer()); | 263 | mText.append(event->organizer()); |
263 | } | 264 | } |
264 | #else | 265 | #else |
265 | mText.append(event->organizer()); | 266 | mText.append(event->organizer()); |
266 | #endif | 267 | #endif |
267 | if (iconPath) { | 268 | if (iconPath) { |
268 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 269 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
269 | mText += "<IMG src=\"" + iconPath + "\">"; | 270 | mText += "<IMG src=\"" + iconPath + "\">"; |
270 | mText += "</a>\n"; | 271 | mText += "</a>\n"; |
271 | } | 272 | } |
272 | mText.append("</li></ul>"); | 273 | mText.append("</li></ul>"); |
273 | 274 | ||
274 | addTag("h3",i18n("Attendees")); | 275 | addTag("h3",i18n("Attendees")); |
275 | Attendee *a; | 276 | Attendee *a; |
276 | mText.append("<ul>"); | 277 | mText.append("<ul>"); |
277 | for(a=attendees.first();a;a=attendees.next()) { | 278 | for(a=attendees.first();a;a=attendees.next()) { |
278 | #ifndef KORG_NOKABC | 279 | #if 0 |
280 | //ndef KORG_NOKABC | ||
279 | if (a->name().isEmpty()) { | 281 | if (a->name().isEmpty()) { |
280 | addressList = add_book->findByEmail(a->email()); | 282 | addressList = add_book->findByEmail(a->email()); |
281 | KABC::Addressee o = addressList.first(); | 283 | KABC::Addressee o = addressList.first(); |
282 | if (!o.isEmpty() && addressList.size()<2) { | 284 | if (!o.isEmpty() && addressList.size()<2) { |
283 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 285 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
284 | mText += o.formattedName(); | 286 | mText += o.formattedName(); |
285 | mText += "</a>\n"; | 287 | mText += "</a>\n"; |
286 | } else { | 288 | } else { |
287 | mText += "<li>"; | 289 | mText += "<li>"; |
288 | mText.append(a->email()); | 290 | mText.append(a->email()); |
289 | mText += "\n"; | 291 | mText += "\n"; |
290 | } | 292 | } |
291 | } else { | 293 | } else { |
292 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 294 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
293 | if (!a->name().isEmpty()) mText += a->name(); | 295 | if (!a->name().isEmpty()) mText += a->name(); |
294 | else mText += a->email(); | 296 | else mText += a->email(); |