summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventviewer.cpp
Unidiff
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index db695f5..976ee2c 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,712 +1,714 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
39 39
40#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
41#include <dcopclient.h> 41#include <dcopclient.h>
42#include "korganizer.h" 42#include "korganizer.h"
43#include "koprefs.h" 43#include "koprefs.h"
44#include "actionmanager.h" 44#include "actionmanager.h"
45#endif 45#endif
46 46
47#include "koeventviewer.h" 47#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
50//#define size count 50//#define size count
51//#endif 51//#endif
52 52
53#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 55#include <kabc/addresseeview.h>
56#include <qprinter.h> 56#include <qprinter.h>
57#include <qpainter.h> 57#include <qpainter.h>
58#include <qpaintdevicemetrics.h> 58#include <qpaintdevicemetrics.h>
59#else //DESKTOP_VERSION 59#else //DESKTOP_VERSION
60#include <externalapphandler.h> 60#include <externalapphandler.h>
61#include <qtopia/qcopenvelope_qws.h> 61#include <qtopia/qcopenvelope_qws.h>
62#endif //DESKTOP_VERSION 62#endif //DESKTOP_VERSION
63 63
64KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 64KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
65 : QTextBrowser(parent,name) 65 : QTextBrowser(parent,name)
66{ 66{
67 mSyncMode = false; 67 mSyncMode = false;
68 mColorMode = 0; 68 mColorMode = 0;
69} 69}
70 70
71KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
72{ 72{
73} 73}
74 74
75void KOEventViewer::printMe() 75void KOEventViewer::printMe()
76{ 76{
77#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
78 78
79 KOPrintPrefs pp ( this ); 79 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 80 if (!pp.exec() )
81 return; 81 return;
82 int scaleval = pp.printMode() ; 82 int scaleval = pp.printMode() ;
83 83
84 QPrinter printer; 84 QPrinter printer;
85 if (!printer.setup() ) 85 if (!printer.setup() )
86 return; 86 return;
87 QPainter p; 87 QPainter p;
88 p.begin ( &printer ); 88 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
90 float dx, dy; 90 float dx, dy;
91 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 94 float scale;
95 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
96 if ( dx < dy ) 96 if ( dx < dy )
97 scale = dx; 97 scale = dx;
98 else 98 else
99 scale = dy; 99 scale = dy;
100 100
101 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
103 p.scale( scale, scale ); 103 p.scale( scale, scale );
104 } 104 }
105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
106 p.end(); 106 p.end();
107#endif 107#endif
108 108
109} 109}
110void KOEventViewer::setSource(const QString& n) 110void KOEventViewer::setSource(const QString& n)
111{ 111{
112 112
113 if ( n.left(8) == "todo_uid" ) { 113 if ( n.left(8) == "todo_uid" ) {
114 int midstr = 9; 114 int midstr = 9;
115#ifdef DESKTOP_VERSION 115#ifdef DESKTOP_VERSION
116 midstr = 11; 116 midstr = 11;
117#endif 117#endif
118 //qDebug("-%s- ", n.mid(midstr).latin1()); 118 //qDebug("-%s- ", n.mid(midstr).latin1());
119 emit showIncidence( n.mid(midstr) ); 119 emit showIncidence( n.mid(midstr) );
120 return; 120 return;
121 } 121 }
122 122
123 if ( n.left(3) == "uid" ) 123 if ( n.left(3) == "uid" )
124#ifdef DESKTOP_VERSION 124#ifdef DESKTOP_VERSION
125 { 125 {
126 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 126 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
127 KABC::AddressBook::Iterator it; 127 KABC::AddressBook::Iterator it;
128 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 128 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
129 // LR I do not understand, why the uid string is different on zaurus and desktop 129 // LR I do not understand, why the uid string is different on zaurus and desktop
130 QString uid = "uid://"+(*it).uid(); 130 QString uid = "uid://"+(*it).uid();
131 131
132 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 132 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
133 if (n == uid ) { 133 if (n == uid ) {
134 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 134 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
135 QDialog dia( this,"dia123", true ); 135 QDialog dia( this,"dia123", true );
136 dia.setCaption( i18n("Details of attendee") ); 136 dia.setCaption( i18n("Details of attendee") );
137 QVBoxLayout lay ( &dia ); 137 QVBoxLayout lay ( &dia );
138 KABC::AddresseeView av ( &dia ); 138 KABC::AddresseeView av ( &dia );
139 av.setAddressee( (*it) ); 139 av.setAddressee( (*it) );
140 lay.addWidget( &av ); 140 lay.addWidget( &av );
141 if ( QApplication::desktop()->width() < 480 ) 141 if ( QApplication::desktop()->width() < 480 )
142 dia.resize( 220, 240); 142 dia.resize( 220, 240);
143 else { 143 else {
144 dia.resize( 400,400); 144 dia.resize( 400,400);
145 } 145 }
146 dia.exec(); 146 dia.exec();
147 break; 147 break;
148 } 148 }
149 } 149 }
150 return; 150 return;
151 } 151 }
152#else 152#else
153 { 153 {
154 if ( "uid:organizer" == n ) { 154 if ( "uid:organizer" == n ) {
155 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 155 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
156 return; 156 return;
157 } 157 }
158 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 158 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
159 if (attendees.count()) { 159 if (attendees.count()) {
160 Attendee *a; 160 Attendee *a;
161 for(a=attendees.first();a;a=attendees.next()) { 161 for(a=attendees.first();a;a=attendees.next()) {
162 if ( "uid:"+a->uid() == n ) { 162 if ( "uid:"+a->uid() == n ) {
163 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 163 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
164 return; 164 return;
165 } 165 }
166 } 166 }
167 } 167 }
168 return; 168 return;
169 } 169 }
170 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 170 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
171 // the result should now arrive through method insertAttendees 171 // the result should now arrive through method insertAttendees
172 //QString uid = "uid:"+(*it).uid(); 172 //QString uid = "uid:"+(*it).uid();
173#endif 173#endif
174 if ( n.left(6) == "mailto" ) { 174 if ( n.left(6) == "mailto" ) {
175 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 175 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
176#ifndef DESKTOP_VERSION 176#ifndef DESKTOP_VERSION
177 if ( n.mid(7,3) == "ALL" ) { 177 if ( n.mid(7,3) == "ALL" ) {
178 mailToAttendees( true ); 178 mailToAttendees( true );
179 } else if ( n.mid(7,4) == "RSVP" ) { 179 } else if ( n.mid(7,4) == "RSVP" ) {
180 mailToAttendees( false ); 180 mailToAttendees( false );
181 } else { 181 } else {
182 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 182 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
183 e << n.mid(7); 183 e << n.mid(7);
184 } 184 }
185#endif 185#endif
186 186
187 } 187 }
188 188
189 189
190#ifndef KORG_NODCOP 190#ifndef KORG_NODCOP
191 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 191 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
192 QString tmpStr; 192 QString tmpStr;
193 if (n.startsWith("mailto:")) { 193 if (n.startsWith("mailto:")) {
194 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 194 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
195 //emit showIncidence(n); 195 //emit showIncidence(n);
196 return; 196 return;
197 } else if (n.startsWith("uid:")) { 197 } else if (n.startsWith("uid:")) {
198 DCOPClient *client = KApplication::kApplication()->dcopClient(); 198 DCOPClient *client = KApplication::kApplication()->dcopClient();
199 const QByteArray noParamData; 199 const QByteArray noParamData;
200 const QByteArray paramData; 200 const QByteArray paramData;
201 QByteArray replyData; 201 QByteArray replyData;
202 QCString replyTypeStr; 202 QCString replyTypeStr;
203#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 203#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
204 bool foundAbbrowser = PING_ABBROWSER; 204 bool foundAbbrowser = PING_ABBROWSER;
205 205
206 if (foundAbbrowser) { 206 if (foundAbbrowser) {
207 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 207 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
208 //client->send("kaddressbook","KAddressBookIface", 208 //client->send("kaddressbook","KAddressBookIface",
209 QDataStream arg(paramData, IO_WriteOnly); 209 QDataStream arg(paramData, IO_WriteOnly);
210 arg << n.mid(6); 210 arg << n.mid(6);
211 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 211 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
212 return; 212 return;
213 } else { 213 } else {
214 /* 214 /*
215 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 215 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
216 We start it without its main interface 216 We start it without its main interface
217 */ 217 */
218 KIconLoader* iconLoader = new KIconLoader(); 218 KIconLoader* iconLoader = new KIconLoader();
219 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 219 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
220 ActionManager::setStartedKAddressBook(true); 220 ActionManager::setStartedKAddressBook(true);
221 tmpStr = "kaddressbook --editor-only --uid "; 221 tmpStr = "kaddressbook --editor-only --uid ";
222 tmpStr += KProcess::quote(n.mid(6)); 222 tmpStr += KProcess::quote(n.mid(6));
223 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 223 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
224 return; 224 return;
225 } 225 }
226 } else { 226 } else {
227 //QTextBrowser::setSource(n); 227 //QTextBrowser::setSource(n);
228 } 228 }
229#endif 229#endif
230} 230}
231void KOEventViewer::mailToAttendees( bool all ) 231void KOEventViewer::mailToAttendees( bool all )
232{ 232{
233 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 233 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
234 if (attendees.count() == 0) return; 234 if (attendees.count() == 0) return;
235 QStringList nameList; 235 QStringList nameList;
236 QStringList emailList; 236 QStringList emailList;
237 QStringList uidList; 237 QStringList uidList;
238 Attendee* a; 238 Attendee* a;
239 for(a=attendees.first();a;a=attendees.next()) { 239 for(a=attendees.first();a;a=attendees.next()) {
240 if ( !all && !a->RSVP() ) continue; 240 if ( !all && !a->RSVP() ) continue;
241 if (!a->email().isEmpty()) { 241 if (!a->email().isEmpty()) {
242 nameList.append (a->name() ); 242 nameList.append (a->name() );
243 emailList.append (a->email() ); 243 emailList.append (a->email() );
244 uidList.append (a->uid() ); 244 uidList.append (a->uid() );
245 } 245 }
246 } 246 }
247 QString uid = "ComposeMailUIpick2"+mMailSubject; 247 QString uid = "ComposeMailUIpick2"+mMailSubject;
248#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
249 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 249 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
250#endif 250#endif
251 251
252} 252}
253void KOEventViewer::addTag(const QString & tag,const QString & text) 253void KOEventViewer::addTag(const QString & tag,const QString & text)
254{ 254{
255 int number=text.contains("\n"); 255 int number=text.contains("\n");
256 QString str = "<" + tag + ">"; 256 QString str = "<" + tag + ">";
257 QString tmpText=text; 257 QString tmpText=text;
258 QString tmpStr=str; 258 QString tmpStr=str;
259 if(number !=-1) 259 if(number !=-1)
260 { 260 {
261 if (number > 0) { 261 if (number > 0) {
262 int pos=0; 262 int pos=0;
263 QString tmp; 263 QString tmp;
264 for(int i=0;i<=number;i++) { 264 for(int i=0;i<=number;i++) {
265 pos=tmpText.find("\n"); 265 pos=tmpText.find("\n");
266 tmp=tmpText.left(pos); 266 tmp=tmpText.left(pos);
267 tmpText=tmpText.right(tmpText.length()-pos-1); 267 tmpText=tmpText.right(tmpText.length()-pos-1);
268 tmpStr+=tmp+"<br>"; 268 tmpStr+=tmp+"<br>";
269 } 269 }
270 } 270 }
271 else tmpStr += tmpText; 271 else tmpStr += tmpText;
272 tmpStr+="</" + tag + ">"; 272 tmpStr+="</" + tag + ">";
273 mText.append(tmpStr); 273 mText.append(tmpStr);
274 } 274 }
275 else 275 else
276 { 276 {
277 str += text + "</" + tag + ">"; 277 str += text + "</" + tag + ">";
278 mText.append(str); 278 mText.append(str);
279 } 279 }
280} 280}
281 281
282void KOEventViewer::setColorMode( int m ) 282void KOEventViewer::setColorMode( int m )
283{ 283{
284 mColorMode = m; 284 mColorMode = m;
285} 285}
286void KOEventViewer::appendEvent(Event *event, int mode ) 286void KOEventViewer::appendEvent(Event *event, int mode )
287{ 287{
288 mMailSubject = ""; 288 mMailSubject = "";
289 mCurrentIncidence = event; 289 mCurrentIncidence = event;
290 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 290 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
291 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 291 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
292 topLevelWidget()->setCaption(i18n("Event Viewer")); 292 topLevelWidget()->setCaption(i18n("Event Viewer"));
293 if ( mode == 0 ) { 293 if ( mode == 0 ) {
294 addTag("h2",deTag(event->summary())); 294 addTag("h2",deTag(event->summary()));
295 formatReadOnly(event); 295 formatReadOnly(event);
296 } 296 }
297 else { 297 else {
298 if ( mColorMode == 1 ) { 298 if ( mColorMode == 1 ) {
299 mText +="<font color=\"#00A000\">"; 299 mText +="<font color=\"#00A000\">";
300 } 300 }
301 if ( mColorMode == 2 ) { 301 if ( mColorMode == 2 ) {
302 mText +="<font color=\"#C00000\">"; 302 mText +="<font color=\"#C00000\">";
303 } 303 }
304 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 304 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
305 if ( mode == 1 ) { 305 if ( mode == 1 ) {
306 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 306 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
307 } else { 307 } else {
308 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 308 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
309 } 309 }
310 formatReadOnly(event); 310 formatReadOnly(event);
311 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 311 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
312 if ( mColorMode ) 312 if ( mColorMode )
313 mText += "</font>"; 313 mText += "</font>";
314 } 314 }
315 mMailSubject += i18n( "Meeting " )+ event->summary(); 315 mMailSubject += i18n( "Meeting " )+ event->summary();
316 if (event->cancelled ()) { 316 if (event->cancelled ()) {
317 mText +="<font color=\"#B00000\">"; 317 mText +="<font color=\"#B00000\">";
318 addTag("i",i18n("This event has been cancelled!")); 318 addTag("i",i18n("This event has been cancelled!"));
319 mText.append("<br>"); 319 mText.append("<br>");
320 mText += "</font>"; 320 mText += "</font>";
321 mMailSubject += i18n("(cancelled)"); 321 mMailSubject += i18n("(cancelled)");
322 } 322 }
323 323
324 if (event->doesFloat()) { 324 if (event->doesFloat()) {
325 if (event->isMultiDay()) { 325 if (event->isMultiDay()) {
326 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 326 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
327 .arg(event->dtStartDateStr(shortDate)) 327 .arg(event->dtStartDateStr(shortDate))
328 .arg(event->dtEndDateStr(shortDate))); 328 .arg(event->dtEndDateStr(shortDate)));
329 mText.append(i18n("<p><b>Duration:</b> %1 days</p>")
330 .arg(event->dtStart().daysTo(event->dtEnd())+1));
329 } else { 331 } else {
330 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 332 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
331 } 333 }
332 } else { 334 } else {
333 if (event->isMultiDay()) { 335 if (event->isMultiDay()) {
334 mText.append(i18n("<p><b>From:</b> %1</p> ") 336 mText.append(i18n("<p><b>From:</b> %1</p> ")
335 .arg(event->dtStartStr( shortDate))); 337 .arg(event->dtStartStr( shortDate)));
336 mText.append(i18n("<p><b>To:</b> %1</p>") 338 mText.append(i18n("<p><b>To:</b> %1</p>")
337 .arg(event->dtEndStr(shortDate))); 339 .arg(event->dtEndStr(shortDate)));
338 } else { 340 } else {
339 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 341 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
340 .arg(event->dtStartTimeStr()) 342 .arg(event->dtStartTimeStr())
341 .arg(event->dtEndTimeStr())); 343 .arg(event->dtEndTimeStr()));
342 mText.append(i18n("<p><b>On:</b> %1</p> ") 344 mText.append(i18n("<p><b>On:</b> %1</p> ")
343 .arg(event->dtStartDateStr( shortDate ))); 345 .arg(event->dtStartDateStr( shortDate )));
344 } 346 }
345 } 347 }
346 if (!event->location().isEmpty()) { 348 if (!event->location().isEmpty()) {
347 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 349 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
348 mMailSubject += i18n(" at ") + event->location(); 350 mMailSubject += i18n(" at ") + event->location();
349 } 351 }
350 if (event->doesRecur()) { 352 if (event->doesRecur()) {
351 353
352 QString recurText = event->recurrenceText(); 354 QString recurText = event->recurrenceText();
353 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 355 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
354 bool ok; 356 bool ok;
355 QDate start = QDate::currentDate(); 357 QDate start = QDate::currentDate();
356 QDateTime next; 358 QDateTime next;
357 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 359 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
358 if ( ok ) { 360 if ( ok ) {
359 if ( wideScreen ){ 361 if ( wideScreen ){
360 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 362 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
361 } else { 363 } else {
362 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 364 addTag("p",i18n("<b>Next recurrence is on:</b>") );
363 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 365 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
364 } 366 }
365 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 367 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
366 368
367 } else { 369 } else {
368 bool last; 370 bool last;
369 QDate nextd; 371 QDate nextd;
370 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 372 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
371 if ( last ) { 373 if ( last ) {
372 if ( wideScreen ){ 374 if ( wideScreen ){
373 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 375 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
374 } else{ 376 } else{
375 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 377 addTag("p",i18n("<b>Last recurrence was on:</b>") );
376 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 378 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
377 } 379 }
378 } 380 }
379 } 381 }
380 } else { 382 } else {
381 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 383 mMailSubject += i18n(" - " )+event->dtStartStr( true );
382 384
383 } 385 }
384 386
385 387
386 if (event->isAlarmEnabled()) { 388 if (event->isAlarmEnabled()) {
387 Alarm *alarm =event->alarms().first() ; 389 Alarm *alarm =event->alarms().first() ;
388 QDateTime t = alarm->time(); 390 QDateTime t = alarm->time();
389 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 391 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
390 if(wideScreen ){ 392 if(wideScreen ){
391 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 393 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
392 }else{ 394 }else{
393 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 395 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
394 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 396 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
395 } 397 }
396 //addTag("p",s); 398 //addTag("p",s);
397 } 399 }
398 400
399 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 401 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
400 402
401 formatCategories(event); 403 formatCategories(event);
402 404
403 formatAttendees(event); 405 formatAttendees(event);
404 406
405 if ( KOPrefs::instance()->mEVshowCreated ) { 407 if ( KOPrefs::instance()->mEVshowCreated ) {
406 if(wideScreen ){ 408 if(wideScreen ){
407 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 409 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
408 }else{ 410 }else{
409 addTag("p",i18n("<b>Created: ") +" </b>"); 411 addTag("p",i18n("<b>Created: ") +" </b>");
410 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 412 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
411 } 413 }
412 414
413 415
414 } 416 }
415 if ( KOPrefs::instance()->mEVshowChanged ) { 417 if ( KOPrefs::instance()->mEVshowChanged ) {
416 if(wideScreen ){ 418 if(wideScreen ){
417 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 419 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
418 }else{ 420 }else{
419 addTag("p",i18n("<b>Last modified: ") +" </b>"); 421 addTag("p",i18n("<b>Last modified: ") +" </b>");
420 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 422 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
421 } 423 }
422 424
423 } 425 }
424 if ( KOPrefs::instance()->mEVshowDetails ) { 426 if ( KOPrefs::instance()->mEVshowDetails ) {
425 if (!event->description().isEmpty()) { 427 if (!event->description().isEmpty()) {
426 addTag("p",i18n("<b>Details: </b>")); 428 addTag("p",i18n("<b>Details: </b>"));
427 addTag("p",deTag(event->description())); 429 addTag("p",deTag(event->description()));
428 } 430 }
429 } 431 }
430 setText(mText); 432 setText(mText);
431 //QWhatsThis::add(this,mText); 433 //QWhatsThis::add(this,mText);
432 434
433} 435}
434 436
435void KOEventViewer::appendTodo(Todo *event, int mode ) 437void KOEventViewer::appendTodo(Todo *event, int mode )
436{ 438{
437 mMailSubject = ""; 439 mMailSubject = "";
438 mCurrentIncidence = event; 440 mCurrentIncidence = event;
439 topLevelWidget()->setCaption(i18n("Todo Viewer")); 441 topLevelWidget()->setCaption(i18n("Todo Viewer"));
440 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 442 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
441 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 443 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
442 if (mode == 0 ) { 444 if (mode == 0 ) {
443 addTag("h2",deTag(event->summary())); 445 addTag("h2",deTag(event->summary()));
444 formatReadOnly(event); 446 formatReadOnly(event);
445 } 447 }
446 else { 448 else {
447 if ( mColorMode == 1 ) { 449 if ( mColorMode == 1 ) {
448 mText +="<font color=\"#00A000\">"; 450 mText +="<font color=\"#00A000\">";
449 } 451 }
450 if ( mColorMode == 2 ) { 452 if ( mColorMode == 2 ) {
451 mText +="<font color=\"#B00000\">"; 453 mText +="<font color=\"#B00000\">";
452 } 454 }
453 if ( mode == 1 ) { 455 if ( mode == 1 ) {
454 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 456 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
455 } else { 457 } else {
456 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 458 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
457 } 459 }
458 formatReadOnly(event); 460 formatReadOnly(event);
459 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 461 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
460 if ( mColorMode ) 462 if ( mColorMode )
461 mText += "</font>"; 463 mText += "</font>";
462 } 464 }
463 mMailSubject += i18n( "Todo " )+ event->summary(); 465 mMailSubject += i18n( "Todo " )+ event->summary();
464 466
465 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 467 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
466 mText +="<font color=\"#B00000\">"; 468 mText +="<font color=\"#B00000\">";
467 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 469 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
468 mText += "</font>"; 470 mText += "</font>";
469 } else { 471 } else {
470 mText.append(i18n("<p><i>%1 % completed</i></p>") 472 mText.append(i18n("<p><i>%1 % completed</i></p>")
471 .arg(event->percentComplete())); 473 .arg(event->percentComplete()));
472 } 474 }
473 475
474 if (event->cancelled ()) { 476 if (event->cancelled ()) {
475 mText +="<font color=\"#B00000\">"; 477 mText +="<font color=\"#B00000\">";
476 addTag("i",i18n("This todo has been cancelled!")); 478 addTag("i",i18n("This todo has been cancelled!"));
477 mText.append("<br>"); 479 mText.append("<br>");
478 mText += "</font>"; 480 mText += "</font>";
479 mMailSubject += i18n("(cancelled)"); 481 mMailSubject += i18n("(cancelled)");
480 } 482 }
481 483
482 484
483 485
484 if (event->doesRecur()) { 486 if (event->doesRecur()) {
485 487
486 QString recurText = event->recurrence()->recurrenceText(); 488 QString recurText = event->recurrence()->recurrenceText();
487 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 489 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
488 490
489 } 491 }
490 if (event->hasStartDate()) { 492 if (event->hasStartDate()) {
491 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 493 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
492 } 494 }
493 if (event->hasDueDate()) { 495 if (event->hasDueDate()) {
494 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 496 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
495 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 497 mMailSubject += i18n(" - " )+event->dtDueStr( true );
496 } 498 }
497 if (!event->location().isEmpty()) { 499 if (!event->location().isEmpty()) {
498 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 500 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
499 mMailSubject += i18n(" at ") + event->location(); 501 mMailSubject += i18n(" at ") + event->location();
500 } 502 }
501 mText.append(i18n("<p><b>Priority:</b> %2</p>") 503 mText.append(i18n("<p><b>Priority:</b> %2</p>")
502 .arg(QString::number(event->priority()))); 504 .arg(QString::number(event->priority())));
503 505
504 if (event->isAlarmEnabled()) { 506 if (event->isAlarmEnabled()) {
505 Alarm *alarm =event->alarms().first() ; 507 Alarm *alarm =event->alarms().first() ;
506 QDateTime t = alarm->time(); 508 QDateTime t = alarm->time();
507 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 509 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
508 if ( wideScreen ) { 510 if ( wideScreen ) {
509 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 511 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
510 } else { 512 } else {
511 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 513 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
512 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 514 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
513 } 515 }
514 } 516 }
515 517
516 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 518 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
517 519
518 formatCategories(event); 520 formatCategories(event);
519 521
520 formatAttendees(event); 522 formatAttendees(event);
521 523
522 if ( KOPrefs::instance()->mEVshowCreated ) { 524 if ( KOPrefs::instance()->mEVshowCreated ) {
523 if(wideScreen ){ 525 if(wideScreen ){
524 526
525 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 527 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
526 528
527 } else { 529 } else {
528 addTag("p",i18n("<b>Created: ") +" </b>"); 530 addTag("p",i18n("<b>Created: ") +" </b>");
529 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 531 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
530 } 532 }
531 } 533 }
532 if ( KOPrefs::instance()->mEVshowChanged ) { 534 if ( KOPrefs::instance()->mEVshowChanged ) {
533 if(wideScreen ){ 535 if(wideScreen ){
534 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 536 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
535 537
536 } else { 538 } else {
537 addTag("p",i18n("<b>Last modified: ") +" </b>"); 539 addTag("p",i18n("<b>Last modified: ") +" </b>");
538 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 540 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
539 } 541 }
540 } 542 }
541 if ( event->relatedTo() ) { 543 if ( event->relatedTo() ) {
542 addTag("b",i18n("Parent todo:<br>")); 544 addTag("b",i18n("Parent todo:<br>"));
543 545
544 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); 546 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
545 547
546 mText += t_name; 548 mText += t_name;
547 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; 549 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
548 mText += deTag(event->relatedTo()->summary()); 550 mText += deTag(event->relatedTo()->summary());
549 mText += "</a><br>"; 551 mText += "</a><br>";
550 552
551 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); 553 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
552 } 554 }
553 QPtrList<Incidence> Relations = event->relations(); 555 QPtrList<Incidence> Relations = event->relations();
554 Incidence *to; 556 Incidence *to;
555 if ( Relations.first() ) 557 if ( Relations.first() )
556 addTag("b",i18n("Sub todos:<br>")); 558 addTag("b",i18n("Sub todos:<br>"));
557 for (to=Relations.first();to;to=Relations.next()) { 559 for (to=Relations.first();to;to=Relations.next()) {
558 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); 560 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
559 mText += t_name; 561 mText += t_name;
560 mText += "<a href=\"todo_uid:" + to->uid() + "\">"; 562 mText += "<a href=\"todo_uid:" + to->uid() + "\">";
561 mText += deTag(to->summary()); 563 mText += deTag(to->summary());
562 mText += "</a><br>"; 564 mText += "</a><br>";
563 565
564 } 566 }
565 567
566 if ( KOPrefs::instance()->mEVshowDetails ) { 568 if ( KOPrefs::instance()->mEVshowDetails ) {
567 if (!event->description().isEmpty()) { 569 if (!event->description().isEmpty()) {
568 addTag("p",i18n("<b>Details: </b>")); 570 addTag("p",i18n("<b>Details: </b>"));
569 addTag("p",deTag(event->description())); 571 addTag("p",deTag(event->description()));
570 } 572 }
571 } 573 }
572 setText(mText); 574 setText(mText);
573} 575}
574 576
575void KOEventViewer::formatCategories(Incidence *event) 577void KOEventViewer::formatCategories(Incidence *event)
576{ 578{
577 if (!event->categoriesStr().isEmpty()) { 579 if (!event->categoriesStr().isEmpty()) {
578 if (event->categories().count() == 1) { 580 if (event->categories().count() == 1) {
579 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 581 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
580 } else { 582 } else {
581 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 583 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
582 } 584 }
583 } 585 }
584} 586}
585void KOEventViewer::formatAttendees(Incidence *event) 587void KOEventViewer::formatAttendees(Incidence *event)
586{ 588{
587 QPtrList<Attendee> attendees = event->attendees(); 589 QPtrList<Attendee> attendees = event->attendees();
588 if (attendees.count()) { 590 if (attendees.count()) {
589 591
590 592
591 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 593 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
592 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 594 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
593 addTag("h3",i18n("Organizer")); 595 addTag("h3",i18n("Organizer"));
594 mText.append("<ul><li>"); 596 mText.append("<ul><li>");
595#ifndef KORG_NOKABC 597#ifndef KORG_NOKABC
596 598
597#ifdef DESKTOP_VERSION 599#ifdef DESKTOP_VERSION
598 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 600 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
599 KABC::Addressee::List addressList; 601 KABC::Addressee::List addressList;
600 addressList = add_book->findByEmail(event->organizer()); 602 addressList = add_book->findByEmail(event->organizer());
601 KABC::Addressee o = addressList.first(); 603 KABC::Addressee o = addressList.first();
602 if (!o.isEmpty() && addressList.size()<2) { 604 if (!o.isEmpty() && addressList.size()<2) {
603 mText += "<a href=\"uid:" + o.uid() + "\">"; 605 mText += "<a href=\"uid:" + o.uid() + "\">";
604 mText += o.formattedName(); 606 mText += o.formattedName();
605 mText += "</a>\n"; 607 mText += "</a>\n";
606 } else { 608 } else {
607 mText.append(event->organizer()); 609 mText.append(event->organizer());
608 } 610 }
609#else //DESKTOP_VERSION 611#else //DESKTOP_VERSION
610 mText += "<a href=\"uid:organizer\">"; 612 mText += "<a href=\"uid:organizer\">";
611 mText += event->organizer(); 613 mText += event->organizer();
612 mText += "</a>\n"; 614 mText += "</a>\n";
613#endif //DESKTOP_VERSION 615#endif //DESKTOP_VERSION
614 616
615 617
616#else 618#else
617 mText.append(event->organizer()); 619 mText.append(event->organizer());
618#endif 620#endif
619 621
620 if (iconPath) { 622 if (iconPath) {
621 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 623 mText += " <a href=\"mailto:" + event->organizer() + "\">";
622 mText += "<IMG src=\"" + iconPath + "\">"; 624 mText += "<IMG src=\"" + iconPath + "\">";
623 mText += "</a>\n"; 625 mText += "</a>\n";
624 } 626 }
625 mText.append("</li></ul>"); 627 mText.append("</li></ul>");
626 628
627 addTag("h3",i18n("Attendees")); 629 addTag("h3",i18n("Attendees"));
628 Attendee *a; 630 Attendee *a;
629 mText.append("<ul>"); 631 mText.append("<ul>");
630 int a_count = 0; 632 int a_count = 0;
631 int a_count_nr = 0; 633 int a_count_nr = 0;
632 634
633 for(a=attendees.first();a;a=attendees.next()) { 635 for(a=attendees.first();a;a=attendees.next()) {
634#ifndef KORG_NOKABC 636#ifndef KORG_NOKABC
635#ifdef DESKTOP_VERSION 637#ifdef DESKTOP_VERSION
636 if (a->name().isEmpty()) { 638 if (a->name().isEmpty()) {
637 addressList = add_book->findByEmail(a->email()); 639 addressList = add_book->findByEmail(a->email());
638 KABC::Addressee o = addressList.first(); 640 KABC::Addressee o = addressList.first();
639 if (!o.isEmpty() && addressList.size()<2) { 641 if (!o.isEmpty() && addressList.size()<2) {
640 mText += "<a href=\"uid:" + o.uid() + "\">"; 642 mText += "<a href=\"uid:" + o.uid() + "\">";
641 mText += o.formattedName(); 643 mText += o.formattedName();
642 mText += "</a>\n"; 644 mText += "</a>\n";
643 } else { 645 } else {
644 mText += "<li>"; 646 mText += "<li>";
645 mText.append(a->email()); 647 mText.append(a->email());
646 mText += "\n"; 648 mText += "\n";
647 } 649 }
648 } else { 650 } else {
649 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 651 mText += "<li><a href=\"uid:" + a->uid() + "\">";
650 if (!a->name().isEmpty()) mText += a->name(); 652 if (!a->name().isEmpty()) mText += a->name();
651 else mText += a->email(); 653 else mText += a->email();
652 mText += "</a>\n"; 654 mText += "</a>\n";
653 } 655 }
654#else //DESKTOP_VERSION 656#else //DESKTOP_VERSION
655 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 657 mText += "<li><a href=\"uid:" + a->uid() + "\">";
656 if (!a->name().isEmpty()) mText += a->name(); 658 if (!a->name().isEmpty()) mText += a->name();
657 else mText += a->email(); 659 else mText += a->email();
658 mText += "</a>\n"; 660 mText += "</a>\n";
659#endif //DESKTOP_VERSION 661#endif //DESKTOP_VERSION
660#else 662#else
661 //qDebug("nokabc "); 663 //qDebug("nokabc ");
662 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 664 mText += "<li><a href=\"uid:" + a->uid() + "\">";
663 if (!a->name().isEmpty()) mText += a->name(); 665 if (!a->name().isEmpty()) mText += a->name();
664 else mText += a->email(); 666 else mText += a->email();
665 mText += "</a>\n"; 667 mText += "</a>\n";
666#endif 668#endif
667 669
668 670
669 if (!a->email().isEmpty()) { 671 if (!a->email().isEmpty()) {
670 if (iconPath) { 672 if (iconPath) {
671 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 673 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
672 if ( a->RSVP() ) { 674 if ( a->RSVP() ) {
673 ++a_count_nr; 675 ++a_count_nr;
674 mText += "<IMG src=\"" + iconPath + "\">"; 676 mText += "<IMG src=\"" + iconPath + "\">";
675 } 677 }
676 else { 678 else {
677 ++a_count; 679 ++a_count;
678 mText += "<IMG src=\"" + NOiconPath + "\">"; 680 mText += "<IMG src=\"" + NOiconPath + "\">";
679 } 681 }
680 mText += "</a>\n"; 682 mText += "</a>\n";
681 } 683 }
682 } 684 }
683 if (a->status() != Attendee::NeedsAction ) 685 if (a->status() != Attendee::NeedsAction )
684 mText +="[" + a->statusStr() + "] "; 686 mText +="[" + a->statusStr() + "] ";
685 if (a->role() == Attendee::Chair ) 687 if (a->role() == Attendee::Chair )
686 mText +="(" + a->roleStr().left(1) + ".)"; 688 mText +="(" + a->roleStr().left(1) + ".)";
687 } 689 }
688 mText.append("</li></ul>"); 690 mText.append("</li></ul>");
689 if ( (a_count+a_count_nr) > 1 ) { 691 if ( (a_count+a_count_nr) > 1 ) {
690 mText += "<a href=\"mailto:ALL\">"; 692 mText += "<a href=\"mailto:ALL\">";
691 mText += i18n( "Mail to all" ); 693 mText += i18n( "Mail to all" );
692 mText += "</a> ( "; 694 mText += "</a> ( ";
693 mText += "<IMG src=\"" + iconPath + "\">"; 695 mText += "<IMG src=\"" + iconPath + "\">";
694 mText += i18n( " and " ); 696 mText += i18n( " and " );
695 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 697 mText += "<IMG src=\"" + NOiconPath + "\"> )";
696 mText += "<br>\n"; 698 mText += "<br>\n";
697 699
698 700
699 } 701 }
700 if ( a_count_nr > 1 ) { 702 if ( a_count_nr > 1 ) {
701 mText += "<a href=\"mailto:RSVP\">"; 703 mText += "<a href=\"mailto:RSVP\">";
702 mText += i18n( "Mail to selected" ); 704 mText += i18n( "Mail to selected" );
703 mText += "</a> ( "; 705 mText += "</a> ( ";
704 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 706 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
705 mText += "<br>\n"; 707 mText += "<br>\n";
706 } 708 }
707 } 709 }
708 710
709} 711}
710void KOEventViewer::appendJournal(Journal *jour, int mode ) 712void KOEventViewer::appendJournal(Journal *jour, int mode )
711{ 713{
712 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 714 bool shortDate = KOPrefs::instance()->mShortDateInViewer;