summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koimportoldialog.cpp466
-rw-r--r--korganizer/koimportoldialog.h83
-rw-r--r--korganizer/korganizer.pro23
-rw-r--r--korganizer/mainwindow.cpp22
-rw-r--r--korganizer/mainwindow.h1
5 files changed, 592 insertions, 3 deletions
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
new file mode 100644
index 0000000..36363e5
--- a/dev/null
+++ b/korganizer/koimportoldialog.cpp
@@ -0,0 +1,466 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24#include <qtooltip.h>
25#include <qframe.h>
26#include <qpixmap.h>
27#include <qlayout.h>
28#include <qprogressbar.h>
29#include <qwidgetstack.h>
30#include <qdatetime.h>
31#include <qdir.h>
32#include <qapplication.h>
33#include <qhbox.h>
34#include <qheader.h>
35#include <qdatetime.h>
36#include <qlistview.h>
37
38#include <kdebug.h>
39#include <klocale.h>
40#include <kstandarddirs.h>
41#include <kmessagebox.h>
42#include <kfiledialog.h>
43
44#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h>
46
47#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h>
49
50#include "koprefs.h"
51#include "koglobals.h"
52
53#include "koimportoldialog.h"
54
55#include "../outport/msoutl9.h"
56#include <ole2.h>
57#include <comutil.h>
58_Application gOlApp;
59
60QDateTime mDdate2Qdtr( DATE dt)
61{
62 COleDateTime odt;
63 SYSTEMTIME st;
64 odt = dt;
65 odt.GetAsSystemTime(st);
66 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
67 return qdt;
68}
69
70class OLEListViewItem : public QCheckListItem
71{
72 public:
73 OLEListViewItem( QListView *parent, QString text ) :
74 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
75 OLEListViewItem( QListViewItem *after, QString text ) :
76 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
77 ~OLEListViewItem() {};
78 void setData( DWORD data ) {mData= data; };
79 DWORD data() { return mData ;};
80 private:
81 DWORD mData;
82};
83
84KOImportOLdialog::KOImportOLdialog( const QString &caption,
85 Calendar *calendar, QWidget *parent ) :
86 KDialogBase( Plain, caption, User1 | Close, Ok,
87 parent, caption, true, false, i18n("Import!") )
88{
89 QHBox * mw = new QHBox( this );
90 setMainWidget( mw );
91 mListView = new QListView( mw );
92 mListView->addColumn(i18n("Select Folder to import"));
93 mListView->addColumn(i18n("Content Type"));
94 mCalendar = calendar;
95 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
96 setupFolderView();
97 resize( sizeHint().width()+50, sizeHint().height()+50 );
98}
99
100KOImportOLdialog::~KOImportOLdialog()
101{
102
103}
104
105
106void KOImportOLdialog::setupFolderView()
107{
108 SCODE sc = ::OleInitialize(NULL);
109 if ( FAILED ( sc ) ) {
110 KMessageBox::information(this,"OLE initialisation failed");
111 return;
112 }
113
114 if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){
115 KMessageBox::information(this,"Sorry, cannot access Outlook");
116 return ;
117 }
118 MAPIFolder mfInbox;
119 MAPIFolder mfRoot;
120 CString szName;
121 _NameSpace olNS;
122 olNS = gOlApp.GetNamespace(_T("MAPI"));
123 mfInbox = olNS.GetDefaultFolder(6);
124 mfRoot = mfInbox.GetParent();
125 szName = mfRoot.GetName();
126 long iType = mfRoot.GetDefaultItemType();
127 QString mes;
128 mes = QString::fromUcs2( szName.GetBuffer() );
129 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
130 mfRoot.m_lpDispatch->AddRef();
131 addFolder( root, mfRoot.m_lpDispatch );
132 root->setOpen( true );
133 mListView->setSortColumn( 0 );
134 mListView->sort( );
135}
136
137
138void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
139{
140 MAPIFolder mfParent(dispParent), mfChild;
141 _Folders folders;
142 _variant_t fndx((long)0);
143 CString szName;
144 long iType;
145 OLEListViewItem* hChild;
146
147 folders = mfParent.GetFolders();
148 for(int i=1; i <= folders.GetCount(); ++i)
149 {
150 fndx = (long)i;
151 mfChild = folders.Item(fndx.Detach());
152 mfChild.m_lpDispatch->AddRef();
153 szName = mfChild.GetName();
154 iType = mfChild.GetDefaultItemType();
155 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
156 if ( iType != 1)
157 hChild->setEnabled( false );
158 QString ts;
159 switch( iType ) {
160 case 0:
161 ts = i18n("Mail");
162 break;
163 case 1:
164 ts = i18n("Calendar");
165 break;
166 case 2:
167 ts = i18n("Contacts");
168 break;
169 case 3:
170 ts = i18n("Todos");
171 break;
172 case 4:
173 ts = i18n("Journals");
174 break;
175 case 5:
176 ts = i18n("Notes");
177 break;
178 default:
179 ts = i18n("Unknown");
180 }
181 hChild->setText( 1,ts);
182 hChild->setData( (DWORD) mfChild.m_lpDispatch );
183 mfChild.m_lpDispatch->AddRef();
184 addFolder(hChild, mfChild.m_lpDispatch);
185 }
186}
187
188void KOImportOLdialog::slotApply()
189{
190 importedItems = 0;
191 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
192 while ( child ) {
193 if ( child->isOn() )
194 readCalendarData( child->data() );
195 child = (OLEListViewItem*) child->itemBelow();
196 }
197 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
198 KMessageBox::information(this,mes);
199}
200void KOImportOLdialog::readCalendarData( DWORD folder )
201{
202
203 LPDISPATCH dispItem = (LPDISPATCH)folder;
204 dispItem->AddRef();
205 MAPIFolder mf(dispItem);
206 mf.m_lpDispatch->AddRef();
207 _Items folderItems;
208 _variant_t indx((long)0);
209 LPDISPATCH itm;
210 int i;
211 folderItems = mf.GetItems();
212 QProgressBar bar( folderItems.GetCount(),0 );
213 bar.setCaption (i18n("Importing - close to abort!") );
214 int h = bar.sizeHint().height() ;
215 int w = 300;
216 int dw = QApplication::desktop()->width();
217 int dh = QApplication::desktop()->height();
218 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
219 bar.show();
220 for(i=1; i <= folderItems.GetCount(); ++i)
221 {
222 qApp->processEvents();
223 if ( ! bar.isVisible() )
224 return ;
225 bar.setProgress( i );
226 indx = (long)i;
227 itm = folderItems.Item(indx.Detach());
228 _AppointmentItem * pItem = (_AppointmentItem *)&itm;
229 ol2kopiCalendar( pItem );
230 itm->Release();
231 }
232}
233void KOImportOLdialog::slotOk()
234{
235 QDialog::accept();
236}
237
238void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence )
239{
240 KCal::Event* event = new KCal::Event();
241 if ( aItem->GetAllDayEvent() ){
242 event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) ));
243 event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1));
244 event->setFloats( true );
245 } else {
246 event->setDtStart( mDdate2Qdtr( aItem->GetStart()) );
247 event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) );
248 event->setFloats( false );
249 }
250 event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) );
251 event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) );
252 event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()) );
253 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer());
254 event->setCategories( QStringList::split( ";", cat ));
255 if ( aItem->GetReminderSet() ) {
256 event->clearAlarms();
257 Alarm* alarm = event->newAlarm();
258 alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 );
259 alarm->setEnabled( true );
260 if ( aItem->GetReminderPlaySound() ) {
261 alarm->setType( Alarm::Audio );
262 alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer()));
263 }
264 else
265 alarm->setType( Alarm::Display );
266 alarm->setRepeatCount( aItem->GetReplyTime() );
267 }
268 // OL :pub 0 - pers 1 - priv 2 - conf 3
269 // KO : pub 0 - priv 1 - conf 2
270 int sec = aItem->GetSensitivity() ;
271 if ( sec > 1 )// mapping pers -> private
272 --sec;
273 event->setSecrecy( sec );
274 if ( aItem->GetBusyStatus() == 0 )
275 event->setTransparency( Event::Transparent);// OL free
276 else
277 event->setTransparency( Event::Opaque);//OL all other
278
279 if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur
280
281 RecurrencePattern recpat = aItem->GetRecurrencePattern();
282
283 QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date();
284 int freq = recpat.GetInterval();
285
286 bool hasEndDate = !recpat.GetNoEndDate();
287 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date();
288 QBitArray weekDays( 7 );
289 weekDays.fill(false );
290 uint weekDaysNum = recpat.GetDayOfWeekMask();
291 int i;
292 int bb = 2;
293 for( i = 1; i <= 6; ++i ) {
294 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
295 bb = 4 << (i-1);
296 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
297 }
298 if ( 1 & weekDaysNum)
299 weekDays.setBit( 6 );
300 // int pos = 1;// pending
301
302 Recurrence *r = event->recurrence();
303 int rtype = recpat.GetRecurrenceType();
304 //recurrence types are:
305 /*
306 olRecursDaily(0)
307 olRecursWeekly(1)
308 olRecursMonthly(2)
309 olRecursMonthNth(3)
310 olRecursYearly(5)
311 olRecursYearNth(6)
312 */
313
314 int duration = recpat.GetOccurrences();
315 if ( !hasEndDate )
316 duration = -1;
317
318 //LPDISPATCH RecurrencePattern::GetExceptions()
319 //long RecurrencePattern::GetMonthOfYear()
320 if ( rtype == 0 ) {
321 if ( hasEndDate ) r->setDaily( freq, endDate );
322 else r->setDaily( freq, duration );
323 } else if ( rtype == 1 ) {
324 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
325 else r->setWeekly( freq, weekDays, duration );
326 } else if ( rtype == 2 ) {
327 if ( hasEndDate )
328 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
329 else
330 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
331 //r->addMonthlyDay( startDate.day() );
332 r->addMonthlyDay( recpat.GetDayOfMonth() );
333 } else if ( rtype == 3 ) {
334 if ( hasEndDate )
335 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
336 else
337 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
338 QBitArray days( 7 );
339 days.fill( false );
340 days.setBit( startDate.dayOfWeek() - 1 );
341 int pos = (startDate.day()/7)+1;
342 r->addMonthlyPos( pos, days );
343 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
344 //KMessageBox::information(this,mes);
345 } else if ( rtype == 5 ) {
346 freq = 1;
347 if ( hasEndDate )
348 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
349 else
350 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
351 r->addYearlyNum( startDate.month() );
352 } else if ( true /*rtype == 6*/ ) {
353 // KOganizer cannot handle this in the GUI
354 // we are mapping this to monthly - every 12. month
355 freq = 12;
356 if ( hasEndDate )
357 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
358 else
359 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
360 QBitArray days( 7 );
361 days.fill( false );
362 days.setBit( startDate.dayOfWeek() - 1 );
363 int pos = (startDate.day()/7)+1;
364 r->addMonthlyPos( pos, days );
365 }
366 // recurrence exceptions
367 LPDISPATCH dispItem = recpat.GetExceptions();
368 dispItem->AddRef();
369 Exceptions ex(dispItem);
370 _variant_t indx((long)0);
371 LPDISPATCH itm;
372 for(i=1; i <= ex.GetCount(); ++i) {
373 indx = (long)i;
374 itm = ex.Item( indx.Detach() );
375 ::Exception * pItem = (::Exception *)&itm;
376 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
377 if ( !pItem->GetDeleted() ) {
378 LPDISPATCH appIt = pItem->GetAppointmentItem();
379 _AppointmentItem * paItem = (_AppointmentItem *)&appIt;
380 ol2kopiCalendar( paItem, false );
381 }
382 itm->Release();
383 }
384 }
385 // recurrence ENTE
386 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
387
388 //GetOptionalAttendees()
389 //GetRequiredAttendees()
390 LPDISPATCH dispItem = aItem->GetRecipients();
391 dispItem->AddRef();
392 _Folders mf(dispItem);
393 mf.m_lpDispatch->AddRef();
394 _variant_t indx((long)0);
395 LPDISPATCH itm;
396 int i;
397 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
398 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
399 //GetRequiredAttendees()
400 for(i=1; i <= mf.GetCount(); ++i) {
401 indx = (long)i;
402 itm = mf.Item( indx.Detach() );
403 Recipient * pItem = (Recipient *)&itm;
404
405 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
406 QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
407 KCal::Attendee::PartStat stat;
408 bool rsvp = false;
409 switch ( pItem->GetMeetingResponseStatus() ) {
410 case 0: //not answered
411 rsvp = true;
412 case 5: //not answered
413 stat = Attendee::NeedsAction;
414 break;
415 case 1: //organizer
416 stat = Attendee::Delegated ;
417 break;
418 case 2: //tentative
419 stat = Attendee::Tentative ;
420 break;
421 case 3: //accepted
422 stat = Attendee::Accepted;
423 break;
424 case 4: //declined
425 stat =Attendee::Declined ;
426 break;
427 default:
428 stat = Attendee::NeedsAction ;
429
430 }
431 KCal::Attendee::Role role;
432 if ( event->organizer() == name )
433 role = KCal::Attendee::Chair;
434 else if ( reqAtt.find( name ) >= 0 )
435 role = KCal::Attendee::ReqParticipant;
436 else if ( optAtt.find( name ) >= 0 )
437 role = KCal::Attendee::OptParticipant;
438 else
439 role = KCal::Attendee::NonParticipant;
440 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
441 if( mail.isEmpty() && name.find("@") > 0 )
442 mail = name;
443 QString uid;
444 if ( mail.isEmpty() )
445 uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
446 else
447 uid = mail;
448 mail = mail.stripWhiteSpace();
449 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
450 event->addAttendee( a , false );
451 itm->Release();
452 }
453
454
455 if ( !mCalendar->addEventNoDup( event ))
456 delete event;
457 else {
458 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
459 //KMessageBox::information(this,mes);
460 ++importedItems;
461 }
462}
463void KOImportOLdialog::slotCancel()
464{
465 reject();
466}
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
new file mode 100644
index 0000000..f6a753d
--- a/dev/null
+++ b/korganizer/koimportoldialog.h
@@ -0,0 +1,83 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23#ifndef KOINCIDENCEEDITOR_H
24#define KOINCIDENCEEDITOR_H
25
26#include <kdialogbase.h>
27
28#include <afxdisp.h>
29#include <libkcal/calendar.h>
30#include <libkcal/event.h>
31
32
33class QDateTime;
34class QListView;
35class OLEListViewItem;
36class _AppointmentItem;
37namespace KPIM { class CategorySelectDialog; }
38
39using namespace KCal;
40
41/**
42 This is the base class for the calendar component editors.
43*/
44class KOImportOLdialog : public KDialogBase
45{
46 Q_OBJECT
47 public:
48 /**
49 Construct new IncidenceEditor.
50 */
51 KOImportOLdialog( const QString &caption, Calendar *calendar,
52 QWidget *parent );
53 virtual ~KOImportOLdialog();
54
55 /** Initialize editor. This function creates the tab widgets. */
56 void init();
57
58 public slots:
59
60
61 signals:
62
63 protected slots:
64 void slotApply();
65 void slotOk();
66 void slotCancel();
67
68 protected:
69 void setupFolderView();
70 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
71 void readCalendarData( DWORD folder );
72 void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
73
74 Calendar *mCalendar;
75 QListView * mListView;
76
77 private:
78 int importedItems;
79};
80
81#endif
82
83
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index fe2250e..4e8ce11 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,172 +1,191 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = _obj/ 4OBJECTS_DIR = _obj/
5MOC_DIR = _moc 5MOC_DIR = _moc
6DESTDIR= ../bin 6DESTDIR= ../bin
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile 10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile
11#../qtcompat 11#../qtcompat
12DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 12DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#KORG_NOPRINTER KORG_NOKABC 14#KORG_NOPRINTER KORG_NOKABC
15DEFINES += KORG_NOLVALTERNATION 15DEFINES += KORG_NOLVALTERNATION
16DEFINES += DESKTOP_VERSION 16DEFINES += DESKTOP_VERSION
17unix : { 17unix : {
18LIBS += ../bin/libmicrokdepim.so 18LIBS += ../bin/libmicrokdepim.so
19LIBS += ../bin/libmicrokcal.so 19LIBS += ../bin/libmicrokcal.so
20LIBS += ../bin/libmicrokde.so 20LIBS += ../bin/libmicrokde.so
21LIBS += ../bin/libmicrokabc.so 21LIBS += ../bin/libmicrokabc.so
22LIBS += -lldap 22LIBS += -lldap
23OBJECTS_DIR = obj/unix 23OBJECTS_DIR = obj/unix
24MOC_DIR = moc/unix 24MOC_DIR = moc/unix
25} 25}
26win32: { 26win32: {
27DEFINES += _WIN32_ 27DEFINES += _WIN32_
28LIBS += ../bin/microkdepim.lib 28LIBS += ../bin/microkdepim.lib
29LIBS += ../bin/microkcal.lib 29LIBS += ../bin/microkcal.lib
30LIBS += ../bin/microkde.lib 30LIBS += ../bin/microkde.lib
31LIBS += ../bin/microkabc.lib 31LIBS += ../bin/microkabc.lib
32LIBS += ../libical/lib/ical.lib 32LIBS += ../libical/lib/ical.lib
33LIBS += ../libical/lib/icalss.lib 33LIBS += ../libical/lib/icalss.lib
34#LIBS += atls.lib
35LIBS += mfc71u.lib
34QMAKE_LINK += /NODEFAULTLIB:LIBC 36QMAKE_LINK += /NODEFAULTLIB:LIBC
37#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
38#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
35OBJECTS_DIR = obj/win 39OBJECTS_DIR = obj/win
36MOC_DIR = moc/win 40MOC_DIR = moc/win
37} 41}
38 42
39 43
40INTERFACES = kofilterview_base.ui 44INTERFACES = kofilterview_base.ui
41# filteredit_base.ui 45# filteredit_base.ui
42 46
43# kdateedit.h \ 47# kdateedit.h \
44 48
45HEADERS = \ 49HEADERS = \
46 filteredit_base.h \ 50 filteredit_base.h \
47 alarmclient.h \ 51 alarmclient.h \
48 calendarview.h \ 52 calendarview.h \
49 customlistviewitem.h \ 53 customlistviewitem.h \
50 datenavigator.h \ 54 datenavigator.h \
51 docprefs.h \ 55 docprefs.h \
52 filtereditdialog.h \ 56 filtereditdialog.h \
53 incomingdialog.h \ 57 incomingdialog.h \
54 incomingdialog_base.h \ 58 incomingdialog_base.h \
55 interfaces/korganizer/baseview.h \ 59 interfaces/korganizer/baseview.h \
56 interfaces/korganizer/calendarviewbase.h \ 60 interfaces/korganizer/calendarviewbase.h \
57 journalentry.h \ 61 journalentry.h \
58 kdatenavigator.h \ 62 kdatenavigator.h \
59 koagenda.h \ 63 koagenda.h \
60 koagendaitem.h \ 64 koagendaitem.h \
61 koagendaview.h \ 65 koagendaview.h \
62 kocounterdialog.h \ 66 kocounterdialog.h \
63 kodaymatrix.h \ 67 kodaymatrix.h \
64 kodialogmanager.h \ 68 kodialogmanager.h \
65 koeditordetails.h \ 69 koeditordetails.h \
66 koeditorgeneral.h \ 70 koeditorgeneral.h \
67 koeditorgeneralevent.h \ 71 koeditorgeneralevent.h \
68 koeditorgeneraltodo.h \ 72 koeditorgeneraltodo.h \
69 koeditorrecurrence.h \ 73 koeditorrecurrence.h \
70 koeventeditor.h \ 74 koeventeditor.h \
71 koeventpopupmenu.h \ 75 koeventpopupmenu.h \
72 koeventview.h \ 76 koeventview.h \
73 koeventviewer.h \ 77 koeventviewer.h \
74 koeventviewerdialog.h \ 78 koeventviewerdialog.h \
75 kofilterview.h \ 79 kofilterview.h \
76 koglobals.h \ 80 koglobals.h \
77 koincidenceeditor.h \ 81 koincidenceeditor.h \
78 kojournalview.h \ 82 kojournalview.h \
79 kolistview.h \ 83 kolistview.h \
80 kolocationbox.h \ 84 kolocationbox.h \
81 komonthview.h \ 85 komonthview.h \
82 koprefs.h \ 86 koprefs.h \
83 koprefsdialog.h \ 87 koprefsdialog.h \
84 kosyncprefsdialog.h \ 88 kosyncprefsdialog.h \
85 kotimespanview.h \ 89 kotimespanview.h \
86 kotodoeditor.h \ 90 kotodoeditor.h \
87 kotodoview.h \ 91 kotodoview.h \
88 kotodoviewitem.h \ 92 kotodoviewitem.h \
89 koviewmanager.h \ 93 koviewmanager.h \
90 kowhatsnextview.h \ 94 kowhatsnextview.h \
91 ktimeedit.h \ 95 ktimeedit.h \
92 lineview.h \ 96 lineview.h \
93 mainwindow.h \ 97 mainwindow.h \
94 navigatorbar.h \ 98 navigatorbar.h \
95 outgoingdialog.h \ 99 outgoingdialog.h \
96 outgoingdialog_base.h \ 100 outgoingdialog_base.h \
97 publishdialog.h \ 101 publishdialog.h \
98 publishdialog_base.h \ 102 publishdialog_base.h \
99 savetemplatedialog.h \ 103 savetemplatedialog.h \
100 searchdialog.h \ 104 searchdialog.h \
101 simplealarmclient.h \ 105 simplealarmclient.h \
102 statusdialog.h \ 106 statusdialog.h \
103 timeline.h \ 107 timeline.h \
104 timespanview.h \ 108 timespanview.h \
105 version.h \ 109 version.h \
106 ../kalarmd/alarmdialog.h 110 ../kalarmd/alarmdialog.h \
111
107 112
108SOURCES = \ 113SOURCES = \
109filteredit_base.cpp \ 114filteredit_base.cpp \
110 calendarview.cpp \ 115 calendarview.cpp \
111 datenavigator.cpp \ 116 datenavigator.cpp \
112 docprefs.cpp \ 117 docprefs.cpp \
113 filtereditdialog.cpp \ 118 filtereditdialog.cpp \
114 incomingdialog.cpp \ 119 incomingdialog.cpp \
115 incomingdialog_base.cpp \ 120 incomingdialog_base.cpp \
116 journalentry.cpp \ 121 journalentry.cpp \
117 kdatenavigator.cpp \ 122 kdatenavigator.cpp \
118 koagenda.cpp \ 123 koagenda.cpp \
119 koagendaitem.cpp \ 124 koagendaitem.cpp \
120 koagendaview.cpp \ 125 koagendaview.cpp \
121 kocounterdialog.cpp \ 126 kocounterdialog.cpp \
122 kodaymatrix.cpp \ 127 kodaymatrix.cpp \
123 kodialogmanager.cpp \ 128 kodialogmanager.cpp \
124 koeditordetails.cpp \ 129 koeditordetails.cpp \
125 koeditorgeneral.cpp \ 130 koeditorgeneral.cpp \
126 koeditorgeneralevent.cpp \ 131 koeditorgeneralevent.cpp \
127 koeditorgeneraltodo.cpp \ 132 koeditorgeneraltodo.cpp \
128 koeditorrecurrence.cpp \ 133 koeditorrecurrence.cpp \
129 koeventeditor.cpp \ 134 koeventeditor.cpp \
130 koeventpopupmenu.cpp \ 135 koeventpopupmenu.cpp \
131 koeventview.cpp \ 136 koeventview.cpp \
132 koeventviewer.cpp \ 137 koeventviewer.cpp \
133 koeventviewerdialog.cpp \ 138 koeventviewerdialog.cpp \
134 kofilterview.cpp \ 139 kofilterview.cpp \
135 koglobals.cpp \ 140 koglobals.cpp \
136 koincidenceeditor.cpp \ 141 koincidenceeditor.cpp \
137 kojournalview.cpp \ 142 kojournalview.cpp \
138 kolistview.cpp \ 143 kolistview.cpp \
139 kolocationbox.cpp \ 144 kolocationbox.cpp \
140 komonthview.cpp \ 145 komonthview.cpp \
141 koprefs.cpp \ 146 koprefs.cpp \
142 koprefsdialog.cpp \ 147 koprefsdialog.cpp \
143 kosyncprefsdialog.cpp \ 148 kosyncprefsdialog.cpp \
144 kotimespanview.cpp \ 149 kotimespanview.cpp \
145 kotodoeditor.cpp \ 150 kotodoeditor.cpp \
146 kotodoview.cpp \ 151 kotodoview.cpp \
147 kotodoviewitem.cpp \ 152 kotodoviewitem.cpp \
148 koviewmanager.cpp \ 153 koviewmanager.cpp \
149 kowhatsnextview.cpp \ 154 kowhatsnextview.cpp \
150 ktimeedit.cpp \ 155 ktimeedit.cpp \
151 lineview.cpp \ 156 lineview.cpp \
152 main.cpp \ 157 main.cpp \
153 mainwindow.cpp \ 158 mainwindow.cpp \
154 navigatorbar.cpp \ 159 navigatorbar.cpp \
155 outgoingdialog.cpp \ 160 outgoingdialog.cpp \
156 outgoingdialog_base.cpp \ 161 outgoingdialog_base.cpp \
157 publishdialog.cpp \ 162 publishdialog.cpp \
158 publishdialog_base.cpp \ 163 publishdialog_base.cpp \
159 savetemplatedialog.cpp \ 164 savetemplatedialog.cpp \
160 searchdialog.cpp \ 165 searchdialog.cpp \
161 simplealarmclient.cpp \ 166 simplealarmclient.cpp \
162 statusdialog.cpp \ 167 statusdialog.cpp \
163 timeline.cpp \ 168 timeline.cpp \
164 timespanview.cpp \ 169 timespanview.cpp \
165 ../kalarmd/alarmdialog.cpp 170 ../kalarmd/alarmdialog.cpp
166 171
167HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 172HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
168INTERFACES += calprintdayconfig_base.ui \ 173INTERFACES += calprintdayconfig_base.ui \
169 calprintmonthconfig_base.ui \ 174 calprintmonthconfig_base.ui \
170 calprinttodoconfig_base.ui \ 175 calprinttodoconfig_base.ui \
171 calprintweekconfig_base.ui 176 calprintweekconfig_base.ui
172SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 177SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
178
179
180
181win32: {
182HEADERS += ../outport/msoutl9.h \
183 koimportoldialog.h
184
185
186SOURCES += ../outport/msoutl9.cpp \
187 koimportoldialog.cpp
188
189
190}
191
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 40f2cf4..be69be7 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,151 +1,152 @@
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 <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qwmatrix.h> 14#include <qwmatrix.h>
15#include <qtextbrowser.h> 15#include <qtextbrowser.h>
16#include <qtextstream.h> 16#include <qtextstream.h>
17#ifndef DESKTOP_VERSION 17#ifndef DESKTOP_VERSION
18#include <qpe/global.h> 18#include <qpe/global.h>
19#include <qpe/qpemenubar.h> 19#include <qpe/qpemenubar.h>
20#include <qpe/qpetoolbar.h> 20#include <qpe/qpetoolbar.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qtopia/alarmserver.h> 23#include <qtopia/alarmserver.h>
24#include <qtopia/qcopenvelope_qws.h> 24#include <qtopia/qcopenvelope_qws.h>
25#else 25#else
26#include <qmenubar.h> 26#include <qmenubar.h>
27#include <qtoolbar.h> 27#include <qtoolbar.h>
28#include <qapplication.h> 28#include <qapplication.h>
29//#include <resource.h> 29//#include <resource.h>
30 30
31#endif 31#endif
32#include <libkcal/calendarlocal.h> 32#include <libkcal/calendarlocal.h>
33#include <libkcal/todo.h> 33#include <libkcal/todo.h>
34#include <libkdepim/ksyncprofile.h> 34#include <libkdepim/ksyncprofile.h>
35#include <libkdepim/kincidenceformatter.h> 35#include <libkdepim/kincidenceformatter.h>
36 36
37#include "calendarview.h" 37#include "calendarview.h"
38#include "koviewmanager.h" 38#include "koviewmanager.h"
39#include "datenavigator.h" 39#include "datenavigator.h"
40#include "koagendaview.h" 40#include "koagendaview.h"
41#include "koagenda.h" 41#include "koagenda.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43#include "kdialogbase.h" 43#include "kdialogbase.h"
44#include "kstandarddirs.h" 44#include "kstandarddirs.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "kfiledialog.h" 46#include "kfiledialog.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "kglobal.h" 48#include "kglobal.h"
49#include "klocale.h" 49#include "klocale.h"
50#include "kconfig.h" 50#include "kconfig.h"
51#include "simplealarmclient.h" 51#include "simplealarmclient.h"
52
53using namespace KCal; 52using namespace KCal;
54#ifndef _WIN32_ 53#ifndef _WIN32_
55#include <unistd.h> 54#include <unistd.h>
55#else
56#include "koimportoldialog.h"
56#endif 57#endif
57#include "mainwindow.h" 58#include "mainwindow.h"
58 59
59int globalFlagBlockStartup; 60int globalFlagBlockStartup;
60MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 61MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
61 QMainWindow( parent, name ) 62 QMainWindow( parent, name )
62{ 63{
63 64
64#ifdef DESKTOP_VERSION 65#ifdef DESKTOP_VERSION
65 setFont( QFont("Arial"), 14 ); 66 setFont( QFont("Arial"), 14 );
66#endif 67#endif
67 68
68 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 69 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
69 QString confFile = locateLocal("config","korganizerrc"); 70 QString confFile = locateLocal("config","korganizerrc");
70 QFileInfo finf ( confFile ); 71 QFileInfo finf ( confFile );
71 bool showWarning = !finf.exists(); 72 bool showWarning = !finf.exists();
72 setIcon(SmallIcon( "ko24" ) ); 73 setIcon(SmallIcon( "ko24" ) );
73 mBlockAtStartup = true; 74 mBlockAtStartup = true;
74 mFlagKeyPressed = false; 75 mFlagKeyPressed = false;
75 setCaption("KOrganizer/Pi"); 76 setCaption("KOrganizer/Pi");
76 KOPrefs *p = KOPrefs::instance(); 77 KOPrefs *p = KOPrefs::instance();
77 // if ( QApplication::desktop()->height() > 480 ) { 78 // if ( QApplication::desktop()->height() > 480 ) {
78// if ( p->mHourSize == 4 ) 79// if ( p->mHourSize == 4 )
79// p->mHourSize = 6; 80// p->mHourSize = 6;
80// } 81// }
81 if ( p->mHourSize > 18 ) 82 if ( p->mHourSize > 18 )
82 p->mHourSize = 18; 83 p->mHourSize = 18;
83 QMainWindow::ToolBarDock tbd; 84 QMainWindow::ToolBarDock tbd;
84 if ( p->mToolBarHor ) { 85 if ( p->mToolBarHor ) {
85 if ( p->mToolBarUp ) 86 if ( p->mToolBarUp )
86 tbd = Bottom; 87 tbd = Bottom;
87 else 88 else
88 tbd = Top; 89 tbd = Top;
89 } 90 }
90 else { 91 else {
91 if ( p->mToolBarUp ) 92 if ( p->mToolBarUp )
92 tbd = Right; 93 tbd = Right;
93 else 94 else
94 tbd = Left; 95 tbd = Left;
95 } 96 }
96 if ( KOPrefs::instance()->mUseAppColors ) 97 if ( KOPrefs::instance()->mUseAppColors )
97 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 98 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
98 globalFlagBlockStartup = 1; 99 globalFlagBlockStartup = 1;
99 iconToolBar = new QPEToolBar( this ); 100 iconToolBar = new QPEToolBar( this );
100 addToolBar (iconToolBar , tbd ); 101 addToolBar (iconToolBar , tbd );
101 mBlockSaveFlag = false; 102 mBlockSaveFlag = false;
102 mCalendarModifiedFlag = false; 103 mCalendarModifiedFlag = false;
103 104
104 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 105 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
105 splash->setAlignment ( AlignCenter ); 106 splash->setAlignment ( AlignCenter );
106 setCentralWidget( splash ); 107 setCentralWidget( splash );
107#ifndef DESKTOP_VERSION 108#ifndef DESKTOP_VERSION
108 showMaximized(); 109 showMaximized();
109#endif 110#endif
110 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 111 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
111 setDefaultPreferences(); 112 setDefaultPreferences();
112 mCalendar = new CalendarLocal(); 113 mCalendar = new CalendarLocal();
113 mView = new CalendarView( mCalendar, this,"mCalendar " ); 114 mView = new CalendarView( mCalendar, this,"mCalendar " );
114 mView->hide(); 115 mView->hide();
115 //mView->resize(splash->size() ); 116 //mView->resize(splash->size() );
116 initActions(); 117 initActions();
117#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
118 iconToolBar->show(); 119 iconToolBar->show();
119 qApp->processEvents(); 120 qApp->processEvents();
120#endif 121#endif
121 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 122 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
122 int vh = height() ; 123 int vh = height() ;
123 int vw = width(); 124 int vw = width();
124 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 125 //qDebug("Toolbar hei %d ",iconToolBar->height() );
125 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 126 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
126 vh -= iconToolBar->height(); 127 vh -= iconToolBar->height();
127 } else { 128 } else {
128 vw -= iconToolBar->height(); 129 vw -= iconToolBar->height();
129 } 130 }
130 //mView->setMaximumSize( splash->size() ); 131 //mView->setMaximumSize( splash->size() );
131 //mView->resize( splash->size() ); 132 //mView->resize( splash->size() );
132 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 133 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
133 mView->readSettings(); 134 mView->readSettings();
134 bool oldOpened = false; 135 bool oldOpened = false;
135 bool newFile = false; 136 bool newFile = false;
136 if( !QFile::exists( defaultFileName() ) ) { 137 if( !QFile::exists( defaultFileName() ) ) {
137 QFileInfo finfo ( defaultFileName() ); 138 QFileInfo finfo ( defaultFileName() );
138 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 139 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
139 qDebug("oldfile %s ", oldFile.latin1()); 140 qDebug("oldfile %s ", oldFile.latin1());
140 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"; 141 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";
141 finfo.setFile( oldFile ); 142 finfo.setFile( oldFile );
142 if (finfo.exists() ) { 143 if (finfo.exists() ) {
143 KMessageBox::information( this, message); 144 KMessageBox::information( this, message);
144 mView->openCalendar( oldFile ); 145 mView->openCalendar( oldFile );
145 qApp->processEvents(); 146 qApp->processEvents();
146 } else { 147 } else {
147 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 148 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
148 finfo.setFile( oldFile ); 149 finfo.setFile( oldFile );
149 if (finfo.exists() ) { 150 if (finfo.exists() ) {
150 KMessageBox::information( this, message); 151 KMessageBox::information( this, message);
151 mView->openCalendar( oldFile ); 152 mView->openCalendar( oldFile );
@@ -491,192 +492,200 @@ void MainWindow::initActions()
491 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 492 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
492 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 493 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
493 viewjournal_action->addTo( viewMenu ); 494 viewjournal_action->addTo( viewMenu );
494 connect( viewjournal_action, SIGNAL( activated() ), 495 connect( viewjournal_action, SIGNAL( activated() ),
495 mView->viewManager(), SLOT( showJournalView() ) ); 496 mView->viewManager(), SLOT( showJournalView() ) );
496 497
497 icon = loadPixmap( pathString + "xdays" ); 498 icon = loadPixmap( pathString + "xdays" );
498 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 499 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
499 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 500 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
500 xdays_action->addTo( viewMenu ); 501 xdays_action->addTo( viewMenu );
501 connect( xdays_action, SIGNAL( activated() ), 502 connect( xdays_action, SIGNAL( activated() ),
502 mView->viewManager(), SLOT( showNextXView() ) ); 503 mView->viewManager(), SLOT( showNextXView() ) );
503 504
504 icon = loadPixmap( pathString + "whatsnext" ); 505 icon = loadPixmap( pathString + "whatsnext" );
505 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 506 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
506 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 507 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
507 whatsnext_action->addTo( viewMenu ); 508 whatsnext_action->addTo( viewMenu );
508 connect( whatsnext_action, SIGNAL( activated() ), 509 connect( whatsnext_action, SIGNAL( activated() ),
509 mView->viewManager(), SLOT( showWhatsNextView() ) ); 510 mView->viewManager(), SLOT( showWhatsNextView() ) );
510 511
511#if 0 512#if 0
512 action = new QAction( "view_timespan", "Time Span", 0, this ); 513 action = new QAction( "view_timespan", "Time Span", 0, this );
513 action->addTo( viewMenu ); 514 action->addTo( viewMenu );
514 connect( action, SIGNAL( activated() ), 515 connect( action, SIGNAL( activated() ),
515 mView->viewManager(), SLOT( showTimeSpanView() ) ); 516 mView->viewManager(), SLOT( showTimeSpanView() ) );
516#endif 517#endif
517 518
518 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 519 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
519 this ); 520 this );
520 mNewSubTodoAction->addTo( actionMenu ); 521 mNewSubTodoAction->addTo( actionMenu );
521 connect( mNewSubTodoAction, SIGNAL( activated() ), 522 connect( mNewSubTodoAction, SIGNAL( activated() ),
522 mView, SLOT( newSubTodo() ) ); 523 mView, SLOT( newSubTodo() ) );
523 524
524 actionMenu->insertSeparator(); 525 actionMenu->insertSeparator();
525 526
526 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 527 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
527 mShowAction->addTo( actionMenu ); 528 mShowAction->addTo( actionMenu );
528 connect( mShowAction, SIGNAL( activated() ), 529 connect( mShowAction, SIGNAL( activated() ),
529 mView, SLOT( showIncidence() ) ); 530 mView, SLOT( showIncidence() ) );
530 531
531 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 532 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
532 mEditAction->addTo( actionMenu ); 533 mEditAction->addTo( actionMenu );
533 connect( mEditAction, SIGNAL( activated() ), 534 connect( mEditAction, SIGNAL( activated() ),
534 mView, SLOT( editIncidence() ) ); 535 mView, SLOT( editIncidence() ) );
535 536
536 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 537 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
537 mDeleteAction->addTo( actionMenu ); 538 mDeleteAction->addTo( actionMenu );
538 connect( mDeleteAction, SIGNAL( activated() ), 539 connect( mDeleteAction, SIGNAL( activated() ),
539 mView, SLOT( deleteIncidence() ) ); 540 mView, SLOT( deleteIncidence() ) );
540 541
541 actionMenu->insertSeparator(); 542 actionMenu->insertSeparator();
542 543
543 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 544 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
544 this ); 545 this );
545 action->addTo( actionMenu ); 546 action->addTo( actionMenu );
546 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 547 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
547 548
548 icon = loadPixmap( pathString + "search" ); 549 icon = loadPixmap( pathString + "search" );
549 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 550 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
550 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 551 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
551 search_action->addTo( actionMenu ); 552 search_action->addTo( actionMenu );
552 connect( search_action, SIGNAL( activated() ), 553 connect( search_action, SIGNAL( activated() ),
553 mView->dialogManager(), SLOT( showSearchDialog() ) ); 554 mView->dialogManager(), SLOT( showSearchDialog() ) );
554 555
555 icon = loadPixmap( pathString + "today" ); 556 icon = loadPixmap( pathString + "today" );
556 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 557 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
557 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 558 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
558 today_action->addTo( actionMenu ); 559 today_action->addTo( actionMenu );
559 connect( today_action, SIGNAL( activated() ), 560 connect( today_action, SIGNAL( activated() ),
560 mView, SLOT( goToday() ) ); 561 mView, SLOT( goToday() ) );
561 562
562 if ( KOPrefs::instance()->mShowFullMenu ) { 563 if ( KOPrefs::instance()->mShowFullMenu ) {
563 actionMenu->insertSeparator(); 564 actionMenu->insertSeparator();
564 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 565 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
565 566
566 } 567 }
567 // actionMenu->insertSeparator(); 568 // actionMenu->insertSeparator();
568 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 569 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
569 this ); 570 this );
570 action->addTo( importMenu ); 571 action->addTo( importMenu );
571 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 572 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
572 action = new QAction( "import_quick", i18n("Import last file"), 0, 573 action = new QAction( "import_quick", i18n("Import last file"), 0,
573 this ); 574 this );
574 action->addTo( importMenu ); 575 action->addTo( importMenu );
575 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 576 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
576 importMenu->insertSeparator(); 577 importMenu->insertSeparator();
577 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 578 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
578 this ); 579 this );
579 action->addTo( importMenu ); 580 action->addTo( importMenu );
580 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 581 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
581#ifndef DESKTOP_VERSION 582#ifndef DESKTOP_VERSION
582 importMenu->insertSeparator(); 583 importMenu->insertSeparator();
583 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 584 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
584 this ); 585 this );
585 action->addTo( importMenu ); 586 action->addTo( importMenu );
586 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 587 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
588#else
589#ifdef _WIN32_
590 importMenu->insertSeparator();
591 action = new QAction( "import_ol", i18n("Import from OL"), 0,
592 this );
593 action->addTo( importMenu );
594 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
595#endif
587#endif 596#endif
588 597
589 importMenu->insertSeparator(); 598 importMenu->insertSeparator();
590 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 599 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
591 this ); 600 this );
592 action->addTo( importMenu ); 601 action->addTo( importMenu );
593 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 602 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
594 603
595 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 604 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
596 this ); 605 this );
597 action->addTo( importMenu ); 606 action->addTo( importMenu );
598 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 607 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
599 608
600 importMenu->insertSeparator(); 609 importMenu->insertSeparator();
601 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 610 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
602 this ); 611 this );
603 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 612 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
604 importMenu->insertSeparator(); 613 importMenu->insertSeparator();
605 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 614 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
606 this ); 615 this );
607 action->addTo( importMenu ); 616 action->addTo( importMenu );
608 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 617 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
609#ifndef DESKTOP_VERSION 618#ifndef DESKTOP_VERSION
610 importMenu->insertSeparator(); 619 importMenu->insertSeparator();
611 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 620 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
612 this ); 621 this );
613 action->addTo( importMenu ); 622 action->addTo( importMenu );
614 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 623 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
615 624
616 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 625 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
617 this ); 626 this );
618 action->addTo( importMenu ); 627 action->addTo( importMenu );
619 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 628 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
620#else 629#else
621 importMenu->insertSeparator(); 630 importMenu->insertSeparator();
622 icon = loadPixmap( pathString + "print" ); 631 icon = loadPixmap( pathString + "print" );
623 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 632 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
624 action->addTo( importMenu ); 633 action->addTo( importMenu );
625 connect( action, SIGNAL( activated() ), 634 connect( action, SIGNAL( activated() ),
626 this, SLOT( printCal() ) ); 635 this, SLOT( printCal() ) );
627 636
628 icon = loadPixmap( pathString + "print" ); 637 icon = loadPixmap( pathString + "print" );
629 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 638 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
630 action->addTo( importMenu ); 639 action->addTo( importMenu );
631 connect( action, SIGNAL( activated() ), 640 connect( action, SIGNAL( activated() ),
632 this, SLOT( printSel() ) ); 641 this, SLOT( printSel() ) );
633#endif 642#endif
634 importMenu->insertSeparator(); 643 importMenu->insertSeparator();
635 action = new QAction( "beam all", i18n("Save"), 0, 644 action = new QAction( "beam all", i18n("Save"), 0,
636 this ); 645 this );
637 action->addTo( importMenu ); 646 action->addTo( importMenu );
638 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
639 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 648 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
640 this ); 649 this );
641 action->addTo( importMenu ); 650 action->addTo( importMenu );
642 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
643 652
644 //menuBar->insertItem( "Configure",configureMenu ); 653 //menuBar->insertItem( "Configure",configureMenu );
645 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
646 icon = loadPixmap( "korganizer/korganizer" ); 655 icon = loadPixmap( "korganizer/korganizer" );
647 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
648 action->addTo( helpMenu ); 657 action->addTo( helpMenu );
649 connect( action, SIGNAL( activated() ), 658 connect( action, SIGNAL( activated() ),
650 SLOT( keyBindings() ) ); 659 SLOT( keyBindings() ) );
651 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
652 action->addTo( helpMenu ); 661 action->addTo( helpMenu );
653 connect( action, SIGNAL( activated() ), 662 connect( action, SIGNAL( activated() ),
654 SLOT( features() ) ); 663 SLOT( features() ) );
655 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
656 action->addTo( helpMenu ); 665 action->addTo( helpMenu );
657 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
658 SLOT( aboutAutoSaving() ) ); 667 SLOT( aboutAutoSaving() ) );
659 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
660 action->addTo( helpMenu ); 669 action->addTo( helpMenu );
661 connect( action, SIGNAL( activated() ), 670 connect( action, SIGNAL( activated() ),
662 SLOT( aboutKnownBugs() ) ); 671 SLOT( aboutKnownBugs() ) );
663 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
664 action->addTo( helpMenu ); 673 action->addTo( helpMenu );
665 connect( action, SIGNAL( activated() ), 674 connect( action, SIGNAL( activated() ),
666 SLOT( usertrans() ) ); 675 SLOT( usertrans() ) );
667 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
668 action->addTo( helpMenu ); 677 action->addTo( helpMenu );
669 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
670 SLOT( synchowto() ) ); 679 SLOT( synchowto() ) );
671 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 680 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
672 action->addTo( helpMenu ); 681 action->addTo( helpMenu );
673 connect( action, SIGNAL( activated() ), 682 connect( action, SIGNAL( activated() ),
674 SLOT( whatsNew() ) ); 683 SLOT( whatsNew() ) );
675 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
676 action->addTo( helpMenu ); 685 action->addTo( helpMenu );
677 connect( action, SIGNAL( activated() ), 686 connect( action, SIGNAL( activated() ),
678 SLOT( faq() ) ); 687 SLOT( faq() ) );
679 688
680 689
681 action = new QAction( "about", i18n("About..."), 0, this ); 690 action = new QAction( "about", i18n("About..."), 0, this );
682 action->addTo( helpMenu ); 691 action->addTo( helpMenu );
@@ -837,193 +846,195 @@ void MainWindow::fillSyncMenu()
837 if ( i == 2 ) 846 if ( i == 2 )
838 syncMenu->insertSeparator(); 847 syncMenu->insertSeparator();
839 } 848 }
840 QDir app_dir; 849 QDir app_dir;
841 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 850 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
842 syncMenu->setItemEnabled( false , 1000 ); 851 syncMenu->setItemEnabled( false , 1000 );
843 } 852 }
844} 853}
845 854
846int MainWindow::ringSync() 855int MainWindow::ringSync()
847{ 856{
848 int syncedProfiles = 0; 857 int syncedProfiles = 0;
849 int i; 858 int i;
850 QTime timer; 859 QTime timer;
851 KConfig *config = KOGlobals::config(); 860 KConfig *config = KOGlobals::config();
852 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 861 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
853 KSyncProfile* temp = new KSyncProfile (); 862 KSyncProfile* temp = new KSyncProfile ();
854 KOPrefs::instance()->mAskForPreferences = false; 863 KOPrefs::instance()->mAskForPreferences = false;
855 for ( i = 0; i < syncProfileNames.count(); ++i ) { 864 for ( i = 0; i < syncProfileNames.count(); ++i ) {
856 mCurrentSyncProfile = i; 865 mCurrentSyncProfile = i;
857 temp->setName(syncProfileNames[mCurrentSyncProfile]); 866 temp->setName(syncProfileNames[mCurrentSyncProfile]);
858 temp->readConfig(config); 867 temp->readConfig(config);
859 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 868 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
860 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 869 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
861 ++syncedProfiles; 870 ++syncedProfiles;
862 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 871 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
863 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 872 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
864 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 873 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
865 KOPrefs::instance()->mShowSyncSummary = false; 874 KOPrefs::instance()->mShowSyncSummary = false;
866 mView->setSyncDevice(syncProfileNames[i] ); 875 mView->setSyncDevice(syncProfileNames[i] );
867 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 876 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
868 if ( i == 0 ) { 877 if ( i == 0 ) {
869 syncSharp(); 878 syncSharp();
870 } else { 879 } else {
871 if ( temp->getIsLocalFileSync() ) { 880 if ( temp->getIsLocalFileSync() ) {
872 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 881 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
873 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 882 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
874 } else { 883 } else {
875 syncRemote( temp, false ); 884 syncRemote( temp, false );
876 885
877 } 886 }
878 } 887 }
879 timer.start(); 888 timer.start();
880 setCaption(i18n("Multiple sync in progress ... please wait!") ); 889 setCaption(i18n("Multiple sync in progress ... please wait!") );
881 while ( timer.elapsed () < 2000 ) { 890 while ( timer.elapsed () < 2000 ) {
882 qApp->processEvents(); 891 qApp->processEvents();
883#ifndef _WIN32_ 892#ifndef _WIN32_
884 sleep (1); 893 sleep (1);
885#endif 894#endif
886 } 895 }
887 896
888 } 897 }
889 898
890 } 899 }
891 delete temp; 900 delete temp;
892 return syncedProfiles; 901 return syncedProfiles;
893} 902}
894 903
895void MainWindow::multiSync( bool askforPrefs ) 904void MainWindow::multiSync( bool askforPrefs )
896{ 905{
897 if (mBlockSaveFlag) 906 if (mBlockSaveFlag)
898 return; 907 return;
899 mBlockSaveFlag = true; 908 mBlockSaveFlag = true;
900 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 909 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
901 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 910 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
902 question, 911 question,
903 i18n("Yes"), i18n("No"), 912 i18n("Yes"), i18n("No"),
904 0, 0 ) != 0 ) { 913 0, 0 ) != 0 ) {
905 mBlockSaveFlag = false; 914 mBlockSaveFlag = false;
906 setCaption(i18n("Aborted! Nothing synced!")); 915 setCaption(i18n("Aborted! Nothing synced!"));
907 return; 916 return;
908 } 917 }
909 mView->setSyncDevice(i18n("Multiple profiles") ); 918 mView->setSyncDevice(i18n("Multiple profiles") );
910 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 919 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
911 if ( askforPrefs ) { 920 if ( askforPrefs ) {
912 mView->edit_sync_options(); 921 mView->edit_sync_options();
913 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 922 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
914 } 923 }
915 setCaption(i18n("Multiple sync started.") ); 924 setCaption(i18n("Multiple sync started.") );
916 qApp->processEvents(); 925 qApp->processEvents();
917 int num = ringSync() ; 926 int num = ringSync() ;
918 if ( num > 1 ) 927 if ( num > 1 )
919 ringSync(); 928 ringSync();
920 mBlockSaveFlag = false; 929 mBlockSaveFlag = false;
921 if ( num ) 930 if ( num )
922 save(); 931 save();
923 if ( num ) 932 if ( num )
924 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 933 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
925 else 934 else
926 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 935 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
927 return; 936 return;
928} 937}
929void MainWindow::slotSyncMenu( int action ) 938void MainWindow::slotSyncMenu( int action )
930{ 939{
931 //qDebug("syncaction %d ", action); 940 //qDebug("syncaction %d ", action);
932 if ( action == 0 ) { 941 if ( action == 0 ) {
942
933 confSync(); 943 confSync();
944
934 return; 945 return;
935 } 946 }
936 if ( action == 1 ) { 947 if ( action == 1 ) {
937 multiSync( true ); 948 multiSync( true );
938 return; 949 return;
939 } 950 }
940 951
941 if (mBlockSaveFlag) 952 if (mBlockSaveFlag)
942 return; 953 return;
943 mBlockSaveFlag = true; 954 mBlockSaveFlag = true;
944 mCurrentSyncProfile = action - 1000 ; 955 mCurrentSyncProfile = action - 1000 ;
945 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 956 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
946 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 957 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
947 KConfig *config = KOGlobals::config(); 958 KConfig *config = KOGlobals::config();
948 KSyncProfile* temp = new KSyncProfile (); 959 KSyncProfile* temp = new KSyncProfile ();
949 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 960 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
950 temp->readConfig(config); 961 temp->readConfig(config);
951 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 962 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
952 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 963 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
953 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 964 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
954 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 965 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
955 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 966 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
956 if ( action == 1000 ) { 967 if ( action == 1000 ) {
957 syncSharp(); 968 syncSharp();
958 969
959 } else if ( action == 1001 ) { 970 } else if ( action == 1001 ) {
960 syncLocalFile(); 971 syncLocalFile();
961 972
962 } else if ( action == 1002 ) { 973 } else if ( action == 1002 ) {
963 quickSyncLocalFile(); 974 quickSyncLocalFile();
964 975
965 } else if ( action >= 1003 ) { 976 } else if ( action >= 1003 ) {
966 if ( temp->getIsLocalFileSync() ) { 977 if ( temp->getIsLocalFileSync() ) {
967 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 978 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
968 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 979 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
969 } else { 980 } else {
970 syncRemote( temp ); 981 syncRemote( temp );
971 982
972 } 983 }
973 } 984 }
974 delete temp; 985 delete temp;
975 mBlockSaveFlag = false; 986 mBlockSaveFlag = false;
976} 987}
977void MainWindow::setDefaultPreferences() 988void MainWindow::setDefaultPreferences()
978{ 989{
979 KOPrefs *p = KOPrefs::instance(); 990 KOPrefs *p = KOPrefs::instance();
980 991
981 p->mCompactDialogs = true; 992 p->mCompactDialogs = true;
982 p->mConfirm = true; 993 p->mConfirm = true;
983 // p->mEnableQuickTodo = false; 994 // p->mEnableQuickTodo = false;
984} 995}
985 996
986QString MainWindow::resourcePath() 997QString MainWindow::resourcePath()
987{ 998{
988 return KGlobal::iconLoader()->iconPath(); 999 return KGlobal::iconLoader()->iconPath();
989} 1000}
990 1001
991void MainWindow::displayText( QString text ,QString cap ) 1002void MainWindow::displayText( QString text ,QString cap )
992{ 1003{
993 QDialog dia( this, "name", true ); ; 1004 QDialog dia( this, "name", true ); ;
994 dia.setCaption( cap ); 1005 dia.setCaption( cap );
995 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1006 QVBoxLayout* lay = new QVBoxLayout( &dia );
996 lay->setSpacing( 3 ); 1007 lay->setSpacing( 3 );
997 lay->setMargin( 3 ); 1008 lay->setMargin( 3 );
998 QTextBrowser tb ( &dia ); 1009 QTextBrowser tb ( &dia );
999 lay->addWidget( &tb ); 1010 lay->addWidget( &tb );
1000 tb.setText( text ); 1011 tb.setText( text );
1001#ifdef DESKTOP_VERSION 1012#ifdef DESKTOP_VERSION
1002 dia.resize( 640, 480); 1013 dia.resize( 640, 480);
1003#else 1014#else
1004 dia.showMaximized(); 1015 dia.showMaximized();
1005#endif 1016#endif
1006 dia.exec(); 1017 dia.exec();
1007} 1018}
1008void MainWindow::displayFile( QString fn, QString cap ) 1019void MainWindow::displayFile( QString fn, QString cap )
1009{ 1020{
1010 QString fileName = resourcePath() + fn; 1021 QString fileName = resourcePath() + fn;
1011 QString text; 1022 QString text;
1012 QFile file( fileName ); 1023 QFile file( fileName );
1013 if (!file.open( IO_ReadOnly ) ) { 1024 if (!file.open( IO_ReadOnly ) ) {
1014 return ; 1025 return ;
1015 1026
1016 } 1027 }
1017 QTextStream ts( &file ); 1028 QTextStream ts( &file );
1018 text = ts.read(); 1029 text = ts.read();
1019 file.close(); 1030 file.close();
1020 displayText( text, cap); 1031 displayText( text, cap);
1021} 1032}
1022void MainWindow::features() 1033void MainWindow::features()
1023{ 1034{
1024 1035
1025 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1036 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1026} 1037}
1027 1038
1028void MainWindow::usertrans() 1039void MainWindow::usertrans()
1029{ 1040{
@@ -1126,192 +1137,201 @@ void MainWindow::aboutAutoSaving()
1126 delete msg; 1137 delete msg;
1127 1138
1128 1139
1129} 1140}
1130void MainWindow::aboutKnownBugs() 1141void MainWindow::aboutKnownBugs()
1131{ 1142{
1132 QMessageBox* msg; 1143 QMessageBox* msg;
1133 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1144 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1134 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")+ 1145 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")+
1135 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1146 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1136 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1147 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1137 i18n("\nor report them in the bugtracker on\n") + 1148 i18n("\nor report them in the bugtracker on\n") +
1138 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1149 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1139 QMessageBox::NoIcon, 1150 QMessageBox::NoIcon,
1140 QMessageBox::Ok, 1151 QMessageBox::Ok,
1141 QMessageBox::NoButton, 1152 QMessageBox::NoButton,
1142 QMessageBox::NoButton); 1153 QMessageBox::NoButton);
1143 msg->exec(); 1154 msg->exec();
1144 delete msg; 1155 delete msg;
1145 1156
1146} 1157}
1147 1158
1148QString MainWindow::defaultFileName() 1159QString MainWindow::defaultFileName()
1149{ 1160{
1150 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1161 return locateLocal( "data", "korganizer/mycalendar.ics" );
1151} 1162}
1152 1163
1153void MainWindow::processIncidenceSelection( Incidence *incidence ) 1164void MainWindow::processIncidenceSelection( Incidence *incidence )
1154{ 1165{
1155 if ( !incidence ) { 1166 if ( !incidence ) {
1156 enableIncidenceActions( false ); 1167 enableIncidenceActions( false );
1157 1168
1158 mNewSubTodoAction->setEnabled( false ); 1169 mNewSubTodoAction->setEnabled( false );
1159 setCaptionToDates(); 1170 setCaptionToDates();
1160 return; 1171 return;
1161 1172
1162 } 1173 }
1163 1174
1164 //KGlobal::locale()->formatDateTime(nextA, true); 1175 //KGlobal::locale()->formatDateTime(nextA, true);
1165 QString startString = ""; 1176 QString startString = "";
1166 if ( incidence->type() != "Todo" ) { 1177 if ( incidence->type() != "Todo" ) {
1167 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1178 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1168 if ( incidence->doesFloat() ) { 1179 if ( incidence->doesFloat() ) {
1169 startString += ": "+incidence->dtStartDateStr( true ); 1180 startString += ": "+incidence->dtStartDateStr( true );
1170 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1181 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1171 1182
1172 } else { 1183 } else {
1173 startString = ": "+incidence->dtStartStr(true); 1184 startString = ": "+incidence->dtStartStr(true);
1174 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1185 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1175 1186
1176 } 1187 }
1177 1188
1178 } else { 1189 } else {
1179 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1190 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1180 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1191 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1181 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1192 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1182 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1193 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1183 } 1194 }
1184 1195
1185 } 1196 }
1186 else 1197 else
1187 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1198 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1188 if ( !incidence->location().isEmpty() ) 1199 if ( !incidence->location().isEmpty() )
1189 startString += " (" +incidence->location()+")"; 1200 startString += " (" +incidence->location()+")";
1190 setCaption( incidence->summary()+startString); 1201 setCaption( incidence->summary()+startString);
1191 1202
1192 enableIncidenceActions( true ); 1203 enableIncidenceActions( true );
1193 1204
1194 if ( incidence->type() == "Event" ) { 1205 if ( incidence->type() == "Event" ) {
1195 mShowAction->setText( i18n("Show Event...") ); 1206 mShowAction->setText( i18n("Show Event...") );
1196 mEditAction->setText( i18n("Edit Event...") ); 1207 mEditAction->setText( i18n("Edit Event...") );
1197 mDeleteAction->setText( i18n("Delete Event...") ); 1208 mDeleteAction->setText( i18n("Delete Event...") );
1198 1209
1199 mNewSubTodoAction->setEnabled( false ); 1210 mNewSubTodoAction->setEnabled( false );
1200 } else if ( incidence->type() == "Todo" ) { 1211 } else if ( incidence->type() == "Todo" ) {
1201 mShowAction->setText( i18n("Show Todo...") ); 1212 mShowAction->setText( i18n("Show Todo...") );
1202 mEditAction->setText( i18n("Edit Todo...") ); 1213 mEditAction->setText( i18n("Edit Todo...") );
1203 mDeleteAction->setText( i18n("Delete Todo...") ); 1214 mDeleteAction->setText( i18n("Delete Todo...") );
1204 1215
1205 mNewSubTodoAction->setEnabled( true ); 1216 mNewSubTodoAction->setEnabled( true );
1206 } else { 1217 } else {
1207 mShowAction->setText( i18n("Show...") ); 1218 mShowAction->setText( i18n("Show...") );
1208 mShowAction->setText( i18n("Edit...") ); 1219 mShowAction->setText( i18n("Edit...") );
1209 mShowAction->setText( i18n("Delete...") ); 1220 mShowAction->setText( i18n("Delete...") );
1210 1221
1211 mNewSubTodoAction->setEnabled( false ); 1222 mNewSubTodoAction->setEnabled( false );
1212 } 1223 }
1213} 1224}
1214 1225
1215void MainWindow::enableIncidenceActions( bool enabled ) 1226void MainWindow::enableIncidenceActions( bool enabled )
1216{ 1227{
1217 mShowAction->setEnabled( enabled ); 1228 mShowAction->setEnabled( enabled );
1218 mEditAction->setEnabled( enabled ); 1229 mEditAction->setEnabled( enabled );
1219 mDeleteAction->setEnabled( enabled ); 1230 mDeleteAction->setEnabled( enabled );
1220} 1231}
1221 1232
1233void MainWindow::importOL()
1234{
1235#ifdef _WIN32_
1236 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1237 id->exec();
1238 delete id;
1239 mView->updateView();
1240#endif
1241}
1222void MainWindow::importBday() 1242void MainWindow::importBday()
1223{ 1243{
1224 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1244 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1225 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1245 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1226 i18n("Import!"), i18n("Cancel"), 0, 1246 i18n("Import!"), i18n("Cancel"), 0,
1227 0, 1 ); 1247 0, 1 );
1228 if ( result == 0 ) { 1248 if ( result == 0 ) {
1229 mView->importBday(); 1249 mView->importBday();
1230 1250
1231 } 1251 }
1232 1252
1233 1253
1234} 1254}
1235void MainWindow::importQtopia() 1255void MainWindow::importQtopia()
1236{ 1256{
1237#ifndef DESKTOP_VERSION 1257#ifndef DESKTOP_VERSION
1238 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1258 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1239 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"), 1259 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"),
1240 i18n("Import!"), i18n("Cancel"), 0, 1260 i18n("Import!"), i18n("Cancel"), 0,
1241 0, 1 ); 1261 0, 1 );
1242 if ( result == 0 ) { 1262 if ( result == 0 ) {
1243 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1263 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1244 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1264 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1245 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1265 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1246 mView->importQtopia( categories, datebook, todolist ); 1266 mView->importQtopia( categories, datebook, todolist );
1247 } 1267 }
1248#else 1268#else
1249 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1269 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1250 i18n("Not supported \non desktop!\n"), 1270 i18n("Not supported \non desktop!\n"),
1251 i18n("Ok"), i18n("Cancel"), 0, 1271 i18n("Ok"), i18n("Cancel"), 0,
1252 0, 1 ); 1272 0, 1 );
1253 1273
1254#endif 1274#endif
1255} 1275}
1256 1276
1257void MainWindow::saveOnClose() 1277void MainWindow::saveOnClose()
1258{ 1278{
1259 KOPrefs *p = KOPrefs::instance(); 1279 KOPrefs *p = KOPrefs::instance();
1260 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1280 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1261 p->mToolBarUp = iconToolBar->x() > width()/2 || 1281 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1262 iconToolBar->y() > height()/2; 1282 iconToolBar->y() > height()/2;
1263 mView->writeSettings(); 1283 mView->writeSettings();
1264 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1284 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1265 save(); 1285 save();
1266} 1286}
1267void MainWindow::slotModifiedChanged( bool changed ) 1287void MainWindow::slotModifiedChanged( bool changed )
1268{ 1288{
1269 if ( mBlockAtStartup ) 1289 if ( mBlockAtStartup )
1270 return; 1290 return;
1271 int msec; 1291 int msec;
1272 // we store the changes after 1 minute, 1292 // we store the changes after 1 minute,
1273 // and for safety reasons after 10 minutes again 1293 // and for safety reasons after 10 minutes again
1274 if ( !mBlockSaveFlag ) 1294 if ( !mBlockSaveFlag )
1275 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1295 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1276 else 1296 else
1277 msec = 1000 * 600; 1297 msec = 1000 * 600;
1278 mSaveTimer.start( msec, true ); // 1 minute 1298 mSaveTimer.start( msec, true ); // 1 minute
1279 qDebug("KO: Saving File in %d secs!", msec/1000); 1299 qDebug("KO: Saving File in %d secs!", msec/1000);
1280 mCalendarModifiedFlag = true; 1300 mCalendarModifiedFlag = true;
1281} 1301}
1282#include <qfileinfo.h> 1302#include <qfileinfo.h>
1283void MainWindow::save() 1303void MainWindow::save()
1284{ 1304{
1285 if ( mBlockSaveFlag ) 1305 if ( mBlockSaveFlag )
1286 return; 1306 return;
1287 bool store = mBlockSaveFlag; 1307 bool store = mBlockSaveFlag;
1288 mBlockSaveFlag = true; 1308 mBlockSaveFlag = true;
1289 if ( mView->checkFileVersion( defaultFileName()) ) { 1309 if ( mView->checkFileVersion( defaultFileName()) ) {
1290 1310
1291 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1311 QTime neededSaveTime = QDateTime::currentDateTime().time();
1292 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1312 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1293 qDebug("KO: Start saving data to file!"); 1313 qDebug("KO: Start saving data to file!");
1294 mView->saveCalendar( defaultFileName() ); 1314 mView->saveCalendar( defaultFileName() );
1295 1315
1296 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1316 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1297 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1317 mView->setLoadedFileVersion(QDateTime::currentDateTime());
1298 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1318 qDebug("KO: Needed %d ms for saving.",msNeeded );
1299 QString savemes; 1319 QString savemes;
1300 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1320 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1301 setCaption(savemes); 1321 setCaption(savemes);
1302 } else 1322 } else
1303 setCaption(i18n("Saving cancelled!")); 1323 setCaption(i18n("Saving cancelled!"));
1304 mCalendarModifiedFlag = false; 1324 mCalendarModifiedFlag = false;
1305 mBlockSaveFlag = store; 1325 mBlockSaveFlag = store;
1306} 1326}
1307 1327
1308void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1328void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1309{ 1329{
1310 if ( !e->isAutoRepeat() ) { 1330 if ( !e->isAutoRepeat() ) {
1311 mFlagKeyPressed = false; 1331 mFlagKeyPressed = false;
1312 } 1332 }
1313} 1333}
1314void MainWindow::keyPressEvent ( QKeyEvent * e ) 1334void MainWindow::keyPressEvent ( QKeyEvent * e )
1315{ 1335{
1316 qApp->processEvents(); 1336 qApp->processEvents();
1317 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1337 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index ee4aaa6..a681f42 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,115 +1,116 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7 7
8#include <libkcal/incidence.h> 8#include <libkcal/incidence.h>
9#include "simplealarmclient.h" 9#include "simplealarmclient.h"
10 10
11class QAction; 11class QAction;
12class CalendarView; 12class CalendarView;
13class KSyncProfile; 13class KSyncProfile;
14#ifdef DESKTOP_VERSION 14#ifdef DESKTOP_VERSION
15 15
16#define QPEToolBar QToolBar 16#define QPEToolBar QToolBar
17#define QPEMenuBar QMenuBar 17#define QPEMenuBar QMenuBar
18#endif 18#endif
19class QPEToolBar; 19class QPEToolBar;
20 20
21namespace KCal { 21namespace KCal {
22class CalendarLocal; 22class CalendarLocal;
23} 23}
24 24
25using namespace KCal; 25using namespace KCal;
26 26
27class MainWindow : public QMainWindow 27class MainWindow : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 public: 30 public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
32 ~MainWindow(); 32 ~MainWindow();
33 public slots: 33 public slots:
34 void configureAgenda( int ); 34 void configureAgenda( int );
35 void recieve( const QCString& msg, const QByteArray& data ); 35 void recieve( const QCString& msg, const QByteArray& data );
36 static QString defaultFileName(); 36 static QString defaultFileName();
37 static QString resourcePath(); 37 static QString resourcePath();
38 protected slots: 38 protected slots:
39 void setCaptionToDates(); 39 void setCaptionToDates();
40 int ringSync(); 40 int ringSync();
41 void multiSync( bool askforPrefs = false ); 41 void multiSync( bool askforPrefs = false );
42 void about(); 42 void about();
43 void faq(); 43 void faq();
44 void usertrans(); 44 void usertrans();
45 void features(); 45 void features();
46 void synchowto(); 46 void synchowto();
47 void whatsNew(); 47 void whatsNew();
48 void keyBindings(); 48 void keyBindings();
49 void aboutAutoSaving();; 49 void aboutAutoSaving();;
50 void aboutKnownBugs(); 50 void aboutKnownBugs();
51 51
52 void processIncidenceSelection( Incidence * ); 52 void processIncidenceSelection( Incidence * );
53 53
54 void importQtopia(); 54 void importQtopia();
55 void importBday(); 55 void importBday();
56 void importOL();
56 void importIcal(); 57 void importIcal();
57 void importFile( QString, bool ); 58 void importFile( QString, bool );
58 void quickImportIcal(); 59 void quickImportIcal();
59 60
60 void slotModifiedChanged( bool ); 61 void slotModifiedChanged( bool );
61 62
62 void save(); 63 void save();
63 void configureToolBar( int ); 64 void configureToolBar( int );
64 void printSel(); 65 void printSel();
65 void printCal(); 66 void printCal();
66 void saveCalendar(); 67 void saveCalendar();
67 void loadCalendar(); 68 void loadCalendar();
68 void exportVCalendar(); 69 void exportVCalendar();
69 70
70 void slotSyncMenu( int ); 71 void slotSyncMenu( int );
71 void syncSSH(); 72 void syncSSH();
72 void confSync(); 73 void confSync();
73 void syncSharp(); 74 void syncSharp();
74 void syncLocalFile(); 75 void syncLocalFile();
75 bool syncWithFile( QString, bool ); 76 bool syncWithFile( QString, bool );
76 void quickSyncLocalFile(); 77 void quickSyncLocalFile();
77 78
78 79
79 protected: 80 protected:
80 void displayText( QString, QString); 81 void displayText( QString, QString);
81 void displayFile( QString, QString); 82 void displayFile( QString, QString);
82 83
83 void enableIncidenceActions( bool ); 84 void enableIncidenceActions( bool );
84 85
85 private: 86 private:
86 void saveOnClose(); 87 void saveOnClose();
87 int mCurrentSyncProfile; 88 int mCurrentSyncProfile;
88 void syncRemote( KSyncProfile* , bool ask = true); 89 void syncRemote( KSyncProfile* , bool ask = true);
89 void fillSyncMenu(); 90 void fillSyncMenu();
90 bool mFlagKeyPressed; 91 bool mFlagKeyPressed;
91 bool mBlockAtStartup; 92 bool mBlockAtStartup;
92 QPEToolBar *iconToolBar; 93 QPEToolBar *iconToolBar;
93 void initActions(); 94 void initActions();
94 void setDefaultPreferences(); 95 void setDefaultPreferences();
95 void keyPressEvent ( QKeyEvent * ) ; 96 void keyPressEvent ( QKeyEvent * ) ;
96 void keyReleaseEvent ( QKeyEvent * ) ; 97 void keyReleaseEvent ( QKeyEvent * ) ;
97 QPopupMenu *configureToolBarMenu; 98 QPopupMenu *configureToolBarMenu;
98 QPopupMenu *configureAgendaMenu, *syncMenu; 99 QPopupMenu *configureAgendaMenu, *syncMenu;
99 CalendarLocal *mCalendar; 100 CalendarLocal *mCalendar;
100 CalendarView *mView; 101 CalendarView *mView;
101 QString getPassword(); 102 QString getPassword();
102 QAction *mNewSubTodoAction; 103 QAction *mNewSubTodoAction;
103 104
104 QAction *mShowAction; 105 QAction *mShowAction;
105 QAction *mEditAction; 106 QAction *mEditAction;
106 QAction *mDeleteAction; 107 QAction *mDeleteAction;
107 void closeEvent( QCloseEvent* ce ); 108 void closeEvent( QCloseEvent* ce );
108 SimpleAlarmClient mAlarmClient; 109 SimpleAlarmClient mAlarmClient;
109 QTimer mSaveTimer; 110 QTimer mSaveTimer;
110 bool mBlockSaveFlag; 111 bool mBlockSaveFlag;
111 bool mCalendarModifiedFlag; 112 bool mCalendarModifiedFlag;
112 QPixmap loadPixmap( QString ); 113 QPixmap loadPixmap( QString );
113}; 114};
114 115
115#endif 116#endif