summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-03 14:15:13 (UTC)
committer zautrix <zautrix>2005-07-03 14:15:13 (UTC)
commit3be76edf08827e1e00206399469904fe69887854 (patch) (unidiff)
tree02e2d16a6f133afcd3c54be1f4fe9f2bd424b177 /korganizer
parent971bfd3cf502fbbafc96bef70e21beb545e450b5 (diff)
downloadkdepimpi-3be76edf08827e1e00206399469904fe69887854.zip
kdepimpi-3be76edf08827e1e00206399469904fe69887854.tar.gz
kdepimpi-3be76edf08827e1e00206399469904fe69887854.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/mainwindow.cpp42
2 files changed, 14 insertions, 30 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index d3b2ccf..f6c252b 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,809 +1,809 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
39 39
40#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
41#include <dcopclient.h> 41#include <dcopclient.h>
42#include "korganizer.h" 42#include "korganizer.h"
43#include "koprefs.h" 43#include "koprefs.h"
44#include "actionmanager.h" 44#include "actionmanager.h"
45#endif 45#endif
46 46
47#include "koeventviewer.h" 47#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
50//#define size count 50//#define size count
51//#endif 51//#endif
52 52
53#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 55#include <kabc/addresseeview.h>
56#include <qprinter.h> 56#include <qprinter.h>
57#include <qpainter.h> 57#include <qpainter.h>
58#include <qpaintdevicemetrics.h> 58#include <qpaintdevicemetrics.h>
59#else //DESKTOP_VERSION 59#else //DESKTOP_VERSION
60#include <externalapphandler.h> 60#include <externalapphandler.h>
61#include <qtopia/qcopenvelope_qws.h> 61#include <qtopia/qcopenvelope_qws.h>
62#endif //DESKTOP_VERSION 62#endif //DESKTOP_VERSION
63 63
64KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 64KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
65 : QTextBrowser(parent,name) 65 : QTextBrowser(parent,name)
66{ 66{
67 mSyncMode = false; 67 mSyncMode = false;
68 mColorMode = 0; 68 mColorMode = 0;
69} 69}
70 70
71KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
72{ 72{
73} 73}
74 74
75void KOEventViewer::printMe() 75void KOEventViewer::printMe()
76{ 76{
77#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
78 78
79 KOPrintPrefs pp ( this ); 79 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 80 if (!pp.exec() )
81 return; 81 return;
82 int scaleval = pp.printMode() ; 82 int scaleval = pp.printMode() ;
83 83
84 QPrinter printer; 84 QPrinter printer;
85 if (!printer.setup() ) 85 if (!printer.setup() )
86 return; 86 return;
87 QPainter p; 87 QPainter p;
88 p.begin ( &printer ); 88 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
90 float dx, dy; 90 float dx, dy;
91 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 94 float scale;
95 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
96 if ( dx < dy ) 96 if ( dx < dy )
97 scale = dx; 97 scale = dx;
98 else 98 else
99 scale = dy; 99 scale = dy;
100 100
101 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
103 p.scale( scale, scale ); 103 p.scale( scale, scale );
104 } 104 }
105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
106 p.end(); 106 p.end();
107#endif 107#endif
108 108
109} 109}
110void KOEventViewer::setSource(const QString& n) 110void KOEventViewer::setSource(const QString& n)
111{ 111{
112 112
113 if ( n.left(3) == "uid" ) 113 if ( n.left(3) == "uid" )
114#ifdef DESKTOP_VERSION 114#ifdef DESKTOP_VERSION
115 { 115 {
116 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 116 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
117 KABC::AddressBook::Iterator it; 117 KABC::AddressBook::Iterator it;
118 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 118 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
119 // LR I do not understand, why the uid string is different on zaurus and desktop 119 // LR I do not understand, why the uid string is different on zaurus and desktop
120 QString uid = "uid://"+(*it).uid(); 120 QString uid = "uid://"+(*it).uid();
121 121
122 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 122 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
123 if (n == uid ) { 123 if (n == uid ) {
124 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 124 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
125 QDialog dia( this,"dia123", true ); 125 QDialog dia( this,"dia123", true );
126 dia.setCaption( i18n("Details of attendee") ); 126 dia.setCaption( i18n("Details of attendee") );
127 QVBoxLayout lay ( &dia ); 127 QVBoxLayout lay ( &dia );
128 KABC::AddresseeView av ( &dia ); 128 KABC::AddresseeView av ( &dia );
129 av.setAddressee( (*it) ); 129 av.setAddressee( (*it) );
130 lay.addWidget( &av ); 130 lay.addWidget( &av );
131 if ( QApplication::desktop()->width() < 480 ) 131 if ( QApplication::desktop()->width() < 480 )
132 dia.resize( 220, 240); 132 dia.resize( 220, 240);
133 else { 133 else {
134 dia.resize( 400,400); 134 dia.resize( 400,400);
135 } 135 }
136 dia.exec(); 136 dia.exec();
137 break; 137 break;
138 } 138 }
139 } 139 }
140 return; 140 return;
141 } 141 }
142#else 142#else
143 { 143 {
144 if ( "uid:organizer" == n ) { 144 if ( "uid:organizer" == n ) {
145 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 145 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
146 return; 146 return;
147 } 147 }
148 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 148 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
149 if (attendees.count()) { 149 if (attendees.count()) {
150 Attendee *a; 150 Attendee *a;
151 for(a=attendees.first();a;a=attendees.next()) { 151 for(a=attendees.first();a;a=attendees.next()) {
152 if ( "uid:"+a->uid() == n ) { 152 if ( "uid:"+a->uid() == n ) {
153 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 153 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
154 return; 154 return;
155 } 155 }
156 } 156 }
157 } 157 }
158 return; 158 return;
159 } 159 }
160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
161 // the result should now arrive through method insertAttendees 161 // the result should now arrive through method insertAttendees
162 //QString uid = "uid:"+(*it).uid(); 162 //QString uid = "uid:"+(*it).uid();
163#endif 163#endif
164 if ( n.left(6) == "mailto" ) { 164 if ( n.left(6) == "mailto" ) {
165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 if ( n.mid(7,3) == "ALL" ) { 167 if ( n.mid(7,3) == "ALL" ) {
168 mailToAttendees( true ); 168 mailToAttendees( true );
169 } else if ( n.mid(7,4) == "RSVP" ) { 169 } else if ( n.mid(7,4) == "RSVP" ) {
170 mailToAttendees( false ); 170 mailToAttendees( false );
171 } else { 171 } else {
172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
173 e << n.mid(7); 173 e << n.mid(7);
174 } 174 }
175#endif 175#endif
176 176
177 } 177 }
178 178
179 179
180#ifndef KORG_NODCOP 180#ifndef KORG_NODCOP
181 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 181 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
182 QString tmpStr; 182 QString tmpStr;
183 if (n.startsWith("mailto:")) { 183 if (n.startsWith("mailto:")) {
184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
185 //emit showIncidence(n); 185 //emit showIncidence(n);
186 return; 186 return;
187 } else if (n.startsWith("uid:")) { 187 } else if (n.startsWith("uid:")) {
188 DCOPClient *client = KApplication::kApplication()->dcopClient(); 188 DCOPClient *client = KApplication::kApplication()->dcopClient();
189 const QByteArray noParamData; 189 const QByteArray noParamData;
190 const QByteArray paramData; 190 const QByteArray paramData;
191 QByteArray replyData; 191 QByteArray replyData;
192 QCString replyTypeStr; 192 QCString replyTypeStr;
193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
194 bool foundAbbrowser = PING_ABBROWSER; 194 bool foundAbbrowser = PING_ABBROWSER;
195 195
196 if (foundAbbrowser) { 196 if (foundAbbrowser) {
197 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 197 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
198 //client->send("kaddressbook","KAddressBookIface", 198 //client->send("kaddressbook","KAddressBookIface",
199 QDataStream arg(paramData, IO_WriteOnly); 199 QDataStream arg(paramData, IO_WriteOnly);
200 arg << n.mid(6); 200 arg << n.mid(6);
201 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 201 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
202 return; 202 return;
203 } else { 203 } else {
204 /* 204 /*
205 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 205 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
206 We start it without its main interface 206 We start it without its main interface
207 */ 207 */
208 KIconLoader* iconLoader = new KIconLoader(); 208 KIconLoader* iconLoader = new KIconLoader();
209 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 209 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
210 ActionManager::setStartedKAddressBook(true); 210 ActionManager::setStartedKAddressBook(true);
211 tmpStr = "kaddressbook --editor-only --uid "; 211 tmpStr = "kaddressbook --editor-only --uid ";
212 tmpStr += KProcess::quote(n.mid(6)); 212 tmpStr += KProcess::quote(n.mid(6));
213 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 213 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
214 return; 214 return;
215 } 215 }
216 } else { 216 } else {
217 //QTextBrowser::setSource(n); 217 //QTextBrowser::setSource(n);
218 } 218 }
219#endif 219#endif
220} 220}
221void KOEventViewer::mailToAttendees( bool all ) 221void KOEventViewer::mailToAttendees( bool all )
222{ 222{
223 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 223 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
224 if (attendees.count() == 0) return; 224 if (attendees.count() == 0) return;
225 QStringList nameList; 225 QStringList nameList;
226 QStringList emailList; 226 QStringList emailList;
227 QStringList uidList; 227 QStringList uidList;
228 Attendee* a; 228 Attendee* a;
229 for(a=attendees.first();a;a=attendees.next()) { 229 for(a=attendees.first();a;a=attendees.next()) {
230 if ( !all && !a->RSVP() ) continue; 230 if ( !all && !a->RSVP() ) continue;
231 if (!a->email().isEmpty()) { 231 if (!a->email().isEmpty()) {
232 nameList.append (a->name() ); 232 nameList.append (a->name() );
233 emailList.append (a->email() ); 233 emailList.append (a->email() );
234 uidList.append (a->uid() ); 234 uidList.append (a->uid() );
235 } 235 }
236 } 236 }
237 QString uid = "ComposeMailUIpick2"+mMailSubject; 237 QString uid = "ComposeMailUIpick2"+mMailSubject;
238#ifndef DESKTOP_VERSION 238#ifndef DESKTOP_VERSION
239 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 239 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
240#endif 240#endif
241 241
242} 242}
243void KOEventViewer::addTag(const QString & tag,const QString & text) 243void KOEventViewer::addTag(const QString & tag,const QString & text)
244{ 244{
245 int number=text.contains("\n"); 245 int number=text.contains("\n");
246 QString str = "<" + tag + ">"; 246 QString str = "<" + tag + ">";
247 QString tmpText=text; 247 QString tmpText=text;
248 QString tmpStr=str; 248 QString tmpStr=str;
249 if(number !=-1) 249 if(number !=-1)
250 { 250 {
251 if (number > 0) { 251 if (number > 0) {
252 int pos=0; 252 int pos=0;
253 QString tmp; 253 QString tmp;
254 for(int i=0;i<=number;i++) { 254 for(int i=0;i<=number;i++) {
255 pos=tmpText.find("\n"); 255 pos=tmpText.find("\n");
256 tmp=tmpText.left(pos); 256 tmp=tmpText.left(pos);
257 tmpText=tmpText.right(tmpText.length()-pos-1); 257 tmpText=tmpText.right(tmpText.length()-pos-1);
258 tmpStr+=tmp+"<br>"; 258 tmpStr+=tmp+"<br>";
259 } 259 }
260 } 260 }
261 else tmpStr += tmpText; 261 else tmpStr += tmpText;
262 tmpStr+="</" + tag + ">"; 262 tmpStr+="</" + tag + ">";
263 mText.append(tmpStr); 263 mText.append(tmpStr);
264 } 264 }
265 else 265 else
266 { 266 {
267 str += text + "</" + tag + ">"; 267 str += text + "</" + tag + ">";
268 mText.append(str); 268 mText.append(str);
269 } 269 }
270} 270}
271 271
272void KOEventViewer::setColorMode( int m ) 272void KOEventViewer::setColorMode( int m )
273{ 273{
274 mColorMode = m; 274 mColorMode = m;
275} 275}
276void KOEventViewer::appendEvent(Event *event, int mode ) 276void KOEventViewer::appendEvent(Event *event, int mode )
277{ 277{
278 mMailSubject = ""; 278 mMailSubject = "";
279 mCurrentIncidence = event; 279 mCurrentIncidence = event;
280 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 280 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
281 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 281 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
282 topLevelWidget()->setCaption(i18n("Event Viewer")); 282 topLevelWidget()->setCaption(i18n("Event Viewer"));
283 if ( mode == 0 ) { 283 if ( mode == 0 ) {
284 addTag("h2",deTag(event->summary())); 284 addTag("h2",deTag(event->summary()));
285 formatReadOnly(event); 285 formatReadOnly(event);
286 } 286 }
287 else { 287 else {
288 if ( mColorMode == 1 ) { 288 if ( mColorMode == 1 ) {
289 mText +="<font color=\"#00A000\">"; 289 mText +="<font color=\"#00A000\">";
290 } 290 }
291 if ( mColorMode == 2 ) { 291 if ( mColorMode == 2 ) {
292 mText +="<font color=\"#C00000\">"; 292 mText +="<font color=\"#C00000\">";
293 } 293 }
294 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 294 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
295 if ( mode == 1 ) { 295 if ( mode == 1 ) {
296 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 296 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
297 } else { 297 } else {
298 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 298 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
299 } 299 }
300 formatReadOnly(event); 300 formatReadOnly(event);
301 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 301 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
302 if ( mColorMode ) 302 if ( mColorMode )
303 mText += "</font>"; 303 mText += "</font>";
304 } 304 }
305 mMailSubject += i18n( "Meeting " )+ event->summary(); 305 mMailSubject += i18n( "Meeting " )+ event->summary();
306 if (event->cancelled ()) { 306 if (event->cancelled ()) {
307 mText +="<font color=\"#B00000\">"; 307 mText +="<font color=\"#B00000\">";
308 addTag("i",i18n("This event has been cancelled!")); 308 addTag("i",i18n("This event has been cancelled!"));
309 mText.append("<br>"); 309 mText.append("<br>");
310 mText += "</font>"; 310 mText += "</font>";
311 mMailSubject += i18n("(cancelled)"); 311 mMailSubject += i18n("(cancelled)");
312 } 312 }
313 313
314 if (event->doesFloat()) { 314 if (event->doesFloat()) {
315 if (event->isMultiDay()) { 315 if (event->isMultiDay()) {
316 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 316 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
317 .arg(event->dtStartDateStr(shortDate)) 317 .arg(event->dtStartDateStr(shortDate))
318 .arg(event->dtEndDateStr(shortDate))); 318 .arg(event->dtEndDateStr(shortDate)));
319 } else { 319 } else {
320 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 320 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
321 } 321 }
322 } else { 322 } else {
323 if (event->isMultiDay()) { 323 if (event->isMultiDay()) {
324 mText.append(i18n("<p><b>From:</b> %1</p> ") 324 mText.append(i18n("<p><b>From:</b> %1</p> ")
325 .arg(event->dtStartStr( shortDate))); 325 .arg(event->dtStartStr( shortDate)));
326 mText.append(i18n("<p><b>To:</b> %1</p>") 326 mText.append(i18n("<p><b>To:</b> %1</p>")
327 .arg(event->dtEndStr(shortDate))); 327 .arg(event->dtEndStr(shortDate)));
328 } else { 328 } else {
329 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 329 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
330 .arg(event->dtStartTimeStr()) 330 .arg(event->dtStartTimeStr())
331 .arg(event->dtEndTimeStr())); 331 .arg(event->dtEndTimeStr()));
332 mText.append(i18n("<p><b>On:</b> %1</p> ") 332 mText.append(i18n("<p><b>On:</b> %1</p> ")
333 .arg(event->dtStartDateStr( shortDate ))); 333 .arg(event->dtStartDateStr( shortDate )));
334 } 334 }
335 } 335 }
336 if (!event->location().isEmpty()) { 336 if (!event->location().isEmpty()) {
337 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 337 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
338 mMailSubject += i18n(" at ") + event->location(); 338 mMailSubject += i18n(" at ") + event->location();
339 } 339 }
340 if (event->recurrence()->doesRecur()) { 340 if (event->recurrence()->doesRecur()) {
341 341
342 QString recurText = event->recurrence()->recurrenceText(); 342 QString recurText = event->recurrence()->recurrenceText();
343 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 343 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
344 bool ok; 344 bool ok;
345 QDate start = QDate::currentDate(); 345 QDate start = QDate::currentDate();
346 QDateTime next; 346 QDateTime next;
347 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 347 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
348 if ( ok ) { 348 if ( ok ) {
349 if ( wideScreen ){ 349 if ( wideScreen ){
350 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 350 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
351 } else { 351 } else {
352 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 352 addTag("p",i18n("<b>Next recurrence is on:</b>") );
353 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 353 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
354 } 354 }
355 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 355 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
356 356
357 } else { 357 } else {
358 bool last; 358 bool last;
359 QDate nextd; 359 QDate nextd;
360 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 360 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
361 if ( last ) { 361 if ( last ) {
362 if ( wideScreen ){ 362 if ( wideScreen ){
363 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 363 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
364 } else{ 364 } else{
365 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 365 addTag("p",i18n("<b>Last recurrence was on:</b>") );
366 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 366 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
367 } 367 }
368 } 368 }
369 } 369 }
370 } else { 370 } else {
371 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 371 mMailSubject += i18n(" - " )+event->dtStartStr( true );
372 372
373 } 373 }
374 374
375 375
376 if (event->isAlarmEnabled()) { 376 if (event->isAlarmEnabled()) {
377 Alarm *alarm =event->alarms().first() ; 377 Alarm *alarm =event->alarms().first() ;
378 QDateTime t = alarm->time(); 378 QDateTime t = alarm->time();
379 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 379 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
380 if(wideScreen ){ 380 if(wideScreen ){
381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
382 }else{ 382 }else{
383 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 383 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
384 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 384 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
385 } 385 }
386 //addTag("p",s); 386 //addTag("p",s);
387 } 387 }
388 388
389 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 389 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
390 390
391 formatCategories(event); 391 formatCategories(event);
392 392
393 formatAttendees(event); 393 formatAttendees(event);
394 394
395 if ( KOPrefs::instance()->mEVshowCreated ) { 395 if ( KOPrefs::instance()->mEVshowCreated ) {
396 if(wideScreen ){ 396 if(wideScreen ){
397 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 397 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
398 }else{ 398 }else{
399 addTag("p",i18n("<b>Created: ") +" </b>"); 399 addTag("p",i18n("<b>Created: ") +" </b>");
400 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 400 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
401 } 401 }
402 402
403 403
404 } 404 }
405 if ( KOPrefs::instance()->mEVshowChanged ) { 405 if ( KOPrefs::instance()->mEVshowChanged ) {
406 if(wideScreen ){ 406 if(wideScreen ){
407 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 407 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
408 }else{ 408 }else{
409 addTag("p",i18n("<b>Last modified: ") +" </b>"); 409 addTag("p",i18n("<b>Last modified: ") +" </b>");
410 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 410 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
411 } 411 }
412 412
413 } 413 }
414 if ( KOPrefs::instance()->mEVshowDetails ) { 414 if ( KOPrefs::instance()->mEVshowDetails ) {
415 if (!event->description().isEmpty()) { 415 if (!event->description().isEmpty()) {
416 addTag("p",i18n("<b>Details: </b>")); 416 addTag("p",i18n("<b>Details: </b>"));
417 addTag("p",deTag(event->description())); 417 addTag("p",deTag(event->description()));
418 } 418 }
419 } 419 }
420 setText(mText); 420 setText(mText);
421 //QWhatsThis::add(this,mText); 421 //QWhatsThis::add(this,mText);
422 422
423} 423}
424 424
425void KOEventViewer::appendTodo(Todo *event, int mode ) 425void KOEventViewer::appendTodo(Todo *event, int mode )
426{ 426{
427 mMailSubject = ""; 427 mMailSubject = "";
428 mCurrentIncidence = event; 428 mCurrentIncidence = event;
429 topLevelWidget()->setCaption(i18n("Todo Viewer")); 429 topLevelWidget()->setCaption(i18n("Todo Viewer"));
430 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 430 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
431 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 431 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
432 if (mode == 0 ) { 432 if (mode == 0 ) {
433 addTag("h2",deTag(event->summary())); 433 addTag("h2",deTag(event->summary()));
434 formatReadOnly(event); 434 formatReadOnly(event);
435 } 435 }
436 else { 436 else {
437 if ( mColorMode == 1 ) { 437 if ( mColorMode == 1 ) {
438 mText +="<font color=\"#00A000\">"; 438 mText +="<font color=\"#00A000\">";
439 } 439 }
440 if ( mColorMode == 2 ) { 440 if ( mColorMode == 2 ) {
441 mText +="<font color=\"#B00000\">"; 441 mText +="<font color=\"#B00000\">";
442 } 442 }
443 if ( mode == 1 ) { 443 if ( mode == 1 ) {
444 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 444 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
445 } else { 445 } else {
446 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 446 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
447 } 447 }
448 formatReadOnly(event); 448 formatReadOnly(event);
449 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 449 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
450 if ( mColorMode ) 450 if ( mColorMode )
451 mText += "</font>"; 451 mText += "</font>";
452 } 452 }
453 mMailSubject += i18n( "Todo " )+ event->summary(); 453 mMailSubject += i18n( "Todo " )+ event->summary();
454 454
455 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 455 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
456 mText +="<font color=\"#B00000\">"; 456 mText +="<font color=\"#B00000\">";
457 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 457 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
458 mText += "</font>"; 458 mText += "</font>";
459 } else { 459 } else {
460 mText.append(i18n("<p><i>%1 % completed</i></p>") 460 mText.append(i18n("<p><i>%1 % completed</i></p>")
461 .arg(event->percentComplete())); 461 .arg(event->percentComplete()));
462 } 462 }
463 463
464 if (event->cancelled ()) { 464 if (event->cancelled ()) {
465 mText +="<font color=\"#B00000\">"; 465 mText +="<font color=\"#B00000\">";
466 addTag("i",i18n("This todo has been cancelled!")); 466 addTag("i",i18n("This todo has been cancelled!"));
467 mText.append("<br>"); 467 mText.append("<br>");
468 mText += "</font>"; 468 mText += "</font>";
469 mMailSubject += i18n("(cancelled)"); 469 mMailSubject += i18n("(cancelled)");
470 } 470 }
471 471
472 472
473 473
474 if (event->recurrence()->doesRecur()) { 474 if (event->recurrence()->doesRecur()) {
475 475
476 QString recurText = event->recurrence()->recurrenceText(); 476 QString recurText = event->recurrence()->recurrenceText();
477 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 477 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
478 478
479 } 479 }
480 if (event->hasStartDate()) { 480 if (event->hasStartDate()) {
481 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 481 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
482 } 482 }
483 if (event->hasDueDate()) { 483 if (event->hasDueDate()) {
484 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 484 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
485 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 485 mMailSubject += i18n(" - " )+event->dtDueStr( true );
486 } 486 }
487 if (!event->location().isEmpty()) { 487 if (!event->location().isEmpty()) {
488 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 488 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
489 mMailSubject += i18n(" at ") + event->location(); 489 mMailSubject += i18n(" at ") + event->location();
490 } 490 }
491 mText.append(i18n("<p><b>Priority:</b> %2</p>") 491 mText.append(i18n("<p><b>Priority:</b> %2</p>")
492 .arg(QString::number(event->priority()))); 492 .arg(QString::number(event->priority())));
493 493
494 if (event->isAlarmEnabled()) { 494 if (event->isAlarmEnabled()) {
495 Alarm *alarm =event->alarms().first() ; 495 Alarm *alarm =event->alarms().first() ;
496 QDateTime t = alarm->time(); 496 QDateTime t = alarm->time();
497 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 497 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
498 if ( wideScreen ) { 498 if ( wideScreen ) {
499 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 499 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
500 } else { 500 } else {
501 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 501 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
502 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 502 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
503 } 503 }
504 } 504 }
505 505
506 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 506 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
507 507
508 formatCategories(event); 508 formatCategories(event);
509 509
510 formatAttendees(event); 510 formatAttendees(event);
511 511
512 if ( KOPrefs::instance()->mEVshowCreated ) { 512 if ( KOPrefs::instance()->mEVshowCreated ) {
513 if(wideScreen ){ 513 if(wideScreen ){
514 514
515 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 515 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
516 516
517 } else { 517 } else {
518 addTag("p",i18n("<b>Created: ") +" </b>"); 518 addTag("p",i18n("<b>Created: ") +" </b>");
519 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 519 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
520 } 520 }
521 } 521 }
522 if ( KOPrefs::instance()->mEVshowChanged ) { 522 if ( KOPrefs::instance()->mEVshowChanged ) {
523 if(wideScreen ){ 523 if(wideScreen ){
524 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 524 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
525 525
526 } else { 526 } else {
527 addTag("p",i18n("<b>Last modified: ") +" </b>"); 527 addTag("p",i18n("<b>Last modified: ") +" </b>");
528 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 528 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
529 } 529 }
530 } 530 }
531 if ( event->relatedTo() ) { 531 if ( event->relatedTo() ) {
532 addTag("b",i18n("Parent todo:<br>")); 532 addTag("b",i18n("Parent todo:<br>"));
533 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 533 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
534 } 534 }
535 QPtrList<Incidence> Relations = event->relations(); 535 QPtrList<Incidence> Relations = event->relations();
536 Incidence *to; 536 Incidence *to;
537 if ( Relations.first() ) 537 if ( Relations.first() )
538 addTag("b",i18n("Sub todos:<br>")); 538 addTag("b",i18n("Sub todos:<br>"));
539 for (to=Relations.first();to;to=Relations.next()) { 539 for (to=Relations.first();to;to=Relations.next()) {
540 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 540 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
541 541
542 } 542 }
543 543
544 if ( KOPrefs::instance()->mEVshowDetails ) { 544 if ( KOPrefs::instance()->mEVshowDetails ) {
545 if (!event->description().isEmpty()) { 545 if (!event->description().isEmpty()) {
546 addTag("p",i18n("<b>Details: </b>")); 546 addTag("p",i18n("<b>Details: </b>"));
547 addTag("p",deTag(event->description())); 547 addTag("p",deTag(event->description()));
548 } 548 }
549 } 549 }
550 setText(mText); 550 setText(mText);
551} 551}
552 552
553void KOEventViewer::formatCategories(Incidence *event) 553void KOEventViewer::formatCategories(Incidence *event)
554{ 554{
555 if (!event->categoriesStr().isEmpty()) { 555 if (!event->categoriesStr().isEmpty()) {
556 if (event->categories().count() == 1) { 556 if (event->categories().count() == 1) {
557 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 557 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
558 } else { 558 } else {
559 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 559 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
560 } 560 }
561 } 561 }
562} 562}
563void KOEventViewer::formatAttendees(Incidence *event) 563void KOEventViewer::formatAttendees(Incidence *event)
564{ 564{
565 QPtrList<Attendee> attendees = event->attendees(); 565 QPtrList<Attendee> attendees = event->attendees();
566 if (attendees.count()) { 566 if (attendees.count()) {
567 567
568 568
569 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 569 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
570 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 570 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
571 addTag("h3",i18n("Organizer")); 571 addTag("h3",i18n("Organizer"));
572 mText.append("<ul><li>"); 572 mText.append("<ul><li>");
573#ifndef KORG_NOKABC 573#ifndef KORG_NOKABC
574 574
575#ifdef DESKTOP_VERSION 575#ifdef DESKTOP_VERSION
576 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 576 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
577 KABC::Addressee::List addressList; 577 KABC::Addressee::List addressList;
578 addressList = add_book->findByEmail(event->organizer()); 578 addressList = add_book->findByEmail(event->organizer());
579 KABC::Addressee o = addressList.first(); 579 KABC::Addressee o = addressList.first();
580 if (!o.isEmpty() && addressList.size()<2) { 580 if (!o.isEmpty() && addressList.size()<2) {
581 mText += "<a href=\"uid:" + o.uid() + "\">"; 581 mText += "<a href=\"uid:" + o.uid() + "\">";
582 mText += o.formattedName(); 582 mText += o.formattedName();
583 mText += "</a>\n"; 583 mText += "</a>\n";
584 } else { 584 } else {
585 mText.append(event->organizer()); 585 mText.append(event->organizer());
586 } 586 }
587#else //DESKTOP_VERSION 587#else //DESKTOP_VERSION
588 mText += "<a href=\"uid:organizer\">"; 588 mText += "<a href=\"uid:organizer\">";
589 mText += event->organizer(); 589 mText += event->organizer();
590 mText += "</a>\n"; 590 mText += "</a>\n";
591#endif //DESKTOP_VERSION 591#endif //DESKTOP_VERSION
592 592
593 593
594#else 594#else
595 mText.append(event->organizer()); 595 mText.append(event->organizer());
596#endif 596#endif
597 597
598 if (iconPath) { 598 if (iconPath) {
599 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 599 mText += " <a href=\"mailto:" + event->organizer() + "\">";
600 mText += "<IMG src=\"" + iconPath + "\">"; 600 mText += "<IMG src=\"" + iconPath + "\">";
601 mText += "</a>\n"; 601 mText += "</a>\n";
602 } 602 }
603 mText.append("</li></ul>"); 603 mText.append("</li></ul>");
604 604
605 addTag("h3",i18n("Attendees")); 605 addTag("h3",i18n("Attendees"));
606 Attendee *a; 606 Attendee *a;
607 mText.append("<ul>"); 607 mText.append("<ul>");
608 int a_count = 0; 608 int a_count = 0;
609 int a_count_nr = 0; 609 int a_count_nr = 0;
610 610
611 for(a=attendees.first();a;a=attendees.next()) { 611 for(a=attendees.first();a;a=attendees.next()) {
612#ifndef KORG_NOKABC 612#ifndef KORG_NOKABC
613#ifdef DESKTOP_VERSION 613#ifdef DESKTOP_VERSION
614 if (a->name().isEmpty()) { 614 if (a->name().isEmpty()) {
615 addressList = add_book->findByEmail(a->email()); 615 addressList = add_book->findByEmail(a->email());
616 KABC::Addressee o = addressList.first(); 616 KABC::Addressee o = addressList.first();
617 if (!o.isEmpty() && addressList.size()<2) { 617 if (!o.isEmpty() && addressList.size()<2) {
618 mText += "<a href=\"uid:" + o.uid() + "\">"; 618 mText += "<a href=\"uid:" + o.uid() + "\">";
619 mText += o.formattedName(); 619 mText += o.formattedName();
620 mText += "</a>\n"; 620 mText += "</a>\n";
621 } else { 621 } else {
622 mText += "<li>"; 622 mText += "<li>";
623 mText.append(a->email()); 623 mText.append(a->email());
624 mText += "\n"; 624 mText += "\n";
625 } 625 }
626 } else { 626 } else {
627 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 627 mText += "<li><a href=\"uid:" + a->uid() + "\">";
628 if (!a->name().isEmpty()) mText += a->name(); 628 if (!a->name().isEmpty()) mText += a->name();
629 else mText += a->email(); 629 else mText += a->email();
630 mText += "</a>\n"; 630 mText += "</a>\n";
631 } 631 }
632#else //DESKTOP_VERSION 632#else //DESKTOP_VERSION
633 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 633 mText += "<li><a href=\"uid:" + a->uid() + "\">";
634 if (!a->name().isEmpty()) mText += a->name(); 634 if (!a->name().isEmpty()) mText += a->name();
635 else mText += a->email(); 635 else mText += a->email();
636 mText += "</a>\n"; 636 mText += "</a>\n";
637#endif //DESKTOP_VERSION 637#endif //DESKTOP_VERSION
638#else 638#else
639 //qDebug("nokabc "); 639 //qDebug("nokabc ");
640 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 640 mText += "<li><a href=\"uid:" + a->uid() + "\">";
641 if (!a->name().isEmpty()) mText += a->name(); 641 if (!a->name().isEmpty()) mText += a->name();
642 else mText += a->email(); 642 else mText += a->email();
643 mText += "</a>\n"; 643 mText += "</a>\n";
644#endif 644#endif
645 645
646 646
647 if (!a->email().isEmpty()) { 647 if (!a->email().isEmpty()) {
648 if (iconPath) { 648 if (iconPath) {
649 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 649 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
650 if ( a->RSVP() ) { 650 if ( a->RSVP() ) {
651 ++a_count_nr; 651 ++a_count_nr;
652 mText += "<IMG src=\"" + iconPath + "\">"; 652 mText += "<IMG src=\"" + iconPath + "\">";
653 } 653 }
654 else { 654 else {
655 ++a_count; 655 ++a_count;
656 mText += "<IMG src=\"" + NOiconPath + "\">"; 656 mText += "<IMG src=\"" + NOiconPath + "\">";
657 } 657 }
658 mText += "</a>\n"; 658 mText += "</a>\n";
659 } 659 }
660 } 660 }
661 if (a->status() != Attendee::NeedsAction ) 661 if (a->status() != Attendee::NeedsAction )
662 mText +="[" + a->statusStr() + "] "; 662 mText +="[" + a->statusStr() + "] ";
663 if (a->role() == Attendee::Chair ) 663 if (a->role() == Attendee::Chair )
664 mText +="(" + a->roleStr().left(1) + ".)"; 664 mText +="(" + a->roleStr().left(1) + ".)";
665 } 665 }
666 mText.append("</li></ul>"); 666 mText.append("</li></ul>");
667 if ( (a_count+a_count_nr) > 1 ) { 667 if ( (a_count+a_count_nr) > 1 ) {
668 mText += "<a href=\"mailto:ALL\">"; 668 mText += "<a href=\"mailto:ALL\">";
669 mText += i18n( "Mail to all" ); 669 mText += i18n( "Mail to all" );
670 mText += "</a> ( "; 670 mText += "</a> ( ";
671 mText += "<IMG src=\"" + iconPath + "\">"; 671 mText += "<IMG src=\"" + iconPath + "\">";
672 mText += i18n( " and " ); 672 mText += i18n( " and " );
673 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 673 mText += "<IMG src=\"" + NOiconPath + "\"> )";
674 mText += "<br>\n"; 674 mText += "<br>\n";
675 675
676 676
677 } 677 }
678 if ( a_count_nr > 1 ) { 678 if ( a_count_nr > 1 ) {
679 mText += "<a href=\"mailto:RSVP\">"; 679 mText += "<a href=\"mailto:RSVP\">";
680 mText += i18n( "Mail to selected" ); 680 mText += i18n( "Mail to selected" );
681 mText += "</a> ( "; 681 mText += "</a> ( ";
682 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 682 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
683 mText += "<br>\n"; 683 mText += "<br>\n";
684 } 684 }
685 } 685 }
686 686
687} 687}
688void KOEventViewer::appendJournal(Journal *jour, int mode ) 688void KOEventViewer::appendJournal(Journal *jour, int mode )
689{ 689{
690 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 690 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
691 QString text_d = i18n("Journal from: "); 691 QString text_d = i18n("Journal from: ");
692 if ( !jour->summary().isEmpty() ) 692 if ( !jour->summary().isEmpty() )
693 text_d = jour->summary(); 693 text_d = jour->summary();
694 if (mode == 0 ) { 694 if (mode == 0 ) {
695 addTag("h2", text_d ); 695 addTag("h2", text_d );
696 } 696 }
697 else { 697 else {
698 if ( mode == 1 ) { 698 if ( mode == 1 ) {
699 addTag("h3",i18n( "Local: " ) + text_d ); 699 addTag("h3",i18n( "Local: " ) + text_d );
700 } else { 700 } else {
701 addTag("h3",i18n( "Remote: " ) + text_d ); 701 addTag("h3",i18n( "Remote: " ) + text_d );
702 } 702 }
703 } 703 }
704 topLevelWidget()->setCaption("Journal Viewer"); 704 topLevelWidget()->setCaption(i18n("Journal viewer"));
705 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 705 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
706 formatReadOnly(jour); 706 formatReadOnly(jour);
707 addTag("p","<b>"+i18n( "Last modified: " ) + "</b>"+KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 707 addTag("p","<b>"+i18n( "Last modified: " ) + "</b>"+KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
708 708
709 if (!jour->description().isEmpty()) { 709 if (!jour->description().isEmpty()) {
710 addTag("p",deTag(jour->description())); 710 addTag("p",deTag(jour->description()));
711 } 711 }
712 setText(mText); 712 setText(mText);
713} 713}
714 714
715void KOEventViewer::formatReadOnly(Incidence *event) 715void KOEventViewer::formatReadOnly(Incidence *event)
716{ 716{
717 int id = event->calID(); 717 int id = event->calID();
718 if ( id > 1 ) { 718 if ( id > 1 ) {
719 addTag("p", "<em>("+i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName + ")</em>"); 719 addTag("p", "<em>("+i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName + ")</em>");
720 } 720 }
721 if (event->isReadOnly()) { 721 if (event->isReadOnly()) {
722 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 722 addTag("p","<em>(" + i18n("read-only") + ")</em>");
723 } 723 }
724} 724}
725void KOEventViewer::setSyncMode( bool b ) 725void KOEventViewer::setSyncMode( bool b )
726{ 726{
727 mSyncMode = b; 727 mSyncMode = b;
728} 728}
729 729
730void KOEventViewer::setTodo(Todo *event, bool clearV ) 730void KOEventViewer::setTodo(Todo *event, bool clearV )
731{ 731{
732 if ( clearV ) 732 if ( clearV )
733 clearEvents(); 733 clearEvents();
734 if ( mSyncMode ) { 734 if ( mSyncMode ) {
735 if ( clearV ) 735 if ( clearV )
736 appendTodo(event,1 ); 736 appendTodo(event,1 );
737 else 737 else
738 appendTodo(event,2); 738 appendTodo(event,2);
739 } else 739 } else
740 appendTodo(event); 740 appendTodo(event);
741} 741}
742void KOEventViewer::setJournal(Journal *event, bool clearV ) 742void KOEventViewer::setJournal(Journal *event, bool clearV )
743{ 743{
744 if ( clearV ) 744 if ( clearV )
745 clearEvents(); 745 clearEvents();
746 if ( mSyncMode ) { 746 if ( mSyncMode ) {
747 if ( clearV ) 747 if ( clearV )
748 appendJournal(event, 1); 748 appendJournal(event, 1);
749 else 749 else
750 appendJournal(event, 2); 750 appendJournal(event, 2);
751 } else 751 } else
752 appendJournal(event); 752 appendJournal(event);
753} 753}
754 754
755void KOEventViewer::setEvent(Event *event) 755void KOEventViewer::setEvent(Event *event)
756{ 756{
757 clearEvents(); 757 clearEvents();
758 if ( mSyncMode ) 758 if ( mSyncMode )
759 appendEvent(event, 1); 759 appendEvent(event, 1);
760 else 760 else
761 appendEvent(event); 761 appendEvent(event);
762} 762}
763 763
764void KOEventViewer::addEvent(Event *event) 764void KOEventViewer::addEvent(Event *event)
765{ 765{
766 if ( mSyncMode ) 766 if ( mSyncMode )
767 appendEvent(event, 2); 767 appendEvent(event, 2);
768 else 768 else
769 appendEvent(event); 769 appendEvent(event);
770} 770}
771 771
772void KOEventViewer::clearEvents(bool now) 772void KOEventViewer::clearEvents(bool now)
773{ 773{
774 mText = ""; 774 mText = "";
775 if (now) setText(mText); 775 if (now) setText(mText);
776} 776}
777 777
778void KOEventViewer::addText(QString text) 778void KOEventViewer::addText(QString text)
779{ 779{
780 mText.append(text); 780 mText.append(text);
781 setText(mText); 781 setText(mText);
782} 782}
783QString KOEventViewer::deTag(QString text) 783QString KOEventViewer::deTag(QString text)
784{ 784{
785#if QT_VERSION >= 0x030000 785#if QT_VERSION >= 0x030000
786 text.replace( '<' , "&lt;" ); 786 text.replace( '<' , "&lt;" );
787 text.replace( '>' , "&gt;" ); 787 text.replace( '>' , "&gt;" );
788#else 788#else
789 if ( text.find ('<') >= 0 ) { 789 if ( text.find ('<') >= 0 ) {
790 text.replace( QRegExp("<") , "&lt;" ); 790 text.replace( QRegExp("<") , "&lt;" );
791 } 791 }
792 if ( text.find ('>') >= 0 ) { 792 if ( text.find ('>') >= 0 ) {
793 text.replace( QRegExp(">") , "&gt;" ); 793 text.replace( QRegExp(">") , "&gt;" );
794 } 794 }
795#endif 795#endif
796 return text; 796 return text;
797} 797}
798void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 798void KOEventViewer::keyPressEvent ( QKeyEvent * e )
799{ 799{
800 switch ( e->key() ) { 800 switch ( e->key() ) {
801 case Qt::Key_Return: 801 case Qt::Key_Return:
802 case Qt::Key_Enter : 802 case Qt::Key_Enter :
803 e->ignore(); 803 e->ignore();
804 break; 804 break;
805 default: 805 default:
806 QTextBrowser::keyPressEvent ( e ); 806 QTextBrowser::keyPressEvent ( e );
807 break; 807 break;
808 } 808 }
809} 809}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 5d26d35..88dbd4f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2584 +1,2568 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "kojournalview.h" 50#include "kojournalview.h"
51#include "koagenda.h" 51#include "koagenda.h"
52#include "kodialogmanager.h" 52#include "kodialogmanager.h"
53#include "kdialogbase.h" 53#include "kdialogbase.h"
54#include "kapplication.h" 54#include "kapplication.h"
55#include "kofilterview.h" 55#include "kofilterview.h"
56#include "kstandarddirs.h" 56#include "kstandarddirs.h"
57#include "koprefs.h" 57#include "koprefs.h"
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koglobals.h" 59#include "koglobals.h"
60#include "kglobal.h" 60#include "kglobal.h"
61#include "ktoolbar.h" 61#include "ktoolbar.h"
62#include "klocale.h" 62#include "klocale.h"
63#include "kconfig.h" 63#include "kconfig.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65#include <kglobalsettings.h> 65#include <kglobalsettings.h>
66 66
67using namespace KCal; 67using namespace KCal;
68#ifndef _WIN32_ 68#ifndef _WIN32_
69#include <unistd.h> 69#include <unistd.h>
70#else 70#else
71#ifdef _OL_IMPORT_ 71#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 72#include "koimportoldialog.h"
73#endif 73#endif
74#endif 74#endif
75#include "mainwindow.h" 75#include "mainwindow.h"
76 76
77 77
78class KOex2phonePrefs : public QDialog 78class KOex2phonePrefs : public QDialog
79{ 79{
80 public: 80 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 82 QDialog( parent, name, true )
83 { 83 {
84 setCaption( i18n("Export to phone options") ); 84 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 85 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 86 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 87 lay->setMargin( 3 );
88 QLabel *lab; 88 QLabel *lab;
89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
90 lab->setAlignment (AlignHCenter ); 90 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 91 QHBox* temphb;
92 temphb = new QHBox( this ); 92 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 93 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 94 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 95 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 96 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 97 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 98 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 99 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 100 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 101 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 102 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 105 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 106 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 107 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 108 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 110 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
113 lab->setAlignment (AlignHCenter ); 113 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 115 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 117 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 120 resize( 220, 240 );
121 qApp->processEvents(); 121 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 123 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 124 move( (dw-width())/2, (dh - height() )/2 );
125 } 125 }
126 126
127public: 127public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 129 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 130 QSpinBox* mWriteBackFutureWeeks;
131}; 131};
132 132
133QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
134 134
135 135
136int globalFlagBlockStartup; 136int globalFlagBlockStartup;
137MainWindow::MainWindow( QWidget *parent, const char *name ) : 137MainWindow::MainWindow( QWidget *parent, const char *name ) :
138 QMainWindow( parent, name ) 138 QMainWindow( parent, name )
139{ 139{
140 sgListViewCompletedPix[5] = &listviewPix; 140 sgListViewCompletedPix[5] = &listviewPix;
141 sgListViewCompletedPix[0] = &listviewPix0; 141 sgListViewCompletedPix[0] = &listviewPix0;
142 sgListViewCompletedPix[1] = &listviewPix20; 142 sgListViewCompletedPix[1] = &listviewPix20;
143 sgListViewCompletedPix[2] = &listviewPix40; 143 sgListViewCompletedPix[2] = &listviewPix40;
144 sgListViewCompletedPix[3] = &listviewPix60; 144 sgListViewCompletedPix[3] = &listviewPix60;
145 sgListViewCompletedPix[4] = &listviewPix80; 145 sgListViewCompletedPix[4] = &listviewPix80;
146 if ( sgListViewCompletedPix[5]->height() < 5 ) { 146 if ( sgListViewCompletedPix[5]->height() < 5 ) {
147 //int size = 12; 147 //int size = 12;
148 sgListViewCompletedPix[5]->resize( 11, 11 ); 148 sgListViewCompletedPix[5]->resize( 11, 11 );
149 sgListViewCompletedPix[5]->fill( Qt::white ); 149 sgListViewCompletedPix[5]->fill( Qt::white );
150 QPainter p ( sgListViewCompletedPix[5] ); 150 QPainter p ( sgListViewCompletedPix[5] );
151 p.drawRect( 0,0,11,11); 151 p.drawRect( 0,0,11,11);
152 p.drawLine ( 2, 5, 4 , 7 ) ; 152 p.drawLine ( 2, 5, 4 , 7 ) ;
153 p.drawLine ( 4 , 7 , 8, 3) ; 153 p.drawLine ( 4 , 7 , 8, 3) ;
154 int iii = 0; 154 int iii = 0;
155 for ( iii = 0; iii < 5; ++iii ) { 155 for ( iii = 0; iii < 5; ++iii ) {
156 sgListViewCompletedPix[iii]->resize( 11, 11 ); 156 sgListViewCompletedPix[iii]->resize( 11, 11 );
157 sgListViewCompletedPix[iii]->fill( Qt::white ); 157 sgListViewCompletedPix[iii]->fill( Qt::white );
158 QPainter p ( sgListViewCompletedPix[iii] ); 158 QPainter p ( sgListViewCompletedPix[iii] );
159 p.drawRect( 0,0,11,11); 159 p.drawRect( 0,0,11,11);
160 if ( iii ) 160 if ( iii )
161 p.fillRect( 1,1,iii*2,9,Qt::gray ); 161 p.fillRect( 1,1,iii*2,9,Qt::gray );
162 } 162 }
163 } 163 }
164 mClosed = false; 164 mClosed = false;
165 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 165 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
166 QString confFile = locateLocal("config","korganizerrc"); 166 QString confFile = locateLocal("config","korganizerrc");
167 QFileInfo finf ( confFile ); 167 QFileInfo finf ( confFile );
168 bool showWarning = !finf.exists(); 168 bool showWarning = !finf.exists();
169 setIcon(SmallIcon( "ko24" ) ); 169 setIcon(SmallIcon( "ko24" ) );
170 mBlockAtStartup = true; 170 mBlockAtStartup = true;
171 mFlagKeyPressed = false; 171 mFlagKeyPressed = false;
172 setCaption("KO/Pi"); 172 setCaption("KO/Pi");
173 KOPrefs *p = KOPrefs::instance(); 173 KOPrefs *p = KOPrefs::instance();
174 //KPimGlobalPrefs::instance()->setGlobalConfig(); 174 //KPimGlobalPrefs::instance()->setGlobalConfig();
175 p->mCurrentDisplayedView = 0; 175 p->mCurrentDisplayedView = 0;
176 if ( p->mHourSize > 22 ) 176 if ( p->mHourSize > 22 )
177 p->mHourSize = 22; 177 p->mHourSize = 22;
178 QMainWindow::ToolBarDock tbd; 178 QMainWindow::ToolBarDock tbd;
179 if ( p->mToolBarHor ) { 179 if ( p->mToolBarHor ) {
180 if ( p->mToolBarUp ) 180 if ( p->mToolBarUp )
181 tbd = Bottom; 181 tbd = Bottom;
182 else 182 else
183 tbd = Top; 183 tbd = Top;
184 } 184 }
185 else { 185 else {
186 if ( p->mToolBarUp ) 186 if ( p->mToolBarUp )
187 tbd = Right; 187 tbd = Right;
188 else 188 else
189 tbd = Left; 189 tbd = Left;
190 } 190 }
191 if ( KOPrefs::instance()->mUseAppColors ) 191 if ( KOPrefs::instance()->mUseAppColors )
192 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 192 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
193 globalFlagBlockStartup = 1; 193 globalFlagBlockStartup = 1;
194 iconToolBar = new QPEToolBar( this ); 194 iconToolBar = new QPEToolBar( this );
195 addToolBar (iconToolBar , tbd ); 195 addToolBar (iconToolBar , tbd );
196 196
197#ifdef DESKTOP_VERSION 197#ifdef DESKTOP_VERSION
198 if ( KOPrefs::instance()->mShowIconFilter ) 198 if ( KOPrefs::instance()->mShowIconFilter )
199#else 199#else
200 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 200 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
201#endif 201#endif
202 202
203{ 203{
204 if ( p->mToolBarHorF ) { 204 if ( p->mToolBarHorF ) {
205 if ( p->mToolBarUpF ) 205 if ( p->mToolBarUpF )
206 tbd = Bottom; 206 tbd = Bottom;
207 else 207 else
208 tbd = Top; 208 tbd = Top;
209 } 209 }
210 else { 210 else {
211 if ( p->mToolBarUpF ) 211 if ( p->mToolBarUpF )
212 tbd = Right; 212 tbd = Right;
213 else 213 else
214 tbd = Left; 214 tbd = Left;
215 } 215 }
216 filterToolBar = new QPEToolBar ( this ); 216 filterToolBar = new QPEToolBar ( this );
217 filterMenubar = new QMenuBar( 0 ); 217 filterMenubar = new QMenuBar( 0 );
218 QFontMetrics fm ( filterMenubar->font() ); 218 QFontMetrics fm ( filterMenubar->font() );
219 219
220 filterPopupMenu = new QPopupMenu( this ); 220 filterPopupMenu = new QPopupMenu( this );
221 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 221 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
222 QString addTest = "A"; 222 QString addTest = "A";
223 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 223 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
224#ifdef DESKTOP_VERSION 224#ifdef DESKTOP_VERSION
225 addTest = "AAABBBCCCx"; 225 addTest = "AAABBBCCCx";
226#else 226#else
227 addTest = "AAx"; 227 addTest = "AAx";
228#endif 228#endif
229 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 229 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
230 addToolBar (filterToolBar , tbd ); 230 addToolBar (filterToolBar , tbd );
231 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 231 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
232 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 232 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
233 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 233 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
234 filterToolBar->hide(); 234 filterToolBar->hide();
235 } else { 235 } else {
236 filterToolBar = 0; 236 filterToolBar = 0;
237 filterMenubar = 0; 237 filterMenubar = 0;
238 filterPopupMenu = 0; 238 filterPopupMenu = 0;
239 } 239 }
240 if ( p->mShowIconOnetoolbar ) { 240 if ( p->mShowIconOnetoolbar ) {
241 viewToolBar = iconToolBar ; 241 viewToolBar = iconToolBar ;
242 navigatorToolBar = iconToolBar ; 242 navigatorToolBar = iconToolBar ;
243 } else { 243 } else {
244#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
245 setToolBarsMovable( false ); 245 setToolBarsMovable( false );
246#endif 246#endif
247 if ( p->mToolBarHorV ) { 247 if ( p->mToolBarHorV ) {
248 if ( p->mToolBarUpV ) 248 if ( p->mToolBarUpV )
249 tbd = Bottom; 249 tbd = Bottom;
250 else 250 else
251 tbd = Top; 251 tbd = Top;
252 } 252 }
253 else { 253 else {
254 if ( p->mToolBarUpV ) 254 if ( p->mToolBarUpV )
255 tbd = Right; 255 tbd = Right;
256 else 256 else
257 tbd = Left; 257 tbd = Left;
258 } 258 }
259 viewToolBar = new QPEToolBar( this ); 259 viewToolBar = new QPEToolBar( this );
260 addToolBar (viewToolBar , tbd ); 260 addToolBar (viewToolBar , tbd );
261 if ( p->mToolBarHorN ) { 261 if ( p->mToolBarHorN ) {
262 if ( p->mToolBarUpN ) 262 if ( p->mToolBarUpN )
263 tbd = Bottom; 263 tbd = Bottom;
264 else 264 else
265 tbd = Top; 265 tbd = Top;
266 } 266 }
267 else { 267 else {
268 if ( p->mToolBarUpN ) 268 if ( p->mToolBarUpN )
269 tbd = Right; 269 tbd = Right;
270 else 270 else
271 tbd = Left; 271 tbd = Left;
272 } 272 }
273 navigatorToolBar = new QPEToolBar( this ); 273 navigatorToolBar = new QPEToolBar( this );
274 addToolBar (navigatorToolBar , tbd ); 274 addToolBar (navigatorToolBar , tbd );
275 } 275 }
276 276
277 277
278 278
279 mCalendarModifiedFlag = false; 279 mCalendarModifiedFlag = false;
280 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 280 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
281 splash->setAlignment ( AlignCenter ); 281 splash->setAlignment ( AlignCenter );
282 setCentralWidget( splash ); 282 setCentralWidget( splash );
283#ifndef DESKTOP_VERSION 283#ifndef DESKTOP_VERSION
284 showMaximized(); 284 showMaximized();
285#endif 285#endif
286 286
287 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 287 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
288 setDefaultPreferences(); 288 setDefaultPreferences();
289 mCalendar = new CalendarLocal(); 289 mCalendar = new CalendarLocal();
290 mView = new CalendarView( mCalendar, this,"mCalendar " ); 290 mView = new CalendarView( mCalendar, this,"mCalendar " );
291 mView->hide(); 291 mView->hide();
292 //mView->resize(splash->size() ); 292 //mView->resize(splash->size() );
293 initActions(); 293 initActions();
294 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 294 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
295 mSyncManager->setBlockSave(false); 295 mSyncManager->setBlockSave(false);
296 mView->setSyncManager(mSyncManager); 296 mView->setSyncManager(mSyncManager);
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 iconToolBar->show(); 298 iconToolBar->show();
299 qApp->processEvents(); 299 qApp->processEvents();
300#endif 300#endif
301 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 301 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
302 int vh = height() ; 302 int vh = height() ;
303 int vw = width(); 303 int vw = width();
304 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 304 //qDebug("Toolbar hei %d ",iconToolBar->height() );
305 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 305 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
306 vh -= iconToolBar->height(); 306 vh -= iconToolBar->height();
307 } else { 307 } else {
308 vw -= iconToolBar->height(); 308 vw -= iconToolBar->height();
309 } 309 }
310 //mView->setMaximumSize( splash->size() ); 310 //mView->setMaximumSize( splash->size() );
311 //mView->resize( splash->size() ); 311 //mView->resize( splash->size() );
312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
313 mView->readSettings(); 313 mView->readSettings();
314 bool newFile = false; 314 bool newFile = false;
315 if( !QFile::exists( defaultFileName() ) ) { 315 if( !QFile::exists( defaultFileName() ) ) {
316 QFileInfo finfo ( defaultFileName() ); 316 QFileInfo finfo ( defaultFileName() );
317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
318 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 318 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
319 finfo.setFile( oldFile ); 319 finfo.setFile( oldFile );
320 if (finfo.exists() ) { 320 if (finfo.exists() ) {
321 KMessageBox::information( this, message); 321 KMessageBox::information( this, message);
322 mView->openCalendar( oldFile ); 322 mView->openCalendar( oldFile );
323 qApp->processEvents(); 323 qApp->processEvents();
324 } else { 324 } else {
325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
326 finfo.setFile( oldFile ); 326 finfo.setFile( oldFile );
327 if (finfo.exists() ) { 327 if (finfo.exists() ) {
328 KMessageBox::information( this, message); 328 KMessageBox::information( this, message);
329 mView->openCalendar( oldFile ); 329 mView->openCalendar( oldFile );
330 qApp->processEvents(); 330 qApp->processEvents();
331 } 331 }
332 } 332 }
333 mView->saveCalendar( defaultFileName() ); 333 mView->saveCalendar( defaultFileName() );
334 newFile = true; 334 newFile = true;
335 } 335 }
336 336
337 QTime neededSaveTime = QDateTime::currentDateTime().time(); 337 QTime neededSaveTime = QDateTime::currentDateTime().time();
338 mView->loadCalendars(); 338 mView->loadCalendars();
339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
340 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 340 qDebug("KO: Calendar loading time: %d ms",msNeeded );
341 341
342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
343 KOPrefs::instance()->setAllDefaults(); 343 KOPrefs::instance()->setAllDefaults();
344 } 344 }
345 processIncidenceSelection( 0 ); 345 processIncidenceSelection( 0 );
346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
347 SLOT( processIncidenceSelection( Incidence * ) ) ); 347 SLOT( processIncidenceSelection( Incidence * ) ) );
348 connect( mView, SIGNAL( modifiedChanged( bool ) ), 348 connect( mView, SIGNAL( modifiedChanged( bool ) ),
349 SLOT( slotModifiedChanged( bool ) ) ); 349 SLOT( slotModifiedChanged( bool ) ) );
350 350
351 351
352 connect( mView, SIGNAL( tempDisableBR(bool) ), 352 connect( mView, SIGNAL( tempDisableBR(bool) ),
353 SLOT( disableBR(bool) ) ); 353 SLOT( disableBR(bool) ) );
354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
355 mView->setModified( false ); 355 mView->setModified( false );
356 mBlockAtStartup = false; 356 mBlockAtStartup = false;
357 mView->setModified( false ); 357 mView->setModified( false );
358 setCentralWidget( mView ); 358 setCentralWidget( mView );
359 globalFlagBlockStartup = 0; 359 globalFlagBlockStartup = 0;
360 mView->show(); 360 mView->show();
361 delete splash; 361 delete splash;
362 if ( newFile ) 362 if ( newFile )
363 mView->updateConfig(); 363 mView->updateConfig();
364 // qApp->processEvents(); 364 // qApp->processEvents();
365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
366 //fillSyncMenu(); 366 //fillSyncMenu();
367 367
368 368
369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
374 mSyncManager->setDefaultFileName( sentSyncFile()); 374 mSyncManager->setDefaultFileName( sentSyncFile());
375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
376 mSyncManager->fillSyncMenu(); 376 mSyncManager->fillSyncMenu();
377 377
378 378
379 379
380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
381 if ( showWarning ) { 381 if ( showWarning ) {
382 KMessageBox::information( this, 382 KMessageBox::information( this,
383 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 383 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
384 qApp->processEvents(); 384 qApp->processEvents();
385 mView->dialogManager()->showSyncOptions(); 385 mView->dialogManager()->showSyncOptions();
386 } 386 }
387 387
388 //US listen for result adressed from Ka/Pi 388 //US listen for result adressed from Ka/Pi
389#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
391#endif 391#endif
392#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
393 infrared = 0; 393 infrared = 0;
394#endif 394#endif
395 updateFilterToolbar(); 395 updateFilterToolbar();
396 updateWeek( mView->startDate() ); 396 updateWeek( mView->startDate() );
397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
398 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 398 SLOT( updateWeekNum( const KCal::DateList & ) ) );
399 mBRdisabled = false; 399 mBRdisabled = false;
400 //toggleBeamReceive(); 400 //toggleBeamReceive();
401 401
402 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 402 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
403} 403}
404MainWindow::~MainWindow() 404MainWindow::~MainWindow()
405{ 405{
406 //qDebug("MainWindow::~MainWindow() "); 406 //qDebug("MainWindow::~MainWindow() ");
407 //save toolbar location 407 //save toolbar location
408 delete mCalendar; 408 delete mCalendar;
409 delete mSyncManager; 409 delete mSyncManager;
410#ifndef DESKTOP_VERSION 410#ifndef DESKTOP_VERSION
411 if ( infrared ) 411 if ( infrared )
412 delete infrared; 412 delete infrared;
413#endif 413#endif
414 414
415 415
416} 416}
417 417
418void MainWindow::disableBR(bool b) 418void MainWindow::disableBR(bool b)
419{ 419{
420#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
421 if ( b ) { 421 if ( b ) {
422 if ( infrared ) { 422 if ( infrared ) {
423 toggleBeamReceive(); 423 toggleBeamReceive();
424 mBRdisabled = true; 424 mBRdisabled = true;
425 } 425 }
426 mBRdisabled = true; 426 mBRdisabled = true;
427 } else { 427 } else {
428 if ( mBRdisabled ) { 428 if ( mBRdisabled ) {
429 mBRdisabled = false; 429 mBRdisabled = false;
430 //makes no sense,because other cal ap is probably running 430 //makes no sense,because other cal ap is probably running
431 // toggleBeamReceive(); 431 // toggleBeamReceive();
432 } 432 }
433 } 433 }
434#endif 434#endif
435 435
436} 436}
437bool MainWindow::beamReceiveEnabled() 437bool MainWindow::beamReceiveEnabled()
438{ 438{
439#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
440 return ( infrared != 0 ); 440 return ( infrared != 0 );
441#endif 441#endif
442 return false; 442 return false;
443} 443}
444 444
445void MainWindow::toggleBeamReceive() 445void MainWindow::toggleBeamReceive()
446{ 446{
447 if ( mBRdisabled ) 447 if ( mBRdisabled )
448 return; 448 return;
449#ifndef DESKTOP_VERSION 449#ifndef DESKTOP_VERSION
450 if ( infrared ) { 450 if ( infrared ) {
451 qDebug("KO: Disable BeamReceive "); 451 qDebug("KO: Disable BeamReceive ");
452 delete infrared; 452 delete infrared;
453 infrared = 0; 453 infrared = 0;
454 brAction->setOn(false); 454 brAction->setOn(false);
455 return; 455 return;
456 } 456 }
457 qDebug("KO: Enable BeamReceive "); 457 qDebug("KO: Enable BeamReceive ");
458 brAction->setOn(true); 458 brAction->setOn(true);
459 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 459 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
460 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 460 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
461#endif 461#endif
462} 462}
463void MainWindow::showMaximized () 463void MainWindow::showMaximized ()
464{ 464{
465#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
466 if ( ! globalFlagBlockStartup ) 466 if ( ! globalFlagBlockStartup )
467 if ( mClosed ) 467 if ( mClosed )
468 mView->goToday(); 468 mView->goToday();
469#endif 469#endif
470 QWidget::showMaximized () ; 470 QWidget::showMaximized () ;
471 mClosed = false; 471 mClosed = false;
472} 472}
473void MainWindow::closeEvent( QCloseEvent* ce ) 473void MainWindow::closeEvent( QCloseEvent* ce )
474{ 474{
475 475
476 476
477 477
478 if ( ! KOPrefs::instance()->mAskForQuit ) { 478 if ( ! KOPrefs::instance()->mAskForQuit ) {
479 saveOnClose(); 479 saveOnClose();
480 mClosed = true; 480 mClosed = true;
481 ce->accept(); 481 ce->accept();
482 return; 482 return;
483 483
484 } 484 }
485 485
486 switch( QMessageBox::information( this, "KO/Pi", 486 switch( QMessageBox::information( this, "KO/Pi",
487 i18n("Do you really want\nto close KO/Pi?"), 487 i18n("Do you really want\nto close KO/Pi?"),
488 i18n("Close"), i18n("No"), 488 i18n("Close"), i18n("No"),
489 0, 0 ) ) { 489 0, 0 ) ) {
490 case 0: 490 case 0:
491 saveOnClose(); 491 saveOnClose();
492 mClosed = true; 492 mClosed = true;
493 ce->accept(); 493 ce->accept();
494 break; 494 break;
495 case 1: 495 case 1:
496 ce->ignore(); 496 ce->ignore();
497 break; 497 break;
498 case 2: 498 case 2:
499 499
500 default: 500 default:
501 break; 501 break;
502 } 502 }
503 503
504 504
505} 505}
506 506
507void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 507void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
508{ 508{
509 QDataStream stream( data, IO_ReadOnly ); 509 QDataStream stream( data, IO_ReadOnly );
510 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 510 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
511 //QString datamess; 511 //QString datamess;
512 //qDebug("message "); 512 //qDebug("message ");
513 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 513 qDebug("KO: QCOP message received: %s ", cmsg.data() );
514 514
515 if ( cmsg == "setDocument(QString)" ) { 515 if ( cmsg == "setDocument(QString)" ) {
516 QDataStream stream( data, IO_ReadOnly ); 516 QDataStream stream( data, IO_ReadOnly );
517 QString fileName; 517 QString fileName;
518 stream >> fileName; 518 stream >> fileName;
519 //qDebug("filename %s ", fileName.latin1()); 519 //qDebug("filename %s ", fileName.latin1());
520 showMaximized(); 520 showMaximized();
521 raise(); 521 raise();
522 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 522 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
523 mSyncManager->slotSyncMenu( 1002 ); 523 mSyncManager->slotSyncMenu( 1002 );
524 return; 524 return;
525 } 525 }
526 526
527 if ( cmsg == "-writeFile" ) { 527 if ( cmsg == "-writeFile" ) {
528 // I made from the "-writeFile" an "-writeAlarm" 528 // I made from the "-writeFile" an "-writeAlarm"
529 mView->viewManager()->showWhatsNextView(); 529 mView->viewManager()->showWhatsNextView();
530 mCalendar->checkAlarmForIncidence( 0, true); 530 mCalendar->checkAlarmForIncidence( 0, true);
531 showMaximized(); 531 showMaximized();
532 raise(); 532 raise();
533 return; 533 return;
534 534
535 } 535 }
536 if ( cmsg == "-writeFileSilent" ) { 536 if ( cmsg == "-writeFileSilent" ) {
537 // I made from the "-writeFile" an "-writeAlarm" 537 // I made from the "-writeFile" an "-writeAlarm"
538 // mView->viewManager()->showWhatsNextView(); 538 // mView->viewManager()->showWhatsNextView();
539 mCalendar->checkAlarmForIncidence( 0, true); 539 mCalendar->checkAlarmForIncidence( 0, true);
540 //showMaximized(); 540 //showMaximized();
541 //raise(); 541 //raise();
542 hide(); 542 hide();
543 return; 543 return;
544 } 544 }
545 if ( cmsg == "-newCountdown" ) { 545 if ( cmsg == "-newCountdown" ) {
546 qDebug("newCountdown "); 546 qDebug("newCountdown ");
547 547
548 } 548 }
549 QString msg ; 549 QString msg ;
550 QString allmsg = cmsg; 550 QString allmsg = cmsg;
551 while ( allmsg.length() > 0 ) { 551 while ( allmsg.length() > 0 ) {
552 int nextC = allmsg.find( "-", 1 ); 552 int nextC = allmsg.find( "-", 1 );
553 if ( nextC == -1 ) { 553 if ( nextC == -1 ) {
554 msg = allmsg; 554 msg = allmsg;
555 allmsg = ""; 555 allmsg = "";
556 } else{ 556 } else{
557 msg = allmsg.left( nextC ); 557 msg = allmsg.left( nextC );
558 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 558 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
559 } 559 }
560 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 560 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
561 if ( msg == "-newEvent" ) { 561 if ( msg == "-newEvent" ) {
562 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 562 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
563 } 563 }
564 if ( msg == "-newTodo" ) { 564 if ( msg == "-newTodo" ) {
565 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 565 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
566 } 566 }
567 if ( msg == "-showWN" ) { 567 if ( msg == "-showWN" ) {
568 mView->viewManager()->showWhatsNextView(); 568 mView->viewManager()->showWhatsNextView();
569 } 569 }
570 if ( msg == "-showTodo" ) { 570 if ( msg == "-showTodo" ) {
571 mView->viewManager()->showTodoView(); 571 mView->viewManager()->showTodoView();
572 } 572 }
573 if ( msg == "-showList" ) { 573 if ( msg == "-showList" ) {
574 mView->viewManager()->showListView(); 574 mView->viewManager()->showListView();
575 } 575 }
576 else if ( msg == "-showDay" ) { 576 else if ( msg == "-showDay" ) {
577 mView->viewManager()->showDayView(); 577 mView->viewManager()->showDayView();
578 } 578 }
579 else if ( msg == "-showWWeek" ) { 579 else if ( msg == "-showWWeek" ) {
580 mView->viewManager()->showWorkWeekView(); 580 mView->viewManager()->showWorkWeekView();
581 } 581 }
582 else if ( msg == "-ringSync" ) { 582 else if ( msg == "-ringSync" ) {
583 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 583 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
584 } 584 }
585 else if ( msg == "-showWeek" ) { 585 else if ( msg == "-showWeek" ) {
586 mView->viewManager()->showWeekView(); 586 mView->viewManager()->showWeekView();
587 } 587 }
588 else if ( msg == "-showTodo" ) { 588 else if ( msg == "-showTodo" ) {
589 mView->viewManager()->showTodoView(); 589 mView->viewManager()->showTodoView();
590 } 590 }
591 else if ( msg == "-showJournal" ) { 591 else if ( msg == "-showJournal" ) {
592 mView->dateNavigator()->selectDates( 1 ); 592 mView->dateNavigator()->selectDates( 1 );
593 mView->dateNavigator()->selectToday(); 593 mView->dateNavigator()->selectToday();
594 mView->viewManager()->showJournalView(); 594 mView->viewManager()->showJournalView();
595 } 595 }
596 else if ( msg == "-showKO" ) { 596 else if ( msg == "-showKO" ) {
597 mView->viewManager()->showNextXView(); 597 mView->viewManager()->showNextXView();
598 } 598 }
599 else if ( msg == "-showWNext" ) { 599 else if ( msg == "-showWNext" ) {
600 mView->viewManager()->showWhatsNextView(); 600 mView->viewManager()->showWhatsNextView();
601 } 601 }
602 else if ( msg == "nextView()" ) { 602 else if ( msg == "nextView()" ) {
603 mView->viewManager()->showNextView(); 603 mView->viewManager()->showNextView();
604 } 604 }
605 else if ( msg == "-showNextXView" ) { 605 else if ( msg == "-showNextXView" ) {
606 mView->viewManager()->showNextXView(); 606 mView->viewManager()->showNextXView();
607 } 607 }
608 608
609 609
610 } 610 }
611 611
612 showMaximized(); 612 showMaximized();
613 raise(); 613 raise();
614} 614}
615void MainWindow::startMultiSync() 615void MainWindow::startMultiSync()
616{ 616{
617 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 617 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
618 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 618 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
619 question, 619 question,
620 i18n("Yes"), i18n("No"), 620 i18n("Yes"), i18n("No"),
621 0, 0 ) != 0 ) { 621 0, 0 ) != 0 ) {
622 setCaption(i18n("Aborted! Nothing synced!")); 622 setCaption(i18n("Aborted! Nothing synced!"));
623 return; 623 return;
624 } 624 }
625 mSyncManager->multiSync( false ); 625 mSyncManager->multiSync( false );
626#ifndef DESKTOP_VERSION 626#ifndef DESKTOP_VERSION
627 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 627 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
628#endif 628#endif
629} 629}
630QPixmap MainWindow::loadPixmap( QString name ) 630QPixmap MainWindow::loadPixmap( QString name )
631{ 631{
632 return SmallIcon( name ); 632 return SmallIcon( name );
633 633
634} 634}
635void MainWindow::setUsesBigPixmaps ( bool b ) 635void MainWindow::setUsesBigPixmaps ( bool b )
636{ 636{
637 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 637 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
638 if ( b ) 638 if ( b )
639 qDebug("KO: BigPixmaps are not supported "); 639 qDebug("KO: BigPixmaps are not supported ");
640} 640}
641void MainWindow::initActions() 641void MainWindow::initActions()
642{ 642{
643 //KOPrefs::instance()->mShowFullMenu 643 //KOPrefs::instance()->mShowFullMenu
644 iconToolBar->clear(); 644 iconToolBar->clear();
645 KOPrefs *p = KOPrefs::instance(); 645 KOPrefs *p = KOPrefs::instance();
646 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 646 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
647 647
648 QPopupMenu *viewMenu = new QPopupMenu( this ); 648 QPopupMenu *viewMenu = new QPopupMenu( this );
649 QPopupMenu *actionMenu = new QPopupMenu( this ); 649 QPopupMenu *actionMenu = new QPopupMenu( this );
650 mCurrentItemMenu = new QPopupMenu ( this ); 650 mCurrentItemMenu = new QPopupMenu ( this );
651 QPopupMenu *importMenu = new QPopupMenu( this ); 651 QPopupMenu *importMenu = new QPopupMenu( this );
652 QPopupMenu *importMenu_X = new QPopupMenu( this ); 652 QPopupMenu *importMenu_X = new QPopupMenu( this );
653 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 653 QPopupMenu *exportMenu_X = new QPopupMenu( this );
654 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 654 QPopupMenu *beamMenu_X = new QPopupMenu( this );
655 selectFilterMenu = new QPopupMenu( this ); 655 selectFilterMenu = new QPopupMenu( this );
656 selectFilterMenu->setCheckable( true ); 656 selectFilterMenu->setCheckable( true );
657 syncMenu = new QPopupMenu( this ); 657 syncMenu = new QPopupMenu( this );
658 configureAgendaMenu = new QPopupMenu( this ); 658 configureAgendaMenu = new QPopupMenu( this );
659 configureToolBarMenu = new QPopupMenu( this ); 659 configureToolBarMenu = new QPopupMenu( this );
660 QPopupMenu *helpMenu = new QPopupMenu( this ); 660 QPopupMenu *helpMenu = new QPopupMenu( this );
661 QIconSet icon; 661 QIconSet icon;
662 int pixWid = 22, pixHei = 22; 662 int pixWid = 22, pixHei = 22;
663 QString pathString = ""; 663 QString pathString = "";
664 if ( !p->mToolBarMiniIcons ) { 664 if ( !p->mToolBarMiniIcons ) {
665 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 665 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
666 pathString += "icons16/"; 666 pathString += "icons16/";
667 pixWid = 18; pixHei = 16; 667 pixWid = 18; pixHei = 16;
668 } 668 }
669 } else { 669 } else {
670 pathString += "iconsmini/"; 670 pathString += "iconsmini/";
671 pixWid = 18; pixHei = 16; 671 pixWid = 18; pixHei = 16;
672 } 672 }
673 if ( KOPrefs::instance()->mShowFullMenu ) { 673 if ( KOPrefs::instance()->mShowFullMenu ) {
674 QMenuBar *menuBar1; 674 QMenuBar *menuBar1;
675 menuBar1 = menuBar(); 675 menuBar1 = menuBar();
676 menuBar1->insertItem( i18n("File"), importMenu ); 676 menuBar1->insertItem( i18n("File"), importMenu );
677 menuBar1->insertItem( i18n("View"), viewMenu ); 677 menuBar1->insertItem( i18n("View"), viewMenu );
678 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 678 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
679 menuBar1->insertItem( i18n("Action"), actionMenu ); 679 menuBar1->insertItem( i18n("Action"), actionMenu );
680#ifdef DESKTOP_VERSION 680#ifdef DESKTOP_VERSION
681 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 681 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
682 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 682 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
683#else 683#else
684 menuBar1->insertItem( i18n("Sync"), syncMenu ); 684 menuBar1->insertItem( i18n("Sync"), syncMenu );
685 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 685 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
686#endif 686#endif
687 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 687 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
688 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 688 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
689 menuBar1->insertItem( i18n("Help"), helpMenu ); 689 menuBar1->insertItem( i18n("Help"), helpMenu );
690 } else { 690 } else {
691 QPEMenuBar *menuBar1; 691 QPEMenuBar *menuBar1;
692 menuBar1 = new QPEMenuBar( iconToolBar ); 692 menuBar1 = new QPEMenuBar( iconToolBar );
693 QPopupMenu *menuBar = new QPopupMenu( this ); 693 QPopupMenu *menuBar = new QPopupMenu( this );
694 icon = loadPixmap( pathString + "z_menu" ); 694 icon = loadPixmap( pathString + "z_menu" );
695 menuBar1->insertItem( icon.pixmap(), menuBar); 695 menuBar1->insertItem( icon.pixmap(), menuBar);
696 //menuBar1->insertItem( i18n("ME"), menuBar); 696 //menuBar1->insertItem( i18n("ME"), menuBar);
697 menuBar->insertItem( i18n("File"), importMenu ); 697 menuBar->insertItem( i18n("File"), importMenu );
698 menuBar->insertItem( i18n("View"), viewMenu ); 698 menuBar->insertItem( i18n("View"), viewMenu );
699 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 699 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
700 menuBar->insertItem( i18n("Action"), actionMenu ); 700 menuBar->insertItem( i18n("Action"), actionMenu );
701 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 701 menuBar->insertItem( i18n("Synchronize"), syncMenu );
702 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 702 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
703 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 703 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
704 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 704 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
705 menuBar->insertItem( i18n("Help"), helpMenu ); 705 menuBar->insertItem( i18n("Help"), helpMenu );
706 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 706 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
707 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 707 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
708 } 708 }
709 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 709 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
710 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 710 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
711 711
712 712
713 mWeekBgColor = iconToolBar->backgroundColor(); 713 mWeekBgColor = iconToolBar->backgroundColor();
714 mWeekPixmap.resize( pixWid , pixHei ); 714 mWeekPixmap.resize( pixWid , pixHei );
715 mWeekPixmap.fill( mWeekBgColor ); 715 mWeekPixmap.fill( mWeekBgColor );
716 icon = mWeekPixmap; 716 icon = mWeekPixmap;
717 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 717 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
718 if ( p-> mShowIconWeekNum ) 718 if ( p-> mShowIconWeekNum )
719 mWeekAction->addTo( iconToolBar ); 719 mWeekAction->addTo( iconToolBar );
720 mWeekFont = font(); 720 mWeekFont = font();
721 721
722 int fontPoint = mWeekFont.pointSize(); 722 int fontPoint = mWeekFont.pointSize();
723 QFontMetrics f( mWeekFont ); 723 QFontMetrics f( mWeekFont );
724 int fontWid = f.width( "30" ); 724 int fontWid = f.width( "30" );
725 while ( fontWid > pixWid ) { 725 while ( fontWid > pixWid ) {
726 --fontPoint; 726 --fontPoint;
727 mWeekFont.setPointSize( fontPoint ); 727 mWeekFont.setPointSize( fontPoint );
728 QFontMetrics f( mWeekFont ); 728 QFontMetrics f( mWeekFont );
729 fontWid = f.width( "30" ); 729 fontWid = f.width( "30" );
730 //qDebug("dec-- "); 730 //qDebug("dec-- ");
731 } 731 }
732 732
733 connect( mWeekAction, SIGNAL( activated() ), 733 connect( mWeekAction, SIGNAL( activated() ),
734 this, SLOT( weekAction() ) ); 734 this, SLOT( weekAction() ) );
735 735
736 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 736 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
737 if ( p->mShowIconFilterview ) { 737 if ( p->mShowIconFilterview ) {
738 icon = loadPixmap( pathString + "filter" ); 738 icon = loadPixmap( pathString + "filter" );
739 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 739 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
740 connect( actionFilterMenuTB, SIGNAL( activated() ), 740 connect( actionFilterMenuTB, SIGNAL( activated() ),
741 this, SLOT( fillFilterMenuTB() ) ); 741 this, SLOT( fillFilterMenuTB() ) );
742 actionFilterMenuTB->addTo( iconToolBar ); 742 actionFilterMenuTB->addTo( iconToolBar );
743 selectFilterMenuTB = new QPopupMenu( this ); 743 selectFilterMenuTB = new QPopupMenu( this );
744 selectFilterMenuTB->setCheckable( true ); 744 selectFilterMenuTB->setCheckable( true );
745 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 745 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
746 } 746 }
747 747
748 //#endif 748 //#endif
749 // ****************** 749 // ******************
750 QAction *action; 750 QAction *action;
751 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 751 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
752 configureToolBarMenu->setCheckable( true ); 752 configureToolBarMenu->setCheckable( true );
753 753
754 754
755 configureAgendaMenu->setCheckable( true ); 755 configureAgendaMenu->setCheckable( true );
756 int iii ; 756 int iii ;
757 for ( iii = 1;iii<= 10 ;++iii ){ 757 for ( iii = 1;iii<= 10 ;++iii ){
758 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 758 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
759 } 759 }
760 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 760 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
761 761
762 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 762 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
763 this, SLOT( showConfigureAgenda( ) ) ); 763 this, SLOT( showConfigureAgenda( ) ) );
764 icon = loadPixmap( pathString + "today" ); 764 icon = loadPixmap( pathString + "today" );
765 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 765 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
766 today_action->addTo( actionMenu ); 766 today_action->addTo( actionMenu );
767 connect( today_action, SIGNAL( activated() ), 767 connect( today_action, SIGNAL( activated() ),
768 mView, SLOT( goToday() ) ); 768 mView, SLOT( goToday() ) );
769 769
770 icon = loadPixmap( pathString + "picker" ); 770 icon = loadPixmap( pathString + "picker" );
771 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 771 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
772 dPickerAction->addTo( actionMenu ); 772 dPickerAction->addTo( actionMenu );
773 connect( dPickerAction, SIGNAL( activated() ), 773 connect( dPickerAction, SIGNAL( activated() ),
774 mView, SLOT( showDatePicker() ) ); 774 mView, SLOT( showDatePicker() ) );
775 775
776 icon = loadPixmap( pathString + "search" ); 776 icon = loadPixmap( pathString + "search" );
777 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 777 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
778 search_action->addTo( actionMenu ); 778 search_action->addTo( actionMenu );
779 connect( search_action, SIGNAL( activated() ), 779 connect( search_action, SIGNAL( activated() ),
780 mView->dialogManager(), SLOT( showSearchDialog() ) ); 780 mView->dialogManager(), SLOT( showSearchDialog() ) );
781 781
782 actionMenu->insertSeparator(); 782 actionMenu->insertSeparator();
783 783
784 784
785 785
786 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 786 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
787 action->addTo( mCurrentItemMenu ); 787 action->addTo( mCurrentItemMenu );
788 connect( action, SIGNAL( activated() ), 788 connect( action, SIGNAL( activated() ),
789 mView, SLOT( undo_delete() ) ); 789 mView, SLOT( undo_delete() ) );
790 mCurrentItemMenu->insertSeparator(); 790 mCurrentItemMenu->insertSeparator();
791 icon = loadPixmap( pathString + "newevent" ); 791 icon = loadPixmap( pathString + "newevent" );
792 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 792 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
793 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 793 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
794 configureToolBarMenu->insertSeparator(); 794 configureToolBarMenu->insertSeparator();
795 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 795 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
796 configureToolBarMenu->insertSeparator(); 796 configureToolBarMenu->insertSeparator();
797 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 797 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
798 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 798 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
799 799
800 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 800 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
801 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 801 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
802 mShowAction->addTo( mCurrentItemMenu ); 802 mShowAction->addTo( mCurrentItemMenu );
803 connect( mShowAction, SIGNAL( activated() ), 803 connect( mShowAction, SIGNAL( activated() ),
804 mView, SLOT( showIncidence() ) ); 804 mView, SLOT( showIncidence() ) );
805 805
806 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 806 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
807 mEditAction->addTo( mCurrentItemMenu ); 807 mEditAction->addTo( mCurrentItemMenu );
808 connect( mEditAction, SIGNAL( activated() ), 808 connect( mEditAction, SIGNAL( activated() ),
809 mView, SLOT( editIncidence() ) ); 809 mView, SLOT( editIncidence() ) );
810 810
811 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 811 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
812 mDeleteAction->addTo( mCurrentItemMenu ); 812 mDeleteAction->addTo( mCurrentItemMenu );
813 connect( mDeleteAction, SIGNAL( activated() ), 813 connect( mDeleteAction, SIGNAL( activated() ),
814 mView, SLOT( deleteIncidence() ) ); 814 mView, SLOT( deleteIncidence() ) );
815 815
816 816
817 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 817 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
818 mCloneAction->addTo( mCurrentItemMenu ); 818 mCloneAction->addTo( mCurrentItemMenu );
819 connect( mCloneAction, SIGNAL( activated() ), 819 connect( mCloneAction, SIGNAL( activated() ),
820 mView, SLOT( cloneIncidence() ) ); 820 mView, SLOT( cloneIncidence() ) );
821 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 821 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
822 mMoveAction->addTo( mCurrentItemMenu ); 822 mMoveAction->addTo( mCurrentItemMenu );
823 connect( mMoveAction, SIGNAL( activated() ), 823 connect( mMoveAction, SIGNAL( activated() ),
824 mView, SLOT( moveIncidence() ) ); 824 mView, SLOT( moveIncidence() ) );
825#ifndef DESKTOP_VERSION
825 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 826 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
826 mBeamAction->addTo(mCurrentItemMenu ); 827 mBeamAction->addTo(mCurrentItemMenu );
827 connect( mBeamAction, SIGNAL( activated() ), 828 connect( mBeamAction, SIGNAL( activated() ),
828 mView, SLOT( beamIncidence() ) ); 829 mView, SLOT( beamIncidence() ) );
830#endif
829 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 831 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
830 mCancelAction->addTo( mCurrentItemMenu ); 832 mCancelAction->addTo( mCurrentItemMenu );
831 connect( mCancelAction, SIGNAL( activated() ), 833 connect( mCancelAction, SIGNAL( activated() ),
832 mView, SLOT( toggleCancelIncidence() ) ); 834 mView, SLOT( toggleCancelIncidence() ) );
833 835
834 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 836 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
835 ne_action->addTo( actionMenu ); 837 ne_action->addTo( actionMenu );
836 connect( ne_action, SIGNAL( activated() ), 838 connect( ne_action, SIGNAL( activated() ),
837 mView, SLOT( newEvent() ) ); 839 mView, SLOT( newEvent() ) );
838 icon = loadPixmap( pathString + "newtodo" ); 840 icon = loadPixmap( pathString + "newtodo" );
839 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 841 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
840 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 842 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
841 nt_action->addTo( actionMenu ); 843 nt_action->addTo( actionMenu );
842 connect( nt_action, SIGNAL( activated() ), 844 connect( nt_action, SIGNAL( activated() ),
843 mView, SLOT( newTodo() ) ); 845 mView, SLOT( newTodo() ) );
844 846
845 847
846 848
847 // *********************** 849 // ***********************
848 if ( KOPrefs::instance()->mVerticalScreen ) { 850 if ( KOPrefs::instance()->mVerticalScreen ) {
849 icon = SmallIcon( "1updownarrow" ); 851 icon = SmallIcon( "1updownarrow" );
850 } else { 852 } else {
851 icon = SmallIcon("1leftrightarrow" ); 853 icon = SmallIcon("1leftrightarrow" );
852 } 854 }
853 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 855 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
854 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 856 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
855 FSaction->addTo( viewMenu ); 857 FSaction->addTo( viewMenu );
856 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 858 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
857 859
858 860
859 icon = loadPixmap( pathString + "filter" ); 861 icon = loadPixmap( pathString + "filter" );
860 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 862 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
861 icon = loadPixmap( pathString + "configure" ); 863 icon = loadPixmap( pathString + "configure" );
862 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 864 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
863 action->addTo( viewMenu ); 865 action->addTo( viewMenu );
864 connect( action, SIGNAL( activated() ), 866 connect( action, SIGNAL( activated() ),
865 mView, SLOT( toggleFilter() ) ); 867 mView, SLOT( toggleFilter() ) );
866 mToggleFilter = action; 868 mToggleFilter = action;
867 icon = loadPixmap( pathString + "navi" ); 869 icon = loadPixmap( pathString + "navi" );
868 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 870 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
869 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 871 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
870 action->addTo( viewMenu ); 872 action->addTo( viewMenu );
871 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
872 mView, SLOT( toggleDateNavigatorWidget() ) ); 874 mView, SLOT( toggleDateNavigatorWidget() ) );
873 mToggleNav = action ; 875 mToggleNav = action ;
874 icon = loadPixmap( pathString + "allday" ); 876 icon = loadPixmap( pathString + "allday" );
875 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 877 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
876 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 878 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
877 action->addTo( viewMenu ); 879 action->addTo( viewMenu );
878 connect( action, SIGNAL( activated() ), 880 connect( action, SIGNAL( activated() ),
879 mView, SLOT( toggleAllDaySize() ) ); 881 mView, SLOT( toggleAllDaySize() ) );
880 mToggleAllday = action; 882 mToggleAllday = action;
881 883
882 884
883 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 885 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
884 mToggleNav, SLOT( setEnabled ( bool ) ) ); 886 mToggleNav, SLOT( setEnabled ( bool ) ) );
885 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 887 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
886 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 888 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
887 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 889 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
888 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 890 mToggleAllday, SLOT( setEnabled ( bool ) ) );
889 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 891 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
890 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 892 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
891 893
892 894
893 dPickerAction->addTo( iconToolBar ); 895 dPickerAction->addTo( iconToolBar );
894 viewMenu->insertSeparator(); 896 viewMenu->insertSeparator();
895 897
896 if ( p-> mShowIconToggleFull ) 898 if ( p-> mShowIconToggleFull )
897 FSaction->addTo( iconToolBar ); 899 FSaction->addTo( iconToolBar );
898 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 900 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
899 901
900 //******************** 902 //********************
901 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 903 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
902 904
903 905
904 icon = loadPixmap( pathString + "whatsnext" ); 906 icon = loadPixmap( pathString + "whatsnext" );
905 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 907 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
906 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 908 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
907 whatsnext_action->addTo( viewMenu ); 909 whatsnext_action->addTo( viewMenu );
908 connect( whatsnext_action, SIGNAL( activated() ), 910 connect( whatsnext_action, SIGNAL( activated() ),
909 mView->viewManager(), SLOT( showWhatsNextView() ) ); 911 mView->viewManager(), SLOT( showWhatsNextView() ) );
910 912
911 icon = loadPixmap( pathString + "xdays" ); 913 icon = loadPixmap( pathString + "xdays" );
912 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 914 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
913 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 915 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
914 xdays_action->addTo( viewMenu ); 916 xdays_action->addTo( viewMenu );
915 connect( xdays_action, SIGNAL( activated() ), 917 connect( xdays_action, SIGNAL( activated() ),
916 mView->viewManager(), SLOT( showNextXView() ) ); 918 mView->viewManager(), SLOT( showNextXView() ) );
917 919
918 920
919 icon = loadPixmap( pathString + "journal" ); 921 icon = loadPixmap( pathString + "journal" );
920 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 922 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
921 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 923 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
922 viewjournal_action->addTo( viewMenu ); 924 viewjournal_action->addTo( viewMenu );
923 connect( viewjournal_action, SIGNAL( activated() ), 925 connect( viewjournal_action, SIGNAL( activated() ),
924 mView->viewManager(), SLOT( showJournalView() ) ); 926 mView->viewManager(), SLOT( showJournalView() ) );
925 927
926 928
927 icon = loadPixmap( pathString + "day" ); 929 icon = loadPixmap( pathString + "day" );
928 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 930 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
929 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 931 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
930 day1_action->addTo( viewMenu ); 932 day1_action->addTo( viewMenu );
931 // action->addTo( toolBar ); 933 // action->addTo( toolBar );
932 connect( day1_action, SIGNAL( activated() ), 934 connect( day1_action, SIGNAL( activated() ),
933 mView->viewManager(), SLOT( showDayView() ) ); 935 mView->viewManager(), SLOT( showDayView() ) );
934 936
935 icon = loadPixmap( pathString + "workweek" ); 937 icon = loadPixmap( pathString + "workweek" );
936 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 938 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
937 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 939 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
938 day5_action->addTo( viewMenu ); 940 day5_action->addTo( viewMenu );
939 connect( day5_action, SIGNAL( activated() ), 941 connect( day5_action, SIGNAL( activated() ),
940 mView->viewManager(), SLOT( showWorkWeekView() ) ); 942 mView->viewManager(), SLOT( showWorkWeekView() ) );
941 943
942 icon = loadPixmap( pathString + "week" ); 944 icon = loadPixmap( pathString + "week" );
943 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 945 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
944 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 946 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
945 day7_action->addTo( viewMenu ); 947 day7_action->addTo( viewMenu );
946 connect( day7_action, SIGNAL( activated() ), 948 connect( day7_action, SIGNAL( activated() ),
947 mView->viewManager(), SLOT( showWeekView() ) ); 949 mView->viewManager(), SLOT( showWeekView() ) );
948 950
949 icon = loadPixmap( pathString + "workweek2" ); 951 icon = loadPixmap( pathString + "workweek2" );
950 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 952 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
951 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 953 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
952 day6_action->addTo( viewMenu ); 954 day6_action->addTo( viewMenu );
953 connect( day6_action, SIGNAL( activated() ), 955 connect( day6_action, SIGNAL( activated() ),
954 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 956 mView->viewManager(), SLOT( showMonthViewWeek() ) );
955 957
956 icon = loadPixmap( pathString + "month" ); 958 icon = loadPixmap( pathString + "month" );
957 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 959 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
958 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 960 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
959 month_action->addTo( viewMenu ); 961 month_action->addTo( viewMenu );
960 connect( month_action, SIGNAL( activated() ), 962 connect( month_action, SIGNAL( activated() ),
961 mView->viewManager(), SLOT( showMonthView() ) ); 963 mView->viewManager(), SLOT( showMonthView() ) );
962 964
963 icon = loadPixmap( pathString + "list" ); 965 icon = loadPixmap( pathString + "list" );
964 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 966 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
965 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 967 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
966 showlist_action->addTo( viewMenu ); 968 showlist_action->addTo( viewMenu );
967 connect( showlist_action, SIGNAL( activated() ), 969 connect( showlist_action, SIGNAL( activated() ),
968 mView->viewManager(), SLOT( showListView() ) ); 970 mView->viewManager(), SLOT( showListView() ) );
969 971
970 icon = loadPixmap( pathString + "todo" ); 972 icon = loadPixmap( pathString + "todo" );
971 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 973 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
972 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 974 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
973 todoview_action->addTo( viewMenu ); 975 todoview_action->addTo( viewMenu );
974 connect( todoview_action, SIGNAL( activated() ), 976 connect( todoview_action, SIGNAL( activated() ),
975 mView->viewManager(), SLOT( showTodoView() ) ); 977 mView->viewManager(), SLOT( showTodoView() ) );
976 978
977 979
978 980
979#if 0 981#if 0
980 action = new QAction( "view_timespan", "Time Span", 0, this ); 982 action = new QAction( "view_timespan", "Time Span", 0, this );
981 action->addTo( viewMenu ); 983 action->addTo( viewMenu );
982 connect( action, SIGNAL( activated() ), 984 connect( action, SIGNAL( activated() ),
983 mView->viewManager(), SLOT( showTimeSpanView() ) ); 985 mView->viewManager(), SLOT( showTimeSpanView() ) );
984#endif 986#endif
985 987
986 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 988 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
987 this ); 989 this );
988 mNewSubTodoAction->addTo( actionMenu ); 990 mNewSubTodoAction->addTo( actionMenu );
989 connect( mNewSubTodoAction, SIGNAL( activated() ), 991 connect( mNewSubTodoAction, SIGNAL( activated() ),
990 mView, SLOT( newSubTodo() ) ); 992 mView, SLOT( newSubTodo() ) );
991 993
992 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 994 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
993 this ); 995 this );
994 action->addTo( actionMenu ); 996 action->addTo( actionMenu );
995 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 997 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
996 998
997 999
998 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1000 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
999 1001
1000 1002
1001 1003
1002 actionMenu->insertSeparator(); 1004 actionMenu->insertSeparator();
1003 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1005 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1004 this ); 1006 this );
1005 action->addTo( actionMenu ); 1007 action->addTo( actionMenu );
1006 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1008 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1007 1009
1008 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1010 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1009 this ); 1011 this );
1010 action->addTo( actionMenu ); 1012 action->addTo( actionMenu );
1011 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1013 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1012 1014
1013 1015
1014 actionMenu->insertSeparator(); 1016 actionMenu->insertSeparator();
1015 icon = loadPixmap( pathString + "configure" ); 1017 icon = loadPixmap( pathString + "configure" );
1016 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1018 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1017 action->addTo( actionMenu ); 1019 action->addTo( actionMenu );
1018 connect( action, SIGNAL( activated() ), 1020 connect( action, SIGNAL( activated() ),
1019 mView, SLOT( edit_options() ) ); 1021 mView, SLOT( edit_options() ) );
1020 icon = loadPixmap( pathString + "configure" ); 1022 icon = loadPixmap( pathString + "configure" );
1021 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1023 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1022 action->addTo( actionMenu ); 1024 action->addTo( actionMenu );
1023 connect( action, SIGNAL( activated() ), 1025 connect( action, SIGNAL( activated() ),
1024 mView, SLOT( edit_global_options() ) ); 1026 mView, SLOT( edit_global_options() ) );
1025 if ( KOPrefs::instance()->mShowFullMenu ) { 1027 if ( KOPrefs::instance()->mShowFullMenu ) {
1026 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1028 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1027 1029
1028 } 1030 }
1029 // actionMenu->insertSeparator(); 1031 // actionMenu->insertSeparator();
1030 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1032 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1031 this ); 1033 this );
1032 action->addTo( importMenu_X ); 1034 action->addTo( importMenu_X );
1033 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1035 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1034 action = new QAction( "import_quick", i18n("Import last file"), 0, 1036 action = new QAction( "import_quick", i18n("Import last file"), 0,
1035 this ); 1037 this );
1036 action->addTo( importMenu_X ); 1038 action->addTo( importMenu_X );
1037 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1039 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1038 importMenu_X->insertSeparator(); 1040 importMenu_X->insertSeparator();
1039 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1041 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1040 this ); 1042 this );
1041 action->addTo( importMenu_X ); 1043 action->addTo( importMenu_X );
1042 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1044 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1043 //#ifndef DESKTOP_VERSION 1045 //#ifndef DESKTOP_VERSION
1044 importMenu_X->insertSeparator(); 1046 importMenu_X->insertSeparator();
1045 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1047 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1046 this ); 1048 this );
1047 action->addTo( importMenu_X ); 1049 action->addTo( importMenu_X );
1048 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1050 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1049 //#else 1051 //#else
1050#ifdef _OL_IMPORT_ 1052#ifdef _OL_IMPORT_
1051 importMenu_X->insertSeparator(); 1053 importMenu_X->insertSeparator();
1052 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1054 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1053 this ); 1055 this );
1054 action->addTo( importMenu_X ); 1056 action->addTo( importMenu_X );
1055 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1057 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1056#endif 1058#endif
1057 //#endif 1059 //#endif
1058 1060
1059 //importMenu->insertSeparator(); 1061 //importMenu->insertSeparator();
1060#if 0 1062#if 0
1061 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1063 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1062 this ); 1064 this );
1063 action->addTo( importMenu ); 1065 action->addTo( importMenu );
1064 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1066 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1065#endif 1067#endif
1066 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1068 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1067 this ); 1069 this );
1068 action->addTo( importMenu ); 1070 action->addTo( importMenu );
1069 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1071 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1070 importMenu->insertSeparator(); 1072 importMenu->insertSeparator();
1071 importMenu->insertItem( i18n("Import"), importMenu_X ); 1073 importMenu->insertItem( i18n("Import"), importMenu_X );
1072 //importMenu->insertSeparator(); 1074 //importMenu->insertSeparator();
1073 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1075 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1074 this ); 1076 this );
1075 action->addTo( exportMenu_X ); 1077 action->addTo( exportMenu_X );
1076 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1078 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1077 1079
1078 1080
1079 //LR 1081 //LR
1080 QPopupMenu *ex2phone = new QPopupMenu( this ); 1082 QPopupMenu *ex2phone = new QPopupMenu( this );
1081 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1083 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1082 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1084 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1083 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1085 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1084 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1086 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1085 1087
1086 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1088 importMenu->insertItem( i18n("Export"), exportMenu_X );
1087#ifndef DESKTOP_VERSION 1089#ifndef DESKTOP_VERSION
1088 //importMenu->insertSeparator(); 1090 //importMenu->insertSeparator();
1089 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1091 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1090 this ); 1092 this );
1091 brAction->addTo( beamMenu_X ); 1093 brAction->addTo( beamMenu_X );
1092 brAction->setToggleAction (true ) ; 1094 brAction->setToggleAction (true ) ;
1093 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1095 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1094 1096
1095 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1097 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1096 this ); 1098 this );
1097 action->addTo( beamMenu_X ); 1099 action->addTo( beamMenu_X );
1098 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1100 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1099 1101
1100 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1102 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1101 this ); 1103 this );
1102 action->addTo( beamMenu_X ); 1104 action->addTo( beamMenu_X );
1103 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1105 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1104 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1106 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1105#else 1107#else
1106 //importMenu->insertSeparator(); 1108 //importMenu->insertSeparator();
1107 icon = loadPixmap( pathString + "print" ); 1109 icon = loadPixmap( pathString + "print" );
1108 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1110 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1109 action->addTo( beamMenu_X ); 1111 action->addTo( beamMenu_X );
1110 connect( action, SIGNAL( activated() ), 1112 connect( action, SIGNAL( activated() ),
1111 this, SLOT( printCal() ) ); 1113 this, SLOT( printCal() ) );
1112 1114
1113 icon = loadPixmap( pathString + "print" ); 1115 icon = loadPixmap( pathString + "print" );
1114 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1116 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1115 action->addTo( beamMenu_X ); 1117 action->addTo( beamMenu_X );
1116 connect( action, SIGNAL( activated() ), 1118 connect( action, SIGNAL( activated() ),
1117 this, SLOT( printSel() ) ); 1119 this, SLOT( printSel() ) );
1118 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1120 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1119 action->addTo( beamMenu_X ); 1121 action->addTo( beamMenu_X );
1120 connect( action, SIGNAL( activated() ), 1122 connect( action, SIGNAL( activated() ),
1121 mView->viewManager(), SLOT( slotprintWNV() ) ); 1123 mView->viewManager(), SLOT( slotprintWNV() ) );
1122 1124
1123 1125
1124 icon = loadPixmap( pathString + "print" ); 1126 icon = loadPixmap( pathString + "print" );
1125 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1127 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1126 action->addTo( beamMenu_X ); 1128 action->addTo( beamMenu_X );
1127 connect( action, SIGNAL( activated() ), 1129 connect( action, SIGNAL( activated() ),
1128 this, SLOT( printListView() ) ); 1130 this, SLOT( printListView() ) );
1129 1131
1130 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1132 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1131 action->addTo( beamMenu_X ); 1133 action->addTo( beamMenu_X );
1132 connect( action, SIGNAL( activated() ), 1134 connect( action, SIGNAL( activated() ),
1133 mView, SLOT( slotprintSelInc() ) ); 1135 mView, SLOT( slotprintSelInc() ) );
1134 1136
1135 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1137 importMenu->insertItem( i18n("Print"), beamMenu_X );
1136#endif 1138#endif
1137 1139
1138 importMenu->insertSeparator(); 1140 importMenu->insertSeparator();
1139 action = new QAction( "beam all", i18n("Save"), 0, 1141 action = new QAction( "beam all", i18n("Save"), 0,
1140 this ); 1142 this );
1141 action->addTo( importMenu ); 1143 action->addTo( importMenu );
1142 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1144 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1143 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1145 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1144 this ); 1146 this );
1145 action->addTo( importMenu ); 1147 action->addTo( importMenu );
1146 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1148 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1147 1149
1148 //menuBar->insertItem( "Configure",configureMenu ); 1150 //menuBar->insertItem( "Configure",configureMenu );
1149 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1151 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1150 icon = loadPixmap( "korganizer/korganizer" ); 1152 icon = loadPixmap( "korganizer/korganizer" );
1151 1153
1152 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1154 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1153 action->addTo( helpMenu ); 1155 action->addTo( helpMenu );
1154 connect( action, SIGNAL( activated() ), 1156 connect( action, SIGNAL( activated() ),
1155 SLOT( whatsNew() ) ); 1157 SLOT( whatsNew() ) );
1156 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1158 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1157 action->addTo( helpMenu ); 1159 action->addTo( helpMenu );
1158 connect( action, SIGNAL( activated() ), 1160 connect( action, SIGNAL( activated() ),
1159 SLOT( features() ) ); 1161 SLOT( features() ) );
1160 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1162 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1161 action->addTo( helpMenu ); 1163 action->addTo( helpMenu );
1162 connect( action, SIGNAL( activated() ), 1164 connect( action, SIGNAL( activated() ),
1163 SLOT( keyBindings() ) ); 1165 SLOT( keyBindings() ) );
1164 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1166 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1165 action->addTo( helpMenu ); 1167 action->addTo( helpMenu );
1166 connect( action, SIGNAL( activated() ), 1168 connect( action, SIGNAL( activated() ),
1167 SLOT( storagehowto() ) ); 1169 SLOT( storagehowto() ) );
1168 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1170 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1169 action->addTo( helpMenu ); 1171 action->addTo( helpMenu );
1170 connect( action, SIGNAL( activated() ), 1172 connect( action, SIGNAL( activated() ),
1171 SLOT( timetrackinghowto() ) ); 1173 SLOT( timetrackinghowto() ) );
1172 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1174 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1173 action->addTo( helpMenu ); 1175 action->addTo( helpMenu );
1174 connect( action, SIGNAL( activated() ), 1176 connect( action, SIGNAL( activated() ),
1175 SLOT( synchowto() ) ); 1177 SLOT( synchowto() ) );
1176 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1178 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1177 action->addTo( helpMenu ); 1179 action->addTo( helpMenu );
1178 connect( action, SIGNAL( activated() ), 1180 connect( action, SIGNAL( activated() ),
1179 SLOT( kdesynchowto() ) ); 1181 SLOT( kdesynchowto() ) );
1180 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1182 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1181 action->addTo( helpMenu ); 1183 action->addTo( helpMenu );
1182 connect( action, SIGNAL( activated() ), 1184 connect( action, SIGNAL( activated() ),
1183 SLOT( multisynchowto() ) ); 1185 SLOT( multisynchowto() ) );
1184 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1186 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1185 action->addTo( helpMenu ); 1187 action->addTo( helpMenu );
1186 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1187 SLOT( aboutAutoSaving() ) ); 1189 SLOT( aboutAutoSaving() ) );
1188 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1190 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1189 action->addTo( helpMenu ); 1191 action->addTo( helpMenu );
1190 connect( action, SIGNAL( activated() ), 1192 connect( action, SIGNAL( activated() ),
1191 SLOT( aboutKnownBugs() ) ); 1193 SLOT( aboutKnownBugs() ) );
1192 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1194 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1193 action->addTo( helpMenu ); 1195 action->addTo( helpMenu );
1194 connect( action, SIGNAL( activated() ), 1196 connect( action, SIGNAL( activated() ),
1195 SLOT( usertrans() ) ); 1197 SLOT( usertrans() ) );
1196 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1198 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1197 action->addTo( helpMenu ); 1199 action->addTo( helpMenu );
1198 connect( action, SIGNAL( activated() ), 1200 connect( action, SIGNAL( activated() ),
1199 SLOT( faq() ) ); 1201 SLOT( faq() ) );
1200 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1202 action = new QAction( "licence", i18n("Licence..."), 0, this );
1201 action->addTo( helpMenu ); 1203 action->addTo( helpMenu );
1202 connect( action, SIGNAL( activated() ), 1204 connect( action, SIGNAL( activated() ),
1203 SLOT( licence() ) ); 1205 SLOT( licence() ) );
1204 action = new QAction( "about", i18n("About..."), 0, this ); 1206 action = new QAction( "about", i18n("About..."), 0, this );
1205 action->addTo( helpMenu ); 1207 action->addTo( helpMenu );
1206 connect( action, SIGNAL( activated() ), 1208 connect( action, SIGNAL( activated() ),
1207 SLOT( about() ) ); 1209 SLOT( about() ) );
1208 //menuBar->insertSeparator(); 1210 //menuBar->insertSeparator();
1209 1211
1210 // ****************************************************** 1212 // ******************************************************
1211 // menubar icons 1213 // menubar icons
1212 1214
1213 1215
1214 1216
1215 //menuBar->insertItem( iconToolBar ); 1217 //menuBar->insertItem( iconToolBar );
1216 //xdays_action 1218 //xdays_action
1217 if (p-> mShowIconNewEvent) 1219 if (p-> mShowIconNewEvent)
1218 ne_action->addTo( iconToolBar ); 1220 ne_action->addTo( iconToolBar );
1219 if (p->mShowIconNewTodo ) 1221 if (p->mShowIconNewTodo )
1220 nt_action->addTo( iconToolBar ); 1222 nt_action->addTo( iconToolBar );
1221 if (p-> mShowIconSearch) 1223 if (p-> mShowIconSearch)
1222 search_action->addTo( iconToolBar ); 1224 search_action->addTo( iconToolBar );
1223 if (p-> mShowIconWhatsThis) 1225 if (p-> mShowIconWhatsThis)
1224 QWhatsThis::whatsThisButton ( iconToolBar ); 1226 QWhatsThis::whatsThisButton ( iconToolBar );
1225 if (p-> mShowIconNext) 1227 if (p-> mShowIconNext)
1226 whatsnext_action->addTo( viewToolBar ); 1228 whatsnext_action->addTo( viewToolBar );
1227 if (p-> mShowIconNextDays) 1229 if (p-> mShowIconNextDays)
1228 xdays_action->addTo( viewToolBar ); 1230 xdays_action->addTo( viewToolBar );
1229 if (p-> mShowIconJournal) 1231 if (p-> mShowIconJournal)
1230 viewjournal_action->addTo( viewToolBar ); 1232 viewjournal_action->addTo( viewToolBar );
1231 if (p-> mShowIconDay1) 1233 if (p-> mShowIconDay1)
1232 day1_action->addTo( viewToolBar ); 1234 day1_action->addTo( viewToolBar );
1233 if (p-> mShowIconDay5) 1235 if (p-> mShowIconDay5)
1234 day5_action->addTo( viewToolBar ); 1236 day5_action->addTo( viewToolBar );
1235 if (p-> mShowIconDay7) 1237 if (p-> mShowIconDay7)
1236 day7_action->addTo( viewToolBar ); 1238 day7_action->addTo( viewToolBar );
1237 if (p-> mShowIconDay6) 1239 if (p-> mShowIconDay6)
1238 day6_action->addTo( viewToolBar ); 1240 day6_action->addTo( viewToolBar );
1239 if (p-> mShowIconMonth) 1241 if (p-> mShowIconMonth)
1240 month_action->addTo( viewToolBar ); 1242 month_action->addTo( viewToolBar );
1241 if (p-> mShowIconList) 1243 if (p-> mShowIconList)
1242 showlist_action->addTo( viewToolBar ); 1244 showlist_action->addTo( viewToolBar );
1243 if (p-> mShowIconTodoview) 1245 if (p-> mShowIconTodoview)
1244 todoview_action->addTo( viewToolBar ); 1246 todoview_action->addTo( viewToolBar );
1245 1247
1246 icon = loadPixmap( pathString + "2leftarrowB" ); 1248 icon = loadPixmap( pathString + "2leftarrowB" );
1247 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1249 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1248 if (p-> mShowIconBackFast) { 1250 if (p-> mShowIconBackFast) {
1249 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1251 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1250 connect( action, SIGNAL( activated() ), 1252 connect( action, SIGNAL( activated() ),
1251 mView, SLOT( goPreviousMonth() ) ); 1253 mView, SLOT( goPreviousMonth() ) );
1252 action->addTo( navigatorToolBar ); 1254 action->addTo( navigatorToolBar );
1253 } 1255 }
1254 icon = loadPixmap( pathString + "1leftarrowB" ); 1256 icon = loadPixmap( pathString + "1leftarrowB" );
1255 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1257 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1256 if (p-> mShowIconBack) { 1258 if (p-> mShowIconBack) {
1257 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1259 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1258 connect( action, SIGNAL( activated() ), 1260 connect( action, SIGNAL( activated() ),
1259 mView, SLOT( goPrevious() ) ); 1261 mView, SLOT( goPrevious() ) );
1260 action->addTo( navigatorToolBar ); 1262 action->addTo( navigatorToolBar );
1261 } 1263 }
1262 icon = loadPixmap( pathString + "today" ); 1264 icon = loadPixmap( pathString + "today" );
1263 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1265 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1264 if (p-> mShowIconToday) 1266 if (p-> mShowIconToday)
1265 today_action->addTo( navigatorToolBar ); 1267 today_action->addTo( navigatorToolBar );
1266 icon = loadPixmap( pathString + "1rightarrowB" ); 1268 icon = loadPixmap( pathString + "1rightarrowB" );
1267 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1269 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1268 if (p-> mShowIconForward) { 1270 if (p-> mShowIconForward) {
1269 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1271 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1270 connect( action, SIGNAL( activated() ), 1272 connect( action, SIGNAL( activated() ),
1271 mView, SLOT( goNext() ) ); 1273 mView, SLOT( goNext() ) );
1272 action->addTo( navigatorToolBar ); 1274 action->addTo( navigatorToolBar );
1273 } 1275 }
1274 icon = loadPixmap( pathString + "2rightarrowB" ); 1276 icon = loadPixmap( pathString + "2rightarrowB" );
1275 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1277 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1276 if (p-> mShowIconForwardFast) { 1278 if (p-> mShowIconForwardFast) {
1277 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1279 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1278 connect( action, SIGNAL( activated() ), 1280 connect( action, SIGNAL( activated() ),
1279 mView, SLOT( goNextMonth() ) ); 1281 mView, SLOT( goNextMonth() ) );
1280 action->addTo( navigatorToolBar ); 1282 action->addTo( navigatorToolBar );
1281 } 1283 }
1282 1284
1283 1285
1284 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1286 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1285 1287
1286 1288
1287 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1289 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1288 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1290 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1289 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1291 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1290 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1292 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1291 1293
1292 if (p-> mShowIconNewEvent) 1294 if (p-> mShowIconNewEvent)
1293 configureToolBarMenu->setItemChecked( 10, true ); 1295 configureToolBarMenu->setItemChecked( 10, true );
1294 if (p->mShowIconNewTodo ) 1296 if (p->mShowIconNewTodo )
1295 configureToolBarMenu->setItemChecked( 20, true ); 1297 configureToolBarMenu->setItemChecked( 20, true );
1296 if (p-> mShowIconSearch) 1298 if (p-> mShowIconSearch)
1297 configureToolBarMenu->setItemChecked( 120, true ); 1299 configureToolBarMenu->setItemChecked( 120, true );
1298 if (p-> mShowIconList) 1300 if (p-> mShowIconList)
1299 configureToolBarMenu->setItemChecked( 30, true ); 1301 configureToolBarMenu->setItemChecked( 30, true );
1300 if (p-> mShowIconDay1) 1302 if (p-> mShowIconDay1)
1301 configureToolBarMenu->setItemChecked( 40, true ); 1303 configureToolBarMenu->setItemChecked( 40, true );
1302 if (p-> mShowIconDay5) 1304 if (p-> mShowIconDay5)
1303 configureToolBarMenu->setItemChecked( 50, true ); 1305 configureToolBarMenu->setItemChecked( 50, true );
1304 if (p-> mShowIconDay6) 1306 if (p-> mShowIconDay6)
1305 configureToolBarMenu->setItemChecked( 75, true ); 1307 configureToolBarMenu->setItemChecked( 75, true );
1306 if (p-> mShowIconDay7) 1308 if (p-> mShowIconDay7)
1307 configureToolBarMenu->setItemChecked( 60, true ); 1309 configureToolBarMenu->setItemChecked( 60, true );
1308 if (p-> mShowIconMonth) 1310 if (p-> mShowIconMonth)
1309 configureToolBarMenu->setItemChecked( 70, true ); 1311 configureToolBarMenu->setItemChecked( 70, true );
1310 if (p-> mShowIconTodoview) 1312 if (p-> mShowIconTodoview)
1311 configureToolBarMenu->setItemChecked( 80, true ); 1313 configureToolBarMenu->setItemChecked( 80, true );
1312 if (p-> mShowIconBackFast) 1314 if (p-> mShowIconBackFast)
1313 configureToolBarMenu->setItemChecked( 200, true ); 1315 configureToolBarMenu->setItemChecked( 200, true );
1314 if (p-> mShowIconBack) 1316 if (p-> mShowIconBack)
1315 configureToolBarMenu->setItemChecked( 210, true ); 1317 configureToolBarMenu->setItemChecked( 210, true );
1316 if (p-> mShowIconToday) 1318 if (p-> mShowIconToday)
1317 configureToolBarMenu->setItemChecked( 130, true ); 1319 configureToolBarMenu->setItemChecked( 130, true );
1318 if (p-> mShowIconForward) 1320 if (p-> mShowIconForward)
1319 configureToolBarMenu->setItemChecked( 220, true ); 1321 configureToolBarMenu->setItemChecked( 220, true );
1320 if (p-> mShowIconForwardFast) 1322 if (p-> mShowIconForwardFast)
1321 configureToolBarMenu->setItemChecked( 230, true ); 1323 configureToolBarMenu->setItemChecked( 230, true );
1322 if (p-> mShowIconNextDays) 1324 if (p-> mShowIconNextDays)
1323 configureToolBarMenu->setItemChecked( 100, true ); 1325 configureToolBarMenu->setItemChecked( 100, true );
1324 if (p-> mShowIconNext) 1326 if (p-> mShowIconNext)
1325 configureToolBarMenu->setItemChecked( 110, true ); 1327 configureToolBarMenu->setItemChecked( 110, true );
1326 if (p-> mShowIconJournal) 1328 if (p-> mShowIconJournal)
1327 configureToolBarMenu->setItemChecked( 90, true ); 1329 configureToolBarMenu->setItemChecked( 90, true );
1328 if (p-> mShowIconWhatsThis) 1330 if (p-> mShowIconWhatsThis)
1329 configureToolBarMenu->setItemChecked( 300, true ); 1331 configureToolBarMenu->setItemChecked( 300, true );
1330 if (p-> mShowIconWeekNum) 1332 if (p-> mShowIconWeekNum)
1331 configureToolBarMenu->setItemChecked( 400, true ); 1333 configureToolBarMenu->setItemChecked( 400, true );
1332 if (!p-> mShowIconStretch) { 1334 if (!p-> mShowIconStretch) {
1333 QLabel* dummy = new QLabel( iconToolBar ); 1335 QLabel* dummy = new QLabel( iconToolBar );
1334 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1336 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1335 dummy->setMinimumWidth( 0 ); 1337 dummy->setMinimumWidth( 0 );
1336 iconToolBar->setStretchableWidget ( dummy ) ; 1338 iconToolBar->setStretchableWidget ( dummy ) ;
1337 } 1339 }
1338 else { 1340 else {
1339 iconToolBar->setHorizontalStretchable (true ); 1341 iconToolBar->setHorizontalStretchable (true );
1340 viewToolBar->setHorizontalStretchable (true ); 1342 viewToolBar->setHorizontalStretchable (true );
1341 navigatorToolBar->setHorizontalStretchable (true ); 1343 navigatorToolBar->setHorizontalStretchable (true );
1342 iconToolBar->setVerticalStretchable (true ); 1344 iconToolBar->setVerticalStretchable (true );
1343 viewToolBar->setVerticalStretchable (true ); 1345 viewToolBar->setVerticalStretchable (true );
1344 navigatorToolBar->setVerticalStretchable (true ); 1346 navigatorToolBar->setVerticalStretchable (true );
1345 configureToolBarMenu->setItemChecked( 5, true ); 1347 configureToolBarMenu->setItemChecked( 5, true );
1346 } 1348 }
1347 if (p-> mShowIconFilter) 1349 if (p-> mShowIconFilter)
1348 configureToolBarMenu->setItemChecked( 7, true ); 1350 configureToolBarMenu->setItemChecked( 7, true );
1349 if (p-> mShowIconOnetoolbar) 1351 if (p-> mShowIconOnetoolbar)
1350 configureToolBarMenu->setItemChecked( 6, true ); 1352 configureToolBarMenu->setItemChecked( 6, true );
1351 1353
1352 1354
1353 if ( filterMenubar ) { 1355 if ( filterMenubar ) {
1354 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1356 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1355 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1357 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1356 } 1358 }
1357 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1359 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1358 configureAgenda( p->mHourSize ); 1360 configureAgenda( p->mHourSize );
1359 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1361 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1360} 1362}
1361 1363
1362void MainWindow::exportToPhone( int mode ) 1364void MainWindow::exportToPhone( int mode )
1363{ 1365{
1364 1366
1365 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1367 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1366 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1368 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1367 KOex2phonePrefs ex2phone; 1369 KOex2phonePrefs ex2phone;
1368 1370
1369 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1371 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1370 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1372 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1371 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1373 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1372 if ( mode == 1 ) 1374 if ( mode == 1 )
1373 ex2phone.setCaption(i18n("Export complete calendar")); 1375 ex2phone.setCaption(i18n("Export complete calendar"));
1374 if ( mode == 2 ) 1376 if ( mode == 2 )
1375 ex2phone.setCaption(i18n("Export filtered calendar")); 1377 ex2phone.setCaption(i18n("Export filtered calendar"));
1376 1378
1377 if ( !ex2phone.exec() ) { 1379 if ( !ex2phone.exec() ) {
1378 return; 1380 return;
1379 } 1381 }
1380 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1382 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1381 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1383 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1382 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1384 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1383 1385
1384 int inFuture = 0; 1386 int inFuture = 0;
1385 if ( ex2phone.mWriteBackFuture->isChecked() ) 1387 if ( ex2phone.mWriteBackFuture->isChecked() )
1386 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1388 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1387 QPtrList<Incidence> delSel; 1389 QPtrList<Incidence> delSel;
1388 if ( mode == 1 ) 1390 if ( mode == 1 )
1389 delSel = mCalendar->rawIncidences(); 1391 delSel = mCalendar->rawIncidences();
1390 if ( mode == 2 ) 1392 if ( mode == 2 )
1391 delSel = mCalendar->incidences(); 1393 delSel = mCalendar->incidences();
1392 CalendarLocal* cal = new CalendarLocal(); 1394 CalendarLocal* cal = new CalendarLocal();
1393 cal->setLocalTime(); 1395 cal->setLocalTime();
1394 Incidence *incidence = delSel.first(); 1396 Incidence *incidence = delSel.first();
1395 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1397 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1396 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1398 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1397 while ( incidence ) { 1399 while ( incidence ) {
1398 if ( incidence->typeID() != journalID ) { 1400 if ( incidence->typeID() != journalID ) {
1399 bool add = true; 1401 bool add = true;
1400 if ( inFuture ) { 1402 if ( inFuture ) {
1401 QDateTime dt; 1403 QDateTime dt;
1402 if ( incidence->typeID() == todoID ) { 1404 if ( incidence->typeID() == todoID ) {
1403 Todo * t = (Todo*)incidence; 1405 Todo * t = (Todo*)incidence;
1404 if ( t->hasDueDate() ) 1406 if ( t->hasDueDate() )
1405 dt = t->dtDue(); 1407 dt = t->dtDue();
1406 else 1408 else
1407 dt = cur.addSecs( 62 ); 1409 dt = cur.addSecs( 62 );
1408 } 1410 }
1409 else { 1411 else {
1410 bool ok; 1412 bool ok;
1411 dt = incidence->getNextOccurence( cur, &ok ); 1413 dt = incidence->getNextOccurence( cur, &ok );
1412 if ( !ok ) 1414 if ( !ok )
1413 dt = cur.addSecs( -62 ); 1415 dt = cur.addSecs( -62 );
1414 } 1416 }
1415 if ( dt < cur || dt > end ) { 1417 if ( dt < cur || dt > end ) {
1416 add = false; 1418 add = false;
1417 } 1419 }
1418 } 1420 }
1419 if ( add ) { 1421 if ( add ) {
1420 Incidence *in = incidence->clone(); 1422 Incidence *in = incidence->clone();
1421 cal->addIncidence( in ); 1423 cal->addIncidence( in );
1422 } 1424 }
1423 } 1425 }
1424 incidence = delSel.next(); 1426 incidence = delSel.next();
1425 } 1427 }
1426 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1428 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1427 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1429 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1428 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1430 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1429 1431
1430 setCaption( i18n("Writing to phone...")); 1432 setCaption( i18n("Writing to phone..."));
1431 if ( PhoneFormat::writeToPhone( cal ) ) 1433 if ( PhoneFormat::writeToPhone( cal ) )
1432 setCaption( i18n("Export to phone successful!")); 1434 setCaption( i18n("Export to phone successful!"));
1433 else 1435 else
1434 setCaption( i18n("Error exporting to phone!")); 1436 setCaption( i18n("Error exporting to phone!"));
1435 delete cal; 1437 delete cal;
1436} 1438}
1437 1439
1438 1440
1439void MainWindow::setDefaultPreferences() 1441void MainWindow::setDefaultPreferences()
1440{ 1442{
1441 KOPrefs *p = KOPrefs::instance(); 1443 KOPrefs *p = KOPrefs::instance();
1442 1444
1443 p->mCompactDialogs = true; 1445 p->mCompactDialogs = true;
1444 p->mConfirm = true; 1446 p->mConfirm = true;
1445 // p->mEnableQuickTodo = false; 1447 // p->mEnableQuickTodo = false;
1446 1448
1447} 1449}
1448 1450
1449QString MainWindow::resourcePath() 1451QString MainWindow::resourcePath()
1450{ 1452{
1451 return KGlobal::iconLoader()->iconPath(); 1453 return KGlobal::iconLoader()->iconPath();
1452} 1454}
1453 1455
1454void MainWindow::displayText( QString text ,QString cap ) 1456void MainWindow::displayText( QString text ,QString cap )
1455{ 1457{
1456 QDialog dia( this, "name", true ); ; 1458 QDialog dia( this, "name", true ); ;
1457 dia.setCaption( cap ); 1459 dia.setCaption( cap );
1458 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1460 QVBoxLayout* lay = new QVBoxLayout( &dia );
1459 lay->setSpacing( 3 ); 1461 lay->setSpacing( 3 );
1460 lay->setMargin( 3 ); 1462 lay->setMargin( 3 );
1461 QTextBrowser tb ( &dia ); 1463 QTextBrowser tb ( &dia );
1462 lay->addWidget( &tb ); 1464 lay->addWidget( &tb );
1463 tb.setText( text ); 1465 tb.setText( text );
1464#ifdef DESKTOP_VERSION 1466#ifdef DESKTOP_VERSION
1465 dia.resize( 640, 480); 1467 dia.resize( 640, 480);
1466#else 1468#else
1467 dia.showMaximized(); 1469 dia.showMaximized();
1468#endif 1470#endif
1469 dia.exec(); 1471 dia.exec();
1470} 1472}
1471 1473
1472void MainWindow::features() 1474void MainWindow::features()
1473{ 1475{
1474 1476
1475 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1477 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1476} 1478}
1477 1479
1478void MainWindow::usertrans() 1480void MainWindow::usertrans()
1479{ 1481{
1480 1482
1481 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1483 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1482} 1484}
1483 1485
1484void MainWindow::storagehowto() 1486void MainWindow::storagehowto()
1485{ 1487{
1486 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1488 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1487} 1489}
1488void MainWindow::timetrackinghowto() 1490void MainWindow::timetrackinghowto()
1489{ 1491{
1490 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1492 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1491} 1493}
1492void MainWindow::kdesynchowto() 1494void MainWindow::kdesynchowto()
1493{ 1495{
1494 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1496 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1495} 1497}
1496void MainWindow::multisynchowto() 1498void MainWindow::multisynchowto()
1497{ 1499{
1498 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1500 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1499} 1501}
1500void MainWindow::synchowto() 1502void MainWindow::synchowto()
1501{ 1503{
1502 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1504 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1503} 1505}
1504void MainWindow::faq() 1506void MainWindow::faq()
1505{ 1507{
1506 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1508 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1507 1509
1508} 1510}
1509void MainWindow::whatsNew() 1511void MainWindow::whatsNew()
1510{ 1512{
1511 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1513 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1512 1514
1513} 1515}
1514void MainWindow::licence() 1516void MainWindow::licence()
1515{ 1517{
1516 KApplication::showLicence(); 1518 KApplication::showLicence();
1517 1519
1518} 1520}
1519void MainWindow::about() 1521void MainWindow::about()
1520{ 1522{
1521 QString version; 1523 QString version;
1522#include <../version> 1524#include <../version>
1523 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1525 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1524 i18n("KOrganizer/Platform-independent\n") + 1526 i18n("KOrganizer/Platform-independent\n") +
1525 "(KO/Pi) " + version + " - " + 1527 "(KO/Pi) " + version + " - " +
1526 1528
1527#ifdef DESKTOP_VERSION 1529#ifdef DESKTOP_VERSION
1528 i18n("Desktop Edition\n") + 1530 i18n("Desktop Edition\n") +
1529#else 1531#else
1530 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1532 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1531#endif 1533#endif
1532 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1534 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1533} 1535}
1534void MainWindow::keyBindings() 1536void MainWindow::keyBindings()
1535{ 1537{
1536 QString cap = i18n("KO/Pi Keys + Colors"); 1538 QString cap = i18n("KO/Pi Keys + Colors");
1537 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1539 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1538 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1540 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1539 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1541 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1540 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1542 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1541 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1543 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1542 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1544 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1543 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1545 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1544 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1546 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1545 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1547 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1546 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1548 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1547 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1549 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1548 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1550 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1549 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1551 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1550 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1552 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1551 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1553 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1552 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1554 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1553 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1555 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1554 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1556 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1555 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1557 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1556 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1558 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1557 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1559 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1558 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1560 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1559 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1561 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1560 i18n("<p><h3>In agenda view:</h3></p>\n") + 1562 i18n("<p><h3>In agenda view:</h3></p>\n") +
1561 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1563 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1562 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1564 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1563 i18n("<p><h3>In todo view:</h3></p>\n") + 1565 i18n("<p><h3>In todo view:</h3></p>\n") +
1564 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1566 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1565 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1567 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1566 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1568 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1567 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1569 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1568 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1570 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1569 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1571 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1570 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1572 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1571 i18n("<p><h3>In list view:</h3></p>\n") + 1573 i18n("<p><h3>In list view:</h3></p>\n") +
1572 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1574 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1573 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1575 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1574 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1576 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1575 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1577 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1576 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1578 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1577 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1579 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1578 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1580 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1579 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1581 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1580 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1582 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1581 i18n("<p><b>E</b>: Edit item</p>\n") + 1583 i18n("<p><b>E</b>: Edit item</p>\n") +
1582 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1584 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1583 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1585 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1584 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1586 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1585 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1587 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1586 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1588 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1587 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1589 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1588 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1590 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1589 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1591 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1590 i18n("<p><b>White</b>: Item readonly</p>\n"); 1592 i18n("<p><b>White</b>: Item readonly</p>\n");
1591 displayText( text, cap); 1593 displayText( text, cap);
1592} 1594}
1593void MainWindow::aboutAutoSaving() 1595void MainWindow::aboutAutoSaving()
1594{ 1596{
1595 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1597 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1596 1598
1597 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1599 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1598 1600
1599} 1601}
1600void MainWindow::aboutKnownBugs() 1602void MainWindow::aboutKnownBugs()
1601{ 1603{
1602 QMessageBox* msg; 1604 QMessageBox* msg;
1603 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1605 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1604 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1606 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1605 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1607 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1606 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1608 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1607 i18n("\nor report them in the bugtracker on\n") + 1609 i18n("\nor report them in the bugtracker on\n") +
1608 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1610 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1609 QMessageBox::NoIcon, 1611 QMessageBox::NoIcon,
1610 QMessageBox::Ok, 1612 QMessageBox::Ok,
1611 QMessageBox::NoButton, 1613 QMessageBox::NoButton,
1612 QMessageBox::NoButton); 1614 QMessageBox::NoButton);
1613 msg->exec(); 1615 msg->exec();
1614 delete msg; 1616 delete msg;
1615 1617
1616} 1618}
1617 1619
1618QString MainWindow::defaultFileName() 1620QString MainWindow::defaultFileName()
1619{ 1621{
1620 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1622 return locateLocal( "data", "korganizer/mycalendar.ics" );
1621} 1623}
1622QString MainWindow::syncFileName() 1624QString MainWindow::syncFileName()
1623{ 1625{
1624#ifdef DESKTOP_VERSION 1626#ifdef DESKTOP_VERSION
1625 return locateLocal( "tmp", "synccalendar.ics" ); 1627 return locateLocal( "tmp", "synccalendar.ics" );
1626#else 1628#else
1627 return QString( "/tmp/synccalendar.ics" ); 1629 return QString( "/tmp/synccalendar.ics" );
1628#endif 1630#endif
1629} 1631}
1630#include "koglobals.h" 1632#include "koglobals.h"
1631#include <kcalendarsystem.h> 1633#include <kcalendarsystem.h>
1632void MainWindow::updateWeek(QDate seda) 1634void MainWindow::updateWeek(QDate seda)
1633{ 1635{
1634 int weekNum = KGlobal::locale()->weekNum ( seda ); 1636 int weekNum = KGlobal::locale()->weekNum ( seda );
1635 mWeekPixmap.fill( mWeekBgColor ); 1637 mWeekPixmap.fill( mWeekBgColor );
1636 QPainter p ( &mWeekPixmap ); 1638 QPainter p ( &mWeekPixmap );
1637 p.setFont( mWeekFont ); 1639 p.setFont( mWeekFont );
1638 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1640 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1639 p.end(); 1641 p.end();
1640 QIconSet icon3 ( mWeekPixmap ); 1642 QIconSet icon3 ( mWeekPixmap );
1641 mWeekAction->setIconSet ( icon3 ); 1643 mWeekAction->setIconSet ( icon3 );
1642 1644
1643} 1645}
1644void MainWindow::updateWeekNum(const DateList &selectedDates) 1646void MainWindow::updateWeekNum(const DateList &selectedDates)
1645{ 1647{
1646 updateWeek( selectedDates.first() ); 1648 updateWeek( selectedDates.first() );
1647} 1649}
1648void MainWindow::processIncidenceSelection( Incidence *incidence ) 1650void MainWindow::processIncidenceSelection( Incidence *incidence )
1649{ 1651{
1650
1651 if ( !incidence ) { 1652 if ( !incidence ) {
1653 mShowAction->setMenuText( i18n("Show") );
1652 enableIncidenceActions( false ); 1654 enableIncidenceActions( false );
1653
1654 mNewSubTodoAction->setEnabled( false ); 1655 mNewSubTodoAction->setEnabled( false );
1655 setCaptionToDates(); 1656 setCaptionToDates();
1656 return; 1657 return;
1657
1658 } 1658 }
1659
1660 //KGlobal::locale()->formatDateTime(nextA, true);
1661 QString startString = ""; 1659 QString startString = "";
1662 if ( incidence->typeID() != todoID ) { 1660 if ( incidence->typeID() != todoID ) {
1663 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1661 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1664 if ( incidence->doesFloat() ) { 1662 if ( incidence->doesFloat() ) {
1665 startString += ": "+incidence->dtStartDateStr( true ); 1663 startString += ": "+incidence->dtStartDateStr( true );
1666 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1664 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1667
1668 } else { 1665 } else {
1669 startString = ": "+incidence->dtStartStr(true); 1666 startString = ": "+incidence->dtStartStr(true);
1670 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1667 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1671
1672 } 1668 }
1673
1674 } else { 1669 } else {
1675 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1670 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1676 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1671 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1677 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1672 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1678
1679 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1673 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1680 bool ok; 1674 bool ok;
1681 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1675 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1682 if ( ok ) { 1676 if ( ok ) {
1683 int years = noc.date().year() - incidence->dtStart().date().year(); 1677 int years = noc.date().year() - incidence->dtStart().date().year();
1684 startString += i18n(" (%1 y.)"). arg( years ); 1678 startString += i18n(" (%1 y.)"). arg( years );
1685 } 1679 }
1686 } 1680 }
1687 else 1681 else
1688 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1682 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1689 } 1683 }
1690
1691 } 1684 }
1692 else 1685 else
1693 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1686 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1694 if ( !incidence->location().isEmpty() ) 1687 if ( !incidence->location().isEmpty() )
1695 startString += " (" +incidence->location()+")"; 1688 startString += " (" +incidence->location()+")";
1696 setCaption( incidence->summary()+startString); 1689 setCaption( incidence->summary()+startString);
1697
1698 enableIncidenceActions( true ); 1690 enableIncidenceActions( true );
1699
1700 if ( incidence->typeID() == eventID ) { 1691 if ( incidence->typeID() == eventID ) {
1701 mShowAction->setText( i18n("Show Event...") ); 1692 mShowAction->setMenuText( i18n("Show Event") );
1702 mEditAction->setText( i18n("Edit Event...") );
1703 mDeleteAction->setText( i18n("Delete Event...") );
1704
1705 mNewSubTodoAction->setEnabled( false ); 1693 mNewSubTodoAction->setEnabled( false );
1706 } else if ( incidence->typeID() == todoID ) { 1694 } else if ( incidence->typeID() == todoID ) {
1707 mShowAction->setText( i18n("Show Todo...") ); 1695 mShowAction->setMenuText( i18n("Show Todo") );
1708 mEditAction->setText( i18n("Edit Todo...") );
1709 mDeleteAction->setText( i18n("Delete Todo...") );
1710
1711 mNewSubTodoAction->setEnabled( true ); 1696 mNewSubTodoAction->setEnabled( true );
1712 } else { 1697 } else {
1713 mShowAction->setText( i18n("Show...") ); 1698 mShowAction->setMenuText( i18n("Show") );
1714 mShowAction->setText( i18n("Edit...") );
1715 mShowAction->setText( i18n("Delete...") );
1716
1717 mNewSubTodoAction->setEnabled( false ); 1699 mNewSubTodoAction->setEnabled( false );
1718 } 1700 }
1719} 1701}
1720 1702
1721void MainWindow::enableIncidenceActions( bool enabled ) 1703void MainWindow::enableIncidenceActions( bool enabled )
1722{ 1704{
1723 mShowAction->setEnabled( enabled ); 1705 mShowAction->setEnabled( enabled );
1724 mEditAction->setEnabled( enabled ); 1706 mEditAction->setEnabled( enabled );
1725 mDeleteAction->setEnabled( enabled ); 1707 mDeleteAction->setEnabled( enabled );
1726 1708
1727 mCloneAction->setEnabled( enabled ); 1709 mCloneAction->setEnabled( enabled );
1728 mMoveAction->setEnabled( enabled ); 1710 mMoveAction->setEnabled( enabled );
1711#ifndef DESKTOP_VERSION
1729 mBeamAction->setEnabled( enabled ); 1712 mBeamAction->setEnabled( enabled );
1713#endif
1730 mCancelAction->setEnabled( enabled ); 1714 mCancelAction->setEnabled( enabled );
1731} 1715}
1732 1716
1733void MainWindow::importOL() 1717void MainWindow::importOL()
1734{ 1718{
1735#ifdef _OL_IMPORT_ 1719#ifdef _OL_IMPORT_
1736 mView->clearAllViews(); 1720 mView->clearAllViews();
1737 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1721 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1738 id->exec(); 1722 id->exec();
1739 delete id; 1723 delete id;
1740 mView->calendar()->checkAlarmForIncidence( 0, true ); 1724 mView->calendar()->checkAlarmForIncidence( 0, true );
1741 mView->updateView(); 1725 mView->updateView();
1742#endif 1726#endif
1743} 1727}
1744void MainWindow::importBday() 1728void MainWindow::importBday()
1745{ 1729{
1746 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1730 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1747 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1731 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1748 i18n("Import!"), i18n("Cancel"), 0, 1732 i18n("Import!"), i18n("Cancel"), 0,
1749 0, 1 ); 1733 0, 1 );
1750 if ( result == 0 ) { 1734 if ( result == 0 ) {
1751 mView->importBday(); 1735 mView->importBday();
1752 1736
1753 } 1737 }
1754 1738
1755 1739
1756} 1740}
1757void MainWindow::importQtopia() 1741void MainWindow::importQtopia()
1758{ 1742{
1759 //#ifndef DESKTOP_VERSION 1743 //#ifndef DESKTOP_VERSION
1760 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1744 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1761#ifdef DESKTOP_VERSION 1745#ifdef DESKTOP_VERSION
1762 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1746 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1763#endif 1747#endif
1764 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1748 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1765 i18n("Import!"), i18n("Cancel"), 0, 1749 i18n("Import!"), i18n("Cancel"), 0,
1766 0, 1 ); 1750 0, 1 );
1767 if ( result == 0 ) { 1751 if ( result == 0 ) {
1768#ifndef DESKTOP_VERSION 1752#ifndef DESKTOP_VERSION
1769 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1753 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1770 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1754 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1771 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1755 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1772#else 1756#else
1773 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1757 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1774 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1758 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1775 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1759 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1776#endif 1760#endif
1777 mView->importQtopia( categories, datebook, todolist ); 1761 mView->importQtopia( categories, datebook, todolist );
1778 } 1762 }
1779 mView->calendar()->reInitAlarmSettings(); 1763 mView->calendar()->reInitAlarmSettings();
1780#if 0 1764#if 0
1781 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1765 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1782 i18n("Not supported \non desktop!\n"), 1766 i18n("Not supported \non desktop!\n"),
1783 i18n("Ok"), i18n("Cancel"), 0, 1767 i18n("Ok"), i18n("Cancel"), 0,
1784 0, 1 ); 1768 0, 1 );
1785 1769
1786#endif 1770#endif
1787} 1771}
1788 1772
1789void MainWindow::saveOnClose() 1773void MainWindow::saveOnClose()
1790{ 1774{
1791 KOPrefs *p = KOPrefs::instance(); 1775 KOPrefs *p = KOPrefs::instance();
1792 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1776 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1793 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1777 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1794 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1778 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1795 if ( filterToolBar ) { 1779 if ( filterToolBar ) {
1796 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1780 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1797 } 1781 }
1798#ifdef DESKTOP_VERSION 1782#ifdef DESKTOP_VERSION
1799 1783
1800 QPoint myP; 1784 QPoint myP;
1801 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1785 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1802 if ( p->mToolBarHor ) 1786 if ( p->mToolBarHor )
1803 p->mToolBarUp = myP.y() > height()/2; 1787 p->mToolBarUp = myP.y() > height()/2;
1804 else 1788 else
1805 p->mToolBarUp = myP.x() > width()/2; 1789 p->mToolBarUp = myP.x() > width()/2;
1806 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1790 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1807 if ( p->mToolBarHorV ) 1791 if ( p->mToolBarHorV )
1808 p->mToolBarUpV = myP.y() > height()/2; 1792 p->mToolBarUpV = myP.y() > height()/2;
1809 else 1793 else
1810 p->mToolBarUpV = myP.x() > width()/2 ; 1794 p->mToolBarUpV = myP.x() > width()/2 ;
1811 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1795 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1812 if ( p->mToolBarHorN ) 1796 if ( p->mToolBarHorN )
1813 p->mToolBarUpN = myP.y() > height()/2; 1797 p->mToolBarUpN = myP.y() > height()/2;
1814 else 1798 else
1815 p->mToolBarUpN = myP.x() > width()/2 ; 1799 p->mToolBarUpN = myP.x() > width()/2 ;
1816 if ( filterToolBar ) { 1800 if ( filterToolBar ) {
1817 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1801 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1818 if ( p->mToolBarHorF ) 1802 if ( p->mToolBarHorF )
1819 p->mToolBarUpF = myP.y() > height()/2; 1803 p->mToolBarUpF = myP.y() > height()/2;
1820 else 1804 else
1821 p->mToolBarUpF = myP.x() > width()/2 ; 1805 p->mToolBarUpF = myP.x() > width()/2 ;
1822 } 1806 }
1823#else 1807#else
1824 if ( p->mToolBarHor ) 1808 if ( p->mToolBarHor )
1825 p->mToolBarUp = iconToolBar->y() > height()/2; 1809 p->mToolBarUp = iconToolBar->y() > height()/2;
1826 else 1810 else
1827 p->mToolBarUp = iconToolBar->x() > width()/2; 1811 p->mToolBarUp = iconToolBar->x() > width()/2;
1828 if ( p->mToolBarHorV ) 1812 if ( p->mToolBarHorV )
1829 p->mToolBarUpV = viewToolBar->y() > height()/2; 1813 p->mToolBarUpV = viewToolBar->y() > height()/2;
1830 else 1814 else
1831 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1815 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1832 1816
1833 if ( p->mToolBarHorN ) 1817 if ( p->mToolBarHorN )
1834 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1818 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1835 else 1819 else
1836 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1820 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1837 if ( filterToolBar ) { 1821 if ( filterToolBar ) {
1838 if ( p->mToolBarHorF ) 1822 if ( p->mToolBarHorF )
1839 p->mToolBarUpF = filterToolBar->y() > height()/2; 1823 p->mToolBarUpF = filterToolBar->y() > height()/2;
1840 else 1824 else
1841 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1825 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1842 } 1826 }
1843#endif 1827#endif
1844 save(); 1828 save();
1845 mView->writeSettings(); 1829 mView->writeSettings();
1846 mView->checkSuspendAlarm(); 1830 mView->checkSuspendAlarm();
1847} 1831}
1848void MainWindow::slotModifiedChanged( bool ) 1832void MainWindow::slotModifiedChanged( bool )
1849{ 1833{
1850 if ( mBlockAtStartup ) 1834 if ( mBlockAtStartup )
1851 return; 1835 return;
1852 1836
1853 int msec; 1837 int msec;
1854 // we store the changes after 1 minute, 1838 // we store the changes after 1 minute,
1855 // and for safety reasons after 10 minutes again 1839 // and for safety reasons after 10 minutes again
1856 if ( !mSyncManager->blockSave() ) 1840 if ( !mSyncManager->blockSave() )
1857 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1841 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1858 else 1842 else
1859 msec = 1000 * 600; 1843 msec = 1000 * 600;
1860 mSaveTimer.start( msec, true ); // 1 minute 1844 mSaveTimer.start( msec, true ); // 1 minute
1861 qDebug("KO: Saving File in %d secs!", msec/1000); 1845 qDebug("KO: Saving File in %d secs!", msec/1000);
1862 mCalendarModifiedFlag = true; 1846 mCalendarModifiedFlag = true;
1863} 1847}
1864void MainWindow::saveStopTimer() 1848void MainWindow::saveStopTimer()
1865{ 1849{
1866 mSaveTimer.stop(); 1850 mSaveTimer.stop();
1867} 1851}
1868void MainWindow::backupAllFiles() 1852void MainWindow::backupAllFiles()
1869{ 1853{
1870 QDate reference ( 2000,1,1); 1854 QDate reference ( 2000,1,1);
1871 int daysTo = reference.daysTo ( QDate::currentDate() ); 1855 int daysTo = reference.daysTo ( QDate::currentDate() );
1872 setCaption(i18n("Creating backup ... please wait ..." )); 1856 setCaption(i18n("Creating backup ... please wait ..." ));
1873 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1857 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1874 // we need the file path, the backup dir and the number of bups as param 1858 // we need the file path, the backup dir and the number of bups as param
1875 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1859 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1876 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1860 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1877 bupDir = KGlobalSettings::backupDataDir(); 1861 bupDir = KGlobalSettings::backupDataDir();
1878 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1862 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1879 if ( retval == 0 ) { 1863 if ( retval == 0 ) {
1880 setCaption(i18n("Backup cancelled" )); 1864 setCaption(i18n("Backup cancelled" ));
1881 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1865 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1882 // retval == 0 : backup skipped for today, try again tomorrow 1866 // retval == 0 : backup skipped for today, try again tomorrow
1883 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1867 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1884 } else if ( retval == 1 ){ 1868 } else if ( retval == 1 ){
1885 qDebug("KO: Backup created."); 1869 qDebug("KO: Backup created.");
1886 // backup ok 1870 // backup ok
1887 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1871 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1888 KopiCalendarFile * cal = calendars.first(); 1872 KopiCalendarFile * cal = calendars.first();
1889 cal = calendars.next(); 1873 cal = calendars.next();
1890 while ( cal ) { 1874 while ( cal ) {
1891 if ( !cal->mErrorOnLoad ) { 1875 if ( !cal->mErrorOnLoad ) {
1892 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1876 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1893 } 1877 }
1894 cal = calendars.next(); 1878 cal = calendars.next();
1895 } 1879 }
1896 KOPrefs::instance()->mLastBackupDate = daysTo; 1880 KOPrefs::instance()->mLastBackupDate = daysTo;
1897 setCaption(i18n("Backup succesfully finished" )); 1881 setCaption(i18n("Backup succesfully finished" ));
1898 } else if ( retval == 2 ){ 1882 } else if ( retval == 2 ){
1899 setCaption(i18n("Backup globally disabled" )); 1883 setCaption(i18n("Backup globally disabled" ));
1900 qDebug("KO: Backup globally cancelled."); 1884 qDebug("KO: Backup globally cancelled.");
1901 // backup globally cancelled 1885 // backup globally cancelled
1902 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1886 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1903 } 1887 }
1904 // retval == 3: do nothing, try again later 1888 // retval == 3: do nothing, try again later
1905} 1889}
1906void MainWindow::save() 1890void MainWindow::save()
1907{ 1891{
1908 1892
1909 if ( mView->viewManager()->journalView() ) 1893 if ( mView->viewManager()->journalView() )
1910 mView->viewManager()->journalView()->checkModified(); 1894 mView->viewManager()->journalView()->checkModified();
1911 if ( !mCalendarModifiedFlag ) { 1895 if ( !mCalendarModifiedFlag ) {
1912 qDebug("KO: Calendar not modified. Nothing saved."); 1896 qDebug("KO: Calendar not modified. Nothing saved.");
1913 return; 1897 return;
1914 } 1898 }
1915 if ( mSyncManager->blockSave() ) 1899 if ( mSyncManager->blockSave() )
1916 return; 1900 return;
1917 mSyncManager->setBlockSave(true); 1901 mSyncManager->setBlockSave(true);
1918 if ( mView->checkAllFileVersions() ) { 1902 if ( mView->checkAllFileVersions() ) {
1919 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1903 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1920 QDate reference ( 2000,1,1); 1904 QDate reference ( 2000,1,1);
1921 int daysTo = reference.daysTo ( QDate::currentDate() ); 1905 int daysTo = reference.daysTo ( QDate::currentDate() );
1922 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1906 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1923 backupAllFiles(); 1907 backupAllFiles();
1924 } 1908 }
1925 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1909 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1926 } 1910 }
1927 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1911 QTime neededSaveTime = QDateTime::currentDateTime().time();
1928 if ( !isMinimized () ) 1912 if ( !isMinimized () )
1929 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1913 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1930 qDebug("KO: Start saving data to file!"); 1914 qDebug("KO: Start saving data to file!");
1931 mView->saveCalendars(); 1915 mView->saveCalendars();
1932 mCalendarModifiedFlag = false; 1916 mCalendarModifiedFlag = false;
1933 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1917 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1934 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1918 qDebug("KO: Needed %d ms for saving.",msNeeded );
1935 QString savemes; 1919 QString savemes;
1936 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1920 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1937 if ( !isMinimized () ) 1921 if ( !isMinimized () )
1938 setCaption(savemes); 1922 setCaption(savemes);
1939 else 1923 else
1940 qDebug(savemes); 1924 qDebug(savemes);
1941 } else 1925 } else
1942 setCaption(i18n("Saving cancelled!")); 1926 setCaption(i18n("Saving cancelled!"));
1943 mSyncManager->setBlockSave( false ); 1927 mSyncManager->setBlockSave( false );
1944} 1928}
1945 1929
1946void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1930void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1947{ 1931{
1948 if ( !e->isAutoRepeat() ) { 1932 if ( !e->isAutoRepeat() ) {
1949 mFlagKeyPressed = false; 1933 mFlagKeyPressed = false;
1950 } 1934 }
1951} 1935}
1952void MainWindow::keyPressEvent ( QKeyEvent * e ) 1936void MainWindow::keyPressEvent ( QKeyEvent * e )
1953{ 1937{
1954 qApp->processEvents(); 1938 qApp->processEvents();
1955 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1939 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1956 e->ignore(); 1940 e->ignore();
1957 // qDebug(" ignore %d",e->isAutoRepeat() ); 1941 // qDebug(" ignore %d",e->isAutoRepeat() );
1958 return; 1942 return;
1959 } 1943 }
1960 if (! e->isAutoRepeat() ) 1944 if (! e->isAutoRepeat() )
1961 mFlagKeyPressed = true; 1945 mFlagKeyPressed = true;
1962 KOPrefs *p = KOPrefs::instance(); 1946 KOPrefs *p = KOPrefs::instance();
1963 bool showSelectedDates = false; 1947 bool showSelectedDates = false;
1964 int size; 1948 int size;
1965 int pro = 0; 1949 int pro = 0;
1966 //qDebug("MainWindow::keyPressEvent "); 1950 //qDebug("MainWindow::keyPressEvent ");
1967 switch ( e->key() ) { 1951 switch ( e->key() ) {
1968 case Qt::Key_Right: 1952 case Qt::Key_Right:
1969 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1953 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1970 mView->goNextMonth(); 1954 mView->goNextMonth();
1971 else 1955 else
1972 mView->goNext(); 1956 mView->goNext();
1973 showSelectedDates = true; 1957 showSelectedDates = true;
1974 break; 1958 break;
1975 case Qt::Key_Left: 1959 case Qt::Key_Left:
1976 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1960 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1977 mView->goPreviousMonth(); 1961 mView->goPreviousMonth();
1978 else 1962 else
1979 mView->goPrevious(); 1963 mView->goPrevious();
1980 showSelectedDates = true; 1964 showSelectedDates = true;
1981 break; 1965 break;
1982 case Qt::Key_Down: 1966 case Qt::Key_Down:
1983 mView->viewManager()->agendaView()->scrollOneHourDown(); 1967 mView->viewManager()->agendaView()->scrollOneHourDown();
1984 break; 1968 break;
1985 case Qt::Key_Up: 1969 case Qt::Key_Up:
1986 mView->viewManager()->agendaView()->scrollOneHourUp(); 1970 mView->viewManager()->agendaView()->scrollOneHourUp();
1987 break; 1971 break;
1988 case Qt::Key_K: 1972 case Qt::Key_K:
1989 mView->viewManager()->showMonthViewWeek(); 1973 mView->viewManager()->showMonthViewWeek();
1990 break; 1974 break;
1991 case Qt::Key_I: 1975 case Qt::Key_I:
1992 mView->showIncidence(); 1976 mView->showIncidence();
1993 break; 1977 break;
1994 case Qt::Key_Delete: 1978 case Qt::Key_Delete:
1995 case Qt::Key_Backspace: 1979 case Qt::Key_Backspace:
1996 mView->deleteIncidence(); 1980 mView->deleteIncidence();
1997 break; 1981 break;
1998 case Qt::Key_D: 1982 case Qt::Key_D:
1999 mView->viewManager()->showDayView(); 1983 mView->viewManager()->showDayView();
2000 showSelectedDates = true; 1984 showSelectedDates = true;
2001 break; 1985 break;
2002 case Qt::Key_O: 1986 case Qt::Key_O:
2003 mView->toggleFilerEnabled( ); 1987 mView->toggleFilerEnabled( );
2004 break; 1988 break;
2005 case Qt::Key_0: 1989 case Qt::Key_0:
2006 case Qt::Key_1: 1990 case Qt::Key_1:
2007 case Qt::Key_2: 1991 case Qt::Key_2:
2008 case Qt::Key_3: 1992 case Qt::Key_3:
2009 case Qt::Key_4: 1993 case Qt::Key_4:
2010 case Qt::Key_5: 1994 case Qt::Key_5:
2011 case Qt::Key_6: 1995 case Qt::Key_6:
2012 case Qt::Key_7: 1996 case Qt::Key_7:
2013 case Qt::Key_8: 1997 case Qt::Key_8:
2014 case Qt::Key_9: 1998 case Qt::Key_9:
2015 pro = e->key()-48; 1999 pro = e->key()-48;
2016 if ( pro == 0 ) 2000 if ( pro == 0 )
2017 pro = 10; 2001 pro = 10;
2018 if ( e->state() == Qt::ControlButton) 2002 if ( e->state() == Qt::ControlButton)
2019 pro += 10; 2003 pro += 10;
2020 break; 2004 break;
2021 case Qt::Key_M: 2005 case Qt::Key_M:
2022 mView->viewManager()->showMonthView(); 2006 mView->viewManager()->showMonthView();
2023 showSelectedDates = true; 2007 showSelectedDates = true;
2024 break; 2008 break;
2025 case Qt::Key_Insert: 2009 case Qt::Key_Insert:
2026 mView->newEvent(); 2010 mView->newEvent();
2027 break; 2011 break;
2028 case Qt::Key_S : 2012 case Qt::Key_S :
2029 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2013 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2030 mView->newSubTodo(); 2014 mView->newSubTodo();
2031 else 2015 else
2032 mView->dialogManager()->showSearchDialog(); 2016 mView->dialogManager()->showSearchDialog();
2033 break; 2017 break;
2034 case Qt::Key_Y : 2018 case Qt::Key_Y :
2035 case Qt::Key_Z : 2019 case Qt::Key_Z :
2036 mView->viewManager()->showWorkWeekView(); 2020 mView->viewManager()->showWorkWeekView();
2037 showSelectedDates = true; 2021 showSelectedDates = true;
2038 break; 2022 break;
2039 case Qt::Key_U : 2023 case Qt::Key_U :
2040 mView->viewManager()->showWeekView(); 2024 mView->viewManager()->showWeekView();
2041 showSelectedDates = true; 2025 showSelectedDates = true;
2042 break; 2026 break;
2043 case Qt::Key_H : 2027 case Qt::Key_H :
2044 keyBindings(); 2028 keyBindings();
2045 break; 2029 break;
2046 case Qt::Key_W: 2030 case Qt::Key_W:
2047 mView->viewManager()->showWhatsNextView(); 2031 mView->viewManager()->showWhatsNextView();
2048 break; 2032 break;
2049 case Qt::Key_L: 2033 case Qt::Key_L:
2050 mView->viewManager()->showListView(); 2034 mView->viewManager()->showListView();
2051 break; 2035 break;
2052 case Qt::Key_N: 2036 case Qt::Key_N:
2053 mView->viewManager()->showNextView(); 2037 mView->viewManager()->showNextView();
2054 break; 2038 break;
2055 case Qt::Key_V: 2039 case Qt::Key_V:
2056 mView->viewManager()->showTodoView(); 2040 mView->viewManager()->showTodoView();
2057 break; 2041 break;
2058 case Qt::Key_C: 2042 case Qt::Key_C:
2059 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2043 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2060 break; 2044 break;
2061 case Qt::Key_P: 2045 case Qt::Key_P:
2062 mView->showDatePicker( ); 2046 mView->showDatePicker( );
2063 break; 2047 break;
2064 case Qt::Key_F: 2048 case Qt::Key_F:
2065 mView->editFilters(); 2049 mView->editFilters();
2066 break; 2050 break;
2067 case Qt::Key_R: 2051 case Qt::Key_R:
2068 mView->toggleFilter(); 2052 mView->toggleFilter();
2069 break; 2053 break;
2070 case Qt::Key_X: 2054 case Qt::Key_X:
2071 if ( e->state() == Qt::ControlButton ) 2055 if ( e->state() == Qt::ControlButton )
2072 mView->toggleDateNavigatorWidget(); 2056 mView->toggleDateNavigatorWidget();
2073 else { 2057 else {
2074 mView->viewManager()->showNextXView(); 2058 mView->viewManager()->showNextXView();
2075 showSelectedDates = true; 2059 showSelectedDates = true;
2076 } 2060 }
2077 break; 2061 break;
2078 case Qt::Key_Space: 2062 case Qt::Key_Space:
2079 mView->toggleExpand(); 2063 mView->toggleExpand();
2080 break; 2064 break;
2081 case Qt::Key_A: 2065 case Qt::Key_A:
2082 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2066 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2083 mView->showNextAlarms(); 2067 mView->showNextAlarms();
2084 else 2068 else
2085 mView->toggleAllDaySize(); 2069 mView->toggleAllDaySize();
2086 break; 2070 break;
2087 case Qt::Key_T: 2071 case Qt::Key_T:
2088 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2072 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2089 mView->newTodo(); 2073 mView->newTodo();
2090 else { 2074 else {
2091 mView->goToday(); 2075 mView->goToday();
2092 showSelectedDates = true; 2076 showSelectedDates = true;
2093 } 2077 }
2094 break; 2078 break;
2095 case Qt::Key_J: 2079 case Qt::Key_J:
2096 mView->viewManager()->showJournalView(); 2080 mView->viewManager()->showJournalView();
2097 break; 2081 break;
2098 case Qt::Key_B: 2082 case Qt::Key_B:
2099 mView->editIncidenceDescription();; 2083 mView->editIncidenceDescription();;
2100 break; 2084 break;
2101 // case Qt::Key_Return: 2085 // case Qt::Key_Return:
2102 case Qt::Key_E: 2086 case Qt::Key_E:
2103 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2087 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2104 mView->newEvent(); 2088 mView->newEvent();
2105 else 2089 else
2106 mView->editIncidence(); 2090 mView->editIncidence();
2107 break; 2091 break;
2108 case Qt::Key_Plus: 2092 case Qt::Key_Plus:
2109 size = p->mHourSize +2; 2093 size = p->mHourSize +2;
2110 if ( size <= 22 ) 2094 if ( size <= 22 )
2111 configureAgenda( size ); 2095 configureAgenda( size );
2112 break; 2096 break;
2113 case Qt::Key_Minus: 2097 case Qt::Key_Minus:
2114 size = p->mHourSize - 2; 2098 size = p->mHourSize - 2;
2115 if ( size >= 4 ) 2099 if ( size >= 4 )
2116 configureAgenda( size ); 2100 configureAgenda( size );
2117 break; 2101 break;
2118 2102
2119 2103
2120 default: 2104 default:
2121 e->ignore(); 2105 e->ignore();
2122 } 2106 }
2123 if ( pro > 0 ) { 2107 if ( pro > 0 ) {
2124 selectFilter( pro+1 ); 2108 selectFilter( pro+1 );
2125 } 2109 }
2126 if ( showSelectedDates ) { 2110 if ( showSelectedDates ) {
2127 ;// setCaptionToDates(); 2111 ;// setCaptionToDates();
2128 } 2112 }
2129 2113
2130} 2114}
2131void MainWindow::fillFilterMenuTB() 2115void MainWindow::fillFilterMenuTB()
2132{ 2116{
2133 selectFilterMenuTB->clear(); 2117 selectFilterMenuTB->clear();
2134 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2118 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2135 selectFilterMenuTB->insertSeparator(); 2119 selectFilterMenuTB->insertSeparator();
2136 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2120 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2137 2121
2138 selectFilterMenuTB->insertSeparator(); 2122 selectFilterMenuTB->insertSeparator();
2139 QPtrList<CalFilter> fili = mView->filters(); 2123 QPtrList<CalFilter> fili = mView->filters();
2140 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2124 CalFilter *curfilter = mView->filterView()->selectedFilter();
2141 CalFilter *filter = fili.first(); 2125 CalFilter *filter = fili.first();
2142 int iii = 2; 2126 int iii = 2;
2143 bool checkitem = mView->filterView()->filtersEnabled(); 2127 bool checkitem = mView->filterView()->filtersEnabled();
2144 while(filter) { 2128 while(filter) {
2145 selectFilterMenuTB->insertItem( filter->name(), iii ); 2129 selectFilterMenuTB->insertItem( filter->name(), iii );
2146 if ( filter == curfilter) 2130 if ( filter == curfilter)
2147 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2131 selectFilterMenuTB->setItemChecked( iii, checkitem );
2148 filter = fili.next(); 2132 filter = fili.next();
2149 ++iii; 2133 ++iii;
2150 } 2134 }
2151 if ( !checkitem ) 2135 if ( !checkitem )
2152 selectFilterMenuTB->setItemChecked( 1, true ); 2136 selectFilterMenuTB->setItemChecked( 1, true );
2153 2137
2154 int x = 0; 2138 int x = 0;
2155 int y = iconToolBar->height(); 2139 int y = iconToolBar->height();
2156 int dX = 0; 2140 int dX = 0;
2157 int dY = 0; 2141 int dY = 0;
2158 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2142 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2159 if ( iconToolBar->y() > height()/2 ) { 2143 if ( iconToolBar->y() > height()/2 ) {
2160 dY = selectFilterMenuTB->sizeHint().height()+8; 2144 dY = selectFilterMenuTB->sizeHint().height()+8;
2161 y = 0; 2145 y = 0;
2162 } 2146 }
2163 } else { 2147 } else {
2164 if ( iconToolBar->x() > width()/2 ) { // right side 2148 if ( iconToolBar->x() > width()/2 ) { // right side
2165 x=0; 2149 x=0;
2166 dX= selectFilterMenuTB->sizeHint().width()+8; 2150 dX= selectFilterMenuTB->sizeHint().width()+8;
2167 y = 0; 2151 y = 0;
2168 } else { 2152 } else {
2169 x= iconToolBar->width(); 2153 x= iconToolBar->width();
2170 y = 0; 2154 y = 0;
2171 } 2155 }
2172 } 2156 }
2173 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2157 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2174 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2158 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2175} 2159}
2176void MainWindow::fillFilterMenu() 2160void MainWindow::fillFilterMenu()
2177{ 2161{
2178 selectFilterMenu->clear(); 2162 selectFilterMenu->clear();
2179 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2163 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2180 selectFilterMenu->insertSeparator(); 2164 selectFilterMenu->insertSeparator();
2181 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2165 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2182 2166
2183 selectFilterMenu->insertSeparator(); 2167 selectFilterMenu->insertSeparator();
2184 QPtrList<CalFilter> fili = mView->filters(); 2168 QPtrList<CalFilter> fili = mView->filters();
2185 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2169 CalFilter *curfilter = mView->filterView()->selectedFilter();
2186 CalFilter *filter = fili.first(); 2170 CalFilter *filter = fili.first();
2187 int iii = 2; 2171 int iii = 2;
2188 bool checkitem = mView->filterView()->filtersEnabled(); 2172 bool checkitem = mView->filterView()->filtersEnabled();
2189 while(filter) { 2173 while(filter) {
2190 selectFilterMenu->insertItem( filter->name(), iii ); 2174 selectFilterMenu->insertItem( filter->name(), iii );
2191 if ( filter == curfilter) 2175 if ( filter == curfilter)
2192 selectFilterMenu->setItemChecked( iii, checkitem ); 2176 selectFilterMenu->setItemChecked( iii, checkitem );
2193 filter = fili.next(); 2177 filter = fili.next();
2194 ++iii; 2178 ++iii;
2195 } 2179 }
2196 if ( !checkitem ) 2180 if ( !checkitem )
2197 selectFilterMenu->setItemChecked( 1, true ); 2181 selectFilterMenu->setItemChecked( 1, true );
2198} 2182}
2199void MainWindow::fillFilterMenuPopup() 2183void MainWindow::fillFilterMenuPopup()
2200{ 2184{
2201 filterPopupMenu->clear(); 2185 filterPopupMenu->clear();
2202 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2186 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2203 2187
2204 filterPopupMenu->insertSeparator(); 2188 filterPopupMenu->insertSeparator();
2205 QPtrList<CalFilter> fili = mView->filters(); 2189 QPtrList<CalFilter> fili = mView->filters();
2206 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2190 CalFilter *curfilter = mView->filterView()->selectedFilter();
2207 CalFilter *filter = fili.first(); 2191 CalFilter *filter = fili.first();
2208 int iii = 1; 2192 int iii = 1;
2209 bool checkitem = mView->filterView()->filtersEnabled(); 2193 bool checkitem = mView->filterView()->filtersEnabled();
2210 while(filter) { 2194 while(filter) {
2211 filterPopupMenu->insertItem( filter->name(), iii ); 2195 filterPopupMenu->insertItem( filter->name(), iii );
2212 if ( filter == curfilter) 2196 if ( filter == curfilter)
2213 filterPopupMenu->setItemChecked( iii, checkitem ); 2197 filterPopupMenu->setItemChecked( iii, checkitem );
2214 filter = fili.next(); 2198 filter = fili.next();
2215 ++iii; 2199 ++iii;
2216 } 2200 }
2217 if ( !checkitem ) 2201 if ( !checkitem )
2218 filterPopupMenu->setItemChecked( 0, true ); 2202 filterPopupMenu->setItemChecked( 0, true );
2219} 2203}
2220void MainWindow::selectFilter( int fil ) 2204void MainWindow::selectFilter( int fil )
2221{ 2205{
2222 2206
2223 if ( fil == 0 ) { 2207 if ( fil == 0 ) {
2224 mView->editFilters( ); 2208 mView->editFilters( );
2225 } else if ( fil == 1 ){ 2209 } else if ( fil == 1 ){
2226 if ( mView->filterView()->filtersEnabled() ) 2210 if ( mView->filterView()->filtersEnabled() )
2227 mView->toggleFilerEnabled( ); 2211 mView->toggleFilerEnabled( );
2228 } else { 2212 } else {
2229 if ( !mView->filterView()->filtersEnabled() ) { 2213 if ( !mView->filterView()->filtersEnabled() ) {
2230 mView->filterView()->blockSignals( true ); 2214 mView->filterView()->blockSignals( true );
2231 mView->toggleFilerEnabled( ); 2215 mView->toggleFilerEnabled( );
2232 mView->filterView()->blockSignals( false ); 2216 mView->filterView()->blockSignals( false );
2233 } 2217 }
2234 mView->selectFilter( fil-2 ); 2218 mView->selectFilter( fil-2 );
2235 } 2219 }
2236} 2220}
2237void MainWindow::updateFilterToolbar() 2221void MainWindow::updateFilterToolbar()
2238{ 2222{
2239 if ( filterMenubar ) { 2223 if ( filterMenubar ) {
2240 if ( !mView->filterView()->filtersEnabled() ) { 2224 if ( !mView->filterView()->filtersEnabled() ) {
2241 filterMenubar->changeItem( 0, i18n("No Filter") ); 2225 filterMenubar->changeItem( 0, i18n("No Filter") );
2242 } else { 2226 } else {
2243 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2227 CalFilter *curfilter = mView->filterView()->selectedFilter();
2244 if ( curfilter ) { 2228 if ( curfilter ) {
2245 filterMenubar->changeItem( 0, curfilter->name() ); 2229 filterMenubar->changeItem( 0, curfilter->name() );
2246 } 2230 }
2247 } 2231 }
2248 } 2232 }
2249} 2233}
2250void MainWindow::selectFilterPopup( int fil ) 2234void MainWindow::selectFilterPopup( int fil )
2251{ 2235{
2252 selectFilter( fil + 1 ); 2236 selectFilter( fil + 1 );
2253 2237
2254} 2238}
2255void MainWindow::configureToolBar( int item ) 2239void MainWindow::configureToolBar( int item )
2256{ 2240{
2257 2241
2258 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2242 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2259 KOPrefs *p = KOPrefs::instance(); 2243 KOPrefs *p = KOPrefs::instance();
2260 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2244 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2261 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2245 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2262 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2246 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2263 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2247 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2264 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2248 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2265 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2249 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2266 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2250 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2267 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2251 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2268 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2252 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2269 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2253 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2270 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2254 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2271 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2255 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2272 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2256 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2273 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2257 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2274 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2258 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2275 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2259 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2276 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2260 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2277 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2261 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2278 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2262 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2279 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2263 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2280 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2264 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2281 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2265 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2282 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2266 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2283 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2267 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2284 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2268 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2285 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2269 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2286 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2270 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2287 // initActions(); 2271 // initActions();
2288 setCaption ( i18n("Toolbar changes needs a restart!") ); 2272 setCaption ( i18n("Toolbar changes needs a restart!") );
2289} 2273}
2290void MainWindow::setCaption ( const QString & c ) 2274void MainWindow::setCaption ( const QString & c )
2291{ 2275{
2292 QString cap = c; 2276 QString cap = c;
2293 cap.replace( QRegExp("\n"), " " ); 2277 cap.replace( QRegExp("\n"), " " );
2294 cap = cap.stripWhiteSpace(); 2278 cap = cap.stripWhiteSpace();
2295 if ( cap.isEmpty() ) 2279 if ( cap.isEmpty() )
2296 cap = "KO/Pi"; 2280 cap = "KO/Pi";
2297 QWidget::setCaption( cap ); 2281 QWidget::setCaption( cap );
2298} 2282}
2299void MainWindow::setCaptionToDates() 2283void MainWindow::setCaptionToDates()
2300{ 2284{
2301 QString selDates; 2285 QString selDates;
2302 QDate date = mView->startDate(); 2286 QDate date = mView->startDate();
2303 if ( ! date.isValid() ) { 2287 if ( ! date.isValid() ) {
2304 setCaption(""); 2288 setCaption("");
2305 return; 2289 return;
2306 } 2290 }
2307 selDates = KGlobal::locale()->formatDate( date, true); 2291 selDates = KGlobal::locale()->formatDate( date, true);
2308 if (mView->startDate() < mView->endDate() ) 2292 if (mView->startDate() < mView->endDate() )
2309 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2293 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2310 else { 2294 else {
2311 QString addString; 2295 QString addString;
2312 if ( date == QDateTime::currentDateTime().date() ) 2296 if ( date == QDateTime::currentDateTime().date() )
2313 addString = i18n("Today"); 2297 addString = i18n("Today");
2314 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2298 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2315 addString = i18n("Tomorrow"); 2299 addString = i18n("Tomorrow");
2316 if ( !addString.isEmpty() ) 2300 if ( !addString.isEmpty() )
2317 selDates = addString+", "+selDates ; 2301 selDates = addString+", "+selDates ;
2318 } 2302 }
2319 setCaption( i18n("Dates: ") + selDates ); 2303 setCaption( i18n("Dates: ") + selDates );
2320 2304
2321} 2305}
2322void MainWindow::showConfigureAgenda( ) 2306void MainWindow::showConfigureAgenda( )
2323{ 2307{
2324 int iii; 2308 int iii;
2325 for ( iii = 1;iii<= 10 ;++iii ){ 2309 for ( iii = 1;iii<= 10 ;++iii ){
2326 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2310 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2327 } 2311 }
2328 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2312 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2329} 2313}
2330void MainWindow::configureAgenda( int item ) 2314void MainWindow::configureAgenda( int item )
2331{ 2315{
2332 if ( KOPrefs::instance()->mHourSize == item ) 2316 if ( KOPrefs::instance()->mHourSize == item )
2333 return; 2317 return;
2334 KOPrefs::instance()->mHourSize=item; 2318 KOPrefs::instance()->mHourSize=item;
2335 mView->viewManager()->agendaView()->updateConfig(); 2319 mView->viewManager()->agendaView()->updateConfig();
2336} 2320}
2337 2321
2338void MainWindow::saveCalendar() 2322void MainWindow::saveCalendar()
2339{ 2323{
2340 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2324 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2341 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2325 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2342 bupDir = KGlobalSettings::backupDataDir(); 2326 bupDir = KGlobalSettings::backupDataDir();
2343 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2327 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2344 QString bupHint; 2328 QString bupHint;
2345 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2329 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2346 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2330 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2347 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2331 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2348 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2332 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2349 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2333 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2350 save(); 2334 save();
2351 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2335 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2352 backupAllFiles(); 2336 backupAllFiles();
2353} 2337}
2354void MainWindow::loadCalendar() 2338void MainWindow::loadCalendar()
2355{ 2339{
2356 2340
2357 2341
2358#if 0 2342#if 0
2359 QString fn = KOPrefs::instance()->mLastLoadFile; 2343 QString fn = KOPrefs::instance()->mLastLoadFile;
2360 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2344 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2361 2345
2362 if ( fn == "" ) 2346 if ( fn == "" )
2363 return; 2347 return;
2364 QFileInfo info; 2348 QFileInfo info;
2365 info.setFile( fn ); 2349 info.setFile( fn );
2366 QString mess; 2350 QString mess;
2367 bool loadbup = true; 2351 bool loadbup = true;
2368 if ( info. exists() ) { 2352 if ( info. exists() ) {
2369 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2353 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2370 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2354 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2371 mess, 2355 mess,
2372 i18n("Load!"), i18n("Cancel"), 0, 2356 i18n("Load!"), i18n("Cancel"), 0,
2373 0, 1 ); 2357 0, 1 );
2374 if ( result != 0 ) { 2358 if ( result != 0 ) {
2375 loadbup = false; 2359 loadbup = false;
2376 } 2360 }
2377 } else { 2361 } else {
2378 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2362 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2379 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2363 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2380 0, 1 ); 2364 0, 1 );
2381 2365
2382 return; 2366 return;
2383 } 2367 }
2384 if ( loadbup ) { 2368 if ( loadbup ) {
2385 mView->openCalendar( fn ); 2369 mView->openCalendar( fn );
2386 KOPrefs::instance()->mLastLoadFile = fn; 2370 KOPrefs::instance()->mLastLoadFile = fn;
2387 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2371 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2388 setCaption(mess); 2372 setCaption(mess);
2389 } 2373 }
2390#endif 2374#endif
2391 2375
2392} 2376}
2393void MainWindow::quickImportIcal() 2377void MainWindow::quickImportIcal()
2394{ 2378{
2395 importFile( KOPrefs::instance()->mLastImportFile, false ); 2379 importFile( KOPrefs::instance()->mLastImportFile, false );
2396} 2380}
2397void MainWindow::importFile( QString fn, bool quick ) 2381void MainWindow::importFile( QString fn, bool quick )
2398{ 2382{
2399 QFileInfo info; 2383 QFileInfo info;
2400 info.setFile( fn ); 2384 info.setFile( fn );
2401 QString mess; 2385 QString mess;
2402 if ( !info. exists() ) { 2386 if ( !info. exists() ) {
2403 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2387 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2404 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2388 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2405 mess ); 2389 mess );
2406 return; 2390 return;
2407 } 2391 }
2408 int result = 0; 2392 int result = 0;
2409 if ( !quick ) { 2393 if ( !quick ) {
2410 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2394 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2411 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2395 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2412 mess, 2396 mess,
2413 "Import", "Cancel", 0, 2397 "Import", "Cancel", 0,
2414 0, 1 ); 2398 0, 1 );
2415 } 2399 }
2416 if ( result == 0 ) { 2400 if ( result == 0 ) {
2417 if ( mView->openCalendar( fn, true )) { 2401 if ( mView->openCalendar( fn, true )) {
2418 KOPrefs::instance()->mLastImportFile = fn; 2402 KOPrefs::instance()->mLastImportFile = fn;
2419 setCaption(i18n("Imported file successfully")); 2403 setCaption(i18n("Imported file successfully"));
2420 } else { 2404 } else {
2421 setCaption(i18n("Error importing file")); 2405 setCaption(i18n("Error importing file"));
2422 } 2406 }
2423 } 2407 }
2424} 2408}
2425 2409
2426void MainWindow::importIcal() 2410void MainWindow::importIcal()
2427{ 2411{
2428 2412
2429 QString fn =KOPrefs::instance()->mLastImportFile; 2413 QString fn =KOPrefs::instance()->mLastImportFile;
2430 2414
2431 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2415 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2432 if ( fn == "" ) 2416 if ( fn == "" )
2433 return; 2417 return;
2434 importFile( fn, true ); 2418 importFile( fn, true );
2435 2419
2436} 2420}
2437 2421
2438void MainWindow::exportVCalendar() 2422void MainWindow::exportVCalendar()
2439{ 2423{
2440 QString fn = KOPrefs::instance()->mLastVcalFile; 2424 QString fn = KOPrefs::instance()->mLastVcalFile;
2441 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2425 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2442 if ( fn == "" ) 2426 if ( fn == "" )
2443 return; 2427 return;
2444 QFileInfo info; 2428 QFileInfo info;
2445 info.setFile( fn ); 2429 info.setFile( fn );
2446 QString mes; 2430 QString mes;
2447 bool createbup = true; 2431 bool createbup = true;
2448 if ( info. exists() ) { 2432 if ( info. exists() ) {
2449 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2433 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2450 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2434 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2451 i18n("Overwrite!"), i18n("Cancel"), 0, 2435 i18n("Overwrite!"), i18n("Cancel"), 0,
2452 0, 1 ); 2436 0, 1 );
2453 if ( result != 0 ) { 2437 if ( result != 0 ) {
2454 createbup = false; 2438 createbup = false;
2455 } 2439 }
2456 } 2440 }
2457 if ( createbup ) { 2441 if ( createbup ) {
2458 if ( mView->exportVCalendar( fn ) ) { 2442 if ( mView->exportVCalendar( fn ) ) {
2459 KOPrefs::instance()->mLastVcalFile = fn; 2443 KOPrefs::instance()->mLastVcalFile = fn;
2460 if ( fn.length() > 20 ) 2444 if ( fn.length() > 20 )
2461 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2445 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2462 else 2446 else
2463 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2447 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2464 setCaption(mes); 2448 setCaption(mes);
2465 } 2449 }
2466 } 2450 }
2467 2451
2468} 2452}
2469QString MainWindow::sentSyncFile() 2453QString MainWindow::sentSyncFile()
2470{ 2454{
2471#ifdef DESKTOP_VERSION 2455#ifdef DESKTOP_VERSION
2472 return locateLocal( "tmp", "copysynccal.ics" ); 2456 return locateLocal( "tmp", "copysynccal.ics" );
2473#else 2457#else
2474 return QString( "/tmp/copysynccal.ics" ); 2458 return QString( "/tmp/copysynccal.ics" );
2475#endif 2459#endif
2476} 2460}
2477 2461
2478void MainWindow::syncFileRequest() 2462void MainWindow::syncFileRequest()
2479{ 2463{
2480 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2464 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2481 mSyncManager->slotSyncMenu( 999 ); 2465 mSyncManager->slotSyncMenu( 999 );
2482 } 2466 }
2483 2467
2484 setCaption(i18n("Saving Data to temp file ..." )); 2468 setCaption(i18n("Saving Data to temp file ..." ));
2485 mView->saveCalendar( sentSyncFile() ); 2469 mView->saveCalendar( sentSyncFile() );
2486 setCaption(i18n("Data saved to temp file!" )); 2470 setCaption(i18n("Data saved to temp file!" ));
2487 2471
2488} 2472}
2489void MainWindow::getFile( bool success ) 2473void MainWindow::getFile( bool success )
2490{ 2474{
2491 if ( ! success ) { 2475 if ( ! success ) {
2492 setCaption( i18n("Error receiving file. Nothing changed!") ); 2476 setCaption( i18n("Error receiving file. Nothing changed!") );
2493 return; 2477 return;
2494 } 2478 }
2495 mView->openCalendar( sentSyncFile() ); 2479 mView->openCalendar( sentSyncFile() );
2496 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2480 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2497 mSyncManager->slotSyncMenu( 999 ); 2481 mSyncManager->slotSyncMenu( 999 );
2498 } 2482 }
2499 setCaption( i18n("Pi-Sync successful!") ); 2483 setCaption( i18n("Pi-Sync successful!") );
2500} 2484}
2501void MainWindow::printListView() 2485void MainWindow::printListView()
2502{ 2486{
2503 2487
2504 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2488 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2505 2489
2506 KMessageBox::information( this, message); 2490 KMessageBox::information( this, message);
2507} 2491}
2508void MainWindow::printSel( ) 2492void MainWindow::printSel( )
2509{ 2493{
2510 mView->viewManager()->agendaView()->agenda()->printSelection(); 2494 mView->viewManager()->agendaView()->agenda()->printSelection();
2511} 2495}
2512 2496
2513void MainWindow::printCal() 2497void MainWindow::printCal()
2514{ 2498{
2515 mView->print();//mCp->showDialog(); 2499 mView->print();//mCp->showDialog();
2516} 2500}
2517 2501
2518 2502
2519#include "libkdepim/kdatepicker.h" 2503#include "libkdepim/kdatepicker.h"
2520#include <kdatetbl.h> 2504#include <kdatetbl.h>
2521 2505
2522void MainWindow::weekAction() 2506void MainWindow::weekAction()
2523{ 2507{
2524 int month; 2508 int month;
2525 KPopupFrame* popup = new KPopupFrame(this); 2509 KPopupFrame* popup = new KPopupFrame(this);
2526 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2510 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2527 // ----- 2511 // -----
2528 picker->resize(picker->sizeHint()); 2512 picker->resize(picker->sizeHint());
2529 popup->setMainWidget(picker); 2513 popup->setMainWidget(picker);
2530 picker->setFocus(); 2514 picker->setFocus();
2531 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2515 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2532 int x = 0; 2516 int x = 0;
2533 int y = iconToolBar->height(); 2517 int y = iconToolBar->height();
2534 int dX = 0; 2518 int dX = 0;
2535 int dY = 0; 2519 int dY = 0;
2536 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2520 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2537 if ( iconToolBar->y() > height()/2 ) { 2521 if ( iconToolBar->y() > height()/2 ) {
2538 dY = picker->sizeHint().height()+8; 2522 dY = picker->sizeHint().height()+8;
2539 y = 0; 2523 y = 0;
2540 } 2524 }
2541 } else { 2525 } else {
2542 if ( iconToolBar->x() > width()/2 ) { // right side 2526 if ( iconToolBar->x() > width()/2 ) { // right side
2543 x=0; 2527 x=0;
2544 dX= picker->sizeHint().width()+8; 2528 dX= picker->sizeHint().width()+8;
2545 y = 0; 2529 y = 0;
2546 } else { 2530 } else {
2547 x= iconToolBar->width(); 2531 x= iconToolBar->width();
2548 y = 0; 2532 y = 0;
2549 } 2533 }
2550 } 2534 }
2551 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2535 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2552 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2536 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2553 { 2537 {
2554 month = picker->getResult(); 2538 month = picker->getResult();
2555 emit selectWeek ( month ); 2539 emit selectWeek ( month );
2556 //qDebug("weekSelected %d ", month); 2540 //qDebug("weekSelected %d ", month);
2557 } 2541 }
2558 delete popup; 2542 delete popup;
2559} 2543}
2560 2544
2561void MainWindow::hideEvent ( QHideEvent * ) 2545void MainWindow::hideEvent ( QHideEvent * )
2562{ 2546{
2563 QString message; 2547 QString message;
2564 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2548 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2565 if ( nextA.isValid() ) { 2549 if ( nextA.isValid() ) {
2566 QString sum = mCalendar->nextSummary(); 2550 QString sum = mCalendar->nextSummary();
2567 2551
2568 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2552 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2569 setCaption( message ); 2553 setCaption( message );
2570 } 2554 }
2571} 2555}
2572 2556
2573void MainWindow::resizeEvent( QResizeEvent* e) 2557void MainWindow::resizeEvent( QResizeEvent* e)
2574{ 2558{
2575#ifndef DESKTOP_VERSION 2559#ifndef DESKTOP_VERSION
2576 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2560 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2577 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2561 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2578 filterToolBar->hide(); 2562 filterToolBar->hide();
2579 else 2563 else
2580 filterToolBar->show(); 2564 filterToolBar->show();
2581 } 2565 }
2582#endif 2566#endif
2583 QMainWindow::resizeEvent( e); 2567 QMainWindow::resizeEvent( e);
2584} 2568}