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 | |||
@@ -10,385 +10,387 @@ | |||
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 | ||