author | zautrix <zautrix> | 2005-02-04 13:30:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-04 13:30:05 (UTC) |
commit | 76e6ad6cc6a3be8df896a3e7cf8375234b3212a9 (patch) (unidiff) | |
tree | e5dc828bed35195ae3c24bc487986efc7e0d6011 /korganizer | |
parent | 83256090c493dab56f1afba4829e864598bf70d2 (diff) | |
download | kdepimpi-76e6ad6cc6a3be8df896a3e7cf8375234b3212a9.zip kdepimpi-76e6ad6cc6a3be8df896a3e7cf8375234b3212a9.tar.gz kdepimpi-76e6ad6cc6a3be8df896a3e7cf8375234b3212a9.tar.bz2 |
compile fix
-rw-r--r-- | korganizer/koeventviewer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index bf41edb..2faf18f 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -1,658 +1,660 @@ | |||
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 | #else //DESKTOP_VERSION | 56 | #else //DESKTOP_VERSION |
57 | #include <externalapphandler.h> | 57 | #include <externalapphandler.h> |
58 | #include <qtopia/qcopenvelope_qws.h> | 58 | #include <qtopia/qcopenvelope_qws.h> |
59 | #endif //DESKTOP_VERSION | 59 | #endif //DESKTOP_VERSION |
60 | 60 | ||
61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
62 | : QTextBrowser(parent,name) | 62 | : QTextBrowser(parent,name) |
63 | { | 63 | { |
64 | mSyncMode = false; | 64 | mSyncMode = false; |
65 | mColorMode = 0; | 65 | mColorMode = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | KOEventViewer::~KOEventViewer() | 68 | KOEventViewer::~KOEventViewer() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEventViewer::setSource(const QString& n) | 72 | void KOEventViewer::setSource(const QString& n) |
73 | { | 73 | { |
74 | 74 | ||
75 | if ( n.left(3) == "uid" ) | 75 | if ( n.left(3) == "uid" ) |
76 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
77 | { | 77 | { |
78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
79 | KABC::AddressBook::Iterator it; | 79 | KABC::AddressBook::Iterator it; |
80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
81 | // LR I do not understand, why the uid string is different on zaurus and desktop | 81 | // LR I do not understand, why the uid string is different on zaurus and desktop |
82 | QString uid = "uid://"+(*it).uid(); | 82 | QString uid = "uid://"+(*it).uid(); |
83 | 83 | ||
84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
85 | if (n == uid ) { | 85 | if (n == uid ) { |
86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
87 | QDialog dia( this,"dia123", true ); | 87 | QDialog dia( this,"dia123", true ); |
88 | dia.setCaption( i18n("Details of attendee") ); | 88 | dia.setCaption( i18n("Details of attendee") ); |
89 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
90 | KABC::AddresseeView av ( &dia ); | 90 | KABC::AddresseeView av ( &dia ); |
91 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
92 | lay.addWidget( &av ); | 92 | lay.addWidget( &av ); |
93 | if ( QApplication::desktop()->width() < 480 ) | 93 | if ( QApplication::desktop()->width() < 480 ) |
94 | dia.resize( 220, 240); | 94 | dia.resize( 220, 240); |
95 | else { | 95 | else { |
96 | dia.resize( 400,400); | 96 | dia.resize( 400,400); |
97 | } | 97 | } |
98 | dia.exec(); | 98 | dia.exec(); |
99 | break; | 99 | break; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | #else | 104 | #else |
105 | { | 105 | { |
106 | if ( "uid:organizer" == n ) { | 106 | if ( "uid:organizer" == n ) { |
107 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); | 107 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 110 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
111 | if (attendees.count()) { | 111 | if (attendees.count()) { |
112 | Attendee *a; | 112 | Attendee *a; |
113 | for(a=attendees.first();a;a=attendees.next()) { | 113 | for(a=attendees.first();a;a=attendees.next()) { |
114 | if ( "uid:"+a->uid() == n ) { | 114 | if ( "uid:"+a->uid() == n ) { |
115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
123 | // the result should now arrive through method insertAttendees | 123 | // the result should now arrive through method insertAttendees |
124 | //QString uid = "uid:"+(*it).uid(); | 124 | //QString uid = "uid:"+(*it).uid(); |
125 | #endif | 125 | #endif |
126 | if ( n.left(6) == "mailto" ) { | 126 | if ( n.left(6) == "mailto" ) { |
127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | if ( n.mid(7,3) == "ALL" ) { | 129 | if ( n.mid(7,3) == "ALL" ) { |
130 | qDebug("all "); | 130 | qDebug("all "); |
131 | mailToAttendees( true ); | 131 | mailToAttendees( true ); |
132 | } else if ( n.mid(7,4) == "RSVP" ) { | 132 | } else if ( n.mid(7,4) == "RSVP" ) { |
133 | mailToAttendees( false ); | 133 | mailToAttendees( false ); |
134 | qDebug("rsvp "); | 134 | qDebug("rsvp "); |
135 | } else { | 135 | } else { |
136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
137 | e << n.mid(7); | 137 | e << n.mid(7); |
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | #ifndef KORG_NODCOP | 144 | #ifndef KORG_NODCOP |
145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
146 | QString tmpStr; | 146 | QString tmpStr; |
147 | if (n.startsWith("mailto:")) { | 147 | if (n.startsWith("mailto:")) { |
148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
149 | //emit showIncidence(n); | 149 | //emit showIncidence(n); |
150 | return; | 150 | return; |
151 | } else if (n.startsWith("uid:")) { | 151 | } else if (n.startsWith("uid:")) { |
152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
153 | const QByteArray noParamData; | 153 | const QByteArray noParamData; |
154 | const QByteArray paramData; | 154 | const QByteArray paramData; |
155 | QByteArray replyData; | 155 | QByteArray replyData; |
156 | QCString replyTypeStr; | 156 | QCString replyTypeStr; |
157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
158 | bool foundAbbrowser = PING_ABBROWSER; | 158 | bool foundAbbrowser = PING_ABBROWSER; |
159 | 159 | ||
160 | if (foundAbbrowser) { | 160 | if (foundAbbrowser) { |
161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
162 | //client->send("kaddressbook","KAddressBookIface", | 162 | //client->send("kaddressbook","KAddressBookIface", |
163 | QDataStream arg(paramData, IO_WriteOnly); | 163 | QDataStream arg(paramData, IO_WriteOnly); |
164 | arg << n.mid(6); | 164 | arg << n.mid(6); |
165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
166 | return; | 166 | return; |
167 | } else { | 167 | } else { |
168 | /* | 168 | /* |
169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
170 | We start it without its main interface | 170 | We start it without its main interface |
171 | */ | 171 | */ |
172 | KIconLoader* iconLoader = new KIconLoader(); | 172 | KIconLoader* iconLoader = new KIconLoader(); |
173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
174 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
175 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
176 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | 185 | void KOEventViewer::mailToAttendees( bool all ) |
186 | { | 186 | { |
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
188 | if (attendees.count() == 0) return; | 188 | if (attendees.count() == 0) return; |
189 | QStringList nameList; | 189 | QStringList nameList; |
190 | QStringList emailList; | 190 | QStringList emailList; |
191 | QStringList uidList; | 191 | QStringList uidList; |
192 | Attendee* a; | 192 | Attendee* a; |
193 | for(a=attendees.first();a;a=attendees.next()) { | 193 | for(a=attendees.first();a;a=attendees.next()) { |
194 | if ( !all && !a->RSVP() ) continue; | 194 | if ( !all && !a->RSVP() ) continue; |
195 | if (!a->email().isEmpty()) { | 195 | if (!a->email().isEmpty()) { |
196 | nameList.append (a->name() ); | 196 | nameList.append (a->name() ); |
197 | emailList.append (a->email() ); | 197 | emailList.append (a->email() ); |
198 | uidList.append (a->uid() ); | 198 | uidList.append (a->uid() ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 201 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
202 | #ifndef DESKTOP_VERSION | ||
202 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
204 | #endif | ||
203 | 205 | ||
204 | } | 206 | } |
205 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 207 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
206 | { | 208 | { |
207 | int number=text.contains("\n"); | 209 | int number=text.contains("\n"); |
208 | QString str = "<" + tag + ">"; | 210 | QString str = "<" + tag + ">"; |
209 | QString tmpText=text; | 211 | QString tmpText=text; |
210 | QString tmpStr=str; | 212 | QString tmpStr=str; |
211 | if(number !=-1) | 213 | if(number !=-1) |
212 | { | 214 | { |
213 | if (number > 0) { | 215 | if (number > 0) { |
214 | int pos=0; | 216 | int pos=0; |
215 | QString tmp; | 217 | QString tmp; |
216 | for(int i=0;i<=number;i++) { | 218 | for(int i=0;i<=number;i++) { |
217 | pos=tmpText.find("\n"); | 219 | pos=tmpText.find("\n"); |
218 | tmp=tmpText.left(pos); | 220 | tmp=tmpText.left(pos); |
219 | tmpText=tmpText.right(tmpText.length()-pos-1); | 221 | tmpText=tmpText.right(tmpText.length()-pos-1); |
220 | tmpStr+=tmp+"<br>"; | 222 | tmpStr+=tmp+"<br>"; |
221 | } | 223 | } |
222 | } | 224 | } |
223 | else tmpStr += tmpText; | 225 | else tmpStr += tmpText; |
224 | tmpStr+="</" + tag + ">"; | 226 | tmpStr+="</" + tag + ">"; |
225 | mText.append(tmpStr); | 227 | mText.append(tmpStr); |
226 | } | 228 | } |
227 | else | 229 | else |
228 | { | 230 | { |
229 | str += text + "</" + tag + ">"; | 231 | str += text + "</" + tag + ">"; |
230 | mText.append(str); | 232 | mText.append(str); |
231 | } | 233 | } |
232 | } | 234 | } |
233 | 235 | ||
234 | void KOEventViewer::setColorMode( int m ) | 236 | void KOEventViewer::setColorMode( int m ) |
235 | { | 237 | { |
236 | mColorMode = m; | 238 | mColorMode = m; |
237 | } | 239 | } |
238 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
239 | { | 241 | { |
240 | mMailSubject = ""; | 242 | mMailSubject = ""; |
241 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
242 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
243 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
244 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
245 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
246 | } | 248 | } |
247 | else { | 249 | else { |
248 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
249 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
250 | } | 252 | } |
251 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
252 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
253 | } | 255 | } |
254 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
255 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
256 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
257 | } else { | 259 | } else { |
258 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
259 | } | 261 | } |
260 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
261 | if ( mColorMode ) | 263 | if ( mColorMode ) |
262 | mText += "</font>"; | 264 | mText += "</font>"; |
263 | } | 265 | } |
264 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
265 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
266 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
267 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
268 | mText.append("<br>"); | 270 | mText.append("<br>"); |
269 | mText += "</font>"; | 271 | mText += "</font>"; |
270 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
271 | } | 273 | } |
272 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
273 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
274 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
275 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
276 | } | 278 | } |
277 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
278 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
279 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
280 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
281 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
282 | } else { | 284 | } else { |
283 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
284 | } | 286 | } |
285 | } else { | 287 | } else { |
286 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
287 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
288 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
289 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
290 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
291 | } else { | 293 | } else { |
292 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
293 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
294 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
295 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
296 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
297 | } | 299 | } |
298 | } | 300 | } |
299 | 301 | ||
300 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
301 | 303 | ||
302 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
303 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
304 | bool last; | 306 | bool last; |
305 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
306 | QDate next; | 308 | QDate next; |
307 | next = event->recurrence()->getPreviousDate( start , &last ); | 309 | next = event->recurrence()->getPreviousDate( start , &last ); |
308 | if ( !last ) { | 310 | if ( !last ) { |
309 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | 311 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); |
310 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 312 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
311 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 313 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
312 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 314 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); |
313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | 315 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); |
314 | 316 | ||
315 | } else { | 317 | } else { |
316 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 318 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
317 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 319 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
318 | } | 320 | } |
319 | } else { | 321 | } else { |
320 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 322 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
321 | 323 | ||
322 | } | 324 | } |
323 | 325 | ||
324 | 326 | ||
325 | if (event->isAlarmEnabled()) { | 327 | if (event->isAlarmEnabled()) { |
326 | Alarm *alarm =event->alarms().first() ; | 328 | Alarm *alarm =event->alarms().first() ; |
327 | QDateTime t = alarm->time(); | 329 | QDateTime t = alarm->time(); |
328 | int min = t.secsTo( event->dtStart() )/60; | 330 | int min = t.secsTo( event->dtStart() )/60; |
329 | QString s =i18n("( %1 min before )").arg( min ); | 331 | QString s =i18n("( %1 min before )").arg( min ); |
330 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 332 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
331 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 333 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
332 | //addTag("p",s); | 334 | //addTag("p",s); |
333 | } | 335 | } |
334 | 336 | ||
335 | addTag("b",i18n("Access: ")); | 337 | addTag("b",i18n("Access: ")); |
336 | mText.append(event->secrecyStr()+"<br>"); | 338 | mText.append(event->secrecyStr()+"<br>"); |
337 | if (!event->description().isEmpty()) { | 339 | if (!event->description().isEmpty()) { |
338 | addTag("p",i18n("<b>Details: </b>")); | 340 | addTag("p",i18n("<b>Details: </b>")); |
339 | addTag("p",event->description()); | 341 | addTag("p",event->description()); |
340 | } | 342 | } |
341 | 343 | ||
342 | formatCategories(event); | 344 | formatCategories(event); |
343 | 345 | ||
344 | formatReadOnly(event); | 346 | formatReadOnly(event); |
345 | formatAttendees(event); | 347 | formatAttendees(event); |
346 | 348 | ||
347 | setText(mText); | 349 | setText(mText); |
348 | //QWhatsThis::add(this,mText); | 350 | //QWhatsThis::add(this,mText); |
349 | 351 | ||
350 | } | 352 | } |
351 | 353 | ||
352 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 354 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
353 | { | 355 | { |
354 | mMailSubject = ""; | 356 | mMailSubject = ""; |
355 | mCurrentIncidence = event; | 357 | mCurrentIncidence = event; |
356 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 358 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
357 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 359 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
358 | if (mode == 0 ) | 360 | if (mode == 0 ) |
359 | addTag("h2",event->summary()); | 361 | addTag("h2",event->summary()); |
360 | else { | 362 | else { |
361 | if ( mColorMode == 1 ) { | 363 | if ( mColorMode == 1 ) { |
362 | mText +="<font color=\"#00A000\">"; | 364 | mText +="<font color=\"#00A000\">"; |
363 | } | 365 | } |
364 | if ( mColorMode == 2 ) { | 366 | if ( mColorMode == 2 ) { |
365 | mText +="<font color=\"#B00000\">"; | 367 | mText +="<font color=\"#B00000\">"; |
366 | } | 368 | } |
367 | if ( mode == 1 ) { | 369 | if ( mode == 1 ) { |
368 | addTag("h2",i18n( "Local: " ) +event->summary()); | 370 | addTag("h2",i18n( "Local: " ) +event->summary()); |
369 | } else { | 371 | } else { |
370 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 372 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
371 | } | 373 | } |
372 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 374 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
373 | if ( mColorMode ) | 375 | if ( mColorMode ) |
374 | mText += "</font>"; | 376 | mText += "</font>"; |
375 | } | 377 | } |
376 | mMailSubject += i18n( "Todo " )+ event->summary(); | 378 | mMailSubject += i18n( "Todo " )+ event->summary(); |
377 | 379 | ||
378 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 380 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
379 | mText +="<font color=\"#B00000\">"; | 381 | mText +="<font color=\"#B00000\">"; |
380 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 382 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
381 | mText += "</font>"; | 383 | mText += "</font>"; |
382 | } else { | 384 | } else { |
383 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 385 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
384 | .arg(event->percentComplete())); | 386 | .arg(event->percentComplete())); |
385 | } | 387 | } |
386 | 388 | ||
387 | if (event->cancelled ()) { | 389 | if (event->cancelled ()) { |
388 | mText +="<font color=\"#B00000\">"; | 390 | mText +="<font color=\"#B00000\">"; |
389 | addTag("i",i18n("This todo has been cancelled!")); | 391 | addTag("i",i18n("This todo has been cancelled!")); |
390 | mText.append("<br>"); | 392 | mText.append("<br>"); |
391 | mText += "</font>"; | 393 | mText += "</font>"; |
392 | mMailSubject += i18n("(cancelled)"); | 394 | mMailSubject += i18n("(cancelled)"); |
393 | } | 395 | } |
394 | 396 | ||
395 | if (!event->location().isEmpty()) { | 397 | if (!event->location().isEmpty()) { |
396 | addTag("b",i18n("Location: ")); | 398 | addTag("b",i18n("Location: ")); |
397 | mText.append(event->location()+"<br>"); | 399 | mText.append(event->location()+"<br>"); |
398 | mMailSubject += i18n(" at ") + event->location(); | 400 | mMailSubject += i18n(" at ") + event->location(); |
399 | } | 401 | } |
400 | if (event->hasStartDate()) { | 402 | if (event->hasStartDate()) { |
401 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 403 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
402 | } | 404 | } |
403 | if (event->hasDueDate()) { | 405 | if (event->hasDueDate()) { |
404 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 406 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
405 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 407 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
406 | } | 408 | } |
407 | addTag("b",i18n("Access: ")); | 409 | addTag("b",i18n("Access: ")); |
408 | mText.append(event->secrecyStr()+"<br>"); | 410 | mText.append(event->secrecyStr()+"<br>"); |
409 | if (!event->description().isEmpty()) { | 411 | if (!event->description().isEmpty()) { |
410 | addTag("p",i18n("<b>Details: </b>")); | 412 | addTag("p",i18n("<b>Details: </b>")); |
411 | addTag("p",event->description()); | 413 | addTag("p",event->description()); |
412 | } | 414 | } |
413 | 415 | ||
414 | formatCategories(event); | 416 | formatCategories(event); |
415 | 417 | ||
416 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 418 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
417 | .arg(QString::number(event->priority()))); | 419 | .arg(QString::number(event->priority()))); |
418 | 420 | ||
419 | formatReadOnly(event); | 421 | formatReadOnly(event); |
420 | formatAttendees(event); | 422 | formatAttendees(event); |
421 | if ( event->relatedTo() ) { | 423 | if ( event->relatedTo() ) { |
422 | addTag("b",i18n("Parent todo: ")); | 424 | addTag("b",i18n("Parent todo: ")); |
423 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 425 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
424 | } | 426 | } |
425 | QPtrList<Incidence> Relations = event->relations(); | 427 | QPtrList<Incidence> Relations = event->relations(); |
426 | Incidence *to; | 428 | Incidence *to; |
427 | if ( Relations.first() ) | 429 | if ( Relations.first() ) |
428 | addTag("b",i18n("Sub todos:<br>")); | 430 | addTag("b",i18n("Sub todos:<br>")); |
429 | for (to=Relations.first();to;to=Relations.next()) { | 431 | for (to=Relations.first();to;to=Relations.next()) { |
430 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 432 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
431 | 433 | ||
432 | } | 434 | } |
433 | setText(mText); | 435 | setText(mText); |
434 | } | 436 | } |
435 | 437 | ||
436 | void KOEventViewer::formatCategories(Incidence *event) | 438 | void KOEventViewer::formatCategories(Incidence *event) |
437 | { | 439 | { |
438 | if (!event->categoriesStr().isEmpty()) { | 440 | if (!event->categoriesStr().isEmpty()) { |
439 | if (event->categories().count() == 1) { | 441 | if (event->categories().count() == 1) { |
440 | addTag("h3",i18n("Category")); | 442 | addTag("h3",i18n("Category")); |
441 | } else { | 443 | } else { |
442 | addTag("h3",i18n("Categories")); | 444 | addTag("h3",i18n("Categories")); |
443 | } | 445 | } |
444 | addTag("p",event->categoriesStr()); | 446 | addTag("p",event->categoriesStr()); |
445 | } | 447 | } |
446 | } | 448 | } |
447 | void KOEventViewer::formatAttendees(Incidence *event) | 449 | void KOEventViewer::formatAttendees(Incidence *event) |
448 | { | 450 | { |
449 | QPtrList<Attendee> attendees = event->attendees(); | 451 | QPtrList<Attendee> attendees = event->attendees(); |
450 | if (attendees.count()) { | 452 | if (attendees.count()) { |
451 | 453 | ||
452 | 454 | ||
453 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 455 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
454 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 456 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
455 | addTag("h3",i18n("Organizer")); | 457 | addTag("h3",i18n("Organizer")); |
456 | mText.append("<ul><li>"); | 458 | mText.append("<ul><li>"); |
457 | #ifndef KORG_NOKABC | 459 | #ifndef KORG_NOKABC |
458 | 460 | ||
459 | #ifdef DESKTOP_VERSION | 461 | #ifdef DESKTOP_VERSION |
460 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 462 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
461 | KABC::Addressee::List addressList; | 463 | KABC::Addressee::List addressList; |
462 | addressList = add_book->findByEmail(event->organizer()); | 464 | addressList = add_book->findByEmail(event->organizer()); |
463 | KABC::Addressee o = addressList.first(); | 465 | KABC::Addressee o = addressList.first(); |
464 | if (!o.isEmpty() && addressList.size()<2) { | 466 | if (!o.isEmpty() && addressList.size()<2) { |
465 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 467 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
466 | mText += o.formattedName(); | 468 | mText += o.formattedName(); |
467 | mText += "</a>\n"; | 469 | mText += "</a>\n"; |
468 | } else { | 470 | } else { |
469 | mText.append(event->organizer()); | 471 | mText.append(event->organizer()); |
470 | } | 472 | } |
471 | #else //DESKTOP_VERSION | 473 | #else //DESKTOP_VERSION |
472 | mText += "<a href=\"uid:organizer\">"; | 474 | mText += "<a href=\"uid:organizer\">"; |
473 | mText += event->organizer(); | 475 | mText += event->organizer(); |
474 | mText += "</a>\n"; | 476 | mText += "</a>\n"; |
475 | #endif //DESKTOP_VERSION | 477 | #endif //DESKTOP_VERSION |
476 | 478 | ||
477 | 479 | ||
478 | #else | 480 | #else |
479 | mText.append(event->organizer()); | 481 | mText.append(event->organizer()); |
480 | #endif | 482 | #endif |
481 | 483 | ||
482 | if (iconPath) { | 484 | if (iconPath) { |
483 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 485 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
484 | mText += "<IMG src=\"" + iconPath + "\">"; | 486 | mText += "<IMG src=\"" + iconPath + "\">"; |
485 | mText += "</a>\n"; | 487 | mText += "</a>\n"; |
486 | } | 488 | } |
487 | mText.append("</li></ul>"); | 489 | mText.append("</li></ul>"); |
488 | 490 | ||
489 | addTag("h3",i18n("Attendees")); | 491 | addTag("h3",i18n("Attendees")); |
490 | Attendee *a; | 492 | Attendee *a; |
491 | mText.append("<ul>"); | 493 | mText.append("<ul>"); |
492 | int a_count = 0; | 494 | int a_count = 0; |
493 | int a_count_nr = 0; | 495 | int a_count_nr = 0; |
494 | 496 | ||
495 | for(a=attendees.first();a;a=attendees.next()) { | 497 | for(a=attendees.first();a;a=attendees.next()) { |
496 | #ifndef KORG_NOKABC | 498 | #ifndef KORG_NOKABC |
497 | #ifdef DESKTOP_VERSION | 499 | #ifdef DESKTOP_VERSION |
498 | if (a->name().isEmpty()) { | 500 | if (a->name().isEmpty()) { |
499 | addressList = add_book->findByEmail(a->email()); | 501 | addressList = add_book->findByEmail(a->email()); |
500 | KABC::Addressee o = addressList.first(); | 502 | KABC::Addressee o = addressList.first(); |
501 | if (!o.isEmpty() && addressList.size()<2) { | 503 | if (!o.isEmpty() && addressList.size()<2) { |
502 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 504 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
503 | mText += o.formattedName(); | 505 | mText += o.formattedName(); |
504 | mText += "</a>\n"; | 506 | mText += "</a>\n"; |
505 | } else { | 507 | } else { |
506 | mText += "<li>"; | 508 | mText += "<li>"; |
507 | mText.append(a->email()); | 509 | mText.append(a->email()); |
508 | mText += "\n"; | 510 | mText += "\n"; |
509 | } | 511 | } |
510 | } else { | 512 | } else { |
511 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 513 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
512 | if (!a->name().isEmpty()) mText += a->name(); | 514 | if (!a->name().isEmpty()) mText += a->name(); |
513 | else mText += a->email(); | 515 | else mText += a->email(); |
514 | mText += "</a>\n"; | 516 | mText += "</a>\n"; |
515 | } | 517 | } |
516 | #else //DESKTOP_VERSION | 518 | #else //DESKTOP_VERSION |
517 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 519 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
518 | if (!a->name().isEmpty()) mText += a->name(); | 520 | if (!a->name().isEmpty()) mText += a->name(); |
519 | else mText += a->email(); | 521 | else mText += a->email(); |
520 | mText += "</a>\n"; | 522 | mText += "</a>\n"; |
521 | #endif //DESKTOP_VERSION | 523 | #endif //DESKTOP_VERSION |
522 | #else | 524 | #else |
523 | //qDebug("nokabc "); | 525 | //qDebug("nokabc "); |
524 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 526 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
525 | if (!a->name().isEmpty()) mText += a->name(); | 527 | if (!a->name().isEmpty()) mText += a->name(); |
526 | else mText += a->email(); | 528 | else mText += a->email(); |
527 | mText += "</a>\n"; | 529 | mText += "</a>\n"; |
528 | #endif | 530 | #endif |
529 | 531 | ||
530 | 532 | ||
531 | if (!a->email().isEmpty()) { | 533 | if (!a->email().isEmpty()) { |
532 | if (iconPath) { | 534 | if (iconPath) { |
533 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 535 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
534 | if ( a->RSVP() ) { | 536 | if ( a->RSVP() ) { |
535 | ++a_count; | 537 | ++a_count; |
536 | mText += "<IMG src=\"" + iconPath + "\">"; | 538 | mText += "<IMG src=\"" + iconPath + "\">"; |
537 | } | 539 | } |
538 | else { | 540 | else { |
539 | ++a_count_nr; | 541 | ++a_count_nr; |
540 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 542 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
541 | } | 543 | } |
542 | mText += "</a>\n"; | 544 | mText += "</a>\n"; |
543 | } | 545 | } |
544 | } | 546 | } |
545 | if (a->status() != Attendee::NeedsAction ) | 547 | if (a->status() != Attendee::NeedsAction ) |
546 | mText +="[" + a->statusStr() + "] "; | 548 | mText +="[" + a->statusStr() + "] "; |
547 | if (a->role() == Attendee::Chair ) | 549 | if (a->role() == Attendee::Chair ) |
548 | mText +="(" + a->roleStr().left(1) + ".)"; | 550 | mText +="(" + a->roleStr().left(1) + ".)"; |
549 | } | 551 | } |
550 | mText.append("</li></ul>"); | 552 | mText.append("</li></ul>"); |
551 | if ( a_count > 1 ) { | 553 | if ( a_count > 1 ) { |
552 | mText += "<a href=\"mailto:ALL\">"; | 554 | mText += "<a href=\"mailto:ALL\">"; |
553 | mText += i18n( "Mail to all" ); | 555 | mText += i18n( "Mail to all" ); |
554 | mText += "</a> ( "; | 556 | mText += "</a> ( "; |
555 | mText += "<IMG src=\"" + iconPath + "\">"; | 557 | mText += "<IMG src=\"" + iconPath + "\">"; |
556 | mText += i18n( " and " ); | 558 | mText += i18n( " and " ); |
557 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 559 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
558 | mText += "<br>\n"; | 560 | mText += "<br>\n"; |
559 | 561 | ||
560 | 562 | ||
561 | } | 563 | } |
562 | if ( a_count_nr > 1 ) { | 564 | if ( a_count_nr > 1 ) { |
563 | mText += "<a href=\"mailto:RSVP\">"; | 565 | mText += "<a href=\"mailto:RSVP\">"; |
564 | mText += i18n( "Mail to selected" ); | 566 | mText += i18n( "Mail to selected" ); |
565 | mText += "</a> ( "; | 567 | mText += "</a> ( "; |
566 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 568 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
567 | mText += "\n"; | 569 | mText += "\n"; |
568 | } | 570 | } |
569 | } | 571 | } |
570 | 572 | ||
571 | } | 573 | } |
572 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 574 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
573 | { | 575 | { |
574 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 576 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
575 | if (mode == 0 ) { | 577 | if (mode == 0 ) { |
576 | addTag("h2",i18n("Journal from: ")); | 578 | addTag("h2",i18n("Journal from: ")); |
577 | } | 579 | } |
578 | else { | 580 | else { |
579 | if ( mode == 1 ) { | 581 | if ( mode == 1 ) { |
580 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 582 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
581 | } else { | 583 | } else { |
582 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 584 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
583 | } | 585 | } |
584 | } | 586 | } |
585 | topLevelWidget()->setCaption("Journal Viewer"); | 587 | topLevelWidget()->setCaption("Journal Viewer"); |
586 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 588 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
587 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 589 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
588 | if (!jour->description().isEmpty()) { | 590 | if (!jour->description().isEmpty()) { |
589 | addTag("p",jour->description()); | 591 | addTag("p",jour->description()); |
590 | } | 592 | } |
591 | setText(mText); | 593 | setText(mText); |
592 | } | 594 | } |
593 | 595 | ||
594 | void KOEventViewer::formatReadOnly(Incidence *event) | 596 | void KOEventViewer::formatReadOnly(Incidence *event) |
595 | { | 597 | { |
596 | if (event->isReadOnly()) { | 598 | if (event->isReadOnly()) { |
597 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 599 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
598 | } | 600 | } |
599 | } | 601 | } |
600 | void KOEventViewer::setSyncMode( bool b ) | 602 | void KOEventViewer::setSyncMode( bool b ) |
601 | { | 603 | { |
602 | mSyncMode = b; | 604 | mSyncMode = b; |
603 | } | 605 | } |
604 | 606 | ||
605 | 607 | ||
606 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 608 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
607 | { | 609 | { |
608 | if ( clearV ) | 610 | if ( clearV ) |
609 | clearEvents(); | 611 | clearEvents(); |
610 | if ( mSyncMode ) { | 612 | if ( mSyncMode ) { |
611 | if ( clearV ) | 613 | if ( clearV ) |
612 | appendTodo(event,1 ); | 614 | appendTodo(event,1 ); |
613 | else | 615 | else |
614 | appendTodo(event,2); | 616 | appendTodo(event,2); |
615 | } else | 617 | } else |
616 | appendTodo(event); | 618 | appendTodo(event); |
617 | } | 619 | } |
618 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 620 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
619 | { | 621 | { |
620 | if ( clearV ) | 622 | if ( clearV ) |
621 | clearEvents(); | 623 | clearEvents(); |
622 | if ( mSyncMode ) { | 624 | if ( mSyncMode ) { |
623 | if ( clearV ) | 625 | if ( clearV ) |
624 | appendJournal(event, 1); | 626 | appendJournal(event, 1); |
625 | else | 627 | else |
626 | appendJournal(event, 2); | 628 | appendJournal(event, 2); |
627 | } else | 629 | } else |
628 | appendJournal(event); | 630 | appendJournal(event); |
629 | } | 631 | } |
630 | 632 | ||
631 | void KOEventViewer::setEvent(Event *event) | 633 | void KOEventViewer::setEvent(Event *event) |
632 | { | 634 | { |
633 | clearEvents(); | 635 | clearEvents(); |
634 | if ( mSyncMode ) | 636 | if ( mSyncMode ) |
635 | appendEvent(event, 1); | 637 | appendEvent(event, 1); |
636 | else | 638 | else |
637 | appendEvent(event); | 639 | appendEvent(event); |
638 | } | 640 | } |
639 | 641 | ||
640 | void KOEventViewer::addEvent(Event *event) | 642 | void KOEventViewer::addEvent(Event *event) |
641 | { | 643 | { |
642 | if ( mSyncMode ) | 644 | if ( mSyncMode ) |
643 | appendEvent(event, 2); | 645 | appendEvent(event, 2); |
644 | else | 646 | else |
645 | appendEvent(event); | 647 | appendEvent(event); |
646 | } | 648 | } |
647 | 649 | ||
648 | void KOEventViewer::clearEvents(bool now) | 650 | void KOEventViewer::clearEvents(bool now) |
649 | { | 651 | { |
650 | mText = ""; | 652 | mText = ""; |
651 | if (now) setText(mText); | 653 | if (now) setText(mText); |
652 | } | 654 | } |
653 | 655 | ||
654 | void KOEventViewer::addText(QString text) | 656 | void KOEventViewer::addText(QString text) |
655 | { | 657 | { |
656 | mText.append(text); | 658 | mText.append(text); |
657 | setText(mText); | 659 | setText(mText); |
658 | } | 660 | } |