author | zautrix <zautrix> | 2005-03-28 19:26:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-28 19:26:15 (UTC) |
commit | ea070abfcff313cac87dbb4d5c9410784740de21 (patch) (unidiff) | |
tree | 3e95608a0444030016eb6845b95a582e265c1dad /korganizer | |
parent | 57f95bb15f732ede3ddc68b077b6a5476246e971 (diff) | |
download | kdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.zip kdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.tar.gz kdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.tar.bz2 |
print fixes
-rw-r--r-- | korganizer/koeventviewer.cpp | 13 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 53 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 8 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 12 |
4 files changed, 76 insertions, 10 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 445fc86..dbe0668 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -1,287 +1,298 @@ | |||
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 | ||
64 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 64 | KOEventViewer::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 | ||
71 | KOEventViewer::~KOEventViewer() | 71 | KOEventViewer::~KOEventViewer() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | void KOEventViewer::printMe() | 75 | void KOEventViewer::printMe() |
76 | { | 76 | { |
77 | #ifdef DESKTOP_VERSION | 77 | #ifdef DESKTOP_VERSION |
78 | |||
79 | KOPrintPrefs pp ( this ); | ||
80 | if (!pp.exec() ) | ||
81 | return; | ||
82 | int scaleval = pp.printMode() ; | ||
83 | |||
78 | QPrinter printer; | 84 | QPrinter printer; |
79 | if (!printer.setup() ) | 85 | if (!printer.setup() ) |
80 | return; | 86 | return; |
81 | QPainter p; | 87 | QPainter p; |
82 | p.begin ( &printer ); | 88 | p.begin ( &printer ); |
83 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 89 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
84 | float dx, dy; | 90 | float dx, dy; |
85 | int wid = (m.width() * 9)/10; | 91 | int wid = (m.width() * 9)/10; |
86 | dx = (float) wid/(float)contentsWidth (); | 92 | dx = (float) wid/(float)contentsWidth (); |
87 | dy = (float)(m.height()) / (float)contentsHeight (); | 93 | dy = (float)(m.height()) / (float)contentsHeight (); |
88 | float scale; | 94 | float scale; |
89 | // scale to fit the width or height of the paper | 95 | // scale to fit the width or height of the paper |
90 | if ( dx < dy ) | 96 | if ( dx < dy ) |
91 | scale = dx; | 97 | scale = dx; |
92 | else | 98 | else |
93 | scale = dy; | 99 | scale = dy; |
100 | |||
94 | p.translate( m.width()/10,0 ); | 101 | p.translate( m.width()/10,0 ); |
95 | p.scale( scale, scale ); | 102 | qDebug("Scale: %f ", scale ); |
103 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | ||
104 | qDebug("SCALE "); | ||
105 | p.scale( scale, scale ); | ||
106 | } | ||
96 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 107 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
97 | p.end(); | 108 | p.end(); |
98 | #endif | 109 | #endif |
99 | 110 | ||
100 | } | 111 | } |
101 | void KOEventViewer::setSource(const QString& n) | 112 | void KOEventViewer::setSource(const QString& n) |
102 | { | 113 | { |
103 | 114 | ||
104 | if ( n.left(3) == "uid" ) | 115 | if ( n.left(3) == "uid" ) |
105 | #ifdef DESKTOP_VERSION | 116 | #ifdef DESKTOP_VERSION |
106 | { | 117 | { |
107 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 118 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
108 | KABC::AddressBook::Iterator it; | 119 | KABC::AddressBook::Iterator it; |
109 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 120 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
110 | // LR I do not understand, why the uid string is different on zaurus and desktop | 121 | // LR I do not understand, why the uid string is different on zaurus and desktop |
111 | QString uid = "uid://"+(*it).uid(); | 122 | QString uid = "uid://"+(*it).uid(); |
112 | 123 | ||
113 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 124 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
114 | if (n == uid ) { | 125 | if (n == uid ) { |
115 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 126 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
116 | QDialog dia( this,"dia123", true ); | 127 | QDialog dia( this,"dia123", true ); |
117 | dia.setCaption( i18n("Details of attendee") ); | 128 | dia.setCaption( i18n("Details of attendee") ); |
118 | QVBoxLayout lay ( &dia ); | 129 | QVBoxLayout lay ( &dia ); |
119 | KABC::AddresseeView av ( &dia ); | 130 | KABC::AddresseeView av ( &dia ); |
120 | av.setAddressee( (*it) ); | 131 | av.setAddressee( (*it) ); |
121 | lay.addWidget( &av ); | 132 | lay.addWidget( &av ); |
122 | if ( QApplication::desktop()->width() < 480 ) | 133 | if ( QApplication::desktop()->width() < 480 ) |
123 | dia.resize( 220, 240); | 134 | dia.resize( 220, 240); |
124 | else { | 135 | else { |
125 | dia.resize( 400,400); | 136 | dia.resize( 400,400); |
126 | } | 137 | } |
127 | dia.exec(); | 138 | dia.exec(); |
128 | break; | 139 | break; |
129 | } | 140 | } |
130 | } | 141 | } |
131 | return; | 142 | return; |
132 | } | 143 | } |
133 | #else | 144 | #else |
134 | { | 145 | { |
135 | if ( "uid:organizer" == n ) { | 146 | if ( "uid:organizer" == n ) { |
136 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); | 147 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); |
137 | return; | 148 | return; |
138 | } | 149 | } |
139 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 150 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
140 | if (attendees.count()) { | 151 | if (attendees.count()) { |
141 | Attendee *a; | 152 | Attendee *a; |
142 | for(a=attendees.first();a;a=attendees.next()) { | 153 | for(a=attendees.first();a;a=attendees.next()) { |
143 | if ( "uid:"+a->uid() == n ) { | 154 | if ( "uid:"+a->uid() == n ) { |
144 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 155 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
145 | return; | 156 | return; |
146 | } | 157 | } |
147 | } | 158 | } |
148 | } | 159 | } |
149 | return; | 160 | return; |
150 | } | 161 | } |
151 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 162 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
152 | // the result should now arrive through method insertAttendees | 163 | // the result should now arrive through method insertAttendees |
153 | //QString uid = "uid:"+(*it).uid(); | 164 | //QString uid = "uid:"+(*it).uid(); |
154 | #endif | 165 | #endif |
155 | if ( n.left(6) == "mailto" ) { | 166 | if ( n.left(6) == "mailto" ) { |
156 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 167 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
157 | #ifndef DESKTOP_VERSION | 168 | #ifndef DESKTOP_VERSION |
158 | if ( n.mid(7,3) == "ALL" ) { | 169 | if ( n.mid(7,3) == "ALL" ) { |
159 | qDebug("all "); | 170 | qDebug("all "); |
160 | mailToAttendees( true ); | 171 | mailToAttendees( true ); |
161 | } else if ( n.mid(7,4) == "RSVP" ) { | 172 | } else if ( n.mid(7,4) == "RSVP" ) { |
162 | mailToAttendees( false ); | 173 | mailToAttendees( false ); |
163 | qDebug("rsvp "); | 174 | qDebug("rsvp "); |
164 | } else { | 175 | } else { |
165 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 176 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
166 | e << n.mid(7); | 177 | e << n.mid(7); |
167 | } | 178 | } |
168 | #endif | 179 | #endif |
169 | 180 | ||
170 | } | 181 | } |
171 | 182 | ||
172 | 183 | ||
173 | #ifndef KORG_NODCOP | 184 | #ifndef KORG_NODCOP |
174 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 185 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
175 | QString tmpStr; | 186 | QString tmpStr; |
176 | if (n.startsWith("mailto:")) { | 187 | if (n.startsWith("mailto:")) { |
177 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 188 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
178 | //emit showIncidence(n); | 189 | //emit showIncidence(n); |
179 | return; | 190 | return; |
180 | } else if (n.startsWith("uid:")) { | 191 | } else if (n.startsWith("uid:")) { |
181 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 192 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
182 | const QByteArray noParamData; | 193 | const QByteArray noParamData; |
183 | const QByteArray paramData; | 194 | const QByteArray paramData; |
184 | QByteArray replyData; | 195 | QByteArray replyData; |
185 | QCString replyTypeStr; | 196 | QCString replyTypeStr; |
186 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 197 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
187 | bool foundAbbrowser = PING_ABBROWSER; | 198 | bool foundAbbrowser = PING_ABBROWSER; |
188 | 199 | ||
189 | if (foundAbbrowser) { | 200 | if (foundAbbrowser) { |
190 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 201 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
191 | //client->send("kaddressbook","KAddressBookIface", | 202 | //client->send("kaddressbook","KAddressBookIface", |
192 | QDataStream arg(paramData, IO_WriteOnly); | 203 | QDataStream arg(paramData, IO_WriteOnly); |
193 | arg << n.mid(6); | 204 | arg << n.mid(6); |
194 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 205 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
195 | return; | 206 | return; |
196 | } else { | 207 | } else { |
197 | /* | 208 | /* |
198 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 209 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
199 | We start it without its main interface | 210 | We start it without its main interface |
200 | */ | 211 | */ |
201 | KIconLoader* iconLoader = new KIconLoader(); | 212 | KIconLoader* iconLoader = new KIconLoader(); |
202 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 213 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
203 | ActionManager::setStartedKAddressBook(true); | 214 | ActionManager::setStartedKAddressBook(true); |
204 | tmpStr = "kaddressbook --editor-only --uid "; | 215 | tmpStr = "kaddressbook --editor-only --uid "; |
205 | tmpStr += KProcess::quote(n.mid(6)); | 216 | tmpStr += KProcess::quote(n.mid(6)); |
206 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 217 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
207 | return; | 218 | return; |
208 | } | 219 | } |
209 | } else { | 220 | } else { |
210 | //QTextBrowser::setSource(n); | 221 | //QTextBrowser::setSource(n); |
211 | } | 222 | } |
212 | #endif | 223 | #endif |
213 | } | 224 | } |
214 | void KOEventViewer::mailToAttendees( bool all ) | 225 | void KOEventViewer::mailToAttendees( bool all ) |
215 | { | 226 | { |
216 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 227 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
217 | if (attendees.count() == 0) return; | 228 | if (attendees.count() == 0) return; |
218 | QStringList nameList; | 229 | QStringList nameList; |
219 | QStringList emailList; | 230 | QStringList emailList; |
220 | QStringList uidList; | 231 | QStringList uidList; |
221 | Attendee* a; | 232 | Attendee* a; |
222 | for(a=attendees.first();a;a=attendees.next()) { | 233 | for(a=attendees.first();a;a=attendees.next()) { |
223 | if ( !all && !a->RSVP() ) continue; | 234 | if ( !all && !a->RSVP() ) continue; |
224 | if (!a->email().isEmpty()) { | 235 | if (!a->email().isEmpty()) { |
225 | nameList.append (a->name() ); | 236 | nameList.append (a->name() ); |
226 | emailList.append (a->email() ); | 237 | emailList.append (a->email() ); |
227 | uidList.append (a->uid() ); | 238 | uidList.append (a->uid() ); |
228 | } | 239 | } |
229 | } | 240 | } |
230 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 241 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
231 | #ifndef DESKTOP_VERSION | 242 | #ifndef DESKTOP_VERSION |
232 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 243 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
233 | #endif | 244 | #endif |
234 | 245 | ||
235 | } | 246 | } |
236 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 247 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
237 | { | 248 | { |
238 | int number=text.contains("\n"); | 249 | int number=text.contains("\n"); |
239 | QString str = "<" + tag + ">"; | 250 | QString str = "<" + tag + ">"; |
240 | QString tmpText=text; | 251 | QString tmpText=text; |
241 | QString tmpStr=str; | 252 | QString tmpStr=str; |
242 | if(number !=-1) | 253 | if(number !=-1) |
243 | { | 254 | { |
244 | if (number > 0) { | 255 | if (number > 0) { |
245 | int pos=0; | 256 | int pos=0; |
246 | QString tmp; | 257 | QString tmp; |
247 | for(int i=0;i<=number;i++) { | 258 | for(int i=0;i<=number;i++) { |
248 | pos=tmpText.find("\n"); | 259 | pos=tmpText.find("\n"); |
249 | tmp=tmpText.left(pos); | 260 | tmp=tmpText.left(pos); |
250 | tmpText=tmpText.right(tmpText.length()-pos-1); | 261 | tmpText=tmpText.right(tmpText.length()-pos-1); |
251 | tmpStr+=tmp+"<br>"; | 262 | tmpStr+=tmp+"<br>"; |
252 | } | 263 | } |
253 | } | 264 | } |
254 | else tmpStr += tmpText; | 265 | else tmpStr += tmpText; |
255 | tmpStr+="</" + tag + ">"; | 266 | tmpStr+="</" + tag + ">"; |
256 | mText.append(tmpStr); | 267 | mText.append(tmpStr); |
257 | } | 268 | } |
258 | else | 269 | else |
259 | { | 270 | { |
260 | str += text + "</" + tag + ">"; | 271 | str += text + "</" + tag + ">"; |
261 | mText.append(str); | 272 | mText.append(str); |
262 | } | 273 | } |
263 | } | 274 | } |
264 | 275 | ||
265 | void KOEventViewer::setColorMode( int m ) | 276 | void KOEventViewer::setColorMode( int m ) |
266 | { | 277 | { |
267 | mColorMode = m; | 278 | mColorMode = m; |
268 | } | 279 | } |
269 | void KOEventViewer::appendEvent(Event *event, int mode ) | 280 | void KOEventViewer::appendEvent(Event *event, int mode ) |
270 | { | 281 | { |
271 | mMailSubject = ""; | 282 | mMailSubject = ""; |
272 | mCurrentIncidence = event; | 283 | mCurrentIncidence = event; |
273 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 284 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
274 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 285 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
275 | if ( mode == 0 ) { | 286 | if ( mode == 0 ) { |
276 | addTag("h2",deTag(event->summary())); | 287 | addTag("h2",deTag(event->summary())); |
277 | } | 288 | } |
278 | else { | 289 | else { |
279 | if ( mColorMode == 1 ) { | 290 | if ( mColorMode == 1 ) { |
280 | mText +="<font color=\"#00A000\">"; | 291 | mText +="<font color=\"#00A000\">"; |
281 | } | 292 | } |
282 | if ( mColorMode == 2 ) { | 293 | if ( mColorMode == 2 ) { |
283 | mText +="<font color=\"#C00000\">"; | 294 | mText +="<font color=\"#C00000\">"; |
284 | } | 295 | } |
285 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 296 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
286 | if ( mode == 1 ) { | 297 | if ( mode == 1 ) { |
287 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 298 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index ca5bc15..6ecc233 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h | |||
@@ -1,78 +1,131 @@ | |||
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 | #ifndef KOEVENTVIEWER_H | 19 | #ifndef KOEVENTVIEWER_H |
20 | #define KOEVENTVIEWER_H | 20 | #define KOEVENTVIEWER_H |
21 | // | 21 | // |
22 | // Viewer widget for events. | 22 | // Viewer widget for events. |
23 | // | 23 | // |
24 | 24 | ||
25 | #include <qtextbrowser.h> | 25 | #include <qtextbrowser.h> |
26 | 26 | ||
27 | #include <libkcal/event.h> | 27 | #include <libkcal/event.h> |
28 | #include <libkcal/journal.h> | 28 | #include <libkcal/journal.h> |
29 | 29 | ||
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | #ifdef DESKTOP_VERSION | ||
34 | |||
35 | #include <qradiobutton.h> | ||
36 | #include <qpushbutton.h> | ||
37 | #include <qlayout.h> | ||
38 | #include <qdialog.h> | ||
39 | #include <qlabel.h> | ||
40 | #include <qbuttongroup.h> | ||
41 | #include <kglobal.h> | ||
42 | |||
43 | class KOPrintPrefs : public QDialog | ||
44 | { | ||
45 | public: | ||
46 | KOPrintPrefs( QWidget *parent=0, const char *name=0 ) : | ||
47 | QDialog( parent, name, true ) | ||
48 | { | ||
49 | setCaption( i18n("KO/Pi Printout") ); | ||
50 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
51 | lay->setSpacing( 3 ); | ||
52 | lay->setMargin( 3 ); | ||
53 | QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog."), this ); | ||
54 | lay->addWidget( lab ); | ||
55 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Printout Mode"), this ); | ||
56 | lay->addWidget( format ); | ||
57 | format->setExclusive ( true ) ; | ||
58 | pmNo = new QRadioButton(i18n("Print unscaled"), format ); | ||
59 | pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format ); | ||
60 | new QRadioButton(i18n("Print scaled up/down to fit one page"), format ); | ||
61 | pmScaledDown->setChecked( true ); | ||
62 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | ||
63 | lay->addWidget( ok ); | ||
64 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
65 | lay->addWidget( cancel ); | ||
66 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
67 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
68 | resize( 200, 200 ); | ||
69 | } | ||
70 | |||
71 | int printMode() | ||
72 | { | ||
73 | if ( pmNo->isChecked() ) | ||
74 | return 0; | ||
75 | if ( pmScaledDown->isChecked() ) | ||
76 | return 1; | ||
77 | return 2; | ||
78 | } | ||
79 | private: | ||
80 | QRadioButton* pmNo; | ||
81 | QRadioButton* pmScaledDown; | ||
82 | }; | ||
83 | |||
84 | #endif | ||
85 | |||
33 | class KOEventViewer : public QTextBrowser { | 86 | class KOEventViewer : public QTextBrowser { |
34 | Q_OBJECT | 87 | Q_OBJECT |
35 | public: | 88 | public: |
36 | KOEventViewer(QWidget *parent=0,const char *name=0); | 89 | KOEventViewer(QWidget *parent=0,const char *name=0); |
37 | virtual ~KOEventViewer(); | 90 | virtual ~KOEventViewer(); |
38 | 91 | ||
39 | void setSource(const QString &); | 92 | void setSource(const QString &); |
40 | void setEvent(Event *event); | 93 | void setEvent(Event *event); |
41 | void addEvent(Event *event); | 94 | void addEvent(Event *event); |
42 | void setTodo(Todo *event, bool clearV = true ); | 95 | void setTodo(Todo *event, bool clearV = true ); |
43 | void setJournal(Journal *jour, bool clearV = true ); | 96 | void setJournal(Journal *jour, bool clearV = true ); |
44 | 97 | ||
45 | void appendEvent(Event *event, int mode = 0 ); | 98 | void appendEvent(Event *event, int mode = 0 ); |
46 | void appendTodo(Todo *event, int mode = 0 ); | 99 | void appendTodo(Todo *event, int mode = 0 ); |
47 | void appendJournal(Journal *jour, int mode = 0 ); | 100 | void appendJournal(Journal *jour, int mode = 0 ); |
48 | 101 | ||
49 | void clearEvents(bool now=false); | 102 | void clearEvents(bool now=false); |
50 | 103 | ||
51 | void addText(QString text); | 104 | void addText(QString text); |
52 | void setSyncMode( bool ); | 105 | void setSyncMode( bool ); |
53 | void setColorMode( int ); | 106 | void setColorMode( int ); |
54 | void mailToAttendees( bool all ); | 107 | void mailToAttendees( bool all ); |
55 | void printMe(); | 108 | void printMe(); |
56 | 109 | ||
57 | protected: | 110 | protected: |
58 | int mColorMode; | 111 | int mColorMode; |
59 | void addTag(const QString & tag,const QString & text); | 112 | void addTag(const QString & tag,const QString & text); |
60 | 113 | ||
61 | void formatCategories(Incidence *event); | 114 | void formatCategories(Incidence *event); |
62 | void formatAttendees(Incidence *event); | 115 | void formatAttendees(Incidence *event); |
63 | void formatReadOnly(Incidence *event); | 116 | void formatReadOnly(Incidence *event); |
64 | void keyPressEvent ( QKeyEvent * e ); | 117 | void keyPressEvent ( QKeyEvent * e ); |
65 | 118 | ||
66 | private: | 119 | private: |
67 | QTextBrowser *mEventTextView; | 120 | QTextBrowser *mEventTextView; |
68 | bool mSyncMode; | 121 | bool mSyncMode; |
69 | QString deTag(QString text); | 122 | QString deTag(QString text); |
70 | 123 | ||
71 | QString mText; | 124 | QString mText; |
72 | QString mMailSubject; | 125 | QString mMailSubject; |
73 | Incidence* mCurrentIncidence; | 126 | Incidence* mCurrentIncidence; |
74 | signals: | 127 | signals: |
75 | void launchaddressbook(QString uid); | 128 | void launchaddressbook(QString uid); |
76 | }; | 129 | }; |
77 | 130 | ||
78 | #endif | 131 | #endif |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index ec55cca..35d084d 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,295 +1,287 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | 25 | ||
26 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
27 | #include <kmessagebox.h> | 27 | #include <kmessagebox.h> |
28 | #include "koprefs.h" | 28 | #include "koprefs.h" |
29 | #include <libkcal/todo.h> | 29 | #include <libkcal/todo.h> |
30 | #include "qapp.h" | 30 | #include "qapp.h" |
31 | 31 | ||
32 | #include "koeventviewerdialog.h" | 32 | #include "koeventviewerdialog.h" |
33 | extern int globalFlagBlockAgenda; | 33 | extern int globalFlagBlockAgenda; |
34 | 34 | ||
35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
36 | : KDialogBase(parent,name, | 36 | : KDialogBase(parent,name, |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | true , | 38 | true , |
39 | #else | 39 | #else |
40 | false, | 40 | false, |
41 | #endif | 41 | #endif |
42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
43 | { | 43 | { |
44 | sendSignalViewerClosed = true; | 44 | sendSignalViewerClosed = true; |
45 | mEventViewer = new KOEventViewer(this); | 45 | mEventViewer = new KOEventViewer(this); |
46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
47 | setMainWidget(mEventViewer); | 47 | setMainWidget(mEventViewer); |
48 | setButtonText(Ok, i18n("Edit") ); | 48 | setButtonText(Ok, i18n("Edit") ); |
49 | 49 | ||
50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
51 | SLOT(editIncidence())); | 51 | SLOT(editIncidence())); |
52 | QObject::connect(this,SIGNAL(user1Clicked()), | 52 | QObject::connect(this,SIGNAL(user1Clicked()), |
53 | SLOT(showIncidence())); | 53 | SLOT(showIncidence())); |
54 | mIncidence = 0; | 54 | mIncidence = 0; |
55 | // TODO: Set a sensible size (based on the content?). | 55 | // TODO: Set a sensible size (based on the content?). |
56 | //showMaximized(); | 56 | //showMaximized(); |
57 | //qDebug("++++++++++++KOEventViewerDialog() "); | 57 | //qDebug("++++++++++++KOEventViewerDialog() "); |
58 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 58 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
59 | // setFixedSize( 240,284 ); | 59 | // setFixedSize( 240,284 ); |
60 | // move( 0, 15 ); | 60 | // move( 0, 15 ); |
61 | // } else { | 61 | // } else { |
62 | // setMinimumSize(300,200); | 62 | // setMinimumSize(300,200); |
63 | // resize(320,300); | 63 | // resize(320,300); |
64 | // } | 64 | // } |
65 | mSyncMode = false; | 65 | mSyncMode = false; |
66 | mSyncResult = 0; | 66 | mSyncResult = 0; |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | KOEventViewerDialog::~KOEventViewerDialog() | 70 | KOEventViewerDialog::~KOEventViewerDialog() |
71 | { | 71 | { |
72 | //qDebug("-------~KOEventViewerDialog() "); | 72 | //qDebug("-------~KOEventViewerDialog() "); |
73 | } | 73 | } |
74 | void KOEventViewerDialog::showMe() | 74 | void KOEventViewerDialog::showMe() |
75 | { | 75 | { |
76 | 76 | ||
77 | #ifdef DESKTOP_VERSION | 77 | #ifdef DESKTOP_VERSION |
78 | int x,y,w,h; | 78 | int x,y,w,h; |
79 | x = geometry().x(); | 79 | x = geometry().x(); |
80 | y = geometry().y(); | 80 | y = geometry().y(); |
81 | w = width(); | 81 | w = width(); |
82 | h = height(); | 82 | h = height(); |
83 | show(); | 83 | show(); |
84 | setGeometry(x,y,w,h); | 84 | setGeometry(x,y,w,h); |
85 | #else | 85 | #else |
86 | showMaximized(); | 86 | showMaximized(); |
87 | #endif | 87 | #endif |
88 | raise(); | 88 | raise(); |
89 | setActiveWindow(); | 89 | setActiveWindow(); |
90 | mEventViewer->setFocus(); | 90 | mEventViewer->setFocus(); |
91 | //raise(); | 91 | //raise(); |
92 | 92 | ||
93 | } | 93 | } |
94 | void KOEventViewerDialog::print() | 94 | void KOEventViewerDialog::print() |
95 | { | 95 | { |
96 | qDebug("PRINT "); | ||
97 | int km = KMessageBox::warningContinueCancel(this,mIncidence->summary().left(35) + | ||
98 | i18n("\n\nDo you really want to print this item?"), | ||
99 | i18n("KO/Pi Print Confirmation"),i18n("Print")); | ||
100 | if ( km != KMessageBox::Continue ) { | ||
101 | qDebug("cancel "); | ||
102 | return; | ||
103 | } | ||
104 | mEventViewer->printMe(); | 96 | mEventViewer->printMe(); |
105 | 97 | ||
106 | } | 98 | } |
107 | void KOEventViewerDialog::setSyncMode( bool b ) | 99 | void KOEventViewerDialog::setSyncMode( bool b ) |
108 | { | 100 | { |
109 | mSyncMode = b; | 101 | mSyncMode = b; |
110 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 102 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
111 | if ( mSyncMode ) { | 103 | if ( mSyncMode ) { |
112 | findButton( Close )->setText( i18n("Cancel Sync")); | 104 | findButton( Close )->setText( i18n("Cancel Sync")); |
113 | findButton( Ok )->setText( i18n("Remote")); | 105 | findButton( Ok )->setText( i18n("Remote")); |
114 | findButton( User1 )->setText( i18n("Local")); | 106 | findButton( User1 )->setText( i18n("Local")); |
115 | } else { | 107 | } else { |
116 | findButton( Close )->setText( i18n("Close")); | 108 | findButton( Close )->setText( i18n("Close")); |
117 | findButton( Ok )->setText( i18n("Edit")); | 109 | findButton( Ok )->setText( i18n("Edit")); |
118 | findButton( User1 )->setText( i18n("Agenda")); | 110 | findButton( User1 )->setText( i18n("Agenda")); |
119 | } | 111 | } |
120 | mEventViewer->setSyncMode( b ); | 112 | mEventViewer->setSyncMode( b ); |
121 | } | 113 | } |
122 | void KOEventViewerDialog::setColorMode( int m ) | 114 | void KOEventViewerDialog::setColorMode( int m ) |
123 | { | 115 | { |
124 | mEventViewer->setColorMode( m ); | 116 | mEventViewer->setColorMode( m ); |
125 | } | 117 | } |
126 | int KOEventViewerDialog::executeS( bool local ) | 118 | int KOEventViewerDialog::executeS( bool local ) |
127 | { | 119 | { |
128 | mSyncResult = 3; | 120 | mSyncResult = 3; |
129 | if ( local ) | 121 | if ( local ) |
130 | findButton( User1 )->setFocus(); | 122 | findButton( User1 )->setFocus(); |
131 | else | 123 | else |
132 | findButton( Ok )->setFocus(); | 124 | findButton( Ok )->setFocus(); |
133 | exec(); | 125 | exec(); |
134 | return mSyncResult; | 126 | return mSyncResult; |
135 | } | 127 | } |
136 | 128 | ||
137 | void KOEventViewerDialog::updateConfig() | 129 | void KOEventViewerDialog::updateConfig() |
138 | { | 130 | { |
139 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 131 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
140 | 132 | ||
141 | } | 133 | } |
142 | void KOEventViewerDialog::setEvent(Event *event) | 134 | void KOEventViewerDialog::setEvent(Event *event) |
143 | { | 135 | { |
144 | mEventViewer->setEvent(event); | 136 | mEventViewer->setEvent(event); |
145 | mIncidence = event; | 137 | mIncidence = event; |
146 | mEventViewer->setFocus(); | 138 | mEventViewer->setFocus(); |
147 | //findButton( Close )->setFocus(); | 139 | //findButton( Close )->setFocus(); |
148 | if ( !mSyncMode ) { | 140 | if ( !mSyncMode ) { |
149 | findButton( User1 )->setText( i18n("Agenda")); | 141 | findButton( User1 )->setText( i18n("Agenda")); |
150 | } | 142 | } |
151 | } | 143 | } |
152 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 144 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
153 | { | 145 | { |
154 | if ( in->type() == "Event" ) | 146 | if ( in->type() == "Event" ) |
155 | setEvent( (Event*) in ); | 147 | setEvent( (Event*) in ); |
156 | else if ( in->type() =="Todo" ) | 148 | else if ( in->type() =="Todo" ) |
157 | setTodo( (Todo*) in ); | 149 | setTodo( (Todo*) in ); |
158 | else if ( in->type() =="Journal" ) | 150 | else if ( in->type() =="Journal" ) |
159 | setJournal( (Journal*) in ); | 151 | setJournal( (Journal*) in ); |
160 | } | 152 | } |
161 | void KOEventViewerDialog::addIncidence(Incidence *in) | 153 | void KOEventViewerDialog::addIncidence(Incidence *in) |
162 | { | 154 | { |
163 | if ( in->type() == "Event" ) | 155 | if ( in->type() == "Event" ) |
164 | addEvent( (Event*) in ); | 156 | addEvent( (Event*) in ); |
165 | else if ( in->type() =="Todo" ) | 157 | else if ( in->type() =="Todo" ) |
166 | mEventViewer->setTodo( (Todo*) in, false ); | 158 | mEventViewer->setTodo( (Todo*) in, false ); |
167 | else if ( in->type() =="Journal" ) | 159 | else if ( in->type() =="Journal" ) |
168 | mEventViewer->setJournal( (Journal*) in, false ); | 160 | mEventViewer->setJournal( (Journal*) in, false ); |
169 | if ( mSyncMode ) { | 161 | if ( mSyncMode ) { |
170 | findButton( User1 )->setFocus(); | 162 | findButton( User1 )->setFocus(); |
171 | setCaption(i18n("Conflict! Please choose entry")); | 163 | setCaption(i18n("Conflict! Please choose entry")); |
172 | } | 164 | } |
173 | } | 165 | } |
174 | 166 | ||
175 | void KOEventViewerDialog::addEvent(Event *event) | 167 | void KOEventViewerDialog::addEvent(Event *event) |
176 | { | 168 | { |
177 | mEventViewer->addEvent(event); | 169 | mEventViewer->addEvent(event); |
178 | mIncidence = event; | 170 | mIncidence = event; |
179 | mEventViewer->setFocus(); | 171 | mEventViewer->setFocus(); |
180 | //findButton( Close )->setFocus(); | 172 | //findButton( Close )->setFocus(); |
181 | if ( !mSyncMode ) { | 173 | if ( !mSyncMode ) { |
182 | findButton( User1 )->setText( i18n("Agenda")); | 174 | findButton( User1 )->setText( i18n("Agenda")); |
183 | } | 175 | } |
184 | } | 176 | } |
185 | 177 | ||
186 | void KOEventViewerDialog::setTodo(Todo *event) | 178 | void KOEventViewerDialog::setTodo(Todo *event) |
187 | { | 179 | { |
188 | mEventViewer->setTodo(event); | 180 | mEventViewer->setTodo(event); |
189 | mIncidence = (Incidence*)event; | 181 | mIncidence = (Incidence*)event; |
190 | mEventViewer->setFocus(); | 182 | mEventViewer->setFocus(); |
191 | //findButton( Close )->setFocus(); | 183 | //findButton( Close )->setFocus(); |
192 | if ( !mSyncMode ) { | 184 | if ( !mSyncMode ) { |
193 | findButton( User1 )->setText( i18n("Set complete")); | 185 | findButton( User1 )->setText( i18n("Set complete")); |
194 | } | 186 | } |
195 | } | 187 | } |
196 | void KOEventViewerDialog::setJournal(Journal *j) | 188 | void KOEventViewerDialog::setJournal(Journal *j) |
197 | { | 189 | { |
198 | mEventViewer->setJournal(j); | 190 | mEventViewer->setJournal(j); |
199 | mIncidence = (Incidence*)j; | 191 | mIncidence = (Incidence*)j; |
200 | mEventViewer->setFocus(); | 192 | mEventViewer->setFocus(); |
201 | //findButton( Close )->setFocus(); | 193 | //findButton( Close )->setFocus(); |
202 | if ( !mSyncMode ) { | 194 | if ( !mSyncMode ) { |
203 | findButton( User1 )->setText( i18n("Agenda")); | 195 | findButton( User1 )->setText( i18n("Agenda")); |
204 | } | 196 | } |
205 | } | 197 | } |
206 | 198 | ||
207 | void KOEventViewerDialog::addText(QString text) | 199 | void KOEventViewerDialog::addText(QString text) |
208 | { | 200 | { |
209 | mEventViewer->addText(text); | 201 | mEventViewer->addText(text); |
210 | mEventViewer->setFocus(); | 202 | mEventViewer->setFocus(); |
211 | //findButton( Close )->setFocus(); | 203 | //findButton( Close )->setFocus(); |
212 | } | 204 | } |
213 | void KOEventViewerDialog::editIncidence() | 205 | void KOEventViewerDialog::editIncidence() |
214 | { | 206 | { |
215 | sendSignalViewerClosed = false; | 207 | sendSignalViewerClosed = false; |
216 | if ( mSyncMode ) { | 208 | if ( mSyncMode ) { |
217 | mSyncResult = 2; | 209 | mSyncResult = 2; |
218 | accept(); | 210 | accept(); |
219 | return; | 211 | return; |
220 | } | 212 | } |
221 | if ( mIncidence ){ | 213 | if ( mIncidence ){ |
222 | #ifndef DESKTOP_VERSION | 214 | #ifndef DESKTOP_VERSION |
223 | hide(); | 215 | hide(); |
224 | #endif | 216 | #endif |
225 | emit editIncidence( mIncidence ); | 217 | emit editIncidence( mIncidence ); |
226 | } | 218 | } |
227 | } | 219 | } |
228 | void KOEventViewerDialog::showIncidence() | 220 | void KOEventViewerDialog::showIncidence() |
229 | { | 221 | { |
230 | sendSignalViewerClosed = false; | 222 | sendSignalViewerClosed = false; |
231 | if ( mSyncMode ) { | 223 | if ( mSyncMode ) { |
232 | mSyncResult = 1; | 224 | mSyncResult = 1; |
233 | accept(); | 225 | accept(); |
234 | return; | 226 | return; |
235 | } | 227 | } |
236 | 228 | ||
237 | if ( mIncidence ){ | 229 | if ( mIncidence ){ |
238 | #ifndef DESKTOP_VERSION | 230 | #ifndef DESKTOP_VERSION |
239 | hide(); | 231 | hide(); |
240 | #endif | 232 | #endif |
241 | QDate date; | 233 | QDate date; |
242 | if ( mIncidence->type() == "Todo" ) { | 234 | if ( mIncidence->type() == "Todo" ) { |
243 | /* | 235 | /* |
244 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 236 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
245 | date = ((Todo*)mIncidence)->dtDue().date(); | 237 | date = ((Todo*)mIncidence)->dtDue().date(); |
246 | else { | 238 | else { |
247 | globalFlagBlockAgenda = 2; | 239 | globalFlagBlockAgenda = 2; |
248 | emit showAgendaView( false ); | 240 | emit showAgendaView( false ); |
249 | return; | 241 | return; |
250 | } | 242 | } |
251 | */ | 243 | */ |
252 | ((Todo*)mIncidence)->setCompleted( true ); | 244 | ((Todo*)mIncidence)->setCompleted( true ); |
253 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 245 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
254 | hide(); | 246 | hide(); |
255 | emit todoCompleted(((Todo*)mIncidence)); | 247 | emit todoCompleted(((Todo*)mIncidence)); |
256 | return; | 248 | return; |
257 | 249 | ||
258 | } else | 250 | } else |
259 | date = mIncidence->dtStart().date(); | 251 | date = mIncidence->dtStart().date(); |
260 | globalFlagBlockAgenda = 1; | 252 | globalFlagBlockAgenda = 1; |
261 | emit showAgendaView( false ); | 253 | emit showAgendaView( false ); |
262 | globalFlagBlockAgenda = 2; | 254 | globalFlagBlockAgenda = 2; |
263 | emit jumpToTime( date ); | 255 | emit jumpToTime( date ); |
264 | } | 256 | } |
265 | } | 257 | } |
266 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 258 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
267 | { | 259 | { |
268 | switch ( e->key() ) { | 260 | switch ( e->key() ) { |
269 | 261 | ||
270 | case Qt::Key_A : | 262 | case Qt::Key_A : |
271 | case Qt::Key_L : | 263 | case Qt::Key_L : |
272 | showIncidence(); | 264 | showIncidence(); |
273 | break; | 265 | break; |
274 | case Qt::Key_E : | 266 | case Qt::Key_E : |
275 | case Qt::Key_R : | 267 | case Qt::Key_R : |
276 | editIncidence(); | 268 | editIncidence(); |
277 | break; | 269 | break; |
278 | case Qt::Key_C: | 270 | case Qt::Key_C: |
279 | case Qt::Key_Escape: | 271 | case Qt::Key_Escape: |
280 | sendSignalViewerClosed = true; | 272 | sendSignalViewerClosed = true; |
281 | close(); | 273 | close(); |
282 | break; | 274 | break; |
283 | case Qt::Key_I: | 275 | case Qt::Key_I: |
284 | #ifndef DESKTOP_VERSION | 276 | #ifndef DESKTOP_VERSION |
285 | sendSignalViewerClosed = true; | 277 | sendSignalViewerClosed = true; |
286 | close(); | 278 | close(); |
287 | #else | 279 | #else |
288 | sendSignalViewerClosed = true; | 280 | sendSignalViewerClosed = true; |
289 | slotViewerClosed(); | 281 | slotViewerClosed(); |
290 | //accept(); | 282 | //accept(); |
291 | #endif | 283 | #endif |
292 | break; | 284 | break; |
293 | default: | 285 | default: |
294 | KDialogBase::keyPressEvent ( e ); | 286 | KDialogBase::keyPressEvent ( e ); |
295 | break; | 287 | break; |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 66ff75d..53fe7d0 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,273 +1,283 @@ | |||
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 <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #ifdef DESKTOP_VERSION | 27 | #ifdef DESKTOP_VERSION |
28 | #include <qpaintdevicemetrics.h> | 28 | #include <qpaintdevicemetrics.h> |
29 | #endif | 29 | #endif |
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | 37 | ||
38 | #ifndef KORG_NOPRINTER | 38 | #ifndef KORG_NOPRINTER |
39 | #include "calprinter.h" | 39 | #include "calprinter.h" |
40 | #endif | 40 | #endif |
41 | #include "koglobals.h" | 41 | #include "koglobals.h" |
42 | #include "koprefs.h" | 42 | #include "koprefs.h" |
43 | #include "koeventviewerdialog.h" | 43 | #include "koeventviewerdialog.h" |
44 | #include "koeventviewer.h" | ||
44 | #include <qstylesheet.h> | 45 | #include <qstylesheet.h> |
45 | #include "kowhatsnextview.h" | 46 | #include "kowhatsnextview.h" |
46 | using namespace KOrg; | 47 | using namespace KOrg; |
47 | 48 | ||
48 | void WhatsNextTextBrowser::setSource(const QString& n) | 49 | void WhatsNextTextBrowser::setSource(const QString& n) |
49 | { | 50 | { |
50 | 51 | ||
51 | if (n.startsWith("event:")) { | 52 | if (n.startsWith("event:")) { |
52 | emit showIncidence(n); | 53 | emit showIncidence(n); |
53 | return; | 54 | return; |
54 | } else if (n.startsWith("todo:")) { | 55 | } else if (n.startsWith("todo:")) { |
55 | emit showIncidence(n); | 56 | emit showIncidence(n); |
56 | return; | 57 | return; |
57 | } else { | 58 | } else { |
58 | QTextBrowser::setSource(n); | 59 | QTextBrowser::setSource(n); |
59 | } | 60 | } |
60 | } | 61 | } |
61 | void WhatsNextTextBrowser::printMe() | 62 | void WhatsNextTextBrowser::printMe() |
62 | { | 63 | { |
63 | #ifdef DESKTOP_VERSION | 64 | #ifdef DESKTOP_VERSION |
65 | KOPrintPrefs pp ( this ); | ||
66 | if (!pp.exec() ) | ||
67 | return; | ||
68 | int scaleval = pp.printMode() ; | ||
69 | |||
64 | QPrinter printer; | 70 | QPrinter printer; |
65 | if (!printer.setup() ) | 71 | if (!printer.setup() ) |
66 | return; | 72 | return; |
67 | QPainter p; | 73 | QPainter p; |
68 | p.begin ( &printer ); | 74 | p.begin ( &printer ); |
69 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 75 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
70 | float dx, dy; | 76 | float dx, dy; |
71 | int wid = (m.width() * 9)/10; | 77 | int wid = (m.width() * 9)/10; |
72 | dx = (float) wid/(float)contentsWidth (); | 78 | dx = (float) wid/(float)contentsWidth (); |
73 | dy = (float)(m.height()) / (float)contentsHeight (); | 79 | dy = (float)(m.height()) / (float)contentsHeight (); |
74 | float scale; | 80 | float scale; |
75 | // scale to fit the width or height of the paper | 81 | // scale to fit the width or height of the paper |
76 | if ( dx < dy ) | 82 | if ( dx < dy ) |
77 | scale = dx; | 83 | scale = dx; |
78 | else | 84 | else |
79 | scale = dy; | 85 | scale = dy; |
80 | p.translate( m.width()/10,0 ); | 86 | p.translate( m.width()/10,0 ); |
81 | p.scale( scale, scale ); | 87 | qDebug("Scale: %f ", scale ); |
88 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | ||
89 | qDebug("SCALE "); | ||
90 | p.scale( scale, scale ); | ||
91 | } | ||
82 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 92 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
83 | p.end(); | 93 | p.end(); |
84 | #endif | 94 | #endif |
85 | } | 95 | } |
86 | 96 | ||
87 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 97 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
88 | const char *name) | 98 | const char *name) |
89 | : KOrg::BaseView(calendar, parent, name) | 99 | : KOrg::BaseView(calendar, parent, name) |
90 | { | 100 | { |
91 | // mDateLabel = | 101 | // mDateLabel = |
92 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 102 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
93 | // mDateLabel->setMargin(2); | 103 | // mDateLabel->setMargin(2); |
94 | // mDateLabel->setAlignment(AlignCenter); | 104 | // mDateLabel->setAlignment(AlignCenter); |
95 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 105 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
96 | mView = new WhatsNextTextBrowser(this); | 106 | mView = new WhatsNextTextBrowser(this); |
97 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 107 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
98 | QStyleSheet* stsh = mView->styleSheet(); | 108 | QStyleSheet* stsh = mView->styleSheet(); |
99 | QStyleSheetItem * style ; | 109 | QStyleSheetItem * style ; |
100 | style = stsh->item ("h2" ); | 110 | style = stsh->item ("h2" ); |
101 | if ( style ) { | 111 | if ( style ) { |
102 | style->setMargin(QStyleSheetItem::MarginAll,0); | 112 | style->setMargin(QStyleSheetItem::MarginAll,0); |
103 | } | 113 | } |
104 | style = stsh->item ("h3" ); | 114 | style = stsh->item ("h3" ); |
105 | if ( style ) { | 115 | if ( style ) { |
106 | style->setMargin(QStyleSheetItem::MarginAll,0); | 116 | style->setMargin(QStyleSheetItem::MarginAll,0); |
107 | } | 117 | } |
108 | mEventViewer = 0; | 118 | mEventViewer = 0; |
109 | 119 | ||
110 | QBoxLayout *topLayout = new QVBoxLayout(this); | 120 | QBoxLayout *topLayout = new QVBoxLayout(this); |
111 | // topLayout->addWidget(mDateLabel); | 121 | // topLayout->addWidget(mDateLabel); |
112 | topLayout->addWidget(mView); | 122 | topLayout->addWidget(mView); |
113 | mTimer = new QTimer( this ); | 123 | mTimer = new QTimer( this ); |
114 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 124 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
115 | 125 | ||
116 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 126 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
117 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 127 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
118 | } | 128 | } |
119 | 129 | ||
120 | KOWhatsNextView::~KOWhatsNextView() | 130 | KOWhatsNextView::~KOWhatsNextView() |
121 | { | 131 | { |
122 | } | 132 | } |
123 | 133 | ||
124 | int KOWhatsNextView::maxDatesHint() | 134 | int KOWhatsNextView::maxDatesHint() |
125 | { | 135 | { |
126 | return 0; | 136 | return 0; |
127 | } | 137 | } |
128 | 138 | ||
129 | int KOWhatsNextView::currentDateCount() | 139 | int KOWhatsNextView::currentDateCount() |
130 | { | 140 | { |
131 | return 0; | 141 | return 0; |
132 | } | 142 | } |
133 | 143 | ||
134 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 144 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
135 | { | 145 | { |
136 | QPtrList<Incidence> eventList; | 146 | QPtrList<Incidence> eventList; |
137 | 147 | ||
138 | return eventList; | 148 | return eventList; |
139 | } | 149 | } |
140 | 150 | ||
141 | void KOWhatsNextView::printMe() | 151 | void KOWhatsNextView::printMe() |
142 | { | 152 | { |
143 | #ifdef DESKTOP_VERSION | 153 | #ifdef DESKTOP_VERSION |
144 | mView->printMe(); | 154 | mView->printMe(); |
145 | #endif | 155 | #endif |
146 | } | 156 | } |
147 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 157 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
148 | const QDate &td) | 158 | const QDate &td) |
149 | { | 159 | { |
150 | #ifndef KORG_NOPRINTER | 160 | #ifndef KORG_NOPRINTER |
151 | calPrinter->preview(CalPrinter::Day, fd, td); | 161 | calPrinter->preview(CalPrinter::Day, fd, td); |
152 | #endif | 162 | #endif |
153 | } | 163 | } |
154 | void KOWhatsNextView::updateConfig() | 164 | void KOWhatsNextView::updateConfig() |
155 | { | 165 | { |
156 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 166 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
157 | updateView(); | 167 | updateView(); |
158 | 168 | ||
159 | } | 169 | } |
160 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 170 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
161 | { | 171 | { |
162 | //qDebug("KOWhatsNextView::showEvent "); | 172 | //qDebug("KOWhatsNextView::showEvent "); |
163 | restartTimer(); | 173 | restartTimer(); |
164 | QWidget::showEvent ( e ); | 174 | QWidget::showEvent ( e ); |
165 | } | 175 | } |
166 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 176 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
167 | { | 177 | { |
168 | //qDebug(" KOWhatsNextView::hideEvent"); | 178 | //qDebug(" KOWhatsNextView::hideEvent"); |
169 | mTimer->stop(); | 179 | mTimer->stop(); |
170 | QWidget::hideEvent ( e ); | 180 | QWidget::hideEvent ( e ); |
171 | } | 181 | } |
172 | void KOWhatsNextView::restartTimer() | 182 | void KOWhatsNextView::restartTimer() |
173 | { | 183 | { |
174 | //qDebug("KOWhatsNextView::restartTimer() "); | 184 | //qDebug("KOWhatsNextView::restartTimer() "); |
175 | mTimer->start( 300000 ); | 185 | mTimer->start( 300000 ); |
176 | //mTimer->start( 5000 ); | 186 | //mTimer->start( 5000 ); |
177 | } | 187 | } |
178 | void KOWhatsNextView::updateView() | 188 | void KOWhatsNextView::updateView() |
179 | { | 189 | { |
180 | //qDebug("KOWhatsNextView::updateView() "); | 190 | //qDebug("KOWhatsNextView::updateView() "); |
181 | if ( mTimer->isActive() ) | 191 | if ( mTimer->isActive() ) |
182 | restartTimer(); | 192 | restartTimer(); |
183 | //qDebug("KOWhatsNextView::updateView() "); | 193 | //qDebug("KOWhatsNextView::updateView() "); |
184 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 194 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
185 | KIconLoader kil("korganizer"); | 195 | KIconLoader kil("korganizer"); |
186 | QString ipath;// = new QString(); | 196 | QString ipath;// = new QString(); |
187 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 197 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
188 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 198 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
189 | mText = "<table width=\"100%\">\n"; | 199 | mText = "<table width=\"100%\">\n"; |
190 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 200 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
191 | #ifdef DESKTOP_VERSION | 201 | #ifdef DESKTOP_VERSION |
192 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 202 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
193 | #else | 203 | #else |
194 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 204 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
195 | #endif | 205 | #endif |
196 | // mText += "<img src=\""; | 206 | // mText += "<img src=\""; |
197 | // mText += ipath; | 207 | // mText += ipath; |
198 | // mText += "\">"; | 208 | // mText += "\">"; |
199 | mEventDate = QDate::currentDate(); | 209 | mEventDate = QDate::currentDate(); |
200 | #ifdef DESKTOP_VERSION | 210 | #ifdef DESKTOP_VERSION |
201 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 211 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
202 | #else | 212 | #else |
203 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 213 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
204 | #endif | 214 | #endif |
205 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 215 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
206 | int iii; | 216 | int iii; |
207 | mTodos.clear(); | 217 | mTodos.clear(); |
208 | QPtrList<Event> events; | 218 | QPtrList<Event> events; |
209 | QPtrList<Todo> todos = calendar()->todos(); | 219 | QPtrList<Todo> todos = calendar()->todos(); |
210 | Todo * todo; | 220 | Todo * todo; |
211 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 221 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
212 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 222 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
213 | bool itemAdded = false; | 223 | bool itemAdded = false; |
214 | for ( iii = 0; iii < daysToShow; ++iii ) { | 224 | for ( iii = 0; iii < daysToShow; ++iii ) { |
215 | QString date; | 225 | QString date; |
216 | itemAdded = false; | 226 | itemAdded = false; |
217 | events = calendar()->events( mEventDate, true ); | 227 | events = calendar()->events( mEventDate, true ); |
218 | 228 | ||
219 | if ( iii == 0 ) { // today !!! | 229 | if ( iii == 0 ) { // today !!! |
220 | todo = todos.first(); | 230 | todo = todos.first(); |
221 | while(todo) { | 231 | while(todo) { |
222 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 232 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
223 | if ( ! itemAdded ) { | 233 | if ( ! itemAdded ) { |
224 | appendDay ( iii, mEventDate ); | 234 | appendDay ( iii, mEventDate ); |
225 | //itemAdded = true; | 235 | //itemAdded = true; |
226 | 236 | ||
227 | } //bool reply=false, bool notRed = true, bool appendTable = false); | 237 | } //bool reply=false, bool notRed = true, bool appendTable = false); |
228 | appendEvent(todo, false, false, !itemAdded ); | 238 | appendEvent(todo, false, false, !itemAdded ); |
229 | itemAdded = true; | 239 | itemAdded = true; |
230 | } | 240 | } |
231 | todo = todos.next(); | 241 | todo = todos.next(); |
232 | } | 242 | } |
233 | } | 243 | } |
234 | 244 | ||
235 | 245 | ||
236 | if (events.count() > 0) { | 246 | if (events.count() > 0) { |
237 | // mText += "<p></p>"; | 247 | // mText += "<p></p>"; |
238 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 248 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
239 | // mText += "<h2>"; | 249 | // mText += "<h2>"; |
240 | //mText += " <img src=\""; | 250 | //mText += " <img src=\""; |
241 | //mText += ipath; | 251 | //mText += ipath; |
242 | //mText += "\">"; | 252 | //mText += "\">"; |
243 | if ( ! itemAdded ) { | 253 | if ( ! itemAdded ) { |
244 | appendDay ( iii, mEventDate ); | 254 | appendDay ( iii, mEventDate ); |
245 | 255 | ||
246 | } | 256 | } |
247 | // for first day (iii == 0) | 257 | // for first day (iii == 0) |
248 | // we may have syncevents, or events in the past, which maybe should not be diaplayed | 258 | // we may have syncevents, or events in the past, which maybe should not be diaplayed |
249 | // for that reason we cannot append <table> in appendDay () for iii == 0 | 259 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
250 | // we must append it in the first successful call of appendEvent() | 260 | // we must append it in the first successful call of appendEvent() |
251 | Event *ev = events.first(); | 261 | Event *ev = events.first(); |
252 | while(ev) { | 262 | while(ev) { |
253 | //qDebug("+++++event append %s", ev->summary().latin1()); | 263 | //qDebug("+++++event append %s", ev->summary().latin1()); |
254 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 264 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
255 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 265 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
256 | itemAdded = true; | 266 | itemAdded = true; |
257 | } | 267 | } |
258 | ev = events.next(); | 268 | ev = events.next(); |
259 | } | 269 | } |
260 | 270 | ||
261 | //mText += "</table>\n"; | 271 | //mText += "</table>\n"; |
262 | } | 272 | } |
263 | 273 | ||
264 | todo = todos.first(); | 274 | todo = todos.first(); |
265 | while(todo) { | 275 | while(todo) { |
266 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 276 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
267 | if ( ! itemAdded ) { | 277 | if ( ! itemAdded ) { |
268 | appendDay ( iii, mEventDate ); | 278 | appendDay ( iii, mEventDate ); |
269 | //itemAdded = true; | 279 | //itemAdded = true; |
270 | } | 280 | } |
271 | appendEvent(todo, false , iii!= 0,!itemAdded); | 281 | appendEvent(todo, false , iii!= 0,!itemAdded); |
272 | itemAdded = true; | 282 | itemAdded = true; |
273 | } | 283 | } |