summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-05-24 22:30:39 (UTC)
committer zautrix <zautrix>2005-05-24 22:30:39 (UTC)
commitc0ca8beceaa7a366a2d74a82504cad19f4ccd642 (patch) (unidiff)
tree80d7934f39d856801c2491d735455cea1b119e8b
parenta3a535e57c53071eb15aa034472d402d619ca84d (diff)
downloadkdepimpi-c0ca8beceaa7a366a2d74a82504cad19f4ccd642.zip
kdepimpi-c0ca8beceaa7a366a2d74a82504cad19f4ccd642.tar.gz
kdepimpi-c0ca8beceaa7a366a2d74a82504cad19f4ccd642.tar.bz2
todo fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/gammu/gammu.pro5
-rw-r--r--kaddressbook/kaddressbook.pro6
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--korganizer/korganizer.pro10
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/koviewmanager.cpp5
6 files changed, 25 insertions, 8 deletions
diff --git a/gammu/emb/gammu/gammu.pro b/gammu/emb/gammu/gammu.pro
index 55bfdec..c8aa3f0 100644
--- a/gammu/emb/gammu/gammu.pro
+++ b/gammu/emb/gammu/gammu.pro
@@ -1,64 +1,65 @@
1###################################################################### 1######################################################################
2# Automatically generated by qmake (1.07a) Fri Jul 30 22:22:02 2004 2# Automatically generated by qmake (1.07a) Fri Jul 30 22:22:02 2004
3###################################################################### 3######################################################################
4 4
5TEMPLATE = app 5TEMPLATE = app
6DEPENDPATH += msvc06.mak \ 6DEPENDPATH += msvc06.mak \
7 msvc2003.mak \ 7 msvc2003.mak \
8 smsd \ 8 smsd \
9 depend/nokia \ 9 depend/nokia \
10 depend/siemens \ 10 depend/siemens \
11 depend/nokia/dct3trac 11 depend/nokia/dct3trac
12INCLUDEPATH += . smsd depend/nokia depend/nokia/dct3trac depend/siemens 12INCLUDEPATH += . smsd depend/nokia depend/nokia/dct3trac depend/siemens
13 CONFIG = warn_off release console 13 CONFIG += warn_off console
14# Input 14# Input
15 15
16include( ../../../variables.pri )
16HEADERS += gammu.h \ 17HEADERS += gammu.h \
17 sniff.h \ 18 sniff.h \
18 smsd/s_files.h \ 19 smsd/s_files.h \
19 smsd/s_mysql.h \ 20 smsd/s_mysql.h \
20 smsd/smsdcore.h \ 21 smsd/smsdcore.h \
21 depend/nokia/dct3.h \ 22 depend/nokia/dct3.h \
22 depend/nokia/dct4.h \ 23 depend/nokia/dct4.h \
23 depend/siemens/chiffre.h \ 24 depend/siemens/chiffre.h \
24 depend/siemens/dsiemens.h \ 25 depend/siemens/dsiemens.h \
25 depend/nokia/dct3trac/type-cc.h \ 26 depend/nokia/dct3trac/type-cc.h \
26 depend/nokia/dct3trac/type-mm.h \ 27 depend/nokia/dct3trac/type-mm.h \
27 depend/nokia/dct3trac/type-rr.h \ 28 depend/nokia/dct3trac/type-rr.h \
28 depend/nokia/dct3trac/type-sms.h \ 29 depend/nokia/dct3trac/type-sms.h \
29 depend/nokia/dct3trac/type-ss.h \ 30 depend/nokia/dct3trac/type-ss.h \
30 depend/nokia/dct3trac/wmx-gsm.h \ 31 depend/nokia/dct3trac/wmx-gsm.h \
31 depend/nokia/dct3trac/wmx-list.h \ 32 depend/nokia/dct3trac/wmx-list.h \
32 depend/nokia/dct3trac/wmx-sim.h \ 33 depend/nokia/dct3trac/wmx-sim.h \
33 depend/nokia/dct3trac/wmx-util.h \ 34 depend/nokia/dct3trac/wmx-util.h \
34 depend/nokia/dct3trac/wmx.h 35 depend/nokia/dct3trac/wmx.h
35SOURCES += gammu.c \ 36SOURCES += gammu.c \
36 sniff.c \ 37 sniff.c \
37 smsd/s_files.c \ 38 smsd/s_files.c \
38 smsd/smsdcore.c \ 39 smsd/smsdcore.c \
39 depend/nokia/dct3.c \ 40 depend/nokia/dct3.c \
40 depend/nokia/dct4.c \ 41 depend/nokia/dct4.c \
41 depend/siemens/chiffre.c \ 42 depend/siemens/chiffre.c \
42 depend/siemens/dsiemens.c \ 43 depend/siemens/dsiemens.c \
43 depend/nokia/dct3trac/wmx-gsm.c \ 44 depend/nokia/dct3trac/wmx-gsm.c \
44 depend/nokia/dct3trac/wmx-list.c \ 45 depend/nokia/dct3trac/wmx-list.c \
45 depend/nokia/dct3trac/wmx-sim.c \ 46 depend/nokia/dct3trac/wmx-sim.c \
46 depend/nokia/dct3trac/wmx-util.c \ 47 depend/nokia/dct3trac/wmx-util.c \
47 depend/nokia/dct3trac/wmx.c 48 depend/nokia/dct3trac/wmx.c
48unix : { 49unix : {
49LIBS += ../../../bin/libmicrogammu.so /usr/lib/libpthread.so 50LIBS += ../../../bin/libmicrogammu.so /usr/lib/libpthread.so
50# bluetooth disabled for now 51# bluetooth disabled for now
51#/usr/lib/libbluetooth.so /usr/lib/libsdp.so 52#/usr/lib/libbluetooth.so /usr/lib/libsdp.so
52OBJECTS_DIR = obj/unix 53OBJECTS_DIR = obj/unix
53} 54}
54win32 : { 55win32 : {
55 CONFIG = qt warn_on 56 CONFIG += qt warn_on
56#LIBS += mfc71u.lib 57#LIBS += mfc71u.lib
57LIBS += libc.lib 58LIBS += libc.lib
58#LIBS += msvcrt.lib 59#LIBS += msvcrt.lib
59QMAKE_LINK += /NODEFAULTLIB:msvcrt 60QMAKE_LINK += /NODEFAULTLIB:msvcrt
60LIBS += ../../../bin/microgammu.lib 61LIBS += ../../../bin/microgammu.lib
61OBJECTS_DIR = obj/win 62OBJECTS_DIR = obj/win
62} 63}
63DESTDIR = ../../../bin 64DESTDIR = ../../../bin
64TARGET = kammu 65TARGET = kammu
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index 7203eb3..f9d22d5 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -1,198 +1,202 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 TARGET = kapi 3 TARGET = kapi
4DESTDIR= ../bin 4DESTDIR= ../bin
5 5
6include( ../variables.pri ) 6include( ../variables.pri )
7 7
8 8
9INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces 9INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces
10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION 10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION
11 11
12unix : { 12unix : {
13 13
14staticlib: { 14staticlib: {
15LIBS += ../bin/libmicrokabc_qtopia.a 15LIBS += ../bin/libmicrokabc_qtopia.a
16LIBS += ../bin/libmicrokabc_file.a 16LIBS += ../bin/libmicrokabc_file.a
17LIBS += ../bin/libmicrokabc_dir.a 17LIBS += ../bin/libmicrokabc_dir.a
18LIBS += ../bin/libmicrokdepim.a 18LIBS += ../bin/libmicrokdepim.a
19LIBS += ../bin/libmicrokcal.a 19LIBS += ../bin/libmicrokcal.a
20LIBS += ../bin/libmicrokabc.a 20LIBS += ../bin/libmicrokabc.a
21LIBS += ../bin/libmicrokde.a 21LIBS += ../bin/libmicrokde.a
22LIBS += ../bin/libmicrokabc_qtopia.a 22LIBS += ../bin/libmicrokabc_qtopia.a
23LIBS += ../bin/libmicrokabc_file.a 23LIBS += ../bin/libmicrokabc_file.a
24LIBS += ../bin/libmicrokabc_dir.a 24LIBS += ../bin/libmicrokabc_dir.a
25LIBS += ../bin/libmicrokdepim.a 25LIBS += ../bin/libmicrokdepim.a
26LIBS += ../bin/libmicrokcal.a 26LIBS += ../bin/libmicrokcal.a
27LIBS += ../bin/libmicrokabc.a 27LIBS += ../bin/libmicrokabc.a
28LIBS += ../bin/libmicrokde.a 28LIBS += ../bin/libmicrokde.a
29LIBS += ../libical/lib/libical.a 29LIBS += ../libical/lib/libical.a
30LIBS += ../libical/lib/libicalss.a 30LIBS += ../libical/lib/libicalss.a
31 31
32} else { 32} else {
33LIBS += ../bin/libmicrokdepim.so 33LIBS += ../bin/libmicrokdepim.so
34LIBS += ../bin/libmicrokde.so 34LIBS += ../bin/libmicrokde.so
35LIBS += ../bin/libmicrokabc.so 35LIBS += ../bin/libmicrokabc.so
36LIBS += ../bin/libmicrokcal.so 36LIBS += ../bin/libmicrokcal.so
37#LIBS += -lldap 37#LIBS += -lldap
38} 38}
39OBJECTS_DIR = obj/unix 39OBJECTS_DIR = obj/unix
40MOC_DIR = moc/unix 40MOC_DIR = moc/unix
41} 41}
42win32: { 42win32: {
43RC_FILE = winicons.rc 43RC_FILE = winicons.rc
44DEFINES += _WIN32_ 44DEFINES += _WIN32_
45LIBS += ../bin/microkdepim.lib 45LIBS += ../bin/microkdepim.lib
46LIBS += ../bin/microkcal.lib 46LIBS += ../bin/microkcal.lib
47LIBS += ../bin/microkde.lib 47LIBS += ../bin/microkde.lib
48LIBS += ../bin/microkabc.lib 48LIBS += ../bin/microkabc.lib
49QMAKE_LINK += /NODEFAULTLIB:LIBC 49QMAKE_LINK += /NODEFAULTLIB:LIBC
50OBJECTS_DIR = obj/win 50OBJECTS_DIR = obj/win
51MOC_DIR = moc/win 51MOC_DIR = moc/win
52#olimport section 52#olimport section
53#blabla: { 53#blabla: {
54 54debug: {
55LIBS += mfc71ud.lib
56}
57release: {
55LIBS += mfc71u.lib 58LIBS += mfc71u.lib
59}
56DEFINES += _OL_IMPORT_ 60DEFINES += _OL_IMPORT_
57HEADERS = ../outport/msoutl9.h \ 61HEADERS = ../outport/msoutl9.h \
58 kaimportoldialog.h 62 kaimportoldialog.h
59SOURCES = ../outport/msoutl9.cpp \ 63SOURCES = ../outport/msoutl9.cpp \
60 kaimportoldialog.cpp 64 kaimportoldialog.cpp
61#} 65#}
62#olimport section end 66#olimport section end
63} 67}
64 68
65INTERFACES = \ 69INTERFACES = \
66# filteredit_base.ui \ 70# filteredit_base.ui \
67# kofilterview_base.ui \ 71# kofilterview_base.ui \
68 72
69HEADERS += \ 73HEADERS += \
70features/mergewidget.h \ 74features/mergewidget.h \
71features/distributionlistwidget.h \ 75features/distributionlistwidget.h \
72kcmconfigs/addresseewidget.h \ 76kcmconfigs/addresseewidget.h \
73kcmconfigs/extensionconfigdialog.h \ 77kcmconfigs/extensionconfigdialog.h \
74kcmconfigs/kcmkabconfig.h \ 78kcmconfigs/kcmkabconfig.h \
75kcmconfigs/kabconfigwidget.h \ 79kcmconfigs/kabconfigwidget.h \
76addresseeeditordialog.h \ 80addresseeeditordialog.h \
77addresseeeditorwidget.h \ 81addresseeeditorwidget.h \
78addresseditwidget.h \ 82addresseditwidget.h \
79addresseeconfig.h \ 83addresseeconfig.h \
80addresseeutil.h \ 84addresseeutil.h \
81emaileditwidget.h \ 85emaileditwidget.h \
82filtereditdialog.h \ 86filtereditdialog.h \
83kaddressbookmain.h \ 87kaddressbookmain.h \
84kabprefs.h \ 88kabprefs.h \
85kabcore.h \ 89kabcore.h \
86viewmanager.h \ 90viewmanager.h \
87extensionmanager.h \ 91extensionmanager.h \
88extensionwidget.h \ 92extensionwidget.h \
89kaddressbookview.h \ 93kaddressbookview.h \
90geowidget.h \ 94geowidget.h \
91imagewidget.h \ 95imagewidget.h \
92incsearchwidget.h \ 96incsearchwidget.h \
93jumpbuttonbar.h \ 97jumpbuttonbar.h \
94phoneeditwidget.h \ 98phoneeditwidget.h \
95secrecywidget.h \ 99secrecywidget.h \
96keywidget.h \ 100keywidget.h \
97nameeditdialog.h \ 101nameeditdialog.h \
98filter.h \ 102filter.h \
99addviewdialog.h \ 103addviewdialog.h \
100configurewidget.h \ 104configurewidget.h \
101viewconfigurewidget.h \ 105viewconfigurewidget.h \
102viewconfigurefieldspage.h \ 106viewconfigurefieldspage.h \
103viewconfigurefilterpage.h \ 107viewconfigurefilterpage.h \
104typecombo.h \ 108typecombo.h \
105undo.h \ 109undo.h \
106undocmds.h \ 110undocmds.h \
107xxportmanager.h \ 111xxportmanager.h \
108xxportobject.h \ 112xxportobject.h \
109xxportselectdialog.h \ 113xxportselectdialog.h \
110details/detailsviewcontainer.h \ 114details/detailsviewcontainer.h \
111details/look_basic.h \ 115details/look_basic.h \
112details/look_html.h \ 116details/look_html.h \
113views/kaddressbookiconview.h \ 117views/kaddressbookiconview.h \
114views/kaddressbooktableview.h \ 118views/kaddressbooktableview.h \
115views/kaddressbookcardview.h \ 119views/kaddressbookcardview.h \
116views/configuretableviewdialog.h \ 120views/configuretableviewdialog.h \
117views/configurecardviewdialog.h \ 121views/configurecardviewdialog.h \
118views/cardview.h \ 122views/cardview.h \
119views/colorlistbox.h \ 123views/colorlistbox.h \
120views/contactlistview.h \ 124views/contactlistview.h \
121xxport/vcard_xxport.h \ 125xxport/vcard_xxport.h \
122xxport/kde2_xxport.h \ 126xxport/kde2_xxport.h \
123xxport/csv_xxport.h \ 127xxport/csv_xxport.h \
124xxport/csvimportdialog.h \ 128xxport/csvimportdialog.h \
125xxport/opie_xxport.h \ 129xxport/opie_xxport.h \
126xxport/qtopia_xxport.h \ 130xxport/qtopia_xxport.h \
127xxport/sharpdtm_xxport.h \ 131xxport/sharpdtm_xxport.h \
128#details/look_details.h \ 132#details/look_details.h \
129#mainwindoiw.h \ 133#mainwindoiw.h \
130# alarmclient.h \ 134# alarmclient.h \
131# calendarview.h \ 135# calendarview.h \
132# customlistviewitem.h \ 136# customlistviewitem.h \
133# datenavigator.h 137# datenavigator.h
134 138
135SOURCES += \ 139SOURCES += \
136addresseeeditordialog.cpp \ 140addresseeeditordialog.cpp \
137addresseeeditorwidget.cpp \ 141addresseeeditorwidget.cpp \
138addresseditwidget.cpp \ 142addresseditwidget.cpp \
139addresseeconfig.cpp \ 143addresseeconfig.cpp \
140addresseeutil.cpp \ 144addresseeutil.cpp \
141extensionmanager.cpp \ 145extensionmanager.cpp \
142features/mergewidget.cpp \ 146features/mergewidget.cpp \
143features/distributionlistwidget.cpp \ 147features/distributionlistwidget.cpp \
144kcmconfigs/addresseewidget.cpp \ 148kcmconfigs/addresseewidget.cpp \
145kcmconfigs/extensionconfigdialog.cpp \ 149kcmconfigs/extensionconfigdialog.cpp \
146kcmconfigs/kcmkabconfig.cpp \ 150kcmconfigs/kcmkabconfig.cpp \
147kcmconfigs/kabconfigwidget.cpp \ 151kcmconfigs/kabconfigwidget.cpp \
148emaileditwidget.cpp \ 152emaileditwidget.cpp \
149filtereditdialog.cpp \ 153filtereditdialog.cpp \
150mainembedded.cpp \ 154mainembedded.cpp \
151kaddressbookmain.cpp \ 155kaddressbookmain.cpp \
152kabcore.cpp \ 156kabcore.cpp \
153kabprefs.cpp \ 157kabprefs.cpp \
154viewmanager.cpp \ 158viewmanager.cpp \
155kaddressbookview.cpp \ 159kaddressbookview.cpp \
156extensionwidget.cpp \ 160extensionwidget.cpp \
157geowidget.cpp \ 161geowidget.cpp \
158imagewidget.cpp \ 162imagewidget.cpp \
159incsearchwidget.cpp \ 163incsearchwidget.cpp \
160jumpbuttonbar.cpp \ 164jumpbuttonbar.cpp \
161phoneeditwidget.cpp \ 165phoneeditwidget.cpp \
162secrecywidget.cpp \ 166secrecywidget.cpp \
163keywidget.cpp \ 167keywidget.cpp \
164nameeditdialog.cpp \ 168nameeditdialog.cpp \
165filter.cpp \ 169filter.cpp \
166addviewdialog.cpp \ 170addviewdialog.cpp \
167configurewidget.cpp \ 171configurewidget.cpp \
168viewconfigurewidget.cpp \ 172viewconfigurewidget.cpp \
169viewconfigurefieldspage.cpp \ 173viewconfigurefieldspage.cpp \
170viewconfigurefilterpage.cpp \ 174viewconfigurefilterpage.cpp \
171undo.cpp \ 175undo.cpp \
172undocmds.cpp \ 176undocmds.cpp \
173xxportmanager.cpp \ 177xxportmanager.cpp \
174xxportobject.cpp \ 178xxportobject.cpp \
175xxportselectdialog.cpp \ 179xxportselectdialog.cpp \
176details/detailsviewcontainer.cpp \ 180details/detailsviewcontainer.cpp \
177details/look_basic.cpp \ 181details/look_basic.cpp \
178details/look_html.cpp \ 182details/look_html.cpp \
179views/kaddressbookiconview.cpp \ 183views/kaddressbookiconview.cpp \
180views/kaddressbooktableview.cpp \ 184views/kaddressbooktableview.cpp \
181views/kaddressbookcardview.cpp \ 185views/kaddressbookcardview.cpp \
182views/configuretableviewdialog.cpp \ 186views/configuretableviewdialog.cpp \
183views/configurecardviewdialog.cpp \ 187views/configurecardviewdialog.cpp \
184views/cardview.cpp \ 188views/cardview.cpp \
185views/contactlistview.cpp \ 189views/contactlistview.cpp \
186views/colorlistbox.cpp \ 190views/colorlistbox.cpp \
187xxport/vcard_xxport.cpp \ 191xxport/vcard_xxport.cpp \
188xxport/kde2_xxport.cpp \ 192xxport/kde2_xxport.cpp \
189xxport/csv_xxport.cpp \ 193xxport/csv_xxport.cpp \
190xxport/csvimportdialog.cpp \ 194xxport/csvimportdialog.cpp \
191xxport/opie_xxport.cpp \ 195xxport/opie_xxport.cpp \
192xxport/qtopia_xxport.cpp \ 196xxport/qtopia_xxport.cpp \
193xxport/sharpdtm_xxport.cpp \ 197xxport/sharpdtm_xxport.cpp \
194#details/look_details.cpp \ 198#details/look_details.cpp \
195#mainwindow.cpp \ 199#mainwindow.cpp \
196# calendarview.cpp \ 200# calendarview.cpp \
197# timespanview.cpp 201# timespanview.cpp
198 202
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 904bbe2..a8ad467 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -637,2050 +637,2052 @@ void CalendarView::computeAlarm( QString msg )
637void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 637void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
638{ 638{
639 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 639 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
640 640
641 mSuspendAlarmNotification = noti; 641 mSuspendAlarmNotification = noti;
642 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 642 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
643 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 643 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
644 mSuspendTimer->start( ms , true ); 644 mSuspendTimer->start( ms , true );
645 645
646} 646}
647 647
648void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 648void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
649{ 649{
650 mNextAlarmDateTime = qdt; 650 mNextAlarmDateTime = qdt;
651 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 651 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
652 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 652 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
653#ifndef DESKTOP_VERSION 653#ifndef DESKTOP_VERSION
654 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 654 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
655#endif 655#endif
656 return; 656 return;
657 } 657 }
658 int maxSec; 658 int maxSec;
659 //maxSec = 5; //testing only 659 //maxSec = 5; //testing only
660 maxSec = 86400+3600; // one day+1hour 660 maxSec = 86400+3600; // one day+1hour
661 mAlarmNotification = noti; 661 mAlarmNotification = noti;
662 int sec = QDateTime::currentDateTime().secsTo( qdt ); 662 int sec = QDateTime::currentDateTime().secsTo( qdt );
663 if ( sec > maxSec ) { 663 if ( sec > maxSec ) {
664 mRecheckAlarmTimer->start( maxSec * 1000 ); 664 mRecheckAlarmTimer->start( maxSec * 1000 );
665 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 665 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
666 return; 666 return;
667 } else { 667 } else {
668 mRecheckAlarmTimer->stop(); 668 mRecheckAlarmTimer->stop();
669 } 669 }
670 //qDebug("Alarm timer started with secs: %d ", sec); 670 //qDebug("Alarm timer started with secs: %d ", sec);
671 mAlarmTimer->start( sec *1000 , true ); 671 mAlarmTimer->start( sec *1000 , true );
672 672
673} 673}
674// called by mRecheckAlarmTimer to get next alarm 674// called by mRecheckAlarmTimer to get next alarm
675// we need this, because a QTimer has only a max range of 25 days 675// we need this, because a QTimer has only a max range of 25 days
676void CalendarView::recheckTimerAlarm() 676void CalendarView::recheckTimerAlarm()
677{ 677{
678 mAlarmTimer->stop(); 678 mAlarmTimer->stop();
679 mRecheckAlarmTimer->stop(); 679 mRecheckAlarmTimer->stop();
680 mCalendar->checkAlarmForIncidence( 0, true ); 680 mCalendar->checkAlarmForIncidence( 0, true );
681} 681}
682void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 682void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
683{ 683{
684 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 684 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
685 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 685 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
686#ifndef DESKTOP_VERSION 686#ifndef DESKTOP_VERSION
687 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 687 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
688#endif 688#endif
689 return; 689 return;
690 } 690 }
691 mAlarmTimer->stop(); 691 mAlarmTimer->stop();
692} 692}
693void CalendarView::selectWeekNum ( int num ) 693void CalendarView::selectWeekNum ( int num )
694{ 694{
695 dateNavigator()->blockSignals( true ); 695 dateNavigator()->blockSignals( true );
696 dateNavigator()->selectWeek( num ); 696 dateNavigator()->selectWeek( num );
697 dateNavigator()->blockSignals( false ); 697 dateNavigator()->blockSignals( false );
698 mViewManager->showWeekView(); 698 mViewManager->showWeekView();
699} 699}
700KOViewManager *CalendarView::viewManager() 700KOViewManager *CalendarView::viewManager()
701{ 701{
702 return mViewManager; 702 return mViewManager;
703} 703}
704 704
705KODialogManager *CalendarView::dialogManager() 705KODialogManager *CalendarView::dialogManager()
706{ 706{
707 return mDialogManager; 707 return mDialogManager;
708} 708}
709 709
710QDate CalendarView::startDate() 710QDate CalendarView::startDate()
711{ 711{
712 DateList dates = mNavigator->selectedDates(); 712 DateList dates = mNavigator->selectedDates();
713 713
714 return dates.first(); 714 return dates.first();
715} 715}
716 716
717QDate CalendarView::endDate() 717QDate CalendarView::endDate()
718{ 718{
719 DateList dates = mNavigator->selectedDates(); 719 DateList dates = mNavigator->selectedDates();
720 720
721 return dates.last(); 721 return dates.last();
722} 722}
723 723
724 724
725void CalendarView::createPrinter() 725void CalendarView::createPrinter()
726{ 726{
727#ifndef KORG_NOPRINTER 727#ifndef KORG_NOPRINTER
728 if (!mCalPrinter) { 728 if (!mCalPrinter) {
729 mCalPrinter = new CalPrinter(this, mCalendar); 729 mCalPrinter = new CalPrinter(this, mCalendar);
730 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 730 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
731 } 731 }
732#endif 732#endif
733} 733}
734 734
735 735
736//KOPrefs::instance()->mWriteBackFile 736//KOPrefs::instance()->mWriteBackFile
737//KOPrefs::instance()->mWriteBackExistingOnly 737//KOPrefs::instance()->mWriteBackExistingOnly
738 738
739// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 739// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
740// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 740// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
741// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 741// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
742// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 742// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
743// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 743// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
744// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 744// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
745 745
746int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 746int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
747{ 747{
748 748
749 // 0 equal 749 // 0 equal
750 // 1 take local 750 // 1 take local
751 // 2 take remote 751 // 2 take remote
752 // 3 cancel 752 // 3 cancel
753 QDateTime lastSync = mLastCalendarSync; 753 QDateTime lastSync = mLastCalendarSync;
754 QDateTime localMod = local->lastModified(); 754 QDateTime localMod = local->lastModified();
755 QDateTime remoteMod = remote->lastModified(); 755 QDateTime remoteMod = remote->lastModified();
756 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 756 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
757 bool remCh, locCh; 757 bool remCh, locCh;
758 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 758 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
759 //if ( remCh ) 759 //if ( remCh )
760 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 760 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
761 locCh = ( localMod > mLastCalendarSync ); 761 locCh = ( localMod > mLastCalendarSync );
762 if ( !remCh && ! locCh ) { 762 if ( !remCh && ! locCh ) {
763 //qDebug("both not changed "); 763 //qDebug("both not changed ");
764 lastSync = localMod.addDays(1); 764 lastSync = localMod.addDays(1);
765 if ( mode <= SYNC_PREF_ASK ) 765 if ( mode <= SYNC_PREF_ASK )
766 return 0; 766 return 0;
767 } else { 767 } else {
768 if ( locCh ) { 768 if ( locCh ) {
769 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 769 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
770 lastSync = localMod.addDays( -1 ); 770 lastSync = localMod.addDays( -1 );
771 if ( !remCh ) 771 if ( !remCh )
772 remoteMod = ( lastSync.addDays( -1 ) ); 772 remoteMod = ( lastSync.addDays( -1 ) );
773 } else { 773 } else {
774 //qDebug(" not loc changed "); 774 //qDebug(" not loc changed ");
775 lastSync = localMod.addDays( 1 ); 775 lastSync = localMod.addDays( 1 );
776 if ( remCh ) 776 if ( remCh )
777 remoteMod =( lastSync.addDays( 1 ) ); 777 remoteMod =( lastSync.addDays( 1 ) );
778 778
779 } 779 }
780 } 780 }
781 full = true; 781 full = true;
782 if ( mode < SYNC_PREF_ASK ) 782 if ( mode < SYNC_PREF_ASK )
783 mode = SYNC_PREF_ASK; 783 mode = SYNC_PREF_ASK;
784 } else { 784 } else {
785 if ( localMod == remoteMod ) 785 if ( localMod == remoteMod )
786 // if ( local->revision() == remote->revision() ) 786 // if ( local->revision() == remote->revision() )
787 return 0; 787 return 0;
788 788
789 } 789 }
790 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 790 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
791 791
792 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 792 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
793 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 793 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
794 //full = true; //debug only 794 //full = true; //debug only
795 if ( full ) { 795 if ( full ) {
796 bool equ = false; 796 bool equ = false;
797 if ( local->type() == "Event" ) { 797 if ( local->type() == "Event" ) {
798 equ = (*((Event*) local) == *((Event*) remote)); 798 equ = (*((Event*) local) == *((Event*) remote));
799 } 799 }
800 else if ( local->type() =="Todo" ) 800 else if ( local->type() =="Todo" )
801 equ = (*((Todo*) local) == (*(Todo*) remote)); 801 equ = (*((Todo*) local) == (*(Todo*) remote));
802 else if ( local->type() =="Journal" ) 802 else if ( local->type() =="Journal" )
803 equ = (*((Journal*) local) == *((Journal*) remote)); 803 equ = (*((Journal*) local) == *((Journal*) remote));
804 if ( equ ) { 804 if ( equ ) {
805 //qDebug("equal "); 805 //qDebug("equal ");
806 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 806 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
807 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 807 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
808 } 808 }
809 if ( mode < SYNC_PREF_FORCE_LOCAL ) 809 if ( mode < SYNC_PREF_FORCE_LOCAL )
810 return 0; 810 return 0;
811 811
812 }//else //debug only 812 }//else //debug only
813 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 813 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
814 } 814 }
815 int result; 815 int result;
816 bool localIsNew; 816 bool localIsNew;
817 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 817 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
818 818
819 819
820 // ************************************************ 820 // ************************************************
821 // ************************************************ 821 // ************************************************
822 // ************************************************ 822 // ************************************************
823 // We may have that lastSync > remoteMod AND lastSync > localMod 823 // We may have that lastSync > remoteMod AND lastSync > localMod
824 // BUT remoteMod != localMod 824 // BUT remoteMod != localMod
825 825
826 826
827 if ( full && mode < SYNC_PREF_NEWEST ) 827 if ( full && mode < SYNC_PREF_NEWEST )
828 mode = SYNC_PREF_ASK; 828 mode = SYNC_PREF_ASK;
829 829
830 switch( mode ) { 830 switch( mode ) {
831 case SYNC_PREF_LOCAL: 831 case SYNC_PREF_LOCAL:
832 if ( lastSync > remoteMod ) 832 if ( lastSync > remoteMod )
833 return 1; 833 return 1;
834 if ( lastSync > localMod ) 834 if ( lastSync > localMod )
835 return 2; 835 return 2;
836 return 1; 836 return 1;
837 break; 837 break;
838 case SYNC_PREF_REMOTE: 838 case SYNC_PREF_REMOTE:
839 if ( lastSync > localMod ) 839 if ( lastSync > localMod )
840 return 2; 840 return 2;
841 if ( lastSync > remoteMod ) 841 if ( lastSync > remoteMod )
842 return 1; 842 return 1;
843 return 2; 843 return 2;
844 break; 844 break;
845 case SYNC_PREF_NEWEST: 845 case SYNC_PREF_NEWEST:
846 if ( localMod >= remoteMod ) 846 if ( localMod >= remoteMod )
847 return 1; 847 return 1;
848 else 848 else
849 return 2; 849 return 2;
850 break; 850 break;
851 case SYNC_PREF_ASK: 851 case SYNC_PREF_ASK:
852 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 852 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
853 if ( lastSync > remoteMod && lastSync > localMod) 853 if ( lastSync > remoteMod && lastSync > localMod)
854 return 0; 854 return 0;
855 if ( lastSync > remoteMod ) 855 if ( lastSync > remoteMod )
856 return 1; 856 return 1;
857 if ( lastSync > localMod ) 857 if ( lastSync > localMod )
858 return 2; 858 return 2;
859 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 859 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
860 localIsNew = localMod >= remoteMod; 860 localIsNew = localMod >= remoteMod;
861 if ( localIsNew ) 861 if ( localIsNew )
862 getEventViewerDialog()->setColorMode( 1 ); 862 getEventViewerDialog()->setColorMode( 1 );
863 else 863 else
864 getEventViewerDialog()->setColorMode( 2 ); 864 getEventViewerDialog()->setColorMode( 2 );
865 getEventViewerDialog()->setIncidence(local); 865 getEventViewerDialog()->setIncidence(local);
866 if ( localIsNew ) 866 if ( localIsNew )
867 getEventViewerDialog()->setColorMode( 2 ); 867 getEventViewerDialog()->setColorMode( 2 );
868 else 868 else
869 getEventViewerDialog()->setColorMode( 1 ); 869 getEventViewerDialog()->setColorMode( 1 );
870 getEventViewerDialog()->addIncidence(remote); 870 getEventViewerDialog()->addIncidence(remote);
871 getEventViewerDialog()->setColorMode( 0 ); 871 getEventViewerDialog()->setColorMode( 0 );
872 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 872 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
873 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 873 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
874 getEventViewerDialog()->showMe(); 874 getEventViewerDialog()->showMe();
875 result = getEventViewerDialog()->executeS( localIsNew ); 875 result = getEventViewerDialog()->executeS( localIsNew );
876 return result; 876 return result;
877 877
878 break; 878 break;
879 case SYNC_PREF_FORCE_LOCAL: 879 case SYNC_PREF_FORCE_LOCAL:
880 return 1; 880 return 1;
881 break; 881 break;
882 case SYNC_PREF_FORCE_REMOTE: 882 case SYNC_PREF_FORCE_REMOTE:
883 return 2; 883 return 2;
884 break; 884 break;
885 885
886 default: 886 default:
887 // SYNC_PREF_TAKE_BOTH not implemented 887 // SYNC_PREF_TAKE_BOTH not implemented
888 break; 888 break;
889 } 889 }
890 return 0; 890 return 0;
891} 891}
892Event* CalendarView::getLastSyncEvent() 892Event* CalendarView::getLastSyncEvent()
893{ 893{
894 Event* lse; 894 Event* lse;
895 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 895 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
896 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 896 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
897 if (!lse) { 897 if (!lse) {
898 lse = new Event(); 898 lse = new Event();
899 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 899 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
900 QString sum = ""; 900 QString sum = "";
901 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 901 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
902 sum = "E: "; 902 sum = "E: ";
903 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 903 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
904 lse->setDtStart( mLastCalendarSync ); 904 lse->setDtStart( mLastCalendarSync );
905 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 905 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
906 lse->setCategories( i18n("SyncEvent") ); 906 lse->setCategories( i18n("SyncEvent") );
907 lse->setReadOnly( true ); 907 lse->setReadOnly( true );
908 mCalendar->addEvent( lse ); 908 mCalendar->addEvent( lse );
909 } 909 }
910 910
911 return lse; 911 return lse;
912 912
913} 913}
914 914
915// we check, if the to delete event has a id for a profile 915// we check, if the to delete event has a id for a profile
916// if yes, we set this id in the profile to delete 916// if yes, we set this id in the profile to delete
917void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 917void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
918{ 918{
919 if ( lastSync.count() == 0 ) { 919 if ( lastSync.count() == 0 ) {
920 //qDebug(" lastSync.count() == 0"); 920 //qDebug(" lastSync.count() == 0");
921 return; 921 return;
922 } 922 }
923 if ( toDelete->type() == "Journal" ) 923 if ( toDelete->type() == "Journal" )
924 return; 924 return;
925 925
926 Event* eve = lastSync.first(); 926 Event* eve = lastSync.first();
927 927
928 while ( eve ) { 928 while ( eve ) {
929 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 929 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
930 if ( !id.isEmpty() ) { 930 if ( !id.isEmpty() ) {
931 QString des = eve->description(); 931 QString des = eve->description();
932 QString pref = "e"; 932 QString pref = "e";
933 if ( toDelete->type() == "Todo" ) 933 if ( toDelete->type() == "Todo" )
934 pref = "t"; 934 pref = "t";
935 des += pref+ id + ","; 935 des += pref+ id + ",";
936 eve->setReadOnly( false ); 936 eve->setReadOnly( false );
937 eve->setDescription( des ); 937 eve->setDescription( des );
938 //qDebug("setdes %s ", des.latin1()); 938 //qDebug("setdes %s ", des.latin1());
939 eve->setReadOnly( true ); 939 eve->setReadOnly( true );
940 } 940 }
941 eve = lastSync.next(); 941 eve = lastSync.next();
942 } 942 }
943 943
944} 944}
945void CalendarView::checkExternalId( Incidence * inc ) 945void CalendarView::checkExternalId( Incidence * inc )
946{ 946{
947 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 947 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
948 checkExternSyncEvent( lastSync, inc ); 948 checkExternSyncEvent( lastSync, inc );
949 949
950} 950}
951bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 951bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
952{ 952{
953 bool syncOK = true; 953 bool syncOK = true;
954 int addedEvent = 0; 954 int addedEvent = 0;
955 int addedEventR = 0; 955 int addedEventR = 0;
956 int deletedEventR = 0; 956 int deletedEventR = 0;
957 int deletedEventL = 0; 957 int deletedEventL = 0;
958 int changedLocal = 0; 958 int changedLocal = 0;
959 int changedRemote = 0; 959 int changedRemote = 0;
960 int filteredIN = 0; 960 int filteredIN = 0;
961 int filteredOUT = 0; 961 int filteredOUT = 0;
962 //QPtrList<Event> el = local->rawEvents(); 962 //QPtrList<Event> el = local->rawEvents();
963 Event* eventR; 963 Event* eventR;
964 QString uid; 964 QString uid;
965 int take; 965 int take;
966 Event* eventL; 966 Event* eventL;
967 Event* eventRSync; 967 Event* eventRSync;
968 Event* eventLSync; 968 Event* eventLSync;
969 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 969 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
970 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 970 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
971 bool fullDateRange = false; 971 bool fullDateRange = false;
972 local->resetTempSyncStat(); 972 local->resetTempSyncStat();
973 mLastCalendarSync = QDateTime::currentDateTime(); 973 mLastCalendarSync = QDateTime::currentDateTime();
974 if ( mSyncManager->syncWithDesktop() ) { 974 if ( mSyncManager->syncWithDesktop() ) {
975 remote->resetPilotStat(1); 975 remote->resetPilotStat(1);
976 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 976 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
977 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 977 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
978 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 978 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
979 } else { 979 } else {
980 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 980 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
981 } 981 }
982 } 982 }
983 QDateTime modifiedCalendar = mLastCalendarSync; 983 QDateTime modifiedCalendar = mLastCalendarSync;
984 eventLSync = getLastSyncEvent(); 984 eventLSync = getLastSyncEvent();
985 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 985 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
986 if ( eventR ) { 986 if ( eventR ) {
987 eventRSync = (Event*) eventR->clone(); 987 eventRSync = (Event*) eventR->clone();
988 remote->deleteEvent(eventR ); 988 remote->deleteEvent(eventR );
989 989
990 } else { 990 } else {
991 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 991 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
992 eventRSync = (Event*)eventLSync->clone(); 992 eventRSync = (Event*)eventLSync->clone();
993 } else { 993 } else {
994 fullDateRange = true; 994 fullDateRange = true;
995 eventRSync = new Event(); 995 eventRSync = new Event();
996 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 996 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
997 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 997 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
998 eventRSync->setDtStart( mLastCalendarSync ); 998 eventRSync->setDtStart( mLastCalendarSync );
999 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 999 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1000 eventRSync->setCategories( i18n("SyncEvent") ); 1000 eventRSync->setCategories( i18n("SyncEvent") );
1001 } 1001 }
1002 } 1002 }
1003 if ( eventLSync->dtStart() == mLastCalendarSync ) 1003 if ( eventLSync->dtStart() == mLastCalendarSync )
1004 fullDateRange = true; 1004 fullDateRange = true;
1005 1005
1006 if ( ! fullDateRange ) { 1006 if ( ! fullDateRange ) {
1007 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 1007 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
1008 1008
1009 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 1009 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
1010 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 1010 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
1011 fullDateRange = true; 1011 fullDateRange = true;
1012 } 1012 }
1013 } 1013 }
1014 if ( mSyncManager->syncWithDesktop() ) { 1014 if ( mSyncManager->syncWithDesktop() ) {
1015 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1015 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
1016 } 1016 }
1017 if ( fullDateRange ) 1017 if ( fullDateRange )
1018 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1018 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1019 else 1019 else
1020 mLastCalendarSync = eventLSync->dtStart(); 1020 mLastCalendarSync = eventLSync->dtStart();
1021 // for resyncing if own file has changed 1021 // for resyncing if own file has changed
1022 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1022 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1023 mLastCalendarSync = loadedFileVersion; 1023 mLastCalendarSync = loadedFileVersion;
1024 //qDebug("setting mLastCalendarSync "); 1024 //qDebug("setting mLastCalendarSync ");
1025 } 1025 }
1026 //qDebug("*************************** "); 1026 //qDebug("*************************** ");
1027 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1027 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1028 QPtrList<Incidence> er = remote->rawIncidences(); 1028 QPtrList<Incidence> er = remote->rawIncidences();
1029 Incidence* inR = er.first(); 1029 Incidence* inR = er.first();
1030 Incidence* inL; 1030 Incidence* inL;
1031 QProgressBar bar( er.count(),0 ); 1031 QProgressBar bar( er.count(),0 );
1032 bar.setCaption (i18n("Syncing - close to abort!") ); 1032 bar.setCaption (i18n("Syncing - close to abort!") );
1033 1033
1034 // ************** setting up filter ************* 1034 // ************** setting up filter *************
1035 CalFilter *filterIN = 0; 1035 CalFilter *filterIN = 0;
1036 CalFilter *filterOUT = 0; 1036 CalFilter *filterOUT = 0;
1037 CalFilter *filter = mFilters.first(); 1037 CalFilter *filter = mFilters.first();
1038 while(filter) { 1038 while(filter) {
1039 if ( filter->name() == mSyncManager->mFilterInCal ) 1039 if ( filter->name() == mSyncManager->mFilterInCal )
1040 filterIN = filter; 1040 filterIN = filter;
1041 if ( filter->name() == mSyncManager->mFilterOutCal ) 1041 if ( filter->name() == mSyncManager->mFilterOutCal )
1042 filterOUT = filter; 1042 filterOUT = filter;
1043 filter = mFilters.next(); 1043 filter = mFilters.next();
1044 } 1044 }
1045 int w = 300; 1045 int w = 300;
1046 if ( QApplication::desktop()->width() < 320 ) 1046 if ( QApplication::desktop()->width() < 320 )
1047 w = 220; 1047 w = 220;
1048 int h = bar.sizeHint().height() ; 1048 int h = bar.sizeHint().height() ;
1049 int dw = QApplication::desktop()->width(); 1049 int dw = QApplication::desktop()->width();
1050 int dh = QApplication::desktop()->height(); 1050 int dh = QApplication::desktop()->height();
1051 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1051 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1052 bar.show(); 1052 bar.show();
1053 int modulo = (er.count()/10)+1; 1053 int modulo = (er.count()/10)+1;
1054 int incCounter = 0; 1054 int incCounter = 0;
1055 while ( inR ) { 1055 while ( inR ) {
1056 if ( ! bar.isVisible() ) 1056 if ( ! bar.isVisible() )
1057 return false; 1057 return false;
1058 if ( incCounter % modulo == 0 ) 1058 if ( incCounter % modulo == 0 )
1059 bar.setProgress( incCounter ); 1059 bar.setProgress( incCounter );
1060 ++incCounter; 1060 ++incCounter;
1061 uid = inR->uid(); 1061 uid = inR->uid();
1062 bool skipIncidence = false; 1062 bool skipIncidence = false;
1063 if ( uid.left(15) == QString("last-syncEvent-") ) 1063 if ( uid.left(15) == QString("last-syncEvent-") )
1064 skipIncidence = true; 1064 skipIncidence = true;
1065 QString idS; 1065 QString idS;
1066 qApp->processEvents(); 1066 qApp->processEvents();
1067 if ( !skipIncidence ) { 1067 if ( !skipIncidence ) {
1068 inL = local->incidence( uid ); 1068 inL = local->incidence( uid );
1069 if ( inL ) { // maybe conflict - same uid in both calendars 1069 if ( inL ) { // maybe conflict - same uid in both calendars
1070 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1070 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1071 //qDebug("take %d %s ", take, inL->summary().latin1()); 1071 //qDebug("take %d %s ", take, inL->summary().latin1());
1072 if ( take == 3 ) 1072 if ( take == 3 )
1073 return false; 1073 return false;
1074 if ( take == 1 ) {// take local ********************** 1074 if ( take == 1 ) {// take local **********************
1075 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1075 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1076 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1076 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1077 else 1077 else
1078 idS = inR->IDStr(); 1078 idS = inR->IDStr();
1079 remote->deleteIncidence( inR ); 1079 remote->deleteIncidence( inR );
1080 inR = inL->clone(); 1080 inR = inL->clone();
1081 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1081 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1082 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1082 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1083 inR->setIDStr( idS ); 1083 inR->setIDStr( idS );
1084 remote->addIncidence( inR ); 1084 remote->addIncidence( inR );
1085 if ( mSyncManager->syncWithDesktop() ) 1085 if ( mSyncManager->syncWithDesktop() )
1086 inR->setPilotId( 2 ); 1086 inR->setPilotId( 2 );
1087 ++changedRemote; 1087 ++changedRemote;
1088 } else {// take remote ********************** 1088 } else {// take remote **********************
1089 idS = inL->IDStr(); 1089 idS = inL->IDStr();
1090 int pid = inL->pilotId(); 1090 int pid = inL->pilotId();
1091 local->deleteIncidence( inL ); 1091 local->deleteIncidence( inL );
1092 inL = inR->clone(); 1092 inL = inR->clone();
1093 if ( mSyncManager->syncWithDesktop() ) 1093 if ( mSyncManager->syncWithDesktop() )
1094 inL->setPilotId( pid ); 1094 inL->setPilotId( pid );
1095 inL->setIDStr( idS ); 1095 inL->setIDStr( idS );
1096 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1096 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1097 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1097 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1098 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1098 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1099 } 1099 }
1100 local->addIncidence( inL ); 1100 local->addIncidence( inL );
1101 ++changedLocal; 1101 ++changedLocal;
1102 } 1102 }
1103 } 1103 }
1104 } else { // no conflict ********** add or delete remote 1104 } else { // no conflict ********** add or delete remote
1105 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1105 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1106 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1106 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1107 QString des = eventLSync->description(); 1107 QString des = eventLSync->description();
1108 QString pref = "e"; 1108 QString pref = "e";
1109 if ( inR->type() == "Todo" ) 1109 if ( inR->type() == "Todo" )
1110 pref = "t"; 1110 pref = "t";
1111 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1111 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1112 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1112 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1113 //remote->deleteIncidence( inR ); 1113 //remote->deleteIncidence( inR );
1114 ++deletedEventR; 1114 ++deletedEventR;
1115 } else { 1115 } else {
1116 inR->setLastModified( modifiedCalendar ); 1116 inR->setLastModified( modifiedCalendar );
1117 inL = inR->clone(); 1117 inL = inR->clone();
1118 inL->setIDStr( ":" ); 1118 inL->setIDStr( ":" );
1119 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1119 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1120 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1120 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1121 local->addIncidence( inL ); 1121 local->addIncidence( inL );
1122 ++addedEvent; 1122 ++addedEvent;
1123 1123
1124 } 1124 }
1125 } else { 1125 } else {
1126 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1126 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1127 inR->setLastModified( modifiedCalendar ); 1127 inR->setLastModified( modifiedCalendar );
1128 inL = inR->clone(); 1128 inL = inR->clone();
1129 inL->setIDStr( ":" ); 1129 inL->setIDStr( ":" );
1130 local->addIncidence( inL ); 1130 local->addIncidence( inL );
1131 ++addedEvent; 1131 ++addedEvent;
1132 1132
1133 } else { 1133 } else {
1134 checkExternSyncEvent(eventRSyncSharp, inR); 1134 checkExternSyncEvent(eventRSyncSharp, inR);
1135 remote->deleteIncidence( inR ); 1135 remote->deleteIncidence( inR );
1136 ++deletedEventR; 1136 ++deletedEventR;
1137 } 1137 }
1138 } 1138 }
1139 } else { 1139 } else {
1140 ++filteredIN; 1140 ++filteredIN;
1141 } 1141 }
1142 } 1142 }
1143 } 1143 }
1144 inR = er.next(); 1144 inR = er.next();
1145 } 1145 }
1146 QPtrList<Incidence> el = local->rawIncidences(); 1146 QPtrList<Incidence> el = local->rawIncidences();
1147 inL = el.first(); 1147 inL = el.first();
1148 modulo = (el.count()/10)+1; 1148 modulo = (el.count()/10)+1;
1149 bar.setCaption (i18n("Add / remove events") ); 1149 bar.setCaption (i18n("Add / remove events") );
1150 bar.setTotalSteps ( el.count() ) ; 1150 bar.setTotalSteps ( el.count() ) ;
1151 bar.show(); 1151 bar.show();
1152 incCounter = 0; 1152 incCounter = 0;
1153 1153
1154 while ( inL ) { 1154 while ( inL ) {
1155 1155
1156 qApp->processEvents(); 1156 qApp->processEvents();
1157 if ( ! bar.isVisible() ) 1157 if ( ! bar.isVisible() )
1158 return false; 1158 return false;
1159 if ( incCounter % modulo == 0 ) 1159 if ( incCounter % modulo == 0 )
1160 bar.setProgress( incCounter ); 1160 bar.setProgress( incCounter );
1161 ++incCounter; 1161 ++incCounter;
1162 uid = inL->uid(); 1162 uid = inL->uid();
1163 bool skipIncidence = false; 1163 bool skipIncidence = false;
1164 if ( uid.left(15) == QString("last-syncEvent-") ) 1164 if ( uid.left(15) == QString("last-syncEvent-") )
1165 skipIncidence = true; 1165 skipIncidence = true;
1166 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1166 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1167 skipIncidence = true; 1167 skipIncidence = true;
1168 if ( !skipIncidence ) { 1168 if ( !skipIncidence ) {
1169 inR = remote->incidence( uid ); 1169 inR = remote->incidence( uid );
1170 if ( ! inR ) { 1170 if ( ! inR ) {
1171 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1171 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1172 // no conflict ********** add or delete local 1172 // no conflict ********** add or delete local
1173 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1173 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1174 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1174 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1175 checkExternSyncEvent(eventLSyncSharp, inL); 1175 checkExternSyncEvent(eventLSyncSharp, inL);
1176 local->deleteIncidence( inL ); 1176 local->deleteIncidence( inL );
1177 ++deletedEventL; 1177 ++deletedEventL;
1178 } else { 1178 } else {
1179 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1179 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1180 inL->removeID(mCurrentSyncDevice ); 1180 inL->removeID(mCurrentSyncDevice );
1181 ++addedEventR; 1181 ++addedEventR;
1182 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1182 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1183 inL->setLastModified( modifiedCalendar ); 1183 inL->setLastModified( modifiedCalendar );
1184 inR = inL->clone(); 1184 inR = inL->clone();
1185 inR->setIDStr( ":" ); 1185 inR->setIDStr( ":" );
1186 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1186 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1187 remote->addIncidence( inR ); 1187 remote->addIncidence( inR );
1188 } 1188 }
1189 } 1189 }
1190 } else { 1190 } else {
1191 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1191 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1192 checkExternSyncEvent(eventLSyncSharp, inL); 1192 checkExternSyncEvent(eventLSyncSharp, inL);
1193 local->deleteIncidence( inL ); 1193 local->deleteIncidence( inL );
1194 ++deletedEventL; 1194 ++deletedEventL;
1195 } else { 1195 } else {
1196 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1196 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1197 ++addedEventR; 1197 ++addedEventR;
1198 inL->setLastModified( modifiedCalendar ); 1198 inL->setLastModified( modifiedCalendar );
1199 inR = inL->clone(); 1199 inR = inL->clone();
1200 inR->setIDStr( ":" ); 1200 inR->setIDStr( ":" );
1201 remote->addIncidence( inR ); 1201 remote->addIncidence( inR );
1202 } 1202 }
1203 } 1203 }
1204 } 1204 }
1205 } else { 1205 } else {
1206 ++filteredOUT; 1206 ++filteredOUT;
1207 } 1207 }
1208 } 1208 }
1209 } 1209 }
1210 inL = el.next(); 1210 inL = el.next();
1211 } 1211 }
1212 int delFut = 0; 1212 int delFut = 0;
1213 int remRem = 0; 1213 int remRem = 0;
1214 if ( mSyncManager->mWriteBackInFuture ) { 1214 if ( mSyncManager->mWriteBackInFuture ) {
1215 er = remote->rawIncidences(); 1215 er = remote->rawIncidences();
1216 remRem = er.count(); 1216 remRem = er.count();
1217 inR = er.first(); 1217 inR = er.first();
1218 QDateTime dt; 1218 QDateTime dt;
1219 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1219 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1220 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1220 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1221 while ( inR ) { 1221 while ( inR ) {
1222 if ( inR->type() == "Todo" ) { 1222 if ( inR->type() == "Todo" ) {
1223 Todo * t = (Todo*)inR; 1223 Todo * t = (Todo*)inR;
1224 if ( t->hasDueDate() ) 1224 if ( t->hasDueDate() )
1225 dt = t->dtDue(); 1225 dt = t->dtDue();
1226 else 1226 else
1227 dt = cur.addSecs( 62 ); 1227 dt = cur.addSecs( 62 );
1228 } 1228 }
1229 else if (inR->type() == "Event" ) { 1229 else if (inR->type() == "Event" ) {
1230 bool ok; 1230 bool ok;
1231 dt = inR->getNextOccurence( cur, &ok ); 1231 dt = inR->getNextOccurence( cur, &ok );
1232 if ( !ok ) 1232 if ( !ok )
1233 dt = cur.addSecs( -62 ); 1233 dt = cur.addSecs( -62 );
1234 } 1234 }
1235 else 1235 else
1236 dt = inR->dtStart(); 1236 dt = inR->dtStart();
1237 if ( dt < cur || dt > end ) { 1237 if ( dt < cur || dt > end ) {
1238 remote->deleteIncidence( inR ); 1238 remote->deleteIncidence( inR );
1239 ++delFut; 1239 ++delFut;
1240 } 1240 }
1241 inR = er.next(); 1241 inR = er.next();
1242 } 1242 }
1243 } 1243 }
1244 bar.hide(); 1244 bar.hide();
1245 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1245 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1246 eventLSync->setReadOnly( false ); 1246 eventLSync->setReadOnly( false );
1247 eventLSync->setDtStart( mLastCalendarSync ); 1247 eventLSync->setDtStart( mLastCalendarSync );
1248 eventRSync->setDtStart( mLastCalendarSync ); 1248 eventRSync->setDtStart( mLastCalendarSync );
1249 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1249 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1250 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1250 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1251 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1251 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1252 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1252 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1253 eventLSync->setReadOnly( true ); 1253 eventLSync->setReadOnly( true );
1254 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1254 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1255 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1255 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1256 remote->addEvent( eventRSync ); 1256 remote->addEvent( eventRSync );
1257 else 1257 else
1258 delete eventRSync; 1258 delete eventRSync;
1259 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1259 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1260 QString mes; 1260 QString mes;
1261 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1261 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1262 QString delmess; 1262 QString delmess;
1263 if ( delFut ) { 1263 if ( delFut ) {
1264 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1264 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1265 mes += delmess; 1265 mes += delmess;
1266 } 1266 }
1267 mes = i18n("Local calendar changed!\n") +mes; 1267 mes = i18n("Local calendar changed!\n") +mes;
1268 mCalendar->checkAlarmForIncidence( 0, true ); 1268 mCalendar->checkAlarmForIncidence( 0, true );
1269 qDebug( mes ); 1269 qDebug( mes );
1270 if ( mSyncManager->mShowSyncSummary ) { 1270 if ( mSyncManager->mShowSyncSummary ) {
1271 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1271 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1272 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1272 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1273 qDebug("KO: WB cancelled "); 1273 qDebug("KO: WB cancelled ");
1274 mSyncManager->mWriteBackFile = false; 1274 mSyncManager->mWriteBackFile = false;
1275 return syncOK; 1275 return syncOK;
1276 } 1276 }
1277 } 1277 }
1278 return syncOK; 1278 return syncOK;
1279} 1279}
1280 1280
1281void CalendarView::setSyncDevice( QString s ) 1281void CalendarView::setSyncDevice( QString s )
1282{ 1282{
1283 mCurrentSyncDevice= s; 1283 mCurrentSyncDevice= s;
1284} 1284}
1285void CalendarView::setSyncName( QString s ) 1285void CalendarView::setSyncName( QString s )
1286{ 1286{
1287 mCurrentSyncName= s; 1287 mCurrentSyncName= s;
1288} 1288}
1289bool CalendarView::syncCalendar(QString filename, int mode) 1289bool CalendarView::syncCalendar(QString filename, int mode)
1290{ 1290{
1291 //qDebug("syncCalendar %s ", filename.latin1()); 1291 //qDebug("syncCalendar %s ", filename.latin1());
1292 mGlobalSyncMode = SYNC_MODE_NORMAL; 1292 mGlobalSyncMode = SYNC_MODE_NORMAL;
1293 CalendarLocal* calendar = new CalendarLocal(); 1293 CalendarLocal* calendar = new CalendarLocal();
1294 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1294 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1295 FileStorage* storage = new FileStorage( calendar ); 1295 FileStorage* storage = new FileStorage( calendar );
1296 bool syncOK = false; 1296 bool syncOK = false;
1297 storage->setFileName( filename ); 1297 storage->setFileName( filename );
1298 // qDebug("loading ... "); 1298 // qDebug("loading ... ");
1299 if ( storage->load() ) { 1299 if ( storage->load() ) {
1300 getEventViewerDialog()->setSyncMode( true ); 1300 getEventViewerDialog()->setSyncMode( true );
1301 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1301 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1302 getEventViewerDialog()->setSyncMode( false ); 1302 getEventViewerDialog()->setSyncMode( false );
1303 if ( syncOK ) { 1303 if ( syncOK ) {
1304 if ( mSyncManager->mWriteBackFile ) 1304 if ( mSyncManager->mWriteBackFile )
1305 { 1305 {
1306 storage->setSaveFormat( new ICalFormat() ); 1306 storage->setSaveFormat( new ICalFormat() );
1307 storage->save(); 1307 storage->save();
1308 } 1308 }
1309 } 1309 }
1310 setModified( true ); 1310 setModified( true );
1311 } 1311 }
1312 delete storage; 1312 delete storage;
1313 delete calendar; 1313 delete calendar;
1314 if ( syncOK ) 1314 if ( syncOK )
1315 updateView(); 1315 updateView();
1316 return syncOK; 1316 return syncOK;
1317} 1317}
1318 1318
1319void CalendarView::syncExternal( int mode ) 1319void CalendarView::syncExternal( int mode )
1320{ 1320{
1321 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1321 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1322 1322
1323 qApp->processEvents(); 1323 qApp->processEvents();
1324 CalendarLocal* calendar = new CalendarLocal(); 1324 CalendarLocal* calendar = new CalendarLocal();
1325 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1325 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1326 bool syncOK = false; 1326 bool syncOK = false;
1327 bool loadSuccess = false; 1327 bool loadSuccess = false;
1328 PhoneFormat* phoneFormat = 0; 1328 PhoneFormat* phoneFormat = 0;
1329 emit tempDisableBR(true); 1329 emit tempDisableBR(true);
1330#ifndef DESKTOP_VERSION 1330#ifndef DESKTOP_VERSION
1331 SharpFormat* sharpFormat = 0; 1331 SharpFormat* sharpFormat = 0;
1332 if ( mode == 0 ) { // sharp 1332 if ( mode == 0 ) { // sharp
1333 sharpFormat = new SharpFormat () ; 1333 sharpFormat = new SharpFormat () ;
1334 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1334 loadSuccess = sharpFormat->load( calendar, mCalendar );
1335 1335
1336 } else 1336 } else
1337#endif 1337#endif
1338 if ( mode == 1 ) { // phone 1338 if ( mode == 1 ) { // phone
1339 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1339 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1340 mSyncManager->mPhoneDevice, 1340 mSyncManager->mPhoneDevice,
1341 mSyncManager->mPhoneConnection, 1341 mSyncManager->mPhoneConnection,
1342 mSyncManager->mPhoneModel); 1342 mSyncManager->mPhoneModel);
1343 loadSuccess = phoneFormat->load( calendar,mCalendar); 1343 loadSuccess = phoneFormat->load( calendar,mCalendar);
1344 1344
1345 } else { 1345 } else {
1346 emit tempDisableBR(false); 1346 emit tempDisableBR(false);
1347 return; 1347 return;
1348 } 1348 }
1349 if ( loadSuccess ) { 1349 if ( loadSuccess ) {
1350 getEventViewerDialog()->setSyncMode( true ); 1350 getEventViewerDialog()->setSyncMode( true );
1351 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1351 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1352 getEventViewerDialog()->setSyncMode( false ); 1352 getEventViewerDialog()->setSyncMode( false );
1353 qApp->processEvents(); 1353 qApp->processEvents();
1354 if ( syncOK ) { 1354 if ( syncOK ) {
1355 if ( mSyncManager->mWriteBackFile ) 1355 if ( mSyncManager->mWriteBackFile )
1356 { 1356 {
1357 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1357 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1358 Incidence* inc = iL.first(); 1358 Incidence* inc = iL.first();
1359 if ( phoneFormat ) { 1359 if ( phoneFormat ) {
1360 while ( inc ) { 1360 while ( inc ) {
1361 inc->removeID(mCurrentSyncDevice); 1361 inc->removeID(mCurrentSyncDevice);
1362 inc = iL.next(); 1362 inc = iL.next();
1363 } 1363 }
1364 } 1364 }
1365#ifndef DESKTOP_VERSION 1365#ifndef DESKTOP_VERSION
1366 if ( sharpFormat ) 1366 if ( sharpFormat )
1367 sharpFormat->save(calendar); 1367 sharpFormat->save(calendar);
1368#endif 1368#endif
1369 if ( phoneFormat ) 1369 if ( phoneFormat )
1370 phoneFormat->save(calendar); 1370 phoneFormat->save(calendar);
1371 iL = calendar->rawIncidences(); 1371 iL = calendar->rawIncidences();
1372 inc = iL.first(); 1372 inc = iL.first();
1373 Incidence* loc; 1373 Incidence* loc;
1374 while ( inc ) { 1374 while ( inc ) {
1375 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1375 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1376 loc = mCalendar->incidence(inc->uid() ); 1376 loc = mCalendar->incidence(inc->uid() );
1377 if ( loc ) { 1377 if ( loc ) {
1378 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1378 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1379 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1379 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1380 } 1380 }
1381 } 1381 }
1382 inc = iL.next(); 1382 inc = iL.next();
1383 } 1383 }
1384 Incidence* lse = getLastSyncEvent(); 1384 Incidence* lse = getLastSyncEvent();
1385 if ( lse ) { 1385 if ( lse ) {
1386 lse->setReadOnly( false ); 1386 lse->setReadOnly( false );
1387 lse->setDescription( "" ); 1387 lse->setDescription( "" );
1388 lse->setReadOnly( true ); 1388 lse->setReadOnly( true );
1389 } 1389 }
1390 } 1390 }
1391 } else { 1391 } else {
1392 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1392 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1393 } 1393 }
1394 setModified( true ); 1394 setModified( true );
1395 } else { 1395 } else {
1396 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1396 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1397 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1397 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1398 question, i18n("Ok")) ; 1398 question, i18n("Ok")) ;
1399 1399
1400 } 1400 }
1401 delete calendar; 1401 delete calendar;
1402 updateView(); 1402 updateView();
1403 emit tempDisableBR(false); 1403 emit tempDisableBR(false);
1404 return ;//syncOK; 1404 return ;//syncOK;
1405 1405
1406} 1406}
1407 1407
1408bool CalendarView::importBday() 1408bool CalendarView::importBday()
1409{ 1409{
1410#ifndef KORG_NOKABC 1410#ifndef KORG_NOKABC
1411 1411
1412#ifdef DESKTOP_VERSION 1412#ifdef DESKTOP_VERSION
1413 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1413 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1414 KABC::AddressBook::Iterator it; 1414 KABC::AddressBook::Iterator it;
1415 int count = 0; 1415 int count = 0;
1416 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1416 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1417 ++count; 1417 ++count;
1418 } 1418 }
1419 QProgressBar bar(count,0 ); 1419 QProgressBar bar(count,0 );
1420 int w = 300; 1420 int w = 300;
1421 if ( QApplication::desktop()->width() < 320 ) 1421 if ( QApplication::desktop()->width() < 320 )
1422 w = 220; 1422 w = 220;
1423 int h = bar.sizeHint().height() ; 1423 int h = bar.sizeHint().height() ;
1424 int dw = QApplication::desktop()->width(); 1424 int dw = QApplication::desktop()->width();
1425 int dh = QApplication::desktop()->height(); 1425 int dh = QApplication::desktop()->height();
1426 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1426 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1427 bar.show(); 1427 bar.show();
1428 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1428 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1429 qApp->processEvents(); 1429 qApp->processEvents();
1430 count = 0; 1430 count = 0;
1431 int addCount = 0; 1431 int addCount = 0;
1432 KCal::Attendee* a = 0; 1432 KCal::Attendee* a = 0;
1433 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1433 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1434 if ( ! bar.isVisible() ) 1434 if ( ! bar.isVisible() )
1435 return false; 1435 return false;
1436 bar.setProgress( count++ ); 1436 bar.setProgress( count++ );
1437 qApp->processEvents(); 1437 qApp->processEvents();
1438 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1438 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1439 if ( (*it).birthday().date().isValid() ){ 1439 if ( (*it).birthday().date().isValid() ){
1440 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1440 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1441 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1441 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1442 ++addCount; 1442 ++addCount;
1443 } 1443 }
1444 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1444 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1445 if ( anni.isValid() ){ 1445 if ( anni.isValid() ){
1446 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1446 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1447 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1447 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1448 ++addCount; 1448 ++addCount;
1449 } 1449 }
1450 } 1450 }
1451 updateView(); 1451 updateView();
1452 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1452 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1453#else //DESKTOP_VERSION 1453#else //DESKTOP_VERSION
1454 1454
1455 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1455 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1456 // the result should now arrive through method insertBirthdays 1456 // the result should now arrive through method insertBirthdays
1457 1457
1458#endif //DESKTOP_VERSION 1458#endif //DESKTOP_VERSION
1459 1459
1460#endif //KORG_NOKABC 1460#endif //KORG_NOKABC
1461 1461
1462 1462
1463 return true; 1463 return true;
1464} 1464}
1465 1465
1466// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1466// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1467void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1467void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1468 const QStringList& anniversaryList, const QStringList& realNameList, 1468 const QStringList& anniversaryList, const QStringList& realNameList,
1469 const QStringList& emailList, const QStringList& assembledNameList, 1469 const QStringList& emailList, const QStringList& assembledNameList,
1470 const QStringList& uidList) 1470 const QStringList& uidList)
1471{ 1471{
1472 //qDebug("KO::CalendarView::insertBirthdays"); 1472 //qDebug("KO::CalendarView::insertBirthdays");
1473 if (uid == this->name()) 1473 if (uid == this->name())
1474 { 1474 {
1475 int count = birthdayList.count(); 1475 int count = birthdayList.count();
1476 int addCount = 0; 1476 int addCount = 0;
1477 KCal::Attendee* a = 0; 1477 KCal::Attendee* a = 0;
1478 1478
1479 //qDebug("CalView 1 %i", count); 1479 //qDebug("CalView 1 %i", count);
1480 1480
1481 QProgressBar bar(count,0 ); 1481 QProgressBar bar(count,0 );
1482 int w = 300; 1482 int w = 300;
1483 if ( QApplication::desktop()->width() < 320 ) 1483 if ( QApplication::desktop()->width() < 320 )
1484 w = 220; 1484 w = 220;
1485 int h = bar.sizeHint().height() ; 1485 int h = bar.sizeHint().height() ;
1486 int dw = QApplication::desktop()->width(); 1486 int dw = QApplication::desktop()->width();
1487 int dh = QApplication::desktop()->height(); 1487 int dh = QApplication::desktop()->height();
1488 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1488 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1489 bar.show(); 1489 bar.show();
1490 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1490 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1491 qApp->processEvents(); 1491 qApp->processEvents();
1492 1492
1493 QDate birthday; 1493 QDate birthday;
1494 QDate anniversary; 1494 QDate anniversary;
1495 QString realName; 1495 QString realName;
1496 QString email; 1496 QString email;
1497 QString assembledName; 1497 QString assembledName;
1498 QString uid; 1498 QString uid;
1499 bool ok = true; 1499 bool ok = true;
1500 for ( int i = 0; i < count; i++) 1500 for ( int i = 0; i < count; i++)
1501 { 1501 {
1502 if ( ! bar.isVisible() ) 1502 if ( ! bar.isVisible() )
1503 return; 1503 return;
1504 bar.setProgress( i ); 1504 bar.setProgress( i );
1505 qApp->processEvents(); 1505 qApp->processEvents();
1506 1506
1507 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1507 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1508 if (!ok) { 1508 if (!ok) {
1509 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1509 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1510 } 1510 }
1511 1511
1512 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1512 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1513 if (!ok) { 1513 if (!ok) {
1514 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1514 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1515 } 1515 }
1516 realName = realNameList[i]; 1516 realName = realNameList[i];
1517 email = emailList[i]; 1517 email = emailList[i];
1518 assembledName = assembledNameList[i]; 1518 assembledName = assembledNameList[i];
1519 uid = uidList[i]; 1519 uid = uidList[i];
1520 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1520 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1521 1521
1522 if ( birthday.isValid() ){ 1522 if ( birthday.isValid() ){
1523 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1523 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1524 KCal::Attendee::ReqParticipant,uid) ; 1524 KCal::Attendee::ReqParticipant,uid) ;
1525 if ( addAnniversary( birthday, assembledName, a, true ) ) 1525 if ( addAnniversary( birthday, assembledName, a, true ) )
1526 ++addCount; 1526 ++addCount;
1527 } 1527 }
1528 1528
1529 if ( anniversary.isValid() ){ 1529 if ( anniversary.isValid() ){
1530 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1530 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1531 KCal::Attendee::ReqParticipant,uid) ; 1531 KCal::Attendee::ReqParticipant,uid) ;
1532 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1532 if ( addAnniversary( anniversary, assembledName, a, false ) )
1533 ++addCount; 1533 ++addCount;
1534 } 1534 }
1535 } 1535 }
1536 1536
1537 updateView(); 1537 updateView();
1538 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1538 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1539 1539
1540 } 1540 }
1541 1541
1542} 1542}
1543 1543
1544 1544
1545 1545
1546bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1546bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1547{ 1547{
1548 //qDebug("addAnni "); 1548 //qDebug("addAnni ");
1549 Event * ev = new Event(); 1549 Event * ev = new Event();
1550 ev->setOrganizer(KOPrefs::instance()->email()); 1550 ev->setOrganizer(KOPrefs::instance()->email());
1551 if ( a ) { 1551 if ( a ) {
1552 ev->addAttendee( a ); 1552 ev->addAttendee( a );
1553 } 1553 }
1554 QString kind; 1554 QString kind;
1555 if ( birthday ) { 1555 if ( birthday ) {
1556 kind = i18n( "Birthday" ); 1556 kind = i18n( "Birthday" );
1557 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1557 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1558 } 1558 }
1559 else { 1559 else {
1560 kind = i18n( "Anniversary" ); 1560 kind = i18n( "Anniversary" );
1561 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1561 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1562 } 1562 }
1563 ev->setCategories( kind ); 1563 ev->setCategories( kind );
1564 ev->setDtStart( QDateTime(date) ); 1564 ev->setDtStart( QDateTime(date) );
1565 ev->setDtEnd( QDateTime(date) ); 1565 ev->setDtEnd( QDateTime(date) );
1566 ev->setFloats( true ); 1566 ev->setFloats( true );
1567 Recurrence * rec = ev->recurrence(); 1567 Recurrence * rec = ev->recurrence();
1568 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1568 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1569 rec->addYearlyNum( date.month() ); 1569 rec->addYearlyNum( date.month() );
1570 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1570 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1571 delete ev; 1571 delete ev;
1572 return false; 1572 return false;
1573 } 1573 }
1574 return true; 1574 return true;
1575 1575
1576} 1576}
1577bool CalendarView::importQtopia( const QString &categories, 1577bool CalendarView::importQtopia( const QString &categories,
1578 const QString &datebook, 1578 const QString &datebook,
1579 const QString &todolist ) 1579 const QString &todolist )
1580{ 1580{
1581 1581
1582 QtopiaFormat qtopiaFormat; 1582 QtopiaFormat qtopiaFormat;
1583 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1583 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1584 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1584 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1585 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1585 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1586 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1586 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1587 1587
1588 updateView(); 1588 updateView();
1589 return true; 1589 return true;
1590 1590
1591#if 0 1591#if 0
1592 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1592 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1593 mCurrentSyncDevice = "qtopia-XML"; 1593 mCurrentSyncDevice = "qtopia-XML";
1594 if ( mSyncManager->mAskForPreferences ) 1594 if ( mSyncManager->mAskForPreferences )
1595 edit_sync_options(); 1595 edit_sync_options();
1596 qApp->processEvents(); 1596 qApp->processEvents();
1597 CalendarLocal* calendar = new CalendarLocal(); 1597 CalendarLocal* calendar = new CalendarLocal();
1598 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1598 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1599 bool syncOK = false; 1599 bool syncOK = false;
1600 QtopiaFormat qtopiaFormat; 1600 QtopiaFormat qtopiaFormat;
1601 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1601 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1602 bool loadOk = true; 1602 bool loadOk = true;
1603 if ( !categories.isEmpty() ) 1603 if ( !categories.isEmpty() )
1604 loadOk = qtopiaFormat.load( calendar, categories ); 1604 loadOk = qtopiaFormat.load( calendar, categories );
1605 if ( loadOk && !datebook.isEmpty() ) 1605 if ( loadOk && !datebook.isEmpty() )
1606 loadOk = qtopiaFormat.load( calendar, datebook ); 1606 loadOk = qtopiaFormat.load( calendar, datebook );
1607 if ( loadOk && !todolist.isEmpty() ) 1607 if ( loadOk && !todolist.isEmpty() )
1608 loadOk = qtopiaFormat.load( calendar, todolist ); 1608 loadOk = qtopiaFormat.load( calendar, todolist );
1609 1609
1610 if ( loadOk ) { 1610 if ( loadOk ) {
1611 getEventViewerDialog()->setSyncMode( true ); 1611 getEventViewerDialog()->setSyncMode( true );
1612 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1612 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1613 getEventViewerDialog()->setSyncMode( false ); 1613 getEventViewerDialog()->setSyncMode( false );
1614 qApp->processEvents(); 1614 qApp->processEvents();
1615 if ( syncOK ) { 1615 if ( syncOK ) {
1616 if ( mSyncManager->mWriteBackFile ) 1616 if ( mSyncManager->mWriteBackFile )
1617 { 1617 {
1618 // write back XML file 1618 // write back XML file
1619 1619
1620 } 1620 }
1621 setModified( true ); 1621 setModified( true );
1622 } 1622 }
1623 } else { 1623 } else {
1624 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1624 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1625 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1625 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1626 question, i18n("Ok")) ; 1626 question, i18n("Ok")) ;
1627 } 1627 }
1628 delete calendar; 1628 delete calendar;
1629 updateView(); 1629 updateView();
1630 return syncOK; 1630 return syncOK;
1631 1631
1632 1632
1633#endif 1633#endif
1634 1634
1635} 1635}
1636 1636
1637void CalendarView::setSyncEventsReadOnly() 1637void CalendarView::setSyncEventsReadOnly()
1638{ 1638{
1639 Event * ev; 1639 Event * ev;
1640 QPtrList<Event> eL = mCalendar->rawEvents(); 1640 QPtrList<Event> eL = mCalendar->rawEvents();
1641 ev = eL.first(); 1641 ev = eL.first();
1642 while ( ev ) { 1642 while ( ev ) {
1643 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1643 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1644 ev->setReadOnly( true ); 1644 ev->setReadOnly( true );
1645 ev = eL.next(); 1645 ev = eL.next();
1646 } 1646 }
1647} 1647}
1648bool CalendarView::openCalendar(QString filename, bool merge) 1648bool CalendarView::openCalendar(QString filename, bool merge)
1649{ 1649{
1650 1650
1651 if (filename.isEmpty()) { 1651 if (filename.isEmpty()) {
1652 return false; 1652 return false;
1653 } 1653 }
1654 1654
1655 if (!QFile::exists(filename)) { 1655 if (!QFile::exists(filename)) {
1656 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1656 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1657 return false; 1657 return false;
1658 } 1658 }
1659 1659
1660 globalFlagBlockAgenda = 1; 1660 globalFlagBlockAgenda = 1;
1661 if (!merge) mCalendar->close(); 1661 if (!merge) {
1662 1662 mCalendar->close();
1663 mTodoList->clearList();
1664 }
1663 mStorage->setFileName( filename ); 1665 mStorage->setFileName( filename );
1664 1666
1665 if ( mStorage->load() ) { 1667 if ( mStorage->load() ) {
1666 if ( merge ) ;//setModified( true ); 1668 if ( merge ) ;//setModified( true );
1667 else { 1669 else {
1668 //setModified( true ); 1670 //setModified( true );
1669 mViewManager->setDocumentId( filename ); 1671 mViewManager->setDocumentId( filename );
1670 mDialogManager->setDocumentId( filename ); 1672 mDialogManager->setDocumentId( filename );
1671 mTodoList->setDocumentId( filename ); 1673 mTodoList->setDocumentId( filename );
1672 } 1674 }
1673 globalFlagBlockAgenda = 2; 1675 globalFlagBlockAgenda = 2;
1674 // if ( getLastSyncEvent() ) 1676 // if ( getLastSyncEvent() )
1675 // getLastSyncEvent()->setReadOnly( true ); 1677 // getLastSyncEvent()->setReadOnly( true );
1676 mCalendar->reInitAlarmSettings(); 1678 mCalendar->reInitAlarmSettings();
1677 setSyncEventsReadOnly(); 1679 setSyncEventsReadOnly();
1678 updateUnmanagedViews(); 1680 updateUnmanagedViews();
1679 updateView(); 1681 updateView();
1680 if ( filename != MainWindow::defaultFileName() ) { 1682 if ( filename != MainWindow::defaultFileName() ) {
1681 saveCalendar( MainWindow::defaultFileName() ); 1683 saveCalendar( MainWindow::defaultFileName() );
1682 } else { 1684 } else {
1683 QFileInfo finf ( MainWindow::defaultFileName()); 1685 QFileInfo finf ( MainWindow::defaultFileName());
1684 if ( finf.exists() ) { 1686 if ( finf.exists() ) {
1685 setLoadedFileVersion( finf.lastModified () ); 1687 setLoadedFileVersion( finf.lastModified () );
1686 } 1688 }
1687 } 1689 }
1688 return true; 1690 return true;
1689 } else { 1691 } else {
1690 // while failing to load, the calendar object could 1692 // while failing to load, the calendar object could
1691 // have become partially populated. Clear it out. 1693 // have become partially populated. Clear it out.
1692 if ( !merge ) { 1694 if ( !merge ) {
1693 mCalendar->close(); 1695 mCalendar->close();
1694 mViewManager->setDocumentId( filename ); 1696 mViewManager->setDocumentId( filename );
1695 mDialogManager->setDocumentId( filename ); 1697 mDialogManager->setDocumentId( filename );
1696 mTodoList->setDocumentId( filename ); 1698 mTodoList->setDocumentId( filename );
1697 } 1699 }
1698 1700
1699 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1701 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1700 1702
1701 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1703 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1702 globalFlagBlockAgenda = 2; 1704 globalFlagBlockAgenda = 2;
1703 mCalendar->reInitAlarmSettings(); 1705 mCalendar->reInitAlarmSettings();
1704 setSyncEventsReadOnly(); 1706 setSyncEventsReadOnly();
1705 updateUnmanagedViews(); 1707 updateUnmanagedViews();
1706 updateView(); 1708 updateView();
1707 } 1709 }
1708 return false; 1710 return false;
1709} 1711}
1710void CalendarView::showOpenError() 1712void CalendarView::showOpenError()
1711{ 1713{
1712 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1714 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1713} 1715}
1714void CalendarView::setLoadedFileVersion(QDateTime dt) 1716void CalendarView::setLoadedFileVersion(QDateTime dt)
1715{ 1717{
1716 loadedFileVersion = dt; 1718 loadedFileVersion = dt;
1717} 1719}
1718bool CalendarView::checkFileChanged(QString fn) 1720bool CalendarView::checkFileChanged(QString fn)
1719{ 1721{
1720 QFileInfo finf ( fn ); 1722 QFileInfo finf ( fn );
1721 if ( !finf.exists() ) 1723 if ( !finf.exists() )
1722 return true; 1724 return true;
1723 QDateTime dt = finf.lastModified (); 1725 QDateTime dt = finf.lastModified ();
1724 if ( dt <= loadedFileVersion ) 1726 if ( dt <= loadedFileVersion )
1725 return false; 1727 return false;
1726 return true; 1728 return true;
1727 1729
1728} 1730}
1729void CalendarView::watchSavedFile() 1731void CalendarView::watchSavedFile()
1730{ 1732{
1731 QFileInfo finf ( MainWindow::defaultFileName()); 1733 QFileInfo finf ( MainWindow::defaultFileName());
1732 if ( !finf.exists() ) 1734 if ( !finf.exists() )
1733 return; 1735 return;
1734 QDateTime dt = finf.lastModified (); 1736 QDateTime dt = finf.lastModified ();
1735 if ( dt < loadedFileVersion ) { 1737 if ( dt < loadedFileVersion ) {
1736 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1738 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1737 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1739 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1738 return; 1740 return;
1739 } 1741 }
1740 loadedFileVersion = dt; 1742 loadedFileVersion = dt;
1741} 1743}
1742 1744
1743bool CalendarView::checkFileVersion(QString fn) 1745bool CalendarView::checkFileVersion(QString fn)
1744{ 1746{
1745 QFileInfo finf ( fn ); 1747 QFileInfo finf ( fn );
1746 if ( !finf.exists() ) 1748 if ( !finf.exists() )
1747 return true; 1749 return true;
1748 QDateTime dt = finf.lastModified (); 1750 QDateTime dt = finf.lastModified ();
1749 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1751 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1750 //qDebug("file on disk version %s",dt.toString().latin1()); 1752 //qDebug("file on disk version %s",dt.toString().latin1());
1751 if ( dt <= loadedFileVersion ) 1753 if ( dt <= loadedFileVersion )
1752 return true; 1754 return true;
1753 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 1755 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1754 i18n("KO/Pi Warning"),i18n("Overwrite"), 1756 i18n("KO/Pi Warning"),i18n("Overwrite"),
1755 i18n("Sync+save")); 1757 i18n("Sync+save"));
1756 1758
1757 if ( km == KMessageBox::Cancel ) 1759 if ( km == KMessageBox::Cancel )
1758 return false; 1760 return false;
1759 if ( km == KMessageBox::Yes ) 1761 if ( km == KMessageBox::Yes )
1760 return true; 1762 return true;
1761 1763
1762 setSyncDevice("deleteaftersync" ); 1764 setSyncDevice("deleteaftersync" );
1763 mSyncManager->mAskForPreferences = true; 1765 mSyncManager->mAskForPreferences = true;
1764 mSyncManager->mSyncAlgoPrefs = 3; 1766 mSyncManager->mSyncAlgoPrefs = 3;
1765 mSyncManager->mWriteBackFile = false; 1767 mSyncManager->mWriteBackFile = false;
1766 mSyncManager->mWriteBackExistingOnly = false; 1768 mSyncManager->mWriteBackExistingOnly = false;
1767 mSyncManager->mShowSyncSummary = false; 1769 mSyncManager->mShowSyncSummary = false;
1768 syncCalendar( fn, 3 ); 1770 syncCalendar( fn, 3 );
1769 Event * e = getLastSyncEvent(); 1771 Event * e = getLastSyncEvent();
1770 mCalendar->deleteEvent ( e ); 1772 mCalendar->deleteEvent ( e );
1771 updateView(); 1773 updateView();
1772 return true; 1774 return true;
1773} 1775}
1774 1776
1775bool CalendarView::saveCalendar( QString filename ) 1777bool CalendarView::saveCalendar( QString filename )
1776{ 1778{
1777 1779
1778 // Store back all unsaved data into calendar object 1780 // Store back all unsaved data into calendar object
1779 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1781 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1780 if ( mViewManager->currentView() ) 1782 if ( mViewManager->currentView() )
1781 mViewManager->currentView()->flushView(); 1783 mViewManager->currentView()->flushView();
1782 1784
1783 1785
1784 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1786 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1785 mStorage->setSaveFormat( new ICalFormat() ); 1787 mStorage->setSaveFormat( new ICalFormat() );
1786 mStorage->setFileName( filename ); 1788 mStorage->setFileName( filename );
1787 bool success; 1789 bool success;
1788 success = mStorage->save(); 1790 success = mStorage->save();
1789 if ( !success ) { 1791 if ( !success ) {
1790 return false; 1792 return false;
1791 } 1793 }
1792 if ( filename == MainWindow::defaultFileName() ) { 1794 if ( filename == MainWindow::defaultFileName() ) {
1793 setLoadedFileVersion( lfv ); 1795 setLoadedFileVersion( lfv );
1794 watchSavedFile(); 1796 watchSavedFile();
1795 } 1797 }
1796 return true; 1798 return true;
1797} 1799}
1798 1800
1799void CalendarView::closeCalendar() 1801void CalendarView::closeCalendar()
1800{ 1802{
1801 1803
1802 // child windows no longer valid 1804 // child windows no longer valid
1803 emit closingDown(); 1805 emit closingDown();
1804 1806
1805 mCalendar->close(); 1807 mCalendar->close();
1806 setModified(false); 1808 setModified(false);
1807 updateView(); 1809 updateView();
1808} 1810}
1809 1811
1810void CalendarView::archiveCalendar() 1812void CalendarView::archiveCalendar()
1811{ 1813{
1812 mDialogManager->showArchiveDialog(); 1814 mDialogManager->showArchiveDialog();
1813} 1815}
1814 1816
1815 1817
1816void CalendarView::readSettings() 1818void CalendarView::readSettings()
1817{ 1819{
1818 1820
1819 1821
1820 // mViewManager->showAgendaView(); 1822 // mViewManager->showAgendaView();
1821 QString str; 1823 QString str;
1822 //qDebug("CalendarView::readSettings() "); 1824 //qDebug("CalendarView::readSettings() ");
1823 // read settings from the KConfig, supplying reasonable 1825 // read settings from the KConfig, supplying reasonable
1824 // defaults where none are to be found 1826 // defaults where none are to be found
1825 KConfig *config = KOGlobals::config(); 1827 KConfig *config = KOGlobals::config();
1826#ifndef KORG_NOSPLITTER 1828#ifndef KORG_NOSPLITTER
1827 config->setGroup("KOrganizer Geometry"); 1829 config->setGroup("KOrganizer Geometry");
1828 1830
1829 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1831 QValueList<int> sizes = config->readIntListEntry("Separator1");
1830 if (sizes.count() != 2) { 1832 if (sizes.count() != 2) {
1831 sizes << mDateNavigator->minimumSizeHint().width(); 1833 sizes << mDateNavigator->minimumSizeHint().width();
1832 sizes << 300; 1834 sizes << 300;
1833 } 1835 }
1834 mPanner->setSizes(sizes); 1836 mPanner->setSizes(sizes);
1835 1837
1836 sizes = config->readIntListEntry("Separator2"); 1838 sizes = config->readIntListEntry("Separator2");
1837 if ( ( mResourceView && sizes.count() == 4 ) || 1839 if ( ( mResourceView && sizes.count() == 4 ) ||
1838 ( !mResourceView && sizes.count() == 3 ) ) { 1840 ( !mResourceView && sizes.count() == 3 ) ) {
1839 mLeftSplitter->setSizes(sizes); 1841 mLeftSplitter->setSizes(sizes);
1840 } 1842 }
1841#endif 1843#endif
1842 globalFlagBlockAgenda = 1; 1844 globalFlagBlockAgenda = 1;
1843 mViewManager->showAgendaView(); 1845 mViewManager->showAgendaView();
1844 //mViewManager->readSettings( config ); 1846 //mViewManager->readSettings( config );
1845 mTodoList->restoreLayout(config,QString("Todo Layout")); 1847 mTodoList->restoreLayout(config,QString("Todo Layout"));
1846 readFilterSettings(config); 1848 readFilterSettings(config);
1847 1849
1848#ifdef DESKTOP_VERSION 1850#ifdef DESKTOP_VERSION
1849 config->setGroup("WidgetLayout"); 1851 config->setGroup("WidgetLayout");
1850 QStringList list; 1852 QStringList list;
1851 list = config->readListEntry("MainLayout"); 1853 list = config->readListEntry("MainLayout");
1852 int x,y,w,h; 1854 int x,y,w,h;
1853 if ( ! list.isEmpty() ) { 1855 if ( ! list.isEmpty() ) {
1854 x = list[0].toInt(); 1856 x = list[0].toInt();
1855 y = list[1].toInt(); 1857 y = list[1].toInt();
1856 w = list[2].toInt(); 1858 w = list[2].toInt();
1857 h = list[3].toInt(); 1859 h = list[3].toInt();
1858 KApplication::testCoords( &x,&y,&w,&h ); 1860 KApplication::testCoords( &x,&y,&w,&h );
1859 topLevelWidget()->setGeometry(x,y,w,h); 1861 topLevelWidget()->setGeometry(x,y,w,h);
1860 1862
1861 } else { 1863 } else {
1862 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1864 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1863 } 1865 }
1864 list = config->readListEntry("EditEventLayout"); 1866 list = config->readListEntry("EditEventLayout");
1865 if ( ! list.isEmpty() ) { 1867 if ( ! list.isEmpty() ) {
1866 x = list[0].toInt(); 1868 x = list[0].toInt();
1867 y = list[1].toInt(); 1869 y = list[1].toInt();
1868 w = list[2].toInt(); 1870 w = list[2].toInt();
1869 h = list[3].toInt(); 1871 h = list[3].toInt();
1870 KApplication::testCoords( &x,&y,&w,&h ); 1872 KApplication::testCoords( &x,&y,&w,&h );
1871 mEventEditor->setGeometry(x,y,w,h); 1873 mEventEditor->setGeometry(x,y,w,h);
1872 1874
1873 } 1875 }
1874 list = config->readListEntry("EditTodoLayout"); 1876 list = config->readListEntry("EditTodoLayout");
1875 if ( ! list.isEmpty() ) { 1877 if ( ! list.isEmpty() ) {
1876 x = list[0].toInt(); 1878 x = list[0].toInt();
1877 y = list[1].toInt(); 1879 y = list[1].toInt();
1878 w = list[2].toInt(); 1880 w = list[2].toInt();
1879 h = list[3].toInt(); 1881 h = list[3].toInt();
1880 KApplication::testCoords( &x,&y,&w,&h ); 1882 KApplication::testCoords( &x,&y,&w,&h );
1881 mTodoEditor->setGeometry(x,y,w,h); 1883 mTodoEditor->setGeometry(x,y,w,h);
1882 1884
1883 } 1885 }
1884 list = config->readListEntry("ViewerLayout"); 1886 list = config->readListEntry("ViewerLayout");
1885 if ( ! list.isEmpty() ) { 1887 if ( ! list.isEmpty() ) {
1886 x = list[0].toInt(); 1888 x = list[0].toInt();
1887 y = list[1].toInt(); 1889 y = list[1].toInt();
1888 w = list[2].toInt(); 1890 w = list[2].toInt();
1889 h = list[3].toInt(); 1891 h = list[3].toInt();
1890 KApplication::testCoords( &x,&y,&w,&h ); 1892 KApplication::testCoords( &x,&y,&w,&h );
1891 getEventViewerDialog()->setGeometry(x,y,w,h); 1893 getEventViewerDialog()->setGeometry(x,y,w,h);
1892 } 1894 }
1893#endif 1895#endif
1894 config->setGroup( "Views" ); 1896 config->setGroup( "Views" );
1895 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1897 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1896 1898
1897 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1899 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1898 1900
1899 int resetval = 0; 1901 int resetval = 0;
1900 int maxVal = 0; 1902 int maxVal = 0;
1901 if (sizes.count() != 3) { 1903 if (sizes.count() != 3) {
1902 if ( KOPrefs::instance()->mVerticalScreen ) { 1904 if ( KOPrefs::instance()->mVerticalScreen ) {
1903 resetval = mDateNavigator->sizeHint().width()+2; 1905 resetval = mDateNavigator->sizeHint().width()+2;
1904 } else { 1906 } else {
1905 resetval = mDateNavigator->sizeHint().height()+2; 1907 resetval = mDateNavigator->sizeHint().height()+2;
1906 } 1908 }
1907 } 1909 }
1908 if ( resetval ) { 1910 if ( resetval ) {
1909 sizes.clear(); 1911 sizes.clear();
1910 if ( KOPrefs::instance()->mVerticalScreen ) { 1912 if ( KOPrefs::instance()->mVerticalScreen ) {
1911 maxVal = QApplication::desktop()->width() -10; 1913 maxVal = QApplication::desktop()->width() -10;
1912 } else { 1914 } else {
1913 maxVal = QApplication::desktop()->height()-10; 1915 maxVal = QApplication::desktop()->height()-10;
1914 } 1916 }
1915 sizes << resetval; 1917 sizes << resetval;
1916 if ( maxVal < resetval + resetval) 1918 if ( maxVal < resetval + resetval)
1917 resetval = maxVal - resetval; 1919 resetval = maxVal - resetval;
1918 sizes << resetval; 1920 sizes << resetval;
1919 sizes << 100; 1921 sizes << 100;
1920 } 1922 }
1921 mLeftFrame->setSizes(sizes); 1923 mLeftFrame->setSizes(sizes);
1922 sizes = config->readIntListEntry("Main Splitter Frame"); 1924 sizes = config->readIntListEntry("Main Splitter Frame");
1923 resetval = 0; 1925 resetval = 0;
1924 maxVal = 0; 1926 maxVal = 0;
1925 if (sizes.count() != 2) { 1927 if (sizes.count() != 2) {
1926 if ( !KOPrefs::instance()->mVerticalScreen ) { 1928 if ( !KOPrefs::instance()->mVerticalScreen ) {
1927 resetval = mDateNavigator->sizeHint().width()+2; 1929 resetval = mDateNavigator->sizeHint().width()+2;
1928 } else { 1930 } else {
1929 resetval = mDateNavigator->sizeHint().height()+2; 1931 resetval = mDateNavigator->sizeHint().height()+2;
1930 } 1932 }
1931 } 1933 }
1932 if ( resetval ) { 1934 if ( resetval ) {
1933 sizes.clear(); 1935 sizes.clear();
1934 if ( !KOPrefs::instance()->mVerticalScreen ) { 1936 if ( !KOPrefs::instance()->mVerticalScreen ) {
1935 maxVal = QApplication::desktop()->width() -10; 1937 maxVal = QApplication::desktop()->width() -10;
1936 } else { 1938 } else {
1937 maxVal = QApplication::desktop()->height()-10; 1939 maxVal = QApplication::desktop()->height()-10;
1938 } 1940 }
1939 sizes << resetval; 1941 sizes << resetval;
1940 if ( maxVal < resetval + resetval) 1942 if ( maxVal < resetval + resetval)
1941 resetval = maxVal - resetval; 1943 resetval = maxVal - resetval;
1942 sizes << resetval; 1944 sizes << resetval;
1943 } 1945 }
1944 mMainFrame->setSizes(sizes); 1946 mMainFrame->setSizes(sizes);
1945 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1947 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1946 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1948 else if ( dateCount == 7 ) mNavigator->selectWeek();
1947 else mNavigator->selectDates( dateCount ); 1949 else mNavigator->selectDates( dateCount );
1948 // mViewManager->readSettings( config ); 1950 // mViewManager->readSettings( config );
1949 updateConfig(); 1951 updateConfig();
1950 globalFlagBlockAgenda = 2; 1952 globalFlagBlockAgenda = 2;
1951 mViewManager->readSettings( config ); 1953 mViewManager->readSettings( config );
1952 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 1954 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
1953} 1955}
1954 1956
1955 1957
1956void CalendarView::writeSettings() 1958void CalendarView::writeSettings()
1957{ 1959{
1958 // kdDebug() << "CalendarView::writeSettings" << endl; 1960 // kdDebug() << "CalendarView::writeSettings" << endl;
1959 1961
1960 KConfig *config = KOGlobals::config(); 1962 KConfig *config = KOGlobals::config();
1961 1963
1962 mViewManager->writeSettings( config ); 1964 mViewManager->writeSettings( config );
1963 mTodoList->saveLayout(config,QString("Todo Layout")); 1965 mTodoList->saveLayout(config,QString("Todo Layout"));
1964 mDialogManager->writeSettings( config ); 1966 mDialogManager->writeSettings( config );
1965 //KOPrefs::instance()->usrWriteConfig(); 1967 //KOPrefs::instance()->usrWriteConfig();
1966 KOPrefs::instance()->writeConfig(); 1968 KOPrefs::instance()->writeConfig();
1967 1969
1968 writeFilterSettings(config); 1970 writeFilterSettings(config);
1969 1971
1970 config->setGroup( "Views" ); 1972 config->setGroup( "Views" );
1971 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1973 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1972 1974
1973 QValueList<int> listINT = mLeftFrame->sizes(); 1975 QValueList<int> listINT = mLeftFrame->sizes();
1974 config->writeEntry("Left Splitter Frame",listINT); 1976 config->writeEntry("Left Splitter Frame",listINT);
1975 QValueList<int> listINT2 = mMainFrame->sizes(); 1977 QValueList<int> listINT2 = mMainFrame->sizes();
1976 config->writeEntry("Main Splitter Frame",listINT2); 1978 config->writeEntry("Main Splitter Frame",listINT2);
1977#ifdef DESKTOP_VERSION 1979#ifdef DESKTOP_VERSION
1978 config->setGroup("WidgetLayout"); 1980 config->setGroup("WidgetLayout");
1979 QStringList list ;//= config->readListEntry("MainLayout"); 1981 QStringList list ;//= config->readListEntry("MainLayout");
1980 int x,y,w,h; 1982 int x,y,w,h;
1981 QWidget* wid; 1983 QWidget* wid;
1982 wid = topLevelWidget(); 1984 wid = topLevelWidget();
1983 x = wid->geometry().x(); 1985 x = wid->geometry().x();
1984 y = wid->geometry().y(); 1986 y = wid->geometry().y();
1985 w = wid->width(); 1987 w = wid->width();
1986 h = wid->height(); 1988 h = wid->height();
1987 list.clear(); 1989 list.clear();
1988 list << QString::number( x ); 1990 list << QString::number( x );
1989 list << QString::number( y ); 1991 list << QString::number( y );
1990 list << QString::number( w ); 1992 list << QString::number( w );
1991 list << QString::number( h ); 1993 list << QString::number( h );
1992 config->writeEntry("MainLayout",list ); 1994 config->writeEntry("MainLayout",list );
1993 1995
1994 wid = mEventEditor; 1996 wid = mEventEditor;
1995 x = wid->geometry().x(); 1997 x = wid->geometry().x();
1996 y = wid->geometry().y(); 1998 y = wid->geometry().y();
1997 w = wid->width(); 1999 w = wid->width();
1998 h = wid->height(); 2000 h = wid->height();
1999 list.clear(); 2001 list.clear();
2000 list << QString::number( x ); 2002 list << QString::number( x );
2001 list << QString::number( y ); 2003 list << QString::number( y );
2002 list << QString::number( w ); 2004 list << QString::number( w );
2003 list << QString::number( h ); 2005 list << QString::number( h );
2004 config->writeEntry("EditEventLayout",list ); 2006 config->writeEntry("EditEventLayout",list );
2005 2007
2006 wid = mTodoEditor; 2008 wid = mTodoEditor;
2007 x = wid->geometry().x(); 2009 x = wid->geometry().x();
2008 y = wid->geometry().y(); 2010 y = wid->geometry().y();
2009 w = wid->width(); 2011 w = wid->width();
2010 h = wid->height(); 2012 h = wid->height();
2011 list.clear(); 2013 list.clear();
2012 list << QString::number( x ); 2014 list << QString::number( x );
2013 list << QString::number( y ); 2015 list << QString::number( y );
2014 list << QString::number( w ); 2016 list << QString::number( w );
2015 list << QString::number( h ); 2017 list << QString::number( h );
2016 config->writeEntry("EditTodoLayout",list ); 2018 config->writeEntry("EditTodoLayout",list );
2017 wid = getEventViewerDialog(); 2019 wid = getEventViewerDialog();
2018 x = wid->geometry().x(); 2020 x = wid->geometry().x();
2019 y = wid->geometry().y(); 2021 y = wid->geometry().y();
2020 w = wid->width(); 2022 w = wid->width();
2021 h = wid->height(); 2023 h = wid->height();
2022 list.clear(); 2024 list.clear();
2023 list << QString::number( x ); 2025 list << QString::number( x );
2024 list << QString::number( y ); 2026 list << QString::number( y );
2025 list << QString::number( w ); 2027 list << QString::number( w );
2026 list << QString::number( h ); 2028 list << QString::number( h );
2027 config->writeEntry("ViewerLayout",list ); 2029 config->writeEntry("ViewerLayout",list );
2028 wid = mDialogManager->getSearchDialog(); 2030 wid = mDialogManager->getSearchDialog();
2029 if ( wid ) { 2031 if ( wid ) {
2030 x = wid->geometry().x(); 2032 x = wid->geometry().x();
2031 y = wid->geometry().y(); 2033 y = wid->geometry().y();
2032 w = wid->width(); 2034 w = wid->width();
2033 h = wid->height(); 2035 h = wid->height();
2034 list.clear(); 2036 list.clear();
2035 list << QString::number( x ); 2037 list << QString::number( x );
2036 list << QString::number( y ); 2038 list << QString::number( y );
2037 list << QString::number( w ); 2039 list << QString::number( w );
2038 list << QString::number( h ); 2040 list << QString::number( h );
2039 config->writeEntry("SearchLayout",list ); 2041 config->writeEntry("SearchLayout",list );
2040 } 2042 }
2041#endif 2043#endif
2042 2044
2043 2045
2044 config->sync(); 2046 config->sync();
2045} 2047}
2046 2048
2047void CalendarView::readFilterSettings(KConfig *config) 2049void CalendarView::readFilterSettings(KConfig *config)
2048{ 2050{
2049 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2051 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2050 2052
2051 mFilters.clear(); 2053 mFilters.clear();
2052 2054
2053 config->setGroup("General"); 2055 config->setGroup("General");
2054 QStringList filterList = config->readListEntry("CalendarFilters"); 2056 QStringList filterList = config->readListEntry("CalendarFilters");
2055 2057
2056 QStringList::ConstIterator it = filterList.begin(); 2058 QStringList::ConstIterator it = filterList.begin();
2057 QStringList::ConstIterator end = filterList.end(); 2059 QStringList::ConstIterator end = filterList.end();
2058 while(it != end) { 2060 while(it != end) {
2059 // kdDebug() << " filter: " << (*it) << endl; 2061 // kdDebug() << " filter: " << (*it) << endl;
2060 2062
2061 CalFilter *filter; 2063 CalFilter *filter;
2062 filter = new CalFilter(*it); 2064 filter = new CalFilter(*it);
2063 config->setGroup("Filter_" + (*it).utf8()); 2065 config->setGroup("Filter_" + (*it).utf8());
2064 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2066 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2065 filter->setCriteria(config->readNumEntry("Criteria",0)); 2067 filter->setCriteria(config->readNumEntry("Criteria",0));
2066 filter->setCategoryList(config->readListEntry("CategoryList")); 2068 filter->setCategoryList(config->readListEntry("CategoryList"));
2067 mFilters.append(filter); 2069 mFilters.append(filter);
2068 2070
2069 ++it; 2071 ++it;
2070 } 2072 }
2071 2073
2072 if (mFilters.count() == 0) { 2074 if (mFilters.count() == 0) {
2073 CalFilter *filter = new CalFilter(i18n("Default")); 2075 CalFilter *filter = new CalFilter(i18n("Default"));
2074 mFilters.append(filter); 2076 mFilters.append(filter);
2075 } 2077 }
2076 mFilterView->updateFilters(); 2078 mFilterView->updateFilters();
2077 config->setGroup("FilterView"); 2079 config->setGroup("FilterView");
2078 2080
2079 mFilterView->blockSignals(true); 2081 mFilterView->blockSignals(true);
2080 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2082 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2081 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2083 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2082 mFilterView->blockSignals(false); 2084 mFilterView->blockSignals(false);
2083 // We do it manually to avoid it being done twice by the above calls 2085 // We do it manually to avoid it being done twice by the above calls
2084 updateFilter(); 2086 updateFilter();
2085} 2087}
2086 2088
2087void CalendarView::writeFilterSettings(KConfig *config) 2089void CalendarView::writeFilterSettings(KConfig *config)
2088{ 2090{
2089 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2091 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2090 2092
2091 QStringList filterList; 2093 QStringList filterList;
2092 2094
2093 CalFilter *filter = mFilters.first(); 2095 CalFilter *filter = mFilters.first();
2094 while(filter) { 2096 while(filter) {
2095 // kdDebug() << " fn: " << filter->name() << endl; 2097 // kdDebug() << " fn: " << filter->name() << endl;
2096 filterList << filter->name(); 2098 filterList << filter->name();
2097 config->setGroup("Filter_" + filter->name().utf8()); 2099 config->setGroup("Filter_" + filter->name().utf8());
2098 config->writeEntry("Criteria",filter->criteria()); 2100 config->writeEntry("Criteria",filter->criteria());
2099 config->writeEntry("CategoryList",filter->categoryList()); 2101 config->writeEntry("CategoryList",filter->categoryList());
2100 filter = mFilters.next(); 2102 filter = mFilters.next();
2101 } 2103 }
2102 config->setGroup("General"); 2104 config->setGroup("General");
2103 config->writeEntry("CalendarFilters",filterList); 2105 config->writeEntry("CalendarFilters",filterList);
2104 2106
2105 config->setGroup("FilterView"); 2107 config->setGroup("FilterView");
2106 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2108 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2107 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2109 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2108} 2110}
2109 2111
2110 2112
2111void CalendarView::goToday() 2113void CalendarView::goToday()
2112{ 2114{
2113 if ( mViewManager->currentView()->isMonthView() ) 2115 if ( mViewManager->currentView()->isMonthView() )
2114 mNavigator->selectTodayMonth(); 2116 mNavigator->selectTodayMonth();
2115 else 2117 else
2116 mNavigator->selectToday(); 2118 mNavigator->selectToday();
2117} 2119}
2118 2120
2119void CalendarView::goNext() 2121void CalendarView::goNext()
2120{ 2122{
2121 mNavigator->selectNext(); 2123 mNavigator->selectNext();
2122} 2124}
2123 2125
2124void CalendarView::goPrevious() 2126void CalendarView::goPrevious()
2125{ 2127{
2126 mNavigator->selectPrevious(); 2128 mNavigator->selectPrevious();
2127} 2129}
2128void CalendarView::goNextMonth() 2130void CalendarView::goNextMonth()
2129{ 2131{
2130 mNavigator->selectNextMonth(); 2132 mNavigator->selectNextMonth();
2131} 2133}
2132 2134
2133void CalendarView::goPreviousMonth() 2135void CalendarView::goPreviousMonth()
2134{ 2136{
2135 mNavigator->selectPreviousMonth(); 2137 mNavigator->selectPreviousMonth();
2136} 2138}
2137void CalendarView::writeLocale() 2139void CalendarView::writeLocale()
2138{ 2140{
2139 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2141 //KPimGlobalPrefs::instance()->setGlobalConfig();
2140#if 0 2142#if 0
2141 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2143 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2142 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2144 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2143 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2145 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2144 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2146 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2145 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2147 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2146 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2148 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2147 dummy = KOPrefs::instance()->mUserDateFormatShort; 2149 dummy = KOPrefs::instance()->mUserDateFormatShort;
2148 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2150 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2149 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2151 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2150 KOPrefs::instance()->mDaylightsavingStart, 2152 KOPrefs::instance()->mDaylightsavingStart,
2151 KOPrefs::instance()->mDaylightsavingEnd ); 2153 KOPrefs::instance()->mDaylightsavingEnd );
2152 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2154 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2153#endif 2155#endif
2154} 2156}
2155void CalendarView::updateConfig() 2157void CalendarView::updateConfig()
2156{ 2158{
2157 writeLocale(); 2159 writeLocale();
2158 if ( KOPrefs::instance()->mUseAppColors ) 2160 if ( KOPrefs::instance()->mUseAppColors )
2159 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2161 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2160 emit configChanged(); 2162 emit configChanged();
2161 mTodoList->updateConfig(); 2163 mTodoList->updateConfig();
2162 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2164 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2163 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2165 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2164 // To make the "fill window" configurations work 2166 // To make the "fill window" configurations work
2165 //mViewManager->raiseCurrentView(); 2167 //mViewManager->raiseCurrentView();
2166} 2168}
2167 2169
2168 2170
2169void CalendarView::eventChanged(Event *event) 2171void CalendarView::eventChanged(Event *event)
2170{ 2172{
2171 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2173 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2172 //updateUnmanagedViews(); 2174 //updateUnmanagedViews();
2173} 2175}
2174 2176
2175void CalendarView::eventAdded(Event *event) 2177void CalendarView::eventAdded(Event *event)
2176{ 2178{
2177 changeEventDisplay(event,KOGlobals::EVENTADDED); 2179 changeEventDisplay(event,KOGlobals::EVENTADDED);
2178} 2180}
2179 2181
2180void CalendarView::eventToBeDeleted(Event *) 2182void CalendarView::eventToBeDeleted(Event *)
2181{ 2183{
2182 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2184 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2183} 2185}
2184 2186
2185void CalendarView::eventDeleted() 2187void CalendarView::eventDeleted()
2186{ 2188{
2187 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2189 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2188} 2190}
2189void CalendarView::changeTodoDisplay(Todo *which, int action) 2191void CalendarView::changeTodoDisplay(Todo *which, int action)
2190{ 2192{
2191 changeIncidenceDisplay((Incidence *)which, action); 2193 changeIncidenceDisplay((Incidence *)which, action);
2192 mDateNavigator->updateView(); //LR 2194 mDateNavigator->updateView(); //LR
2193 //mDialogManager->updateSearchDialog(); 2195 //mDialogManager->updateSearchDialog();
2194 2196
2195 if (which) { 2197 if (which) {
2196 mViewManager->updateWNview(); 2198 mViewManager->updateWNview();
2197 //mTodoList->updateView(); 2199 //mTodoList->updateView();
2198 } 2200 }
2199 2201
2200} 2202}
2201 2203
2202void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2204void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2203{ 2205{
2204 updateUnmanagedViews(); 2206 updateUnmanagedViews();
2205 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2207 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2206 if ( action == KOGlobals::EVENTDELETED ) { //delete 2208 if ( action == KOGlobals::EVENTDELETED ) { //delete
2207 mCalendar->checkAlarmForIncidence( 0, true ); 2209 mCalendar->checkAlarmForIncidence( 0, true );
2208 if ( mEventViewerDialog ) 2210 if ( mEventViewerDialog )
2209 mEventViewerDialog->hide(); 2211 mEventViewerDialog->hide();
2210 } 2212 }
2211 else 2213 else
2212 mCalendar->checkAlarmForIncidence( which , false ); 2214 mCalendar->checkAlarmForIncidence( which , false );
2213} 2215}
2214 2216
2215// most of the changeEventDisplays() right now just call the view's 2217// most of the changeEventDisplays() right now just call the view's
2216// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2218// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2217void CalendarView::changeEventDisplay(Event *which, int action) 2219void CalendarView::changeEventDisplay(Event *which, int action)
2218{ 2220{
2219 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2221 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2220 changeIncidenceDisplay((Incidence *)which, action); 2222 changeIncidenceDisplay((Incidence *)which, action);
2221 mDateNavigator->updateView(); 2223 mDateNavigator->updateView();
2222 //mDialogManager->updateSearchDialog(); 2224 //mDialogManager->updateSearchDialog();
2223 2225
2224 if (which) { 2226 if (which) {
2225 // If there is an event view visible update the display 2227 // If there is an event view visible update the display
2226 mViewManager->currentView()->changeEventDisplay(which,action); 2228 mViewManager->currentView()->changeEventDisplay(which,action);
2227 // TODO: check, if update needed 2229 // TODO: check, if update needed
2228 // if (which->getTodoStatus()) { 2230 // if (which->getTodoStatus()) {
2229 mTodoList->updateView(); 2231 mTodoList->updateView();
2230 // } 2232 // }
2231 } else { 2233 } else {
2232 mViewManager->currentView()->updateView(); 2234 mViewManager->currentView()->updateView();
2233 } 2235 }
2234} 2236}
2235 2237
2236 2238
2237void CalendarView::updateTodoViews() 2239void CalendarView::updateTodoViews()
2238{ 2240{
2239 mTodoList->updateView(); 2241 mTodoList->updateView();
2240 mViewManager->currentView()->updateView(); 2242 mViewManager->currentView()->updateView();
2241 2243
2242} 2244}
2243 2245
2244 2246
2245void CalendarView::updateView(const QDate &start, const QDate &end) 2247void CalendarView::updateView(const QDate &start, const QDate &end)
2246{ 2248{
2247 mTodoList->updateView(); 2249 mTodoList->updateView();
2248 mViewManager->updateView(start, end); 2250 mViewManager->updateView(start, end);
2249 //mDateNavigator->updateView(); 2251 //mDateNavigator->updateView();
2250} 2252}
2251 2253
2252void CalendarView::updateView() 2254void CalendarView::updateView()
2253{ 2255{
2254 DateList tmpList = mNavigator->selectedDates(); 2256 DateList tmpList = mNavigator->selectedDates();
2255 2257
2256 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2258 if ( KOPrefs::instance()->mHideNonStartedTodos )
2257 mTodoList->updateView(); 2259 mTodoList->updateView();
2258 // We assume that the navigator only selects consecutive days. 2260 // We assume that the navigator only selects consecutive days.
2259 updateView( tmpList.first(), tmpList.last() ); 2261 updateView( tmpList.first(), tmpList.last() );
2260} 2262}
2261 2263
2262void CalendarView::updateUnmanagedViews() 2264void CalendarView::updateUnmanagedViews()
2263{ 2265{
2264 mDateNavigator->updateDayMatrix(); 2266 mDateNavigator->updateDayMatrix();
2265} 2267}
2266 2268
2267int CalendarView::msgItemDelete(const QString name) 2269int CalendarView::msgItemDelete(const QString name)
2268{ 2270{
2269 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2271 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2270 i18n("This item will be\npermanently deleted."), 2272 i18n("This item will be\npermanently deleted."),
2271 i18n("KO/Pi Confirmation"),i18n("Delete")); 2273 i18n("KO/Pi Confirmation"),i18n("Delete"));
2272} 2274}
2273 2275
2274 2276
2275void CalendarView::edit_cut() 2277void CalendarView::edit_cut()
2276{ 2278{
2277 Event *anEvent=0; 2279 Event *anEvent=0;
2278 2280
2279 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2281 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2280 2282
2281 if (mViewManager->currentView()->isEventView()) { 2283 if (mViewManager->currentView()->isEventView()) {
2282 if ( incidence && incidence->type() == "Event" ) { 2284 if ( incidence && incidence->type() == "Event" ) {
2283 anEvent = static_cast<Event *>(incidence); 2285 anEvent = static_cast<Event *>(incidence);
2284 } 2286 }
2285 } 2287 }
2286 2288
2287 if (!anEvent) { 2289 if (!anEvent) {
2288 KNotifyClient::beep(); 2290 KNotifyClient::beep();
2289 return; 2291 return;
2290 } 2292 }
2291 DndFactory factory( mCalendar ); 2293 DndFactory factory( mCalendar );
2292 factory.cutIncidence(anEvent); 2294 factory.cutIncidence(anEvent);
2293 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2295 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2294} 2296}
2295 2297
2296void CalendarView::edit_copy() 2298void CalendarView::edit_copy()
2297{ 2299{
2298 Event *anEvent=0; 2300 Event *anEvent=0;
2299 2301
2300 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2302 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2301 2303
2302 if (mViewManager->currentView()->isEventView()) { 2304 if (mViewManager->currentView()->isEventView()) {
2303 if ( incidence && incidence->type() == "Event" ) { 2305 if ( incidence && incidence->type() == "Event" ) {
2304 anEvent = static_cast<Event *>(incidence); 2306 anEvent = static_cast<Event *>(incidence);
2305 } 2307 }
2306 } 2308 }
2307 2309
2308 if (!anEvent) { 2310 if (!anEvent) {
2309 KNotifyClient::beep(); 2311 KNotifyClient::beep();
2310 return; 2312 return;
2311 } 2313 }
2312 DndFactory factory( mCalendar ); 2314 DndFactory factory( mCalendar );
2313 factory.copyIncidence(anEvent); 2315 factory.copyIncidence(anEvent);
2314} 2316}
2315 2317
2316void CalendarView::edit_paste() 2318void CalendarView::edit_paste()
2317{ 2319{
2318 QDate date = mNavigator->selectedDates().first(); 2320 QDate date = mNavigator->selectedDates().first();
2319 2321
2320 DndFactory factory( mCalendar ); 2322 DndFactory factory( mCalendar );
2321 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2323 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2322 2324
2323 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2325 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2324} 2326}
2325 2327
2326void CalendarView::edit_options() 2328void CalendarView::edit_options()
2327{ 2329{
2328 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2330 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2329 emit save(); 2331 emit save();
2330 emit saveStopTimer(); 2332 emit saveStopTimer();
2331 mDialogManager->showOptionsDialog(); 2333 mDialogManager->showOptionsDialog();
2332 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2334 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2333 emit saveStopTimer(); 2335 emit saveStopTimer();
2334 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2336 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2335 i18n("Timezone settings"),i18n("Reload"))) { 2337 i18n("Timezone settings"),i18n("Reload"))) {
2336 qDebug("KO: TZ reload cancelled "); 2338 qDebug("KO: TZ reload cancelled ");
2337 return; 2339 return;
2338 } 2340 }
2339 qDebug("KO: Timezone change "); 2341 qDebug("KO: Timezone change ");
2340 openCalendar( MainWindow::defaultFileName() ); 2342 openCalendar( MainWindow::defaultFileName() );
2341 setModified(true); 2343 setModified(true);
2342 } 2344 }
2343 else 2345 else
2344 qDebug("KO: No tz change "); 2346 qDebug("KO: No tz change ");
2345 2347
2346} 2348}
2347 2349
2348 2350
2349void CalendarView::slotSelectPickerDate( QDate d) 2351void CalendarView::slotSelectPickerDate( QDate d)
2350{ 2352{
2351 mDateFrame->hide(); 2353 mDateFrame->hide();
2352 if ( mDatePickerMode == 1 ) { 2354 if ( mDatePickerMode == 1 ) {
2353 mNavigator->slotDaySelect( d ); 2355 mNavigator->slotDaySelect( d );
2354 } else if ( mDatePickerMode == 2 ) { 2356 } else if ( mDatePickerMode == 2 ) {
2355 if ( mMoveIncidence->type() == "Todo" ) { 2357 if ( mMoveIncidence->type() == "Todo" ) {
2356 Todo * to = (Todo *) mMoveIncidence; 2358 Todo * to = (Todo *) mMoveIncidence;
2357 QTime tim; 2359 QTime tim;
2358 int len = 0; 2360 int len = 0;
2359 if ( to->hasStartDate() && to->hasDueDate() ) 2361 if ( to->hasStartDate() && to->hasDueDate() )
2360 len = to->dtStart().secsTo( to->dtDue()); 2362 len = to->dtStart().secsTo( to->dtDue());
2361 if ( to->hasDueDate() ) 2363 if ( to->hasDueDate() )
2362 tim = to->dtDue().time(); 2364 tim = to->dtDue().time();
2363 else { 2365 else {
2364 tim = QTime ( 0,0,0 ); 2366 tim = QTime ( 0,0,0 );
2365 to->setFloats( true ); 2367 to->setFloats( true );
2366 to->setHasDueDate( true ); 2368 to->setHasDueDate( true );
2367 } 2369 }
2368 QDateTime dt ( d,tim ); 2370 QDateTime dt ( d,tim );
2369 to->setDtDue( dt ); 2371 to->setDtDue( dt );
2370 2372
2371 if ( to->hasStartDate() ) { 2373 if ( to->hasStartDate() ) {
2372 if ( len>0 ) 2374 if ( len>0 )
2373 to->setDtStart(to->dtDue().addSecs( -len )); 2375 to->setDtStart(to->dtDue().addSecs( -len ));
2374 else 2376 else
2375 if (to->dtStart() > to->dtDue() ) 2377 if (to->dtStart() > to->dtDue() )
2376 to->setDtStart(to->dtDue().addDays( -3 )); 2378 to->setDtStart(to->dtDue().addDays( -3 ));
2377 } 2379 }
2378 2380
2379 todoChanged( to ); 2381 todoChanged( to );
2380 } else { 2382 } else {
2381 if ( mMoveIncidence->doesRecur() ) { 2383 if ( mMoveIncidence->doesRecur() ) {
2382#if 0 2384#if 0
2383 // PENDING implement this 2385 // PENDING implement this
2384 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2386 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2385 mCalendar()->addIncidence( newInc ); 2387 mCalendar()->addIncidence( newInc );
2386 if ( mMoveIncidence->type() == "Todo" ) 2388 if ( mMoveIncidence->type() == "Todo" )
2387 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2389 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2388 else 2390 else
2389 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2391 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2390 mMoveIncidence = newInc; 2392 mMoveIncidence = newInc;
2391 2393
2392#endif 2394#endif
2393 } 2395 }
2394 QTime tim = mMoveIncidence->dtStart().time(); 2396 QTime tim = mMoveIncidence->dtStart().time();
2395 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2397 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2396 QDateTime dt ( d,tim ); 2398 QDateTime dt ( d,tim );
2397 mMoveIncidence->setDtStart( dt ); 2399 mMoveIncidence->setDtStart( dt );
2398 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2400 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2399 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2401 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2400 } 2402 }
2401 2403
2402 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2404 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2403 } 2405 }
2404} 2406}
2405 2407
2406void CalendarView::removeCategories() 2408void CalendarView::removeCategories()
2407{ 2409{
2408 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2410 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2409 QStringList catList = KOPrefs::instance()->mCustomCategories; 2411 QStringList catList = KOPrefs::instance()->mCustomCategories;
2410 QStringList catIncList; 2412 QStringList catIncList;
2411 QStringList newCatList; 2413 QStringList newCatList;
2412 Incidence* inc = incList.first(); 2414 Incidence* inc = incList.first();
2413 int i; 2415 int i;
2414 int count = 0; 2416 int count = 0;
2415 while ( inc ) { 2417 while ( inc ) {
2416 newCatList.clear(); 2418 newCatList.clear();
2417 catIncList = inc->categories() ; 2419 catIncList = inc->categories() ;
2418 for( i = 0; i< catIncList.count(); ++i ) { 2420 for( i = 0; i< catIncList.count(); ++i ) {
2419 if ( catList.contains (catIncList[i])) 2421 if ( catList.contains (catIncList[i]))
2420 newCatList.append( catIncList[i] ); 2422 newCatList.append( catIncList[i] );
2421 } 2423 }
2422 newCatList.sort(); 2424 newCatList.sort();
2423 inc->setCategories( newCatList.join(",") ); 2425 inc->setCategories( newCatList.join(",") );
2424 inc = incList.next(); 2426 inc = incList.next();
2425 } 2427 }
2426} 2428}
2427 2429
2428int CalendarView::addCategories() 2430int CalendarView::addCategories()
2429{ 2431{
2430 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2432 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2431 QStringList catList = KOPrefs::instance()->mCustomCategories; 2433 QStringList catList = KOPrefs::instance()->mCustomCategories;
2432 QStringList catIncList; 2434 QStringList catIncList;
2433 Incidence* inc = incList.first(); 2435 Incidence* inc = incList.first();
2434 int i; 2436 int i;
2435 int count = 0; 2437 int count = 0;
2436 while ( inc ) { 2438 while ( inc ) {
2437 catIncList = inc->categories() ; 2439 catIncList = inc->categories() ;
2438 for( i = 0; i< catIncList.count(); ++i ) { 2440 for( i = 0; i< catIncList.count(); ++i ) {
2439 if ( !catList.contains (catIncList[i])) { 2441 if ( !catList.contains (catIncList[i])) {
2440 catList.append( catIncList[i] ); 2442 catList.append( catIncList[i] );
2441 //qDebug("add cat %s ", catIncList[i].latin1()); 2443 //qDebug("add cat %s ", catIncList[i].latin1());
2442 ++count; 2444 ++count;
2443 } 2445 }
2444 } 2446 }
2445 inc = incList.next(); 2447 inc = incList.next();
2446 } 2448 }
2447 catList.sort(); 2449 catList.sort();
2448 KOPrefs::instance()->mCustomCategories = catList; 2450 KOPrefs::instance()->mCustomCategories = catList;
2449 return count; 2451 return count;
2450} 2452}
2451 2453
2452void CalendarView::manageCategories() 2454void CalendarView::manageCategories()
2453{ 2455{
2454 KOCatPrefs* cp = new KOCatPrefs(); 2456 KOCatPrefs* cp = new KOCatPrefs();
2455 cp->show(); 2457 cp->show();
2456 int w =cp->sizeHint().width() ; 2458 int w =cp->sizeHint().width() ;
2457 int h = cp->sizeHint().height() ; 2459 int h = cp->sizeHint().height() ;
2458 int dw = QApplication::desktop()->width(); 2460 int dw = QApplication::desktop()->width();
2459 int dh = QApplication::desktop()->height(); 2461 int dh = QApplication::desktop()->height();
2460 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2462 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2461 if ( !cp->exec() ) { 2463 if ( !cp->exec() ) {
2462 delete cp; 2464 delete cp;
2463 return; 2465 return;
2464 } 2466 }
2465 int count = 0; 2467 int count = 0;
2466 if ( cp->addCat() ) { 2468 if ( cp->addCat() ) {
2467 count = addCategories(); 2469 count = addCategories();
2468 if ( count ) { 2470 if ( count ) {
2469 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2471 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2470 writeSettings(); 2472 writeSettings();
2471 } else 2473 } else
2472 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2474 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2473 } else { 2475 } else {
2474 removeCategories(); 2476 removeCategories();
2475 updateView(); 2477 updateView();
2476 } 2478 }
2477 delete cp; 2479 delete cp;
2478} 2480}
2479 2481
2480void CalendarView::beamIncidence(Incidence * Inc) 2482void CalendarView::beamIncidence(Incidence * Inc)
2481{ 2483{
2482 QPtrList<Incidence> delSel ; 2484 QPtrList<Incidence> delSel ;
2483 delSel.append(Inc); 2485 delSel.append(Inc);
2484 beamIncidenceList( delSel ); 2486 beamIncidenceList( delSel );
2485} 2487}
2486void CalendarView::beamCalendar() 2488void CalendarView::beamCalendar()
2487{ 2489{
2488 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2490 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2489 //qDebug("beamCalendar() "); 2491 //qDebug("beamCalendar() ");
2490 beamIncidenceList( delSel ); 2492 beamIncidenceList( delSel );
2491} 2493}
2492void CalendarView::beamFilteredCalendar() 2494void CalendarView::beamFilteredCalendar()
2493{ 2495{
2494 QPtrList<Incidence> delSel = mCalendar->incidences(); 2496 QPtrList<Incidence> delSel = mCalendar->incidences();
2495 //qDebug("beamFilteredCalendar() "); 2497 //qDebug("beamFilteredCalendar() ");
2496 beamIncidenceList( delSel ); 2498 beamIncidenceList( delSel );
2497} 2499}
2498void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2500void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2499{ 2501{
2500 if ( beamDialog->exec () == QDialog::Rejected ) 2502 if ( beamDialog->exec () == QDialog::Rejected )
2501 return; 2503 return;
2502#ifdef DESKTOP_VERSION 2504#ifdef DESKTOP_VERSION
2503 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2505 QString fn = locateLocal( "tmp", "kopibeamfile" );
2504#else 2506#else
2505 QString fn = "/tmp/kopibeamfile"; 2507 QString fn = "/tmp/kopibeamfile";
2506#endif 2508#endif
2507 QString mes; 2509 QString mes;
2508 bool createbup = true; 2510 bool createbup = true;
2509 if ( createbup ) { 2511 if ( createbup ) {
2510 QString description = "\n"; 2512 QString description = "\n";
2511 CalendarLocal* cal = new CalendarLocal(); 2513 CalendarLocal* cal = new CalendarLocal();
2512 if ( beamDialog->beamLocal() ) 2514 if ( beamDialog->beamLocal() )
2513 cal->setLocalTime(); 2515 cal->setLocalTime();
2514 else 2516 else
2515 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2517 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2516 Incidence *incidence = delSel.first(); 2518 Incidence *incidence = delSel.first();
2517 bool addText = false; 2519 bool addText = false;
2518 if ( delSel.count() < 10 ) 2520 if ( delSel.count() < 10 )
2519 addText = true; 2521 addText = true;
2520 else { 2522 else {
2521 description.sprintf(i18n(" %d items?"),delSel.count() ); 2523 description.sprintf(i18n(" %d items?"),delSel.count() );
2522 } 2524 }
2523 while ( incidence ) { 2525 while ( incidence ) {
2524 Incidence *in = incidence->clone(); 2526 Incidence *in = incidence->clone();
2525 if ( ! in->summary().isEmpty() ) { 2527 if ( ! in->summary().isEmpty() ) {
2526 in->setDescription(""); 2528 in->setDescription("");
2527 } else { 2529 } else {
2528 in->setSummary( in->description().left(20)); 2530 in->setSummary( in->description().left(20));
2529 in->setDescription(""); 2531 in->setDescription("");
2530 } 2532 }
2531 if ( addText ) 2533 if ( addText )
2532 description += in->summary() + "\n"; 2534 description += in->summary() + "\n";
2533 cal->addIncidence( in ); 2535 cal->addIncidence( in );
2534 incidence = delSel.next(); 2536 incidence = delSel.next();
2535 } 2537 }
2536 if ( beamDialog->beamVcal() ) { 2538 if ( beamDialog->beamVcal() ) {
2537 fn += ".vcs"; 2539 fn += ".vcs";
2538 FileStorage storage( cal, fn, new VCalFormat ); 2540 FileStorage storage( cal, fn, new VCalFormat );
2539 storage.save(); 2541 storage.save();
2540 } else { 2542 } else {
2541 fn += ".ics"; 2543 fn += ".ics";
2542 FileStorage storage( cal, fn, new ICalFormat( ) ); 2544 FileStorage storage( cal, fn, new ICalFormat( ) );
2543 storage.save(); 2545 storage.save();
2544 } 2546 }
2545 delete cal; 2547 delete cal;
2546 mes = i18n("KO/Pi: Ready for beaming"); 2548 mes = i18n("KO/Pi: Ready for beaming");
2547 topLevelWidget()->setCaption(mes); 2549 topLevelWidget()->setCaption(mes);
2548 KApplication::convert2latin1( fn ); 2550 KApplication::convert2latin1( fn );
2549#ifndef DESKTOP_VERSION 2551#ifndef DESKTOP_VERSION
2550 Ir *ir = new Ir( this ); 2552 Ir *ir = new Ir( this );
2551 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2553 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2552 ir->send( fn, description, "text/x-vCalendar" ); 2554 ir->send( fn, description, "text/x-vCalendar" );
2553#endif 2555#endif
2554 } 2556 }
2555} 2557}
2556void CalendarView::beamDone( Ir *ir ) 2558void CalendarView::beamDone( Ir *ir )
2557{ 2559{
2558#ifndef DESKTOP_VERSION 2560#ifndef DESKTOP_VERSION
2559 delete ir; 2561 delete ir;
2560#endif 2562#endif
2561 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2563 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2562 topLevelWidget()->raise(); 2564 topLevelWidget()->raise();
2563} 2565}
2564 2566
2565void CalendarView::moveIncidence(Incidence * inc ) 2567void CalendarView::moveIncidence(Incidence * inc )
2566{ 2568{
2567 if ( !inc ) return; 2569 if ( !inc ) return;
2568 showDatePickerPopup(); 2570 showDatePickerPopup();
2569 mDatePickerMode = 2; 2571 mDatePickerMode = 2;
2570 mMoveIncidence = inc ; 2572 mMoveIncidence = inc ;
2571 QDate da; 2573 QDate da;
2572 if ( mMoveIncidence->type() == "Todo" ) { 2574 if ( mMoveIncidence->type() == "Todo" ) {
2573 Todo * to = (Todo *) mMoveIncidence; 2575 Todo * to = (Todo *) mMoveIncidence;
2574 if ( to->hasDueDate() ) 2576 if ( to->hasDueDate() )
2575 da = to->dtDue().date(); 2577 da = to->dtDue().date();
2576 else 2578 else
2577 da = QDate::currentDate(); 2579 da = QDate::currentDate();
2578 } else { 2580 } else {
2579 da = mMoveIncidence->dtStart().date(); 2581 da = mMoveIncidence->dtStart().date();
2580 } 2582 }
2581 //PENDING set date for recurring incidence to date of recurrence 2583 //PENDING set date for recurring incidence to date of recurrence
2582 //mMoveIncidenceOldDate; 2584 //mMoveIncidenceOldDate;
2583 mDatePicker->setDate( da ); 2585 mDatePicker->setDate( da );
2584} 2586}
2585void CalendarView::showDatePickerPopup() 2587void CalendarView::showDatePickerPopup()
2586{ 2588{
2587 if ( mDateFrame->isVisible() ) 2589 if ( mDateFrame->isVisible() )
2588 mDateFrame->hide(); 2590 mDateFrame->hide();
2589 else { 2591 else {
2590 int offX = 0, offY = 0; 2592 int offX = 0, offY = 0;
2591#ifdef DESKTOP_VERSION 2593#ifdef DESKTOP_VERSION
2592 int w =mDatePicker->sizeHint().width() ; 2594 int w =mDatePicker->sizeHint().width() ;
2593 int h = mDatePicker->sizeHint().height() ; 2595 int h = mDatePicker->sizeHint().height() ;
2594 int dw = topLevelWidget()->width(); 2596 int dw = topLevelWidget()->width();
2595 int dh = topLevelWidget()->height(); 2597 int dh = topLevelWidget()->height();
2596 offX = topLevelWidget()->x(); 2598 offX = topLevelWidget()->x();
2597 offY = topLevelWidget()->y(); 2599 offY = topLevelWidget()->y();
2598#else 2600#else
2599 int w =mDatePicker->sizeHint().width() ; 2601 int w =mDatePicker->sizeHint().width() ;
2600 int h = mDatePicker->sizeHint().height() ; 2602 int h = mDatePicker->sizeHint().height() ;
2601 int dw = QApplication::desktop()->width(); 2603 int dw = QApplication::desktop()->width();
2602 int dh = QApplication::desktop()->height(); 2604 int dh = QApplication::desktop()->height();
2603#endif 2605#endif
2604 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2606 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2605 mDateFrame->show(); 2607 mDateFrame->show();
2606 } 2608 }
2607} 2609}
2608void CalendarView::showDatePicker( ) 2610void CalendarView::showDatePicker( )
2609{ 2611{
2610 showDatePickerPopup(); 2612 showDatePickerPopup();
2611 mDatePickerMode = 1; 2613 mDatePickerMode = 1;
2612 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2614 mDatePicker->setDate( mNavigator->selectedDates().first() );
2613} 2615}
2614 2616
2615void CalendarView::showEventEditor() 2617void CalendarView::showEventEditor()
2616{ 2618{
2617#ifdef DESKTOP_VERSION 2619#ifdef DESKTOP_VERSION
2618 int x,y,w,h; 2620 int x,y,w,h;
2619 x = mEventEditor->geometry().x(); 2621 x = mEventEditor->geometry().x();
2620 y = mEventEditor->geometry().y(); 2622 y = mEventEditor->geometry().y();
2621 w = mEventEditor->width(); 2623 w = mEventEditor->width();
2622 h = mEventEditor->height(); 2624 h = mEventEditor->height();
2623 mEventEditor->show(); 2625 mEventEditor->show();
2624 mEventEditor->setGeometry(x,y,w,h); 2626 mEventEditor->setGeometry(x,y,w,h);
2625#else 2627#else
2626 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2628 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2627 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2629 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2628 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2630 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2629 qApp->processEvents(); 2631 qApp->processEvents();
2630 delete mEventEditor; 2632 delete mEventEditor;
2631 mEventEditor = mDialogManager->getEventEditor(); 2633 mEventEditor = mDialogManager->getEventEditor();
2632 topLevelWidget()->setCaption( i18n("") ); 2634 topLevelWidget()->setCaption( i18n("") );
2633 } 2635 }
2634 mEventEditor->showMaximized(); 2636 mEventEditor->showMaximized();
2635#endif 2637#endif
2636} 2638}
2637void CalendarView::showTodoEditor() 2639void CalendarView::showTodoEditor()
2638{ 2640{
2639#ifdef DESKTOP_VERSION 2641#ifdef DESKTOP_VERSION
2640 int x,y,w,h; 2642 int x,y,w,h;
2641 x = mTodoEditor->geometry().x(); 2643 x = mTodoEditor->geometry().x();
2642 y = mTodoEditor->geometry().y(); 2644 y = mTodoEditor->geometry().y();
2643 w = mTodoEditor->width(); 2645 w = mTodoEditor->width();
2644 h = mTodoEditor->height(); 2646 h = mTodoEditor->height();
2645 mTodoEditor->show(); 2647 mTodoEditor->show();
2646 mTodoEditor->setGeometry(x,y,w,h); 2648 mTodoEditor->setGeometry(x,y,w,h);
2647#else 2649#else
2648 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2650 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2649 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2651 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2650 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2652 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2651 qApp->processEvents(); 2653 qApp->processEvents();
2652 delete mTodoEditor; 2654 delete mTodoEditor;
2653 mTodoEditor = mDialogManager->getTodoEditor(); 2655 mTodoEditor = mDialogManager->getTodoEditor();
2654 topLevelWidget()->setCaption( i18n("") ); 2656 topLevelWidget()->setCaption( i18n("") );
2655 } 2657 }
2656 mTodoEditor->showMaximized(); 2658 mTodoEditor->showMaximized();
2657#endif 2659#endif
2658} 2660}
2659 2661
2660void CalendarView::cloneIncidence() 2662void CalendarView::cloneIncidence()
2661{ 2663{
2662 Incidence *incidence = currentSelection(); 2664 Incidence *incidence = currentSelection();
2663 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2665 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2664 if ( incidence ) { 2666 if ( incidence ) {
2665 cloneIncidence(incidence); 2667 cloneIncidence(incidence);
2666 } 2668 }
2667} 2669}
2668void CalendarView::moveIncidence() 2670void CalendarView::moveIncidence()
2669{ 2671{
2670 Incidence *incidence = currentSelection(); 2672 Incidence *incidence = currentSelection();
2671 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2673 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2672 if ( incidence ) { 2674 if ( incidence ) {
2673 moveIncidence(incidence); 2675 moveIncidence(incidence);
2674 } 2676 }
2675} 2677}
2676void CalendarView::beamIncidence() 2678void CalendarView::beamIncidence()
2677{ 2679{
2678 Incidence *incidence = currentSelection(); 2680 Incidence *incidence = currentSelection();
2679 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2681 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2680 if ( incidence ) { 2682 if ( incidence ) {
2681 beamIncidence(incidence); 2683 beamIncidence(incidence);
2682 } 2684 }
2683} 2685}
2684void CalendarView::toggleCancelIncidence() 2686void CalendarView::toggleCancelIncidence()
2685{ 2687{
2686 Incidence *incidence = currentSelection(); 2688 Incidence *incidence = currentSelection();
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index d88c300..32ad10a 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,208 +1,214 @@
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 ../microkde/kio/kio ../libkdepim 10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
11#../qtcompat 11#../qtcompat
12DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 12DEFINES += 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 KORG_NODND 14#KORG_NOPRINTER KORG_NOKABC KORG_NODND
15DEFINES += KORG_NOLVALTERNATION 15DEFINES += KORG_NOLVALTERNATION
16DEFINES += DESKTOP_VERSION 16DEFINES += DESKTOP_VERSION
17unix : { 17unix : {
18staticlib: { 18staticlib: {
19LIBS += ../bin/libmicrokabc_qtopia.a 19LIBS += ../bin/libmicrokabc_qtopia.a
20LIBS += ../bin/libmicrokabc_file.a 20LIBS += ../bin/libmicrokabc_file.a
21LIBS += ../bin/libmicrokabc_dir.a 21LIBS += ../bin/libmicrokabc_dir.a
22LIBS += ../bin/libmicrokdepim.a 22LIBS += ../bin/libmicrokdepim.a
23LIBS += ../bin/libmicrokcal.a 23LIBS += ../bin/libmicrokcal.a
24LIBS += ../bin/libmicrokabc.a 24LIBS += ../bin/libmicrokabc.a
25LIBS += ../bin/libmicrokde.a 25LIBS += ../bin/libmicrokde.a
26LIBS += ../bin/libmicrokabc_qtopia.a 26LIBS += ../bin/libmicrokabc_qtopia.a
27LIBS += ../bin/libmicrokabc_file.a 27LIBS += ../bin/libmicrokabc_file.a
28LIBS += ../bin/libmicrokabc_dir.a 28LIBS += ../bin/libmicrokabc_dir.a
29LIBS += ../bin/libmicrokdepim.a 29LIBS += ../bin/libmicrokdepim.a
30LIBS += ../bin/libmicrokcal.a 30LIBS += ../bin/libmicrokcal.a
31LIBS += ../bin/libmicrokabc.a 31LIBS += ../bin/libmicrokabc.a
32LIBS += ../bin/libmicrokde.a 32LIBS += ../bin/libmicrokde.a
33LIBS += ../libical/lib/libical.a 33LIBS += ../libical/lib/libical.a
34LIBS += ../libical/lib/libicalss.a 34LIBS += ../libical/lib/libicalss.a
35} else { 35} else {
36LIBS += ../bin/libmicrokdepim.so 36LIBS += ../bin/libmicrokdepim.so
37LIBS += ../bin/libmicrokcal.so 37LIBS += ../bin/libmicrokcal.so
38LIBS += ../bin/libmicrokde.so 38LIBS += ../bin/libmicrokde.so
39LIBS += ../bin/libmicrokabc.so 39LIBS += ../bin/libmicrokabc.so
40#LIBS += -lbluetooth 40#LIBS += -lbluetooth
41#LIBS += -lsdp 41#LIBS += -lsdp
42 42
43#LIBS += -lldap 43#LIBS += -lldap
44} 44}
45OBJECTS_DIR = obj/unix 45OBJECTS_DIR = obj/unix
46MOC_DIR = moc/unix 46MOC_DIR = moc/unix
47} 47}
48win32: { 48win32: {
49RC_FILE = winicons.rc 49RC_FILE = winicons.rc
50DEFINES += _WIN32_ 50DEFINES += _WIN32_
51LIBS += ../bin/microkdepim.lib 51LIBS += ../bin/microkdepim.lib
52LIBS += ../bin/microkcal.lib 52LIBS += ../bin/microkcal.lib
53LIBS += ../bin/microkde.lib 53LIBS += ../bin/microkde.lib
54LIBS += ../bin/microkabc.lib 54LIBS += ../bin/microkabc.lib
55LIBS += ../libical/lib/ical.lib 55LIBS += ../libical/lib/ical.lib
56LIBS += ../libical/lib/icalss.lib 56LIBS += ../libical/lib/icalss.lib
57#LIBS += atls.lib 57#LIBS += atls.lib
58QMAKE_LINK += /NODEFAULTLIB:LIBC 58QMAKE_LINK += /NODEFAULTLIB:LIBC
59#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 59QMAKE_LINK += /NODEFAULTLIB:MSVCRT
60#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 60QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
61OBJECTS_DIR = obj/win 61OBJECTS_DIR = obj/win
62MOC_DIR = moc/win 62MOC_DIR = moc/win
63#olimport section 63#olimport section
64#blabla: { 64#blabla: {
65debug: {
66LIBS += mfc71ud.lib
67}
68release: {
65LIBS += mfc71u.lib 69LIBS += mfc71u.lib
70}
66DEFINES += _OL_IMPORT_ 71DEFINES += _OL_IMPORT_
67 72
68HEADERS += ../outport/msoutl9.h \ 73HEADERS += ../outport/msoutl9.h \
69 koimportoldialog.h 74 koimportoldialog.h
75
70SOURCES += ../outport/msoutl9.cpp \ 76SOURCES += ../outport/msoutl9.cpp \
71 koimportoldialog.cpp 77 koimportoldialog.cpp
72#} 78#}
73#olimport section end 79#olimport section end
74 80
75} 81}
76 82
77 83
78INTERFACES = kofilterview_base.ui 84INTERFACES = kofilterview_base.ui
79#filteredit_base.ui 85#filteredit_base.ui
80 86
81# kdateedit.h \ 87# kdateedit.h \
82 88
83HEADERS += datenavigatorcontainer.h \ 89HEADERS += datenavigatorcontainer.h \
84 filteredit_base.h \ 90 filteredit_base.h \
85 alarmclient.h \ 91 alarmclient.h \
86 calendarview.h \ 92 calendarview.h \
87 customlistviewitem.h \ 93 customlistviewitem.h \
88 datenavigator.h \ 94 datenavigator.h \
89 docprefs.h \ 95 docprefs.h \
90 filtereditdialog.h \ 96 filtereditdialog.h \
91 incomingdialog.h \ 97 incomingdialog.h \
92 incomingdialog_base.h \ 98 incomingdialog_base.h \
93 interfaces/korganizer/baseview.h \ 99 interfaces/korganizer/baseview.h \
94 interfaces/korganizer/calendarviewbase.h \ 100 interfaces/korganizer/calendarviewbase.h \
95 journalentry.h \ 101 journalentry.h \
96 kdatenavigator.h \ 102 kdatenavigator.h \
97 koagenda.h \ 103 koagenda.h \
98 koagendaitem.h \ 104 koagendaitem.h \
99 koagendaview.h \ 105 koagendaview.h \
100 kocounterdialog.h \ 106 kocounterdialog.h \
101 kodaymatrix.h \ 107 kodaymatrix.h \
102 kodialogmanager.h \ 108 kodialogmanager.h \
103 koeditordetails.h \ 109 koeditordetails.h \
104 koeditorgeneral.h \ 110 koeditorgeneral.h \
105 koeditorgeneralevent.h \ 111 koeditorgeneralevent.h \
106 koeditorgeneraltodo.h \ 112 koeditorgeneraltodo.h \
107 koeditorrecurrence.h \ 113 koeditorrecurrence.h \
108 koeventeditor.h \ 114 koeventeditor.h \
109 koeventpopupmenu.h \ 115 koeventpopupmenu.h \
110 koeventview.h \ 116 koeventview.h \
111 koeventviewer.h \ 117 koeventviewer.h \
112 koeventviewerdialog.h \ 118 koeventviewerdialog.h \
113 kofilterview.h \ 119 kofilterview.h \
114 koglobals.h \ 120 koglobals.h \
115 koincidenceeditor.h \ 121 koincidenceeditor.h \
116 kojournalview.h \ 122 kojournalview.h \
117 kolistview.h \ 123 kolistview.h \
118 kolocationbox.h \ 124 kolocationbox.h \
119 komonthview.h \ 125 komonthview.h \
120 koprefs.h \ 126 koprefs.h \
121 koprefsdialog.h \ 127 koprefsdialog.h \
122 kotimespanview.h \ 128 kotimespanview.h \
123 kotodoeditor.h \ 129 kotodoeditor.h \
124 kotodoview.h \ 130 kotodoview.h \
125 kotodoviewitem.h \ 131 kotodoviewitem.h \
126 koviewmanager.h \ 132 koviewmanager.h \
127 kowhatsnextview.h \ 133 kowhatsnextview.h \
128 ktimeedit.h \ 134 ktimeedit.h \
129 lineview.h \ 135 lineview.h \
130 mainwindow.h \ 136 mainwindow.h \
131 navigatorbar.h \ 137 navigatorbar.h \
132 outgoingdialog.h \ 138 outgoingdialog.h \
133 outgoingdialog_base.h \ 139 outgoingdialog_base.h \
134 publishdialog.h \ 140 publishdialog.h \
135 publishdialog_base.h \ 141 publishdialog_base.h \
136 savetemplatedialog.h \ 142 savetemplatedialog.h \
137 searchdialog.h \ 143 searchdialog.h \
138 statusdialog.h \ 144 statusdialog.h \
139 timeline.h \ 145 timeline.h \
140 timespanview.h \ 146 timespanview.h \
141 version.h \ 147 version.h \
142 ../kalarmd/alarmdialog.h \ 148 ../kalarmd/alarmdialog.h \
143 149
144 150
145SOURCES += datenavigatorcontainer.cpp \ 151SOURCES += datenavigatorcontainer.cpp \
146filteredit_base.cpp \ 152filteredit_base.cpp \
147 calendarview.cpp \ 153 calendarview.cpp \
148 datenavigator.cpp \ 154 datenavigator.cpp \
149 docprefs.cpp \ 155 docprefs.cpp \
150 filtereditdialog.cpp \ 156 filtereditdialog.cpp \
151 incomingdialog.cpp \ 157 incomingdialog.cpp \
152 incomingdialog_base.cpp \ 158 incomingdialog_base.cpp \
153 journalentry.cpp \ 159 journalentry.cpp \
154 kdatenavigator.cpp \ 160 kdatenavigator.cpp \
155 koagenda.cpp \ 161 koagenda.cpp \
156 koagendaitem.cpp \ 162 koagendaitem.cpp \
157 koagendaview.cpp \ 163 koagendaview.cpp \
158 kocounterdialog.cpp \ 164 kocounterdialog.cpp \
159 kodaymatrix.cpp \ 165 kodaymatrix.cpp \
160 kodialogmanager.cpp \ 166 kodialogmanager.cpp \
161 koeditordetails.cpp \ 167 koeditordetails.cpp \
162 koeditorgeneral.cpp \ 168 koeditorgeneral.cpp \
163 koeditorgeneralevent.cpp \ 169 koeditorgeneralevent.cpp \
164 koeditorgeneraltodo.cpp \ 170 koeditorgeneraltodo.cpp \
165 koeditorrecurrence.cpp \ 171 koeditorrecurrence.cpp \
166 koeventeditor.cpp \ 172 koeventeditor.cpp \
167 koeventpopupmenu.cpp \ 173 koeventpopupmenu.cpp \
168 koeventview.cpp \ 174 koeventview.cpp \
169 koeventviewer.cpp \ 175 koeventviewer.cpp \
170 koeventviewerdialog.cpp \ 176 koeventviewerdialog.cpp \
171 kofilterview.cpp \ 177 kofilterview.cpp \
172 koglobals.cpp \ 178 koglobals.cpp \
173 koincidenceeditor.cpp \ 179 koincidenceeditor.cpp \
174 kojournalview.cpp \ 180 kojournalview.cpp \
175 kolistview.cpp \ 181 kolistview.cpp \
176 kolocationbox.cpp \ 182 kolocationbox.cpp \
177 komonthview.cpp \ 183 komonthview.cpp \
178 koprefs.cpp \ 184 koprefs.cpp \
179 koprefsdialog.cpp \ 185 koprefsdialog.cpp \
180 kotimespanview.cpp \ 186 kotimespanview.cpp \
181 kotodoeditor.cpp \ 187 kotodoeditor.cpp \
182 kotodoview.cpp \ 188 kotodoview.cpp \
183 kotodoviewitem.cpp \ 189 kotodoviewitem.cpp \
184 koviewmanager.cpp \ 190 koviewmanager.cpp \
185 kowhatsnextview.cpp \ 191 kowhatsnextview.cpp \
186 ktimeedit.cpp \ 192 ktimeedit.cpp \
187 lineview.cpp \ 193 lineview.cpp \
188 main.cpp \ 194 main.cpp \
189 mainwindow.cpp \ 195 mainwindow.cpp \
190 navigatorbar.cpp \ 196 navigatorbar.cpp \
191 outgoingdialog.cpp \ 197 outgoingdialog.cpp \
192 outgoingdialog_base.cpp \ 198 outgoingdialog_base.cpp \
193 publishdialog.cpp \ 199 publishdialog.cpp \
194 publishdialog_base.cpp \ 200 publishdialog_base.cpp \
195 savetemplatedialog.cpp \ 201 savetemplatedialog.cpp \
196 searchdialog.cpp \ 202 searchdialog.cpp \
197 statusdialog.cpp \ 203 statusdialog.cpp \
198 timeline.cpp \ 204 timeline.cpp \
199 timespanview.cpp \ 205 timespanview.cpp \
200 ../kalarmd/alarmdialog.cpp 206 ../kalarmd/alarmdialog.cpp
201 207
202HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 208HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
203INTERFACES += calprintdayconfig_base.ui \ 209INTERFACES += calprintdayconfig_base.ui \
204 calprintmonthconfig_base.ui \ 210 calprintmonthconfig_base.ui \
205 calprinttodoconfig_base.ui \ 211 calprinttodoconfig_base.ui \
206 calprintweekconfig_base.ui 212 calprintweekconfig_base.ui
207SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 213SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
208 214
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index d368513..1ffc34a 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,264 +1,265 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <klistview.h> 36#include <klistview.h>
37 37
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47 47
48class QDragEnterEvent; 48class QDragEnterEvent;
49class QDragMoveEvent; 49class QDragMoveEvent;
50class QDragLeaveEvent; 50class QDragLeaveEvent;
51class QDropEvent; 51class QDropEvent;
52class KOTodoViewWhatsThis; 52class KOTodoViewWhatsThis;
53 53
54class DocPrefs; 54class DocPrefs;
55 55
56class KOTodoListView : public KListView 56class KOTodoListView : public KListView
57{ 57{
58 Q_OBJECT 58 Q_OBJECT
59 public: 59 public:
60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
61 virtual ~KOTodoListView() {} 61 virtual ~KOTodoListView() {}
62 62
63 signals: 63 signals:
64 void paintNeeded(); 64 void paintNeeded();
65 void todoDropped(Todo *, int); 65 void todoDropped(Todo *, int);
66 void double_Clicked(QListViewItem *item); 66 void double_Clicked(QListViewItem *item);
67 void reparentTodoSignal( Todo *,Todo * ); 67 void reparentTodoSignal( Todo *,Todo * );
68 void unparentTodoSignal(Todo *); 68 void unparentTodoSignal(Todo *);
69 void deleteTodo( Todo * ); 69 void deleteTodo( Todo * );
70 protected: 70 protected:
71 void wheelEvent (QWheelEvent *e); 71 void wheelEvent (QWheelEvent *e);
72 void contentsDragEnterEvent(QDragEnterEvent *); 72 void contentsDragEnterEvent(QDragEnterEvent *);
73 void contentsDragMoveEvent(QDragMoveEvent *); 73 void contentsDragMoveEvent(QDragMoveEvent *);
74 void contentsDragLeaveEvent(QDragLeaveEvent *); 74 void contentsDragLeaveEvent(QDragLeaveEvent *);
75 void contentsDropEvent(QDropEvent *); 75 void contentsDropEvent(QDropEvent *);
76 76
77 void contentsMousePressEvent(QMouseEvent *); 77 void contentsMousePressEvent(QMouseEvent *);
78 void contentsMouseMoveEvent(QMouseEvent *); 78 void contentsMouseMoveEvent(QMouseEvent *);
79 void contentsMouseReleaseEvent(QMouseEvent *); 79 void contentsMouseReleaseEvent(QMouseEvent *);
80 void contentsMouseDoubleClickEvent(QMouseEvent *); 80 void contentsMouseDoubleClickEvent(QMouseEvent *);
81 81
82 private: 82 private:
83 void paintEvent(QPaintEvent * pevent); 83 void paintEvent(QPaintEvent * pevent);
84 bool internalDrop; 84 bool internalDrop;
85 QString mName; 85 QString mName;
86 Calendar *mCalendar; 86 Calendar *mCalendar;
87 QPoint mPressPos; 87 QPoint mPressPos;
88 bool mMousePressed; 88 bool mMousePressed;
89 QListViewItem *mOldCurrent; 89 QListViewItem *mOldCurrent;
90 bool mFlagKeyPressed; 90 bool mFlagKeyPressed;
91 void keyPressEvent ( QKeyEvent * ) ; 91 void keyPressEvent ( QKeyEvent * ) ;
92 void keyReleaseEvent ( QKeyEvent * ) ; 92 void keyReleaseEvent ( QKeyEvent * ) ;
93}; 93};
94 94
95 95
96/** 96/**
97 This is the line-edit on top of the todoview for fast addition of new todos 97 This is the line-edit on top of the todoview for fast addition of new todos
98*/ 98*/
99class KOQuickTodo : public QLineEdit 99class KOQuickTodo : public QLineEdit
100{ 100{
101 public: 101 public:
102 KOQuickTodo(QWidget *parent=0); 102 KOQuickTodo(QWidget *parent=0);
103 protected: 103 protected:
104 void focusInEvent(QFocusEvent *ev); 104 void focusInEvent(QFocusEvent *ev);
105 void focusOutEvent(QFocusEvent *ev); 105 void focusOutEvent(QFocusEvent *ev);
106}; 106};
107 107
108 108
109/** 109/**
110 This class provides a multi-column list view of todo events. 110 This class provides a multi-column list view of todo events.
111 111
112 @short multi-column list view of todo events. 112 @short multi-column list view of todo events.
113 @author Cornelius Schumacher <schumacher@kde.org> 113 @author Cornelius Schumacher <schumacher@kde.org>
114*/ 114*/
115class KOTodoView : public KOrg::BaseView 115class KOTodoView : public KOrg::BaseView
116{ 116{
117 Q_OBJECT 117 Q_OBJECT
118 public: 118 public:
119 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 119 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
120 ~KOTodoView(); 120 ~KOTodoView();
121 121
122 QPtrList<Incidence> selectedIncidences(); 122 QPtrList<Incidence> selectedIncidences();
123 QPtrList<Todo> selectedTodos(); 123 QPtrList<Todo> selectedTodos();
124 124
125 DateList selectedDates() 125 DateList selectedDates()
126 {DateList q; 126 {DateList q;
127 return q;} 127 return q;}
128 128
129 /** Return number of shown dates. TodoView does not show dates, */ 129 /** Return number of shown dates. TodoView does not show dates, */
130 int currentDateCount() { return 0; } 130 int currentDateCount() { return 0; }
131 131
132 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 132 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
133 133
134 void setDocumentId( const QString & ); 134 void setDocumentId( const QString & );
135 135
136 void saveLayout(KConfig *config, const QString &group) const; 136 void saveLayout(KConfig *config, const QString &group) const;
137 void restoreLayout(KConfig *config, const QString &group); 137 void restoreLayout(KConfig *config, const QString &group);
138 /** Create a popup menu to set categories */ 138 /** Create a popup menu to set categories */
139 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 139 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
140 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 140 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
141 QString getWhatsThisText(QPoint p); 141 QString getWhatsThisText(QPoint p);
142 void clearList() {mTodoListView->clear(); }
142 143
143 public slots: 144 public slots:
144 void updateView(); 145 void updateView();
145 void updateConfig(); 146 void updateConfig();
146 147
147 void changeEventDisplay(Event *, int); 148 void changeEventDisplay(Event *, int);
148 149
149 void showDates(const QDate &start, const QDate &end); 150 void showDates(const QDate &start, const QDate &end);
150 void showEvents(QPtrList<Event> eventList); 151 void showEvents(QPtrList<Event> eventList);
151 152
152 void clearSelection(); 153 void clearSelection();
153 void jumpToDate (); 154 void jumpToDate ();
154 155
155 void editItem(QListViewItem *item); 156 void editItem(QListViewItem *item);
156 void showItem(QListViewItem *item,const QPoint &,int); 157 void showItem(QListViewItem *item,const QPoint &,int);
157 void popupMenu(QListViewItem *item,const QPoint &,int); 158 void popupMenu(QListViewItem *item,const QPoint &,int);
158 void newTodo(); 159 void newTodo();
159 void newSubTodo(); 160 void newSubTodo();
160 void unparentTodo(); 161 void unparentTodo();
161 void reparentTodo(); 162 void reparentTodo();
162 void showTodo(); 163 void showTodo();
163 void editTodo(); 164 void editTodo();
164 void cloneTodo(); 165 void cloneTodo();
165 void cancelTodo(); 166 void cancelTodo();
166 void moveTodo(); 167 void moveTodo();
167 void beamTodo(); 168 void beamTodo();
168 void deleteTodo(); 169 void deleteTodo();
169 170
170 void setNewPriority(int); 171 void setNewPriority(int);
171 void setNewPercentage(int); 172 void setNewPercentage(int);
172 void changedCategories(int); 173 void changedCategories(int);
173 174
174 void setAllOpen(); 175 void setAllOpen();
175 void setAllClose(); 176 void setAllClose();
176 void setAllFlat(); 177 void setAllFlat();
177 void displayAllFlat(); 178 void displayAllFlat();
178 179
179 void purgeCompleted(); 180 void purgeCompleted();
180 void toggleCompleted(); 181 void toggleCompleted();
181 void toggleRunning(); 182 void toggleRunning();
182 void toggleQuickTodo(); 183 void toggleQuickTodo();
183 void updateTodo( Todo *, int ); 184 void updateTodo( Todo *, int );
184 185
185 void itemClicked(QListViewItem *); 186 void itemClicked(QListViewItem *);
186 void itemStateChanged(QListViewItem *); 187 void itemStateChanged(QListViewItem *);
187 void modified(bool); 188 void modified(bool);
188 void itemDoubleClicked(QListViewItem *item); 189 void itemDoubleClicked(QListViewItem *item);
189 190
190 signals: 191 signals:
191 void newTodoSignal(); 192 void newTodoSignal();
192 void newSubTodoSignal(Todo *); 193 void newSubTodoSignal(Todo *);
193 void unparentTodoSignal(Todo *); 194 void unparentTodoSignal(Todo *);
194 void reparentTodoSignal( Todo *,Todo * ); 195 void reparentTodoSignal( Todo *,Todo * );
195 void showTodoSignal(Todo *); 196 void showTodoSignal(Todo *);
196 197
197 void editTodoSignal(Todo *); 198 void editTodoSignal(Todo *);
198 void deleteTodoSignal(Todo *); 199 void deleteTodoSignal(Todo *);
199 void todoModifiedSignal (Todo *, int); 200 void todoModifiedSignal (Todo *, int);
200 201
201 void isModified(bool); 202 void isModified(bool);
202 void cloneTodoSignal( Incidence * ); 203 void cloneTodoSignal( Incidence * );
203 void cancelTodoSignal( Incidence * ); 204 void cancelTodoSignal( Incidence * );
204 void moveTodoSignal( Incidence * ); 205 void moveTodoSignal( Incidence * );
205 void beamTodoSignal( Incidence * ); 206 void beamTodoSignal( Incidence * );
206 void purgeCompletedSignal(); 207 void purgeCompletedSignal();
207 208
208 protected slots: 209 protected slots:
209 void toggleRunningItem(); 210 void toggleRunningItem();
210 void paintNeeded(); 211 void paintNeeded();
211 void processSelectionChange(); 212 void processSelectionChange();
212 void addQuickTodo(); 213 void addQuickTodo();
213 void setTodoModified( Todo* ); 214 void setTodoModified( Todo* );
214 void todoModified(Todo *, int ); 215 void todoModified(Todo *, int );
215 216
216 private: 217 private:
217 /* 218 /*
218 * the TodoEditor approach is rather unscaling in the long 219 * the TodoEditor approach is rather unscaling in the long
219 * run. 220 * run.
220 * Korganizer keeps it in memory and we need to update 221 * Korganizer keeps it in memory and we need to update
221 * 1. make KOTodoViewItem a QObject again? 222 * 1. make KOTodoViewItem a QObject again?
222 * 2. add a public method for setting one todo modified? 223 * 2. add a public method for setting one todo modified?
223 * 3. add a private method for setting a todo modified + friend here? 224 * 3. add a private method for setting a todo modified + friend here?
224 * -- zecke 2002-07-08 225 * -- zecke 2002-07-08
225 */ 226 */
226 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 227 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
227 friend class KOTodoListView; 228 friend class KOTodoListView;
228 void paintEvent(QPaintEvent * pevent); 229 void paintEvent(QPaintEvent * pevent);
229 bool mPendingUpdateBeforeRepaint; 230 bool mPendingUpdateBeforeRepaint;
230 friend class KOTodoViewItem; 231 friend class KOTodoViewItem;
231 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 232 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
232 void restoreItemState( QListViewItem * ); 233 void restoreItemState( QListViewItem * );
233 234
234 bool checkTodo( Todo * ); 235 bool checkTodo( Todo * );
235 bool isFlatDisplay; 236 bool isFlatDisplay;
236 void setOpen( QListViewItem*, bool setOpen); 237 void setOpen( QListViewItem*, bool setOpen);
237 KOTodoListView *mTodoListView; 238 KOTodoListView *mTodoListView;
238 QPopupMenu *mItemPopupMenu; 239 QPopupMenu *mItemPopupMenu;
239 QPopupMenu *mPopupMenu; 240 QPopupMenu *mPopupMenu;
240 QPopupMenu *mPriorityPopupMenu; 241 QPopupMenu *mPriorityPopupMenu;
241 QPopupMenu *mPercentageCompletedPopupMenu; 242 QPopupMenu *mPercentageCompletedPopupMenu;
242 QPopupMenu *mCategoryPopupMenu; 243 QPopupMenu *mCategoryPopupMenu;
243 244
244 QMap<int, int> mPercentage; 245 QMap<int, int> mPercentage;
245 QMap<int, int> mPriority; 246 QMap<int, int> mPriority;
246 QMap<int, QString> mCategory; 247 QMap<int, QString> mCategory;
247 KOTodoViewItem *mActiveItem; 248 KOTodoViewItem *mActiveItem;
248 249
249 QMap<Todo *,KOTodoViewItem *> mTodoMap; 250 QMap<Todo *,KOTodoViewItem *> mTodoMap;
250 QString mName; 251 QString mName;
251 252
252 DocPrefs *mDocPrefs; 253 DocPrefs *mDocPrefs;
253 QString mCurrentDoc; 254 QString mCurrentDoc;
254 KOQuickTodo *mQuickAdd; 255 KOQuickTodo *mQuickAdd;
255 bool mBlockUpdate; 256 bool mBlockUpdate;
256 void keyPressEvent ( QKeyEvent * ) ; 257 void keyPressEvent ( QKeyEvent * ) ;
257 KOTodoViewItem * pendingSubtodo; 258 KOTodoViewItem * pendingSubtodo;
258 DateNavigator* mNavigator; 259 DateNavigator* mNavigator;
259 void storeCurrentItem(); 260 void storeCurrentItem();
260 void resetCurrentItem(); 261 void resetCurrentItem();
261 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; 262 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove;
262}; 263};
263 264
264#endif 265#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 2e5a943..fb4de37 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,835 +1,838 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 flagResetViewChangeDate = 0; 64 flagResetViewChangeDate = 0;
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") { 91 else if (view == "Month") {
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 92 if ( !KOPrefs::instance()->mMonthViewWeek )
93 showMonthView(); 93 showMonthView();
94 else 94 else
95 showMonthViewWeek(); 95 showMonthViewWeek();
96 } 96 }
97 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
101 else { 101 else {
102 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
105 showAgendaView(); 105 showAgendaView();
106 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 109#endif
110 } 110 }
111} 111}
112 112
113void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
114{ 114{
115 static int lastMode = 0; 115 static int lastMode = 0;
116 static int lastCount = 0; 116 static int lastCount = 0;
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 resetDateSilent( date,1); 141 resetDateSilent( date,1);
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
166 } else if (view == 10) { 166 } else if (view == 10) {
167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
168 } 168 }
169} 169}
170 170
171 171
172 172
173void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
174{ 174{
175 config->setGroup("General"); 175 config->setGroup("General");
176 176
177 QString view; 177 QString view;
178 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
179 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
180 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
181 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
183 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
184 else view = "Agenda"; 184 else view = "Agenda";
185 185
186 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
187 187
188 if (mAgendaView) { 188 if (mAgendaView) {
189 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
190 } 190 }
191 if (mTimeSpanView) { 191 if (mTimeSpanView) {
192 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
193 } 193 }
194 if (mListView) { 194 if (mListView) {
195 mListView->writeSettings(config); 195 mListView->writeSettings(config);
196 } 196 }
197 if (mTodoView) { 197 if (mTodoView) {
198 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
199 } 199 }
200} 200}
201void KOViewManager::showNextView() 201void KOViewManager::showNextView()
202{ 202{
203 static int selecteddatescount = 0; 203 static int selecteddatescount = 0;
204 static QDate selecteddate = QDate ( 2000, 1, 1 ); 204 static QDate selecteddate = QDate ( 2000, 1, 1 );
205 static QDate baseCycleDate = QDate ( 2000, 1, 1 ); 205 static QDate baseCycleDate = QDate ( 2000, 1, 1 );
206 int newCount = mMainView->dateNavigator()->selectedDates().count(); 206 int newCount = mMainView->dateNavigator()->selectedDates().count();
207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { 207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
208 flagResetViewChangeDate = 1; 208 flagResetViewChangeDate = 1;
209 } 209 }
210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) 210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
211 flagResetViewChangeDate = 1; 211 flagResetViewChangeDate = 1;
212 if ( flagResetViewChangeDate > 0 ) { 212 if ( flagResetViewChangeDate > 0 ) {
213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); 213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
214 //qDebug("newCycle "); 214 //qDebug("newCycle ");
215 } 215 }
216 if (mCurrentView == mWhatsNextView) goto NEXT_X; 216 if (mCurrentView == mWhatsNextView) goto NEXT_X;
217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
218 if (mCurrentView == mJournalView ) goto DAY_1; 218 if (mCurrentView == mJournalView ) goto DAY_1;
219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
221 if (mCurrentView == mAgendaView ) goto DAY_6; 221 if (mCurrentView == mAgendaView ) goto DAY_6;
222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
223 if (mCurrentView == mMonthView ) goto LIST; 223 if (mCurrentView == mMonthView ) goto LIST;
224 if (mCurrentView == mListView ) goto TODO; 224 if (mCurrentView == mListView ) goto TODO;
225 // if (mCurrentView == mTodoView ) goto NEXT; 225 // if (mCurrentView == mTodoView ) goto NEXT;
226 NEXT: 226 NEXT:
227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} 227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
228 NEXT_X: 228 NEXT_X:
229 if ( KOPrefs::instance()->mShowIconNextDays ) { 229 if ( KOPrefs::instance()->mShowIconNextDays ) {
230 showNextXView(); 230 showNextXView();
231 goto ENTE ; 231 goto ENTE ;
232 } 232 }
233 JOURNAL: 233 JOURNAL:
234 if ( KOPrefs::instance()->mShowIconJournal ) { 234 if ( KOPrefs::instance()->mShowIconJournal ) {
235 resetDateSilent( baseCycleDate , 1 ); 235 resetDateSilent( baseCycleDate , 1 );
236 showJournalView() ;goto ENTE ;} 236 showJournalView() ;goto ENTE ;}
237 DAY_1: 237 DAY_1:
238 if ( KOPrefs::instance()->mShowIconDay1 ) { 238 if ( KOPrefs::instance()->mShowIconDay1 ) {
239 resetDateSilent( baseCycleDate , 2 ); 239 resetDateSilent( baseCycleDate , 2 );
240 showDayView() ;goto ENTE ;} 240 showDayView() ;goto ENTE ;}
241 DAY_5: 241 DAY_5:
242 if ( KOPrefs::instance()->mShowIconDay5 ) { 242 if ( KOPrefs::instance()->mShowIconDay5 ) {
243 resetDateSilent( baseCycleDate , 2 ); 243 resetDateSilent( baseCycleDate , 2 );
244 showWorkWeekView() ;goto ENTE ;} 244 showWorkWeekView() ;goto ENTE ;}
245 DAY_7: 245 DAY_7:
246 if ( KOPrefs::instance()->mShowIconDay7 ) { 246 if ( KOPrefs::instance()->mShowIconDay7 ) {
247 resetDateSilent( baseCycleDate , 2 ); 247 resetDateSilent( baseCycleDate , 2 );
248 showWeekView();goto ENTE ;} 248 showWeekView();goto ENTE ;}
249 DAY_6: 249 DAY_6:
250 if ( KOPrefs::instance()->mShowIconDay6 ) { 250 if ( KOPrefs::instance()->mShowIconDay6 ) {
251 resetDateSilent( baseCycleDate , 2 ); 251 resetDateSilent( baseCycleDate , 2 );
252 showMonthViewWeek();goto ENTE ;} 252 showMonthViewWeek();goto ENTE ;}
253 MONTH: 253 MONTH:
254 if ( KOPrefs::instance()->mShowIconMonth ) { 254 if ( KOPrefs::instance()->mShowIconMonth ) {
255 resetDateSilent( baseCycleDate , 2 ); 255 resetDateSilent( baseCycleDate , 2 );
256 showMonthView();goto ENTE ;} 256 showMonthView();goto ENTE ;}
257 LIST: 257 LIST:
258 if ( KOPrefs::instance()->mShowIconList ) { 258 if ( KOPrefs::instance()->mShowIconList ) {
259 resetDateSilent( baseCycleDate , 2 ); 259 resetDateSilent( baseCycleDate , 2 );
260 showListView() ;goto ENTE ;} 260 showListView() ;goto ENTE ;}
261 TODO: 261 TODO:
262 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 262 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
263 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} 263 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
264 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} 264 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
265 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} 265 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
266 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} 266 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
267 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} 267 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
268 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} 268 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
269 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} 269 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
270 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} 270 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
271 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} 271 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
272 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 272 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
273 ENTE: 273 ENTE:
274 flagResetViewChangeDate = 0; 274 flagResetViewChangeDate = 0;
275 selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); 275 selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
276 selecteddate = mMainView->dateNavigator()->selectedDates().first(); 276 selecteddate = mMainView->dateNavigator()->selectedDates().first();
277 277
278} 278}
279void KOViewManager::resetDateSilent( QDate date , int days ) 279void KOViewManager::resetDateSilent( QDate date , int days )
280{ 280{
281 mMainView->dateNavigator()->blockSignals( true ); 281 mMainView->dateNavigator()->blockSignals( true );
282 mMainView->dateNavigator()->selectDates( date , days ); 282 mMainView->dateNavigator()->selectDates( date , days );
283 mMainView->dateNavigator()->blockSignals( false ); 283 mMainView->dateNavigator()->blockSignals( false );
284} 284}
285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
286{ 286{
287 if ( flagResetViewChangeDate < 10 ) 287 if ( flagResetViewChangeDate < 10 )
288 ++flagResetViewChangeDate; 288 ++flagResetViewChangeDate;
289 //mFlagShowNextxDays = false; 289 //mFlagShowNextxDays = false;
290 //if(view == mCurrentView) return; 290 //if(view == mCurrentView) return;
291 if ( view == 0 ) { 291 if ( view == 0 ) {
292 view = mCurrentView; 292 view = mCurrentView;
293 if ( view == 0 ) 293 if ( view == 0 )
294 return; 294 return;
295 } 295 }
296 bool callupdate = !(view == mCurrentView); 296 bool callupdate = !(view == mCurrentView);
297 bool full = fullScreen; 297 bool full = fullScreen;
298 if(view == mCurrentView && view != mWhatsNextView ) { 298 if(view == mCurrentView && view != mWhatsNextView ) {
299 if ( mCurrentAgendaView < 0 ) 299 if ( mCurrentAgendaView < 0 )
300 return; 300 return;
301 if ( view != mMonthView ) 301 if ( view != mMonthView )
302 full = mMainView->leftFrame()->isVisible(); 302 full = mMainView->leftFrame()->isVisible();
303 } else { 303 } else {
304 if ( view == mMonthView && mMonthView) 304 if ( view == mMonthView && mMonthView)
305 ;//mMonthView->skipResize = true ; 305 ;//mMonthView->skipResize = true ;
306 mCurrentView = view; 306 mCurrentView = view;
307 // bool full = fullScreen; 307 // bool full = fullScreen;
308 bool isFull = !mMainView->leftFrame()->isVisible(); 308 bool isFull = !mMainView->leftFrame()->isVisible();
309 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 309 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
310 full = true; 310 full = true;
311 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 311 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
312 full = false; 312 full = false;
313 } 313 }
314 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 314 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
315 //raiseCurrentView( full ); 315 //raiseCurrentView( full );
316 mMainView->processIncidenceSelection( 0 ); 316 mMainView->processIncidenceSelection( 0 );
317 //mMainView->updateView(); 317 //mMainView->updateView();
318 raiseCurrentView( full, callupdate ); 318 raiseCurrentView( full, callupdate );
319 mMainView->adaptNavigationUnits(); 319 mMainView->adaptNavigationUnits();
320 mMainView->updateUnmanagedViews(); 320 mMainView->updateUnmanagedViews();
321} 321}
322 322
323void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 323void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
324{ 324{
325 mCurrentAgendaView = 0; 325 mCurrentAgendaView = 0;
326 if ( fullScreen ) { 326 if ( fullScreen ) {
327 mMainView->leftFrame()->hide(); 327 mMainView->leftFrame()->hide();
328 } else { 328 } else {
329 mMainView->leftFrame()->show(); 329 mMainView->leftFrame()->show();
330 } 330 }
331 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 331 //if ( mCurrentView == mMonthView ) qApp->processEvents();
332 emit signalFullScreen( !fullScreen ); 332 emit signalFullScreen( !fullScreen );
333 if ( callUpdateView ) 333 if ( callUpdateView )
334 mMainView->updateView(); 334 mMainView->updateView();
335 335
336 if ( globalFlagBlockAgenda == 5 ) { 336 if ( globalFlagBlockAgenda == 5 ) {
337 globalFlagBlockAgenda = 4; 337 globalFlagBlockAgenda = 4;
338 globalFlagBlockAgendaItemPaint = 1; 338 globalFlagBlockAgendaItemPaint = 1;
339 } 339 }
340 mMainView->viewStack()->raiseWidget(mCurrentView); 340 mMainView->viewStack()->raiseWidget(mCurrentView);
341 if ( globalFlagBlockAgenda == 4 ) { 341 if ( globalFlagBlockAgenda == 4 ) {
342 if ( mCurrentView == mAgendaView ) { 342 if ( mCurrentView == mAgendaView ) {
343 //globalFlagBlockAgenda =1 ; 343 //globalFlagBlockAgenda =1 ;
344 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 344 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
345 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 345 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
346 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 346 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
347 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 347 mAgendaView->setStartHour( QTime::currentTime ().hour() );
348 qApp->processEvents(); 348 qApp->processEvents();
349 //qDebug("qApp->processEvents() "); 349 //qDebug("qApp->processEvents() ");
350 globalFlagBlockAgenda = 0; 350 globalFlagBlockAgenda = 0;
351 mAgendaView->repaintAgenda(); 351 mAgendaView->repaintAgenda();
352 352
353 } 353 }
354 globalFlagBlockAgenda = 0; 354 globalFlagBlockAgenda = 0;
355 } 355 }
356 emit signalAgendaView( mCurrentView == mAgendaView ); 356 emit signalAgendaView( mCurrentView == mAgendaView );
357 //qDebug("raiseCurrentView ende "); 357 //qDebug("raiseCurrentView ende ");
358 358
359} 359}
360 360
361void KOViewManager::updateView() 361void KOViewManager::updateView()
362{ 362{
363 // qDebug("KOViewManager::updateView() "); 363 // qDebug("KOViewManager::updateView() ");
364 // if we are updating mTodoView, we get endless recursion 364 // if we are updating mTodoView, we get endless recursion
365 if ( mTodoView == mCurrentView ) 365 if ( mTodoView == mCurrentView )
366 return; 366 return;
367 if ( mCurrentView ) mCurrentView->updateView(); 367 if ( mCurrentView ) mCurrentView->updateView();
368 368
369} 369}
370 370
371void KOViewManager::updateView(const QDate &start, const QDate &end) 371void KOViewManager::updateView(const QDate &start, const QDate &end)
372{ 372{
373 // kdDebug() << "KOViewManager::updateView()" << endl; 373 // kdDebug() << "KOViewManager::updateView()" << endl;
374 374
375 if (mCurrentView) mCurrentView->showDates(start, end); 375 if (mCurrentView) mCurrentView->showDates(start, end);
376 376
377 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 377 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
378} 378}
379 379
380 380
381void KOViewManager::updateWNview() 381void KOViewManager::updateWNview()
382{ 382{
383 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 383 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
384 mWhatsNextView->updateView(); 384 mWhatsNextView->updateView();
385 if ( mCurrentView == mMonthView && mMonthView ) 385 if ( mCurrentView == mMonthView && mMonthView )
386 mMonthView->updateView(); 386 mMonthView->updateView();
387 387
388} 388}
389void KOViewManager::showWhatsNextView() 389void KOViewManager::showWhatsNextView()
390{ 390{
391 if (!mWhatsNextView) { 391 if (!mWhatsNextView) {
392 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 392 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
393 "KOViewManager::WhatsNextView"); 393 "KOViewManager::WhatsNextView");
394 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 394 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
395 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 395 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
396 addView(mWhatsNextView); 396 addView(mWhatsNextView);
397 connect(this, SIGNAL( printWNV() ), 397 connect(this, SIGNAL( printWNV() ),
398 mWhatsNextView, SLOT( printMe() ) ); 398 mWhatsNextView, SLOT( printMe() ) );
399 } 399 }
400 globalFlagBlockAgenda = 1; 400 globalFlagBlockAgenda = 1;
401 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 401 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
402 showView(mWhatsNextView, true ); 402 showView(mWhatsNextView, true );
403 //mWhatsNextView->updateView(); 403 //mWhatsNextView->updateView();
404 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 404 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
405} 405}
406 406
407void KOViewManager::slotprintWNV() 407void KOViewManager::slotprintWNV()
408{ 408{
409 if (!mWhatsNextView) 409 if (!mWhatsNextView)
410 showWhatsNextView(); 410 showWhatsNextView();
411 emit printWNV(); 411 emit printWNV();
412 412
413} 413}
414void KOViewManager::showListView() 414void KOViewManager::showListView()
415{ 415{
416 if (!mListView) { 416 if (!mListView) {
417 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 417 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
418 addView(mListView); 418 addView(mListView);
419 419
420 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 420 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
421 mMainView, SLOT(showIncidence(Incidence *))); 421 mMainView, SLOT(showIncidence(Incidence *)));
422 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 422 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
423 mMainView, SLOT(editIncidence(Incidence *))); 423 mMainView, SLOT(editIncidence(Incidence *)));
424 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 424 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
425 mMainView, SLOT(deleteIncidence(Incidence *))); 425 mMainView, SLOT(deleteIncidence(Incidence *)));
426 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 426 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
427 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 427 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
428 connect( mListView, SIGNAL( signalNewEvent() ), 428 connect( mListView, SIGNAL( signalNewEvent() ),
429 mMainView, SLOT( newEvent() ) ); 429 mMainView, SLOT( newEvent() ) );
430 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 430 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
431 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 431 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
432 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 432 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
433 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 433 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
434 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 434 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
435 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 435 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
436 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 436 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
437 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 437 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
438 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 438 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
439 } 439 }
440 // bool temp = mFlagShowNextxDays; 440 // bool temp = mFlagShowNextxDays;
441 //globalFlagBlockPainting = true; 441 //globalFlagBlockPainting = true;
442 globalFlagBlockAgenda = 1; 442 globalFlagBlockAgenda = 1;
443 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 443 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
444 mMainView->setBlockShowDates( true ); 444 mMainView->setBlockShowDates( true );
445 mMainView->dateNavigator()->selectMonth(); 445 mMainView->dateNavigator()->selectMonth();
446 mMainView->setBlockShowDates( false ); 446 mMainView->setBlockShowDates( false );
447 } 447 }
448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
449 showView(mListView, KOPrefs::instance()->mFullViewTodo); 449 showView(mListView, KOPrefs::instance()->mFullViewTodo);
450 //mFlagShowNextxDays = temp; 450 //mFlagShowNextxDays = temp;
451 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 451 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
452} 452}
453 453
454void KOViewManager::showAgendaView( bool fullScreen ) 454void KOViewManager::showAgendaView( bool fullScreen )
455{ 455{
456 456
457 mMainView->dialogManager()->hideSearchDialog(); 457 mMainView->dialogManager()->hideSearchDialog();
458 // qDebug("KOViewManager::showAgendaView "); 458 // qDebug("KOViewManager::showAgendaView ");
459 bool full; 459 bool full;
460 full = fullScreen; 460 full = fullScreen;
461 if (!mAgendaView) { 461 if (!mAgendaView) {
462 full = false; 462 full = false;
463 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 463 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
464 addView(mAgendaView); 464 addView(mAgendaView);
465#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
466 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 466 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
467#endif 467#endif
468 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 468 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
469 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 469 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
470 470
471 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 471 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
472 472
473 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 473 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
474 474
475 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 475 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
476 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 476 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
477 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 477 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
478 mMainView, SLOT(newEvent(QDateTime))); 478 mMainView, SLOT(newEvent(QDateTime)));
479 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 479 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
480 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 480 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
481 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 481 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
482 mMainView, SLOT(newEvent(QDate))); 482 mMainView, SLOT(newEvent(QDate)));
483 483
484 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 484 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
485 mMainView, SLOT(editIncidence(Incidence *))); 485 mMainView, SLOT(editIncidence(Incidence *)));
486 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 486 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
487 mMainView, SLOT(showIncidence(Incidence *))); 487 mMainView, SLOT(showIncidence(Incidence *)));
488 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 488 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
489 mMainView, SLOT(deleteIncidence(Incidence *))); 489 mMainView, SLOT(deleteIncidence(Incidence *)));
490 490
491 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 491 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
492 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 492 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
493 493
494 connect(mAgendaView, SIGNAL( toggleExpand() ), 494 connect(mAgendaView, SIGNAL( toggleExpand() ),
495 mMainView, SLOT( toggleExpand() ) ); 495 mMainView, SLOT( toggleExpand() ) );
496 496
497 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 497 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
498 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 498 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
499 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 499 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
500 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 500 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
501 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 501 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
502 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 502 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
503 SLOT( updateTodo( Todo *, int ) ) ); 503 SLOT( updateTodo( Todo *, int ) ) );
504 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 504 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
505 mMainView, SIGNAL( todoModified( Todo *, int ))); 505 mMainView, SIGNAL( todoModified( Todo *, int )));
506 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 506 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
507 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 507 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
508 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 508 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
509 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 509 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
510 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 510 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
511 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 511 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
512 mAgendaView->readSettings(); 512 mAgendaView->readSettings();
513 mAgendaView->updateConfig(); 513 mAgendaView->updateConfig();
514 } 514 }
515 515
516 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 516 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
517 showView( mAgendaView, full); 517 showView( mAgendaView, full);
518 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 518 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
519} 519}
520 520
521void KOViewManager::showDayView() 521void KOViewManager::showDayView()
522{ 522{
523 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 523 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
524 mFlagShowNextxDays = false; 524 mFlagShowNextxDays = false;
525 globalFlagBlockLabel = 1; 525 globalFlagBlockLabel = 1;
526 globalFlagBlockAgenda = 1; 526 globalFlagBlockAgenda = 1;
527 if ( mCurrentAgendaView != 1 ) 527 if ( mCurrentAgendaView != 1 )
528 mCurrentAgendaView = -1; 528 mCurrentAgendaView = -1;
529 showAgendaView(); 529 showAgendaView();
530 qApp->processEvents(); 530 qApp->processEvents();
531 globalFlagBlockAgenda = 2; 531 globalFlagBlockAgenda = 2;
532 globalFlagBlockLabel = 0; 532 globalFlagBlockLabel = 0;
533 mMainView->dateNavigator()->selectDates( 1 ); 533 mMainView->dateNavigator()->selectDates( 1 );
534 mCurrentAgendaView = 1 ; 534 mCurrentAgendaView = 1 ;
535 535
536} 536}
537 537
538void KOViewManager::showWorkWeekView() 538void KOViewManager::showWorkWeekView()
539{ 539{
540 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 540 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
541 mFlagShowNextxDays = false; 541 mFlagShowNextxDays = false;
542 globalFlagBlockAgenda = 1; 542 globalFlagBlockAgenda = 1;
543 globalFlagBlockLabel = 1; 543 globalFlagBlockLabel = 1;
544 if ( mCurrentAgendaView != 5 ) 544 if ( mCurrentAgendaView != 5 )
545 mCurrentAgendaView = -1; 545 mCurrentAgendaView = -1;
546 showAgendaView(); 546 showAgendaView();
547 qApp->processEvents(); 547 qApp->processEvents();
548 globalFlagBlockAgenda = 2; 548 globalFlagBlockAgenda = 2;
549 globalFlagBlockLabel = 0; 549 globalFlagBlockLabel = 0;
550 mMainView->dateNavigator()->selectWorkWeek(); 550 mMainView->dateNavigator()->selectWorkWeek();
551 mCurrentAgendaView = 5 ; 551 mCurrentAgendaView = 5 ;
552 552
553} 553}
554 554
555void KOViewManager::showWeekView() 555void KOViewManager::showWeekView()
556{ 556{
557 557
558 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 558 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
559 mFlagShowNextxDays = false; 559 mFlagShowNextxDays = false;
560 globalFlagBlockAgenda = 1; 560 globalFlagBlockAgenda = 1;
561 globalFlagBlockLabel = 1; 561 globalFlagBlockLabel = 1;
562 if ( mCurrentAgendaView != 7 ) 562 if ( mCurrentAgendaView != 7 )
563 mCurrentAgendaView = -1; 563 mCurrentAgendaView = -1;
564 showAgendaView(); 564 showAgendaView();
565 qApp->processEvents(); 565 qApp->processEvents();
566 globalFlagBlockAgenda = 2; 566 globalFlagBlockAgenda = 2;
567 globalFlagBlockLabel = 0; 567 globalFlagBlockLabel = 0;
568 mMainView->dateNavigator()->selectWeek(); 568 mMainView->dateNavigator()->selectWeek();
569 mCurrentAgendaView = 7 ; 569 mCurrentAgendaView = 7 ;
570} 570}
571 571
572void KOViewManager::showNextXView() 572void KOViewManager::showNextXView()
573{ 573{
574 574
575 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 575 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
576 globalFlagBlockAgenda = 1; 576 globalFlagBlockAgenda = 1;
577 if ( mCurrentAgendaView != 3 ) 577 if ( mCurrentAgendaView != 3 )
578 mCurrentAgendaView = -1; 578 mCurrentAgendaView = -1;
579 showAgendaView(KOPrefs::instance()->mFullViewMonth); 579 showAgendaView(KOPrefs::instance()->mFullViewMonth);
580 globalFlagBlockAgenda = 2; 580 globalFlagBlockAgenda = 2;
581 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 581 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
582 KOPrefs::instance()->mNextXDays ); 582 KOPrefs::instance()->mNextXDays );
583 mFlagShowNextxDays = true; 583 mFlagShowNextxDays = true;
584 mCurrentAgendaView = 3 ; 584 mCurrentAgendaView = 3 ;
585 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 585 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
586} 586}
587bool KOViewManager::showsNextDays() 587bool KOViewManager::showsNextDays()
588{ 588{
589 return mFlagShowNextxDays; 589 return mFlagShowNextxDays;
590} 590}
591void KOViewManager::createMonthView() 591void KOViewManager::createMonthView()
592{ 592{
593if (!mMonthView) { 593if (!mMonthView) {
594 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 594 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
595 595
596 addView(mMonthView); 596 addView(mMonthView);
597 // mMonthView->show(); 597 // mMonthView->show();
598 // SIGNALS/SLOTS FOR MONTH VIEW 598 // SIGNALS/SLOTS FOR MONTH VIEW
599 599
600 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); 600 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
601 601
602 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), 602 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
603 mMainView, SLOT(newTodoDateTime(QDateTime, bool))); 603 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
604 604
605 605
606 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 606 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
607 mMainView, SLOT(newEvent(QDateTime))); 607 mMainView, SLOT(newEvent(QDateTime)));
608 608
609 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 609 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
610 mMainView, SLOT(showIncidence(Incidence *))); 610 mMainView, SLOT(showIncidence(Incidence *)));
611 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 611 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
612 mMainView, SLOT(editIncidence(Incidence *))); 612 mMainView, SLOT(editIncidence(Incidence *)));
613 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 613 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
614 mMainView, SLOT(deleteIncidence(Incidence *))); 614 mMainView, SLOT(deleteIncidence(Incidence *)));
615 615
616 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 616 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
617 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 617 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
618 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 618 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
619 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 619 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
620 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 620 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
621 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 621 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
622 622
623 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 623 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
624 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 624 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
625 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 625 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
626 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 626 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
627 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 627 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
628 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 628 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
629 connect( mMonthView, SIGNAL( selectMonth() ), 629 connect( mMonthView, SIGNAL( selectMonth() ),
630 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 630 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
631 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 631 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
632 mMainView, SLOT ( showDay( QDate ) ) ); 632 mMainView, SLOT ( showDay( QDate ) ) );
633 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 633 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
634 connect( mMonthView, SIGNAL(nextMonth() ), 634 connect( mMonthView, SIGNAL(nextMonth() ),
635 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 635 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
636 connect( mMonthView, SIGNAL(prevMonth() ), 636 connect( mMonthView, SIGNAL(prevMonth() ),
637 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 637 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
639 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 639 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
640 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 640 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
641 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 641 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
643 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 643 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
644 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 644 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
645 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 645 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
646 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 646 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
647 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 647 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
648 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 648 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
649 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 649 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
650 650
651 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 651 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
652 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 652 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
653 653
654 654
655 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 655 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
656 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 656 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
657 657
658 } 658 }
659} 659}
660void KOViewManager::showMonthViewWeek() 660void KOViewManager::showMonthViewWeek()
661{ 661{
662 createMonthView(); 662 createMonthView();
663 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 663 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
664 globalFlagBlockAgenda = 1; 664 globalFlagBlockAgenda = 1;
665 bool full = true; 665 bool full = true;
666 if ( mCurrentView == mMonthView) 666 if ( mCurrentView == mMonthView)
667 full = mMainView->leftFrame()->isVisible(); 667 full = mMainView->leftFrame()->isVisible();
668 if ( !KOPrefs::instance()->mMonthViewWeek ) { 668 if ( !KOPrefs::instance()->mMonthViewWeek ) {
669 mMonthView->switchView(); 669 mMonthView->switchView();
670 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 670 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
671 full = false; 671 full = false;
672 else 672 else
673 full = true; 673 full = true;
674 } 674 }
675 mMainView->dateNavigator()->selectWeek(); 675 mMainView->dateNavigator()->selectWeek();
676 showView(mMonthView, full ); 676 showView(mMonthView, full );
677 mMonthView->setKeyBFocus(); 677 mMonthView->setKeyBFocus();
678 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 678 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
679} 679}
680 680
681void KOViewManager::showMonth( const QDate & date ) 681void KOViewManager::showMonth( const QDate & date )
682{ 682{
683 mMainView->dateNavigator()->blockSignals( true ); 683 mMainView->dateNavigator()->blockSignals( true );
684 mMainView->dateNavigator()->selectDate( date ); 684 mMainView->dateNavigator()->selectDate( date );
685 mMainView->dateNavigator()->blockSignals( false ); 685 mMainView->dateNavigator()->blockSignals( false );
686 showMonthView(); 686 showMonthView();
687} 687}
688void KOViewManager::showMonthView() 688void KOViewManager::showMonthView()
689 { 689 {
690 690
691 createMonthView(); 691 createMonthView();
692 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 692 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
693 globalFlagBlockAgenda = 1; 693 globalFlagBlockAgenda = 1;
694 //mFlagShowNextxDays = false; 694 //mFlagShowNextxDays = false;
695 bool full = true; 695 bool full = true;
696 if ( mCurrentView == mMonthView) 696 if ( mCurrentView == mMonthView)
697 full = mMainView->leftFrame()->isVisible(); 697 full = mMainView->leftFrame()->isVisible();
698 // if(mMonthView == mCurrentView) return; 698 // if(mMonthView == mCurrentView) return;
699 if ( KOPrefs::instance()->mMonthViewWeek ) { 699 if ( KOPrefs::instance()->mMonthViewWeek ) {
700 mMonthView->switchView(); 700 mMonthView->switchView();
701 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 701 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
702 full = false; 702 full = false;
703 else 703 else
704 full = true; 704 full = true;
705 } 705 }
706 mMainView->dateNavigator()->selectMonth(); 706 mMainView->dateNavigator()->selectMonth();
707 707
708 showView(mMonthView, full ); 708 showView(mMonthView, full );
709 mMonthView->setKeyBFocus(); 709 mMonthView->setKeyBFocus();
710 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 710 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
711 711
712} 712}
713 713
714void KOViewManager::showTodoView() 714void KOViewManager::showTodoView()
715{ 715{
716 //mFlagShowNextxDays = false; 716 //mFlagShowNextxDays = false;
717 if ( !mTodoView ) { 717 if ( !mTodoView ) {
718 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 718 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
719 "KOViewManager::TodoView" ); 719 "KOViewManager::TodoView" );
720 720
721 addView( mTodoView ); 721 addView( mTodoView );
722 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 722 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
723 723
724 // SIGNALS/SLOTS FOR TODO VIEW 724 // SIGNALS/SLOTS FOR TODO VIEW
725 connect( mTodoView, SIGNAL( newTodoSignal() ), 725 connect( mTodoView, SIGNAL( newTodoSignal() ),
726 mMainView, SLOT( newTodo() ) ); 726 mMainView, SLOT( newTodo() ) );
727 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 727 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
728 mMainView, SLOT( newSubTodo( Todo *) ) ); 728 mMainView, SLOT( newSubTodo( Todo *) ) );
729 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 729 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
730 mMainView, SLOT( showTodo( Todo * ) ) ); 730 mMainView, SLOT( showTodo( Todo * ) ) );
731 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 731 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
732 mMainView, SLOT( editTodo( Todo * ) ) ); 732 mMainView, SLOT( editTodo( Todo * ) ) );
733 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 733 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
734 mMainView, SLOT( deleteTodo( Todo * ) ) ); 734 mMainView, SLOT( deleteTodo( Todo * ) ) );
735 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 735 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
736 mMainView, SLOT( purgeCompleted() ) ); 736 mMainView, SLOT( purgeCompleted() ) );
737 737
738 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 738 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
739 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 739 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
740 740
741 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 741 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
742 SLOT( updateConfig() ) ); 742 SLOT( updateConfig() ) );
743 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 743 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
744 SLOT( updateTodo( Todo *, int ) ) ); 744 SLOT( updateTodo( Todo *, int ) ) );
745 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 745 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
746 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 746 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
747 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 747 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
748 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 748 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
749 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 749 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
750 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 750 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
751 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 751 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
752 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 752 mMainView, SLOT ( todo_unsub( Todo * ) ) );
753 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 753 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
754 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 754 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
755 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 755 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
756 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 756 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
757 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 757 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
758 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 758 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
759 KConfig *config = KOGlobals::config(); 759 KConfig *config = KOGlobals::config();
760 mTodoView->restoreLayout(config,"Todo View"); 760 mTodoView->restoreLayout(config,"Todo View");
761 mTodoView->setNavigator( mMainView->dateNavigator() ); 761 mTodoView->setNavigator( mMainView->dateNavigator() );
762 } 762 }
763 763
764 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 764 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
765 globalFlagBlockAgenda = 1; 765 globalFlagBlockAgenda = 1;
766 showView( mTodoView, true ); 766 showView( mTodoView, true );
767 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 767 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
768 768
769} 769}
770 770
771void KOViewManager::showJournalView() 771void KOViewManager::showJournalView()
772{ 772{
773 //mFlagShowNextxDays = false; 773 //mFlagShowNextxDays = false;
774 if (!mJournalView) { 774 if (!mJournalView) {
775 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 775 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
776 "KOViewManager::JournalView"); 776 "KOViewManager::JournalView");
777 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 777 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
778 SLOT( updateConfig() ) ); 778 SLOT( updateConfig() ) );
779 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 779 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
780 addView(mJournalView); 780 addView(mJournalView);
781 } 781 }
782 782
783 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 783 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
784 showView(mJournalView); 784 showView(mJournalView);
785 mMainView->dateNavigator()->selectDates( 1 ); 785 mMainView->dateNavigator()->selectDates( 1 );
786 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 786 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
787} 787}
788 788
789void KOViewManager::showTimeSpanView() 789void KOViewManager::showTimeSpanView()
790{ 790{
791 //mFlagShowNextxDays = false; 791 //mFlagShowNextxDays = false;
792 if (!mTimeSpanView) { 792 if (!mTimeSpanView) {
793 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 793 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
794 "KOViewManager::TimeSpanView"); 794 "KOViewManager::TimeSpanView");
795 addView(mTimeSpanView); 795 addView(mTimeSpanView);
796 796
797 mTimeSpanView->readSettings(); 797 mTimeSpanView->readSettings();
798 } 798 }
799 799
800 showView(mTimeSpanView); 800 showView(mTimeSpanView);
801} 801}
802 802
803Incidence *KOViewManager::currentSelection() 803Incidence *KOViewManager::currentSelection()
804{ 804{
805 if (!mCurrentView) return 0; 805 if (!mCurrentView) return 0;
806 if ( mCurrentView == mListView ) { 806 if ( mCurrentView == mListView ) {
807 if ( mListView->currentItem() ) 807 if ( mListView->currentItem() )
808 return mListView->currentItem(); 808 return mListView->currentItem();
809 } 809 }
810 return mCurrentView->selectedIncidences().first(); 810 return mCurrentView->selectedIncidences().first();
811} 811}
812 812
813QDate KOViewManager::currentSelectionDate() 813QDate KOViewManager::currentSelectionDate()
814{ 814{
815 QDate qd; 815 QDate qd;
816 if (mCurrentView) { 816 if (mCurrentView) {
817 DateList qvl = mCurrentView->selectedDates(); 817 DateList qvl = mCurrentView->selectedDates();
818 if (!qvl.isEmpty()) qd = qvl.first(); 818 if (!qvl.isEmpty()) qd = qvl.first();
819 } 819 }
820 return qd; 820 return qd;
821} 821}
822 822
823void KOViewManager::addView(KOrg::BaseView *view) 823void KOViewManager::addView(KOrg::BaseView *view)
824{ 824{
825#if QT_VERSION >= 0x030000 825#if QT_VERSION >= 0x030000
826 mMainView->viewStack()->addWidget( view ); 826 mMainView->viewStack()->addWidget( view );
827#else 827#else
828 mMainView->viewStack()->addWidget( view, 1 ); 828 mMainView->viewStack()->addWidget( view, 1 );
829#endif 829#endif
830} 830}
831 831
832void KOViewManager::setDocumentId( const QString &id ) 832void KOViewManager::setDocumentId( const QString &id )
833{ 833{
834 if (mTodoView) mTodoView->setDocumentId( id ); 834 if (mTodoView) {
835 mTodoView->clearList();
836 mTodoView->setDocumentId( id );
837 }
835} 838}