author | zautrix <zautrix> | 2005-05-25 09:43:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-05-25 09:43:34 (UTC) |
commit | ce9b826d7c0d9249751f8fb7b791c3757aff3c39 (patch) (unidiff) | |
tree | 719bc7dea987d15c1ee38de58c5b2902c8e0a5ab | |
parent | 75c935404e0a803b7d39dd0cf4d83d4d6cd07da2 (diff) | |
download | kdepimpi-ce9b826d7c0d9249751f8fb7b791c3757aff3c39.zip kdepimpi-ce9b826d7c0d9249751f8fb7b791c3757aff3c39.tar.gz kdepimpi-ce9b826d7c0d9249751f8fb7b791c3757aff3c39.tar.bz2 |
fix
-rw-r--r-- | korganizer/calendarview.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a8ad467..503ef12 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,520 +1,520 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preston.brown@yale.edu) | 8 | Preston Brown (preton.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "datenavigatorcontainer.h" | 110 | #include "datenavigatorcontainer.h" |
111 | #include "statusdialog.h" | 111 | #include "statusdialog.h" |
112 | #include "kdatenavigator.h" | 112 | #include "kdatenavigator.h" |
113 | #include "kotodoview.h" | 113 | #include "kotodoview.h" |
114 | #include "datenavigator.h" | 114 | #include "datenavigator.h" |
115 | #include "resourceview.h" | 115 | #include "resourceview.h" |
116 | #include "navigatorbar.h" | 116 | #include "navigatorbar.h" |
117 | #include "searchdialog.h" | 117 | #include "searchdialog.h" |
118 | #include "mainwindow.h" | 118 | #include "mainwindow.h" |
119 | 119 | ||
120 | #include "calendarview.h" | 120 | #include "calendarview.h" |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | #include <qtopia/alarmserver.h> | 122 | #include <qtopia/alarmserver.h> |
123 | #endif | 123 | #endif |
124 | #ifndef _WIN32_ | 124 | #ifndef _WIN32_ |
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | class KOBeamPrefs : public QDialog | 142 | class KOBeamPrefs : public QDialog |
143 | { | 143 | { |
144 | public: | 144 | public: |
145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
146 | QDialog( parent, name, true ) | 146 | QDialog( parent, name, true ) |
147 | { | 147 | { |
148 | setCaption( i18n("Beam Options") ); | 148 | setCaption( i18n("Beam Options") ); |
149 | QVBoxLayout* lay = new QVBoxLayout( this ); | 149 | QVBoxLayout* lay = new QVBoxLayout( this ); |
150 | lay->setSpacing( 3 ); | 150 | lay->setSpacing( 3 ); |
151 | lay->setMargin( 3 ); | 151 | lay->setMargin( 3 ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
153 | lay->addWidget( format ); | 153 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 154 | format->setExclusive ( true ) ; |
155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
156 | lay->addWidget( time ); time->setExclusive ( true ) ; | 156 | lay->addWidget( time ); time->setExclusive ( true ) ; |
157 | vcal = new QRadioButton(" vCalendar ", format ); | 157 | vcal = new QRadioButton(" vCalendar ", format ); |
158 | ical = new QRadioButton(" iCalendar ", format ); | 158 | ical = new QRadioButton(" iCalendar ", format ); |
159 | vcal->setChecked( true ); | 159 | vcal->setChecked( true ); |
160 | tz = new QRadioButton(i18n(" With timezone "), time ); | 160 | tz = new QRadioButton(i18n(" With timezone "), time ); |
161 | local = new QRadioButton(i18n(" Local time "), time ); | 161 | local = new QRadioButton(i18n(" Local time "), time ); |
162 | tz->setChecked( true ); | 162 | tz->setChecked( true ); |
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 164 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 166 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 169 | resize( 200, 200 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 172 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 173 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 174 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 176 | }; |
177 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
178 | { | 178 | { |
179 | public: | 179 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
182 | { | 182 | { |
183 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
202 | } | 202 | } |
203 | 203 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 205 | private: |
206 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 211 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 212 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 213 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 214 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 215 | mResourceManager( calendar->resourceManager() ) |
216 | { | 216 | { |
217 | 217 | ||
218 | mEventEditor = 0; | 218 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 219 | mTodoEditor = 0; |
220 | 220 | ||
221 | init(); | 221 | init(); |
222 | } | 222 | } |
223 | 223 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 224 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 225 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 226 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 227 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 228 | mResourceManager( 0 ) |
229 | { | 229 | { |
230 | 230 | ||
231 | mEventEditor = 0; | 231 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 232 | mTodoEditor = 0; |
233 | init(); | 233 | init(); |
234 | } | 234 | } |
235 | 235 | ||
236 | void CalendarView::init() | 236 | void CalendarView::init() |
237 | { | 237 | { |
238 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 238 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
239 | setFocusPolicy ( NoFocus ); | 239 | setFocusPolicy ( NoFocus ); |
240 | mViewerCallerIsSearchDialog = false; | 240 | mViewerCallerIsSearchDialog = false; |
241 | mBlockShowDates = false; | 241 | mBlockShowDates = false; |
242 | beamDialog = new KOBeamPrefs(); | 242 | beamDialog = new KOBeamPrefs(); |
243 | mDatePickerMode = 0; | 243 | mDatePickerMode = 0; |
244 | mCurrentSyncDevice = ""; | 244 | mCurrentSyncDevice = ""; |
245 | writeLocale(); | 245 | writeLocale(); |
246 | mViewManager = new KOViewManager( this ); | 246 | mViewManager = new KOViewManager( this ); |
247 | mDialogManager = new KODialogManager( this ); | 247 | mDialogManager = new KODialogManager( this ); |
248 | mEventViewerDialog = 0; | 248 | mEventViewerDialog = 0; |
249 | mModified = false; | 249 | mModified = false; |
250 | mReadOnly = false; | 250 | mReadOnly = false; |
251 | mSelectedIncidence = 0; | 251 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 252 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 253 | mFilters.setAutoDelete(true); |
254 | 254 | ||
255 | mCalendar->registerObserver( this ); | 255 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 256 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 257 | ||
258 | mStorage = new FileStorage( mCalendar ); | 258 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 260 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 262 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 263 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 265 | topLayout->addWidget(mPanner); |
266 | 266 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 268 | "CalendarView::LeftFrame"); |
269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
270 | 270 | ||
271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
272 | "CalendarView::DateNavigator" ); | 272 | "CalendarView::DateNavigator" ); |
273 | 273 | ||
274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
276 | mTodoList->setNavigator( mNavigator ); | 276 | mTodoList->setNavigator( mNavigator ); |
277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
278 | 278 | ||
279 | #ifdef KORG_NORESOURCEVIEW | 279 | #ifdef KORG_NORESOURCEVIEW |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | #else | 281 | #else |
282 | if ( mResourceManager ) { | 282 | if ( mResourceManager ) { |
283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
284 | mResourceView->updateView(); | 284 | mResourceView->updateView(); |
285 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 285 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
286 | SLOT( updateView() ) ); | 286 | SLOT( updateView() ) ); |
287 | } else { | 287 | } else { |
288 | mResourceView = 0; | 288 | mResourceView = 0; |
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | QWidget *rightBox = new QWidget( mPanner ); | 291 | QWidget *rightBox = new QWidget( mPanner ); |
292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
293 | 293 | ||
294 | mRightFrame = new QWidgetStack( rightBox ); | 294 | mRightFrame = new QWidgetStack( rightBox ); |
295 | rightLayout->addWidget( mRightFrame, 1 ); | 295 | rightLayout->addWidget( mRightFrame, 1 ); |
296 | 296 | ||
297 | mLeftFrame = mLeftSplitter; | 297 | mLeftFrame = mLeftSplitter; |
298 | #else | 298 | #else |
299 | //QWidget *mainBox = new QWidget( this ); | 299 | //QWidget *mainBox = new QWidget( this ); |
300 | //QWidget *leftFrame = new QWidget( mainBox ); | 300 | //QWidget *leftFrame = new QWidget( mainBox ); |
301 | //QBoxLayout * mainBoxLayout; | 301 | //QBoxLayout * mainBoxLayout; |
302 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
303 | //mainBoxLayout = new QVBoxLayout(mainBox); | 303 | //mainBoxLayout = new QVBoxLayout(mainBox); |
304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
309 | } else { | 309 | } else { |
310 | //mainBoxLayout = new QHBoxLayout(mainBox); | 310 | //mainBoxLayout = new QHBoxLayout(mainBox); |
311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
316 | } | 316 | } |
317 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 317 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
318 | //QBoxLayout * leftFrameLayout; | 318 | //QBoxLayout * leftFrameLayout; |
319 | topLayout->addWidget( mMainFrame ); | 319 | topLayout->addWidget( mMainFrame ); |
320 | //mainBoxLayout->addWidget (mLeftFrame); | 320 | //mainBoxLayout->addWidget (mLeftFrame); |
321 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 321 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
322 | "CalendarView::DateNavigator" ); | 322 | "CalendarView::DateNavigator" ); |
323 | #if 0 | 323 | #if 0 |
324 | // FIXME | 324 | // FIXME |
325 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 325 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
326 | "CalendarView::DateNavigator", QDate::currentDate()); | 326 | "CalendarView::DateNavigator", QDate::currentDate()); |
327 | #endif | 327 | #endif |
328 | // mDateNavigator->blockSignals( true ); | 328 | // mDateNavigator->blockSignals( true ); |
329 | //leftFrameLayout->addWidget( mDateNavigator ); | 329 | //leftFrameLayout->addWidget( mDateNavigator ); |
330 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 330 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
331 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 331 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
332 | mTodoList->setNavigator( mNavigator ); | 332 | mTodoList->setNavigator( mNavigator ); |
333 | #if 0 | 333 | #if 0 |
334 | if ( QApplication::desktop()->width() < 480 ) { | 334 | if ( QApplication::desktop()->width() < 480 ) { |
335 | leftFrameLayout->addWidget(mFilterView); | 335 | leftFrameLayout->addWidget(mFilterView); |
336 | leftFrameLayout->addWidget(mTodoList, 2 ); | 336 | leftFrameLayout->addWidget(mTodoList, 2 ); |
337 | 337 | ||
338 | } else { | 338 | } else { |
339 | leftFrameLayout->addWidget(mTodoList,2 ); | 339 | leftFrameLayout->addWidget(mTodoList,2 ); |
340 | leftFrameLayout->addWidget(mFilterView ); | 340 | leftFrameLayout->addWidget(mFilterView ); |
341 | } | 341 | } |
342 | #endif | 342 | #endif |
343 | mFilterView->hide(); | 343 | mFilterView->hide(); |
344 | QWidget *rightBox = new QWidget( mMainFrame ); | 344 | QWidget *rightBox = new QWidget( mMainFrame ); |
345 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 345 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
346 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 346 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
347 | mRightFrame = new QWidgetStack( rightBox ); | 347 | mRightFrame = new QWidgetStack( rightBox ); |
348 | rightLayout->addWidget( mRightFrame, 10 ); | 348 | rightLayout->addWidget( mRightFrame, 10 ); |
349 | 349 | ||
350 | //mLeftFrame = (QWidget *)leftFrame; | 350 | //mLeftFrame = (QWidget *)leftFrame; |
351 | if ( KOPrefs::instance()->mVerticalScreen ) { | 351 | if ( KOPrefs::instance()->mVerticalScreen ) { |
352 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 352 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
353 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 353 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
354 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 354 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
355 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 355 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
356 | } else { | 356 | } else { |
357 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 357 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
358 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 358 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
359 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 359 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
360 | } | 360 | } |
361 | if ( !KOPrefs::instance()->mShowDateNavigator) | 361 | if ( !KOPrefs::instance()->mShowDateNavigator) |
362 | mDateNavigator->hide(); | 362 | mDateNavigator->hide(); |
363 | //qDebug("Calendarview Size %d %d ", width(), height()); | 363 | //qDebug("Calendarview Size %d %d ", width(), height()); |
364 | #endif | 364 | #endif |
365 | 365 | ||
366 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 366 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
367 | SLOT( showDates( const KCal::DateList & ) ) ); | 367 | SLOT( showDates( const KCal::DateList & ) ) ); |
368 | 368 | ||
369 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 369 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
370 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 370 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 374 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
375 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 375 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
376 | 376 | ||
377 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 377 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
378 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 378 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
379 | 379 | ||
380 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 380 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
381 | mNavigator, SLOT( selectPreviousYear() ) ); | 381 | mNavigator, SLOT( selectPreviousYear() ) ); |
382 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 382 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
383 | mNavigator, SLOT( selectNextYear() ) ); | 383 | mNavigator, SLOT( selectNextYear() ) ); |
384 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 384 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
385 | mNavigator, SLOT( selectPreviousMonth() ) ); | 385 | mNavigator, SLOT( selectPreviousMonth() ) ); |
386 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 386 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
387 | mNavigator, SLOT( selectNextMonth() ) ); | 387 | mNavigator, SLOT( selectNextMonth() ) ); |
388 | 388 | ||
389 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 389 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
390 | mNavigator, SLOT( selectPrevious() ) ); | 390 | mNavigator, SLOT( selectPrevious() ) ); |
391 | connect( mDateNavigator, SIGNAL( goNext() ), | 391 | connect( mDateNavigator, SIGNAL( goNext() ), |
392 | mNavigator, SLOT( selectNext() ) ); | 392 | mNavigator, SLOT( selectNext() ) ); |
393 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 393 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
394 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 394 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
395 | 395 | ||
396 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 396 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
397 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 397 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
398 | #if 0 | 398 | #if 0 |
399 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 399 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
400 | SLOT( incidenceAdded( Incidence *) ) ); | 400 | SLOT( incidenceAdded( Incidence *) ) ); |
401 | #endif | 401 | #endif |
402 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 402 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
403 | 403 | ||
404 | connect( this, SIGNAL( configChanged() ), | 404 | connect( this, SIGNAL( configChanged() ), |
405 | mDateNavigator, SLOT( updateConfig() ) ); | 405 | mDateNavigator, SLOT( updateConfig() ) ); |
406 | 406 | ||
407 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 407 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
408 | SLOT( newTodo() ) ); | 408 | SLOT( newTodo() ) ); |
409 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 409 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
410 | SLOT( newSubTodo( Todo * ) ) ); | 410 | SLOT( newSubTodo( Todo * ) ) ); |
411 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 411 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
412 | SLOT( editTodo( Todo * ) ) ); | 412 | SLOT( editTodo( Todo * ) ) ); |
413 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 413 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
414 | SLOT( showTodo( Todo *) ) ); | 414 | SLOT( showTodo( Todo *) ) ); |
415 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 415 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
416 | SLOT( deleteTodo( Todo *) ) ); | 416 | SLOT( deleteTodo( Todo *) ) ); |
417 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 417 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
418 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 418 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
419 | SLOT( purgeCompleted() ) ); | 419 | SLOT( purgeCompleted() ) ); |
420 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 420 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
421 | SIGNAL( todoModified( Todo *, int ) ) ); | 421 | SIGNAL( todoModified( Todo *, int ) ) ); |
422 | 422 | ||
423 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 423 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
424 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 424 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
425 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 425 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
426 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 426 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
427 | 427 | ||
428 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 428 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
429 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 429 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
430 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 430 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
431 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 431 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
432 | 432 | ||
433 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 433 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
434 | this, SLOT ( todo_unsub( Todo * ) ) ); | 434 | this, SLOT ( todo_unsub( Todo * ) ) ); |
435 | 435 | ||
436 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 436 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
437 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 437 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
438 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 438 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
439 | SLOT( updateTodo( Todo *, int ) ) ); | 439 | SLOT( updateTodo( Todo *, int ) ) ); |
440 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 440 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
441 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 441 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
442 | 442 | ||
443 | 443 | ||
444 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 444 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
445 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 445 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
446 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 446 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
447 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 447 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | 451 | ||
452 | 452 | ||
453 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 453 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
454 | SLOT(checkClipboard())); | 454 | SLOT(checkClipboard())); |
455 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 455 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
456 | SLOT( processTodoListSelection( Incidence * ) ) ); | 456 | SLOT( processTodoListSelection( Incidence * ) ) ); |
457 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 457 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
458 | 458 | ||
459 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 459 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
460 | 460 | ||
461 | mDateFrame = new QVBox(0,0,WType_Popup); | 461 | mDateFrame = new QVBox(0,0,WType_Popup); |
462 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 462 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
463 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 463 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
464 | mDateFrame->setLineWidth(3); | 464 | mDateFrame->setLineWidth(3); |
465 | mDateFrame->hide(); | 465 | mDateFrame->hide(); |
466 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 466 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
467 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 467 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
468 | 468 | ||
469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
470 | 470 | ||
471 | mEventEditor = mDialogManager->getEventEditor(); | 471 | mEventEditor = mDialogManager->getEventEditor(); |
472 | mTodoEditor = mDialogManager->getTodoEditor(); | 472 | mTodoEditor = mDialogManager->getTodoEditor(); |
473 | 473 | ||
474 | mFlagEditDescription = false; | 474 | mFlagEditDescription = false; |
475 | 475 | ||
476 | mSuspendTimer = new QTimer( this ); | 476 | mSuspendTimer = new QTimer( this ); |
477 | mAlarmTimer = new QTimer( this ); | 477 | mAlarmTimer = new QTimer( this ); |
478 | mRecheckAlarmTimer = new QTimer( this ); | 478 | mRecheckAlarmTimer = new QTimer( this ); |
479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
482 | mAlarmDialog = new AlarmDialog( this ); | 482 | mAlarmDialog = new AlarmDialog( this ); |
483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
484 | mAlarmDialog->setServerNotification( false ); | 484 | mAlarmDialog->setServerNotification( false ); |
485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
486 | 486 | ||
487 | 487 | ||
488 | #ifndef DESKTOP_VERSION | 488 | #ifndef DESKTOP_VERSION |
489 | //US listen for arriving address resultsets | 489 | //US listen for arriving address resultsets |
490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
492 | #endif | 492 | #endif |
493 | mDateNavigator->setCalendar( mCalendar ); | 493 | mDateNavigator->setCalendar( mCalendar ); |
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | CalendarView::~CalendarView() | 497 | CalendarView::~CalendarView() |
498 | { | 498 | { |
499 | // kdDebug() << "~CalendarView()" << endl; | 499 | // kdDebug() << "~CalendarView()" << endl; |
500 | //qDebug("CalendarView::~CalendarView() "); | 500 | //qDebug("CalendarView::~CalendarView() "); |
501 | delete mDialogManager; | 501 | delete mDialogManager; |
502 | delete mViewManager; | 502 | delete mViewManager; |
503 | delete mStorage; | 503 | delete mStorage; |
504 | delete mDateFrame ; | 504 | delete mDateFrame ; |
505 | delete beamDialog; | 505 | delete beamDialog; |
506 | delete mEventViewerDialog; | 506 | delete mEventViewerDialog; |
507 | //kdDebug() << "~CalendarView() done" << endl; | 507 | //kdDebug() << "~CalendarView() done" << endl; |
508 | } | 508 | } |
509 | 509 | ||
510 | void CalendarView::showDay( QDate d ) | 510 | void CalendarView::showDay( QDate d ) |
511 | { | 511 | { |
512 | dateNavigator()->blockSignals( true ); | 512 | dateNavigator()->blockSignals( true ); |
513 | dateNavigator()->selectDate( d ); | 513 | dateNavigator()->selectDate( d ); |
514 | dateNavigator()->blockSignals( false ); | 514 | dateNavigator()->blockSignals( false ); |
515 | mViewManager->showDayView(); | 515 | mViewManager->showDayView(); |
516 | //dateNavigator()->selectDate( d ); | 516 | //dateNavigator()->selectDate( d ); |
517 | } | 517 | } |
518 | void CalendarView::timerAlarm() | 518 | void CalendarView::timerAlarm() |
519 | { | 519 | { |
520 | //qDebug("CalendarView::timerAlarm() "); | 520 | //qDebug("CalendarView::timerAlarm() "); |
@@ -1150,1026 +1150,1027 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 | ||
1281 | void CalendarView::setSyncDevice( QString s ) | 1281 | void CalendarView::setSyncDevice( QString s ) |
1282 | { | 1282 | { |
1283 | mCurrentSyncDevice= s; | 1283 | mCurrentSyncDevice= s; |
1284 | } | 1284 | } |
1285 | void CalendarView::setSyncName( QString s ) | 1285 | void CalendarView::setSyncName( QString s ) |
1286 | { | 1286 | { |
1287 | mCurrentSyncName= s; | 1287 | mCurrentSyncName= s; |
1288 | } | 1288 | } |
1289 | bool CalendarView::syncCalendar(QString filename, int mode) | 1289 | bool 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 | ||
1319 | void CalendarView::syncExternal( int mode ) | 1319 | void 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 | ||
1408 | bool CalendarView::importBday() | 1408 | bool 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 |
1467 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1467 | void 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 | ||
1546 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1546 | bool 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 | } |
1577 | bool CalendarView::importQtopia( const QString &categories, | 1577 | bool 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 | ||
1637 | void CalendarView::setSyncEventsReadOnly() | 1637 | void 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 | } |
1648 | bool CalendarView::openCalendar(QString filename, bool merge) | 1648 | bool 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) { | 1661 | if (!merge) { |
1662 | mCalendar->close(); | ||
1663 | mTodoList->clearList(); | 1662 | mTodoList->clearList(); |
1663 | mViewManager->setDocumentId( filename ); | ||
1664 | mCalendar->close(); | ||
1664 | } | 1665 | } |
1665 | mStorage->setFileName( filename ); | 1666 | mStorage->setFileName( filename ); |
1666 | 1667 | ||
1667 | if ( mStorage->load() ) { | 1668 | if ( mStorage->load() ) { |
1668 | if ( merge ) ;//setModified( true ); | 1669 | if ( merge ) ;//setModified( true ); |
1669 | else { | 1670 | else { |
1670 | //setModified( true ); | 1671 | //setModified( true ); |
1671 | mViewManager->setDocumentId( filename ); | 1672 | mViewManager->setDocumentId( filename ); |
1672 | mDialogManager->setDocumentId( filename ); | 1673 | mDialogManager->setDocumentId( filename ); |
1673 | mTodoList->setDocumentId( filename ); | 1674 | mTodoList->setDocumentId( filename ); |
1674 | } | 1675 | } |
1675 | globalFlagBlockAgenda = 2; | 1676 | globalFlagBlockAgenda = 2; |
1676 | // if ( getLastSyncEvent() ) | 1677 | // if ( getLastSyncEvent() ) |
1677 | // getLastSyncEvent()->setReadOnly( true ); | 1678 | // getLastSyncEvent()->setReadOnly( true ); |
1678 | mCalendar->reInitAlarmSettings(); | 1679 | mCalendar->reInitAlarmSettings(); |
1679 | setSyncEventsReadOnly(); | 1680 | setSyncEventsReadOnly(); |
1680 | updateUnmanagedViews(); | 1681 | updateUnmanagedViews(); |
1681 | updateView(); | 1682 | updateView(); |
1682 | if ( filename != MainWindow::defaultFileName() ) { | 1683 | if ( filename != MainWindow::defaultFileName() ) { |
1683 | saveCalendar( MainWindow::defaultFileName() ); | 1684 | saveCalendar( MainWindow::defaultFileName() ); |
1684 | } else { | 1685 | } else { |
1685 | QFileInfo finf ( MainWindow::defaultFileName()); | 1686 | QFileInfo finf ( MainWindow::defaultFileName()); |
1686 | if ( finf.exists() ) { | 1687 | if ( finf.exists() ) { |
1687 | setLoadedFileVersion( finf.lastModified () ); | 1688 | setLoadedFileVersion( finf.lastModified () ); |
1688 | } | 1689 | } |
1689 | } | 1690 | } |
1690 | return true; | 1691 | return true; |
1691 | } else { | 1692 | } else { |
1692 | // while failing to load, the calendar object could | 1693 | // while failing to load, the calendar object could |
1693 | // have become partially populated. Clear it out. | 1694 | // have become partially populated. Clear it out. |
1694 | if ( !merge ) { | 1695 | if ( !merge ) { |
1695 | mCalendar->close(); | 1696 | mCalendar->close(); |
1696 | mViewManager->setDocumentId( filename ); | 1697 | mViewManager->setDocumentId( filename ); |
1697 | mDialogManager->setDocumentId( filename ); | 1698 | mDialogManager->setDocumentId( filename ); |
1698 | mTodoList->setDocumentId( filename ); | 1699 | mTodoList->setDocumentId( filename ); |
1699 | } | 1700 | } |
1700 | 1701 | ||
1701 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1702 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1702 | 1703 | ||
1703 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1704 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1704 | globalFlagBlockAgenda = 2; | 1705 | globalFlagBlockAgenda = 2; |
1705 | mCalendar->reInitAlarmSettings(); | 1706 | mCalendar->reInitAlarmSettings(); |
1706 | setSyncEventsReadOnly(); | 1707 | setSyncEventsReadOnly(); |
1707 | updateUnmanagedViews(); | 1708 | updateUnmanagedViews(); |
1708 | updateView(); | 1709 | updateView(); |
1709 | } | 1710 | } |
1710 | return false; | 1711 | return false; |
1711 | } | 1712 | } |
1712 | void CalendarView::showOpenError() | 1713 | void CalendarView::showOpenError() |
1713 | { | 1714 | { |
1714 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1715 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1715 | } | 1716 | } |
1716 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1717 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1717 | { | 1718 | { |
1718 | loadedFileVersion = dt; | 1719 | loadedFileVersion = dt; |
1719 | } | 1720 | } |
1720 | bool CalendarView::checkFileChanged(QString fn) | 1721 | bool CalendarView::checkFileChanged(QString fn) |
1721 | { | 1722 | { |
1722 | QFileInfo finf ( fn ); | 1723 | QFileInfo finf ( fn ); |
1723 | if ( !finf.exists() ) | 1724 | if ( !finf.exists() ) |
1724 | return true; | 1725 | return true; |
1725 | QDateTime dt = finf.lastModified (); | 1726 | QDateTime dt = finf.lastModified (); |
1726 | if ( dt <= loadedFileVersion ) | 1727 | if ( dt <= loadedFileVersion ) |
1727 | return false; | 1728 | return false; |
1728 | return true; | 1729 | return true; |
1729 | 1730 | ||
1730 | } | 1731 | } |
1731 | void CalendarView::watchSavedFile() | 1732 | void CalendarView::watchSavedFile() |
1732 | { | 1733 | { |
1733 | QFileInfo finf ( MainWindow::defaultFileName()); | 1734 | QFileInfo finf ( MainWindow::defaultFileName()); |
1734 | if ( !finf.exists() ) | 1735 | if ( !finf.exists() ) |
1735 | return; | 1736 | return; |
1736 | QDateTime dt = finf.lastModified (); | 1737 | QDateTime dt = finf.lastModified (); |
1737 | if ( dt < loadedFileVersion ) { | 1738 | if ( dt < loadedFileVersion ) { |
1738 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1739 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1739 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1740 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1740 | return; | 1741 | return; |
1741 | } | 1742 | } |
1742 | loadedFileVersion = dt; | 1743 | loadedFileVersion = dt; |
1743 | } | 1744 | } |
1744 | 1745 | ||
1745 | bool CalendarView::checkFileVersion(QString fn) | 1746 | bool CalendarView::checkFileVersion(QString fn) |
1746 | { | 1747 | { |
1747 | QFileInfo finf ( fn ); | 1748 | QFileInfo finf ( fn ); |
1748 | if ( !finf.exists() ) | 1749 | if ( !finf.exists() ) |
1749 | return true; | 1750 | return true; |
1750 | QDateTime dt = finf.lastModified (); | 1751 | QDateTime dt = finf.lastModified (); |
1751 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1752 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1752 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1753 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1753 | if ( dt <= loadedFileVersion ) | 1754 | if ( dt <= loadedFileVersion ) |
1754 | return true; | 1755 | return 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)) , | 1756 | 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)) , |
1756 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1757 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1757 | i18n("Sync+save")); | 1758 | i18n("Sync+save")); |
1758 | 1759 | ||
1759 | if ( km == KMessageBox::Cancel ) | 1760 | if ( km == KMessageBox::Cancel ) |
1760 | return false; | 1761 | return false; |
1761 | if ( km == KMessageBox::Yes ) | 1762 | if ( km == KMessageBox::Yes ) |
1762 | return true; | 1763 | return true; |
1763 | 1764 | ||
1764 | setSyncDevice("deleteaftersync" ); | 1765 | setSyncDevice("deleteaftersync" ); |
1765 | mSyncManager->mAskForPreferences = true; | 1766 | mSyncManager->mAskForPreferences = true; |
1766 | mSyncManager->mSyncAlgoPrefs = 3; | 1767 | mSyncManager->mSyncAlgoPrefs = 3; |
1767 | mSyncManager->mWriteBackFile = false; | 1768 | mSyncManager->mWriteBackFile = false; |
1768 | mSyncManager->mWriteBackExistingOnly = false; | 1769 | mSyncManager->mWriteBackExistingOnly = false; |
1769 | mSyncManager->mShowSyncSummary = false; | 1770 | mSyncManager->mShowSyncSummary = false; |
1770 | syncCalendar( fn, 3 ); | 1771 | syncCalendar( fn, 3 ); |
1771 | Event * e = getLastSyncEvent(); | 1772 | Event * e = getLastSyncEvent(); |
1772 | mCalendar->deleteEvent ( e ); | 1773 | mCalendar->deleteEvent ( e ); |
1773 | updateView(); | 1774 | updateView(); |
1774 | return true; | 1775 | return true; |
1775 | } | 1776 | } |
1776 | 1777 | ||
1777 | bool CalendarView::saveCalendar( QString filename ) | 1778 | bool CalendarView::saveCalendar( QString filename ) |
1778 | { | 1779 | { |
1779 | 1780 | ||
1780 | // Store back all unsaved data into calendar object | 1781 | // Store back all unsaved data into calendar object |
1781 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1782 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1782 | if ( mViewManager->currentView() ) | 1783 | if ( mViewManager->currentView() ) |
1783 | mViewManager->currentView()->flushView(); | 1784 | mViewManager->currentView()->flushView(); |
1784 | 1785 | ||
1785 | 1786 | ||
1786 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1787 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1787 | mStorage->setSaveFormat( new ICalFormat() ); | 1788 | mStorage->setSaveFormat( new ICalFormat() ); |
1788 | mStorage->setFileName( filename ); | 1789 | mStorage->setFileName( filename ); |
1789 | bool success; | 1790 | bool success; |
1790 | success = mStorage->save(); | 1791 | success = mStorage->save(); |
1791 | if ( !success ) { | 1792 | if ( !success ) { |
1792 | return false; | 1793 | return false; |
1793 | } | 1794 | } |
1794 | if ( filename == MainWindow::defaultFileName() ) { | 1795 | if ( filename == MainWindow::defaultFileName() ) { |
1795 | setLoadedFileVersion( lfv ); | 1796 | setLoadedFileVersion( lfv ); |
1796 | watchSavedFile(); | 1797 | watchSavedFile(); |
1797 | } | 1798 | } |
1798 | return true; | 1799 | return true; |
1799 | } | 1800 | } |
1800 | 1801 | ||
1801 | void CalendarView::closeCalendar() | 1802 | void CalendarView::closeCalendar() |
1802 | { | 1803 | { |
1803 | 1804 | ||
1804 | // child windows no longer valid | 1805 | // child windows no longer valid |
1805 | emit closingDown(); | 1806 | emit closingDown(); |
1806 | 1807 | ||
1807 | mCalendar->close(); | 1808 | mCalendar->close(); |
1808 | setModified(false); | 1809 | setModified(false); |
1809 | updateView(); | 1810 | updateView(); |
1810 | } | 1811 | } |
1811 | 1812 | ||
1812 | void CalendarView::archiveCalendar() | 1813 | void CalendarView::archiveCalendar() |
1813 | { | 1814 | { |
1814 | mDialogManager->showArchiveDialog(); | 1815 | mDialogManager->showArchiveDialog(); |
1815 | } | 1816 | } |
1816 | 1817 | ||
1817 | 1818 | ||
1818 | void CalendarView::readSettings() | 1819 | void CalendarView::readSettings() |
1819 | { | 1820 | { |
1820 | 1821 | ||
1821 | 1822 | ||
1822 | // mViewManager->showAgendaView(); | 1823 | // mViewManager->showAgendaView(); |
1823 | QString str; | 1824 | QString str; |
1824 | //qDebug("CalendarView::readSettings() "); | 1825 | //qDebug("CalendarView::readSettings() "); |
1825 | // read settings from the KConfig, supplying reasonable | 1826 | // read settings from the KConfig, supplying reasonable |
1826 | // defaults where none are to be found | 1827 | // defaults where none are to be found |
1827 | KConfig *config = KOGlobals::config(); | 1828 | KConfig *config = KOGlobals::config(); |
1828 | #ifndef KORG_NOSPLITTER | 1829 | #ifndef KORG_NOSPLITTER |
1829 | config->setGroup("KOrganizer Geometry"); | 1830 | config->setGroup("KOrganizer Geometry"); |
1830 | 1831 | ||
1831 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1832 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1832 | if (sizes.count() != 2) { | 1833 | if (sizes.count() != 2) { |
1833 | sizes << mDateNavigator->minimumSizeHint().width(); | 1834 | sizes << mDateNavigator->minimumSizeHint().width(); |
1834 | sizes << 300; | 1835 | sizes << 300; |
1835 | } | 1836 | } |
1836 | mPanner->setSizes(sizes); | 1837 | mPanner->setSizes(sizes); |
1837 | 1838 | ||
1838 | sizes = config->readIntListEntry("Separator2"); | 1839 | sizes = config->readIntListEntry("Separator2"); |
1839 | if ( ( mResourceView && sizes.count() == 4 ) || | 1840 | if ( ( mResourceView && sizes.count() == 4 ) || |
1840 | ( !mResourceView && sizes.count() == 3 ) ) { | 1841 | ( !mResourceView && sizes.count() == 3 ) ) { |
1841 | mLeftSplitter->setSizes(sizes); | 1842 | mLeftSplitter->setSizes(sizes); |
1842 | } | 1843 | } |
1843 | #endif | 1844 | #endif |
1844 | globalFlagBlockAgenda = 1; | 1845 | globalFlagBlockAgenda = 1; |
1845 | mViewManager->showAgendaView(); | 1846 | mViewManager->showAgendaView(); |
1846 | //mViewManager->readSettings( config ); | 1847 | //mViewManager->readSettings( config ); |
1847 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1848 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1848 | readFilterSettings(config); | 1849 | readFilterSettings(config); |
1849 | 1850 | ||
1850 | #ifdef DESKTOP_VERSION | 1851 | #ifdef DESKTOP_VERSION |
1851 | config->setGroup("WidgetLayout"); | 1852 | config->setGroup("WidgetLayout"); |
1852 | QStringList list; | 1853 | QStringList list; |
1853 | list = config->readListEntry("MainLayout"); | 1854 | list = config->readListEntry("MainLayout"); |
1854 | int x,y,w,h; | 1855 | int x,y,w,h; |
1855 | if ( ! list.isEmpty() ) { | 1856 | if ( ! list.isEmpty() ) { |
1856 | x = list[0].toInt(); | 1857 | x = list[0].toInt(); |
1857 | y = list[1].toInt(); | 1858 | y = list[1].toInt(); |
1858 | w = list[2].toInt(); | 1859 | w = list[2].toInt(); |
1859 | h = list[3].toInt(); | 1860 | h = list[3].toInt(); |
1860 | KApplication::testCoords( &x,&y,&w,&h ); | 1861 | KApplication::testCoords( &x,&y,&w,&h ); |
1861 | topLevelWidget()->setGeometry(x,y,w,h); | 1862 | topLevelWidget()->setGeometry(x,y,w,h); |
1862 | 1863 | ||
1863 | } else { | 1864 | } else { |
1864 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1865 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1865 | } | 1866 | } |
1866 | list = config->readListEntry("EditEventLayout"); | 1867 | list = config->readListEntry("EditEventLayout"); |
1867 | if ( ! list.isEmpty() ) { | 1868 | if ( ! list.isEmpty() ) { |
1868 | x = list[0].toInt(); | 1869 | x = list[0].toInt(); |
1869 | y = list[1].toInt(); | 1870 | y = list[1].toInt(); |
1870 | w = list[2].toInt(); | 1871 | w = list[2].toInt(); |
1871 | h = list[3].toInt(); | 1872 | h = list[3].toInt(); |
1872 | KApplication::testCoords( &x,&y,&w,&h ); | 1873 | KApplication::testCoords( &x,&y,&w,&h ); |
1873 | mEventEditor->setGeometry(x,y,w,h); | 1874 | mEventEditor->setGeometry(x,y,w,h); |
1874 | 1875 | ||
1875 | } | 1876 | } |
1876 | list = config->readListEntry("EditTodoLayout"); | 1877 | list = config->readListEntry("EditTodoLayout"); |
1877 | if ( ! list.isEmpty() ) { | 1878 | if ( ! list.isEmpty() ) { |
1878 | x = list[0].toInt(); | 1879 | x = list[0].toInt(); |
1879 | y = list[1].toInt(); | 1880 | y = list[1].toInt(); |
1880 | w = list[2].toInt(); | 1881 | w = list[2].toInt(); |
1881 | h = list[3].toInt(); | 1882 | h = list[3].toInt(); |
1882 | KApplication::testCoords( &x,&y,&w,&h ); | 1883 | KApplication::testCoords( &x,&y,&w,&h ); |
1883 | mTodoEditor->setGeometry(x,y,w,h); | 1884 | mTodoEditor->setGeometry(x,y,w,h); |
1884 | 1885 | ||
1885 | } | 1886 | } |
1886 | list = config->readListEntry("ViewerLayout"); | 1887 | list = config->readListEntry("ViewerLayout"); |
1887 | if ( ! list.isEmpty() ) { | 1888 | if ( ! list.isEmpty() ) { |
1888 | x = list[0].toInt(); | 1889 | x = list[0].toInt(); |
1889 | y = list[1].toInt(); | 1890 | y = list[1].toInt(); |
1890 | w = list[2].toInt(); | 1891 | w = list[2].toInt(); |
1891 | h = list[3].toInt(); | 1892 | h = list[3].toInt(); |
1892 | KApplication::testCoords( &x,&y,&w,&h ); | 1893 | KApplication::testCoords( &x,&y,&w,&h ); |
1893 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1894 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1894 | } | 1895 | } |
1895 | #endif | 1896 | #endif |
1896 | config->setGroup( "Views" ); | 1897 | config->setGroup( "Views" ); |
1897 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1898 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1898 | 1899 | ||
1899 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1900 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1900 | 1901 | ||
1901 | int resetval = 0; | 1902 | int resetval = 0; |
1902 | int maxVal = 0; | 1903 | int maxVal = 0; |
1903 | if (sizes.count() != 3) { | 1904 | if (sizes.count() != 3) { |
1904 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1905 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1905 | resetval = mDateNavigator->sizeHint().width()+2; | 1906 | resetval = mDateNavigator->sizeHint().width()+2; |
1906 | } else { | 1907 | } else { |
1907 | resetval = mDateNavigator->sizeHint().height()+2; | 1908 | resetval = mDateNavigator->sizeHint().height()+2; |
1908 | } | 1909 | } |
1909 | } | 1910 | } |
1910 | if ( resetval ) { | 1911 | if ( resetval ) { |
1911 | sizes.clear(); | 1912 | sizes.clear(); |
1912 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1913 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1913 | maxVal = QApplication::desktop()->width() -10; | 1914 | maxVal = QApplication::desktop()->width() -10; |
1914 | } else { | 1915 | } else { |
1915 | maxVal = QApplication::desktop()->height()-10; | 1916 | maxVal = QApplication::desktop()->height()-10; |
1916 | } | 1917 | } |
1917 | sizes << resetval; | 1918 | sizes << resetval; |
1918 | if ( maxVal < resetval + resetval) | 1919 | if ( maxVal < resetval + resetval) |
1919 | resetval = maxVal - resetval; | 1920 | resetval = maxVal - resetval; |
1920 | sizes << resetval; | 1921 | sizes << resetval; |
1921 | sizes << 100; | 1922 | sizes << 100; |
1922 | } | 1923 | } |
1923 | mLeftFrame->setSizes(sizes); | 1924 | mLeftFrame->setSizes(sizes); |
1924 | sizes = config->readIntListEntry("Main Splitter Frame"); | 1925 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1925 | resetval = 0; | 1926 | resetval = 0; |
1926 | maxVal = 0; | 1927 | maxVal = 0; |
1927 | if (sizes.count() != 2) { | 1928 | if (sizes.count() != 2) { |
1928 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1929 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1929 | resetval = mDateNavigator->sizeHint().width()+2; | 1930 | resetval = mDateNavigator->sizeHint().width()+2; |
1930 | } else { | 1931 | } else { |
1931 | resetval = mDateNavigator->sizeHint().height()+2; | 1932 | resetval = mDateNavigator->sizeHint().height()+2; |
1932 | } | 1933 | } |
1933 | } | 1934 | } |
1934 | if ( resetval ) { | 1935 | if ( resetval ) { |
1935 | sizes.clear(); | 1936 | sizes.clear(); |
1936 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1937 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1937 | maxVal = QApplication::desktop()->width() -10; | 1938 | maxVal = QApplication::desktop()->width() -10; |
1938 | } else { | 1939 | } else { |
1939 | maxVal = QApplication::desktop()->height()-10; | 1940 | maxVal = QApplication::desktop()->height()-10; |
1940 | } | 1941 | } |
1941 | sizes << resetval; | 1942 | sizes << resetval; |
1942 | if ( maxVal < resetval + resetval) | 1943 | if ( maxVal < resetval + resetval) |
1943 | resetval = maxVal - resetval; | 1944 | resetval = maxVal - resetval; |
1944 | sizes << resetval; | 1945 | sizes << resetval; |
1945 | } | 1946 | } |
1946 | mMainFrame->setSizes(sizes); | 1947 | mMainFrame->setSizes(sizes); |
1947 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1948 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1948 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1949 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1949 | else mNavigator->selectDates( dateCount ); | 1950 | else mNavigator->selectDates( dateCount ); |
1950 | // mViewManager->readSettings( config ); | 1951 | // mViewManager->readSettings( config ); |
1951 | updateConfig(); | 1952 | updateConfig(); |
1952 | globalFlagBlockAgenda = 2; | 1953 | globalFlagBlockAgenda = 2; |
1953 | mViewManager->readSettings( config ); | 1954 | mViewManager->readSettings( config ); |
1954 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 1955 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
1955 | } | 1956 | } |
1956 | 1957 | ||
1957 | 1958 | ||
1958 | void CalendarView::writeSettings() | 1959 | void CalendarView::writeSettings() |
1959 | { | 1960 | { |
1960 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1961 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1961 | 1962 | ||
1962 | KConfig *config = KOGlobals::config(); | 1963 | KConfig *config = KOGlobals::config(); |
1963 | 1964 | ||
1964 | mViewManager->writeSettings( config ); | 1965 | mViewManager->writeSettings( config ); |
1965 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1966 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1966 | mDialogManager->writeSettings( config ); | 1967 | mDialogManager->writeSettings( config ); |
1967 | //KOPrefs::instance()->usrWriteConfig(); | 1968 | //KOPrefs::instance()->usrWriteConfig(); |
1968 | KOPrefs::instance()->writeConfig(); | 1969 | KOPrefs::instance()->writeConfig(); |
1969 | 1970 | ||
1970 | writeFilterSettings(config); | 1971 | writeFilterSettings(config); |
1971 | 1972 | ||
1972 | config->setGroup( "Views" ); | 1973 | config->setGroup( "Views" ); |
1973 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1974 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1974 | 1975 | ||
1975 | QValueList<int> listINT = mLeftFrame->sizes(); | 1976 | QValueList<int> listINT = mLeftFrame->sizes(); |
1976 | config->writeEntry("Left Splitter Frame",listINT); | 1977 | config->writeEntry("Left Splitter Frame",listINT); |
1977 | QValueList<int> listINT2 = mMainFrame->sizes(); | 1978 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1978 | config->writeEntry("Main Splitter Frame",listINT2); | 1979 | config->writeEntry("Main Splitter Frame",listINT2); |
1979 | #ifdef DESKTOP_VERSION | 1980 | #ifdef DESKTOP_VERSION |
1980 | config->setGroup("WidgetLayout"); | 1981 | config->setGroup("WidgetLayout"); |
1981 | QStringList list ;//= config->readListEntry("MainLayout"); | 1982 | QStringList list ;//= config->readListEntry("MainLayout"); |
1982 | int x,y,w,h; | 1983 | int x,y,w,h; |
1983 | QWidget* wid; | 1984 | QWidget* wid; |
1984 | wid = topLevelWidget(); | 1985 | wid = topLevelWidget(); |
1985 | x = wid->geometry().x(); | 1986 | x = wid->geometry().x(); |
1986 | y = wid->geometry().y(); | 1987 | y = wid->geometry().y(); |
1987 | w = wid->width(); | 1988 | w = wid->width(); |
1988 | h = wid->height(); | 1989 | h = wid->height(); |
1989 | list.clear(); | 1990 | list.clear(); |
1990 | list << QString::number( x ); | 1991 | list << QString::number( x ); |
1991 | list << QString::number( y ); | 1992 | list << QString::number( y ); |
1992 | list << QString::number( w ); | 1993 | list << QString::number( w ); |
1993 | list << QString::number( h ); | 1994 | list << QString::number( h ); |
1994 | config->writeEntry("MainLayout",list ); | 1995 | config->writeEntry("MainLayout",list ); |
1995 | 1996 | ||
1996 | wid = mEventEditor; | 1997 | wid = mEventEditor; |
1997 | x = wid->geometry().x(); | 1998 | x = wid->geometry().x(); |
1998 | y = wid->geometry().y(); | 1999 | y = wid->geometry().y(); |
1999 | w = wid->width(); | 2000 | w = wid->width(); |
2000 | h = wid->height(); | 2001 | h = wid->height(); |
2001 | list.clear(); | 2002 | list.clear(); |
2002 | list << QString::number( x ); | 2003 | list << QString::number( x ); |
2003 | list << QString::number( y ); | 2004 | list << QString::number( y ); |
2004 | list << QString::number( w ); | 2005 | list << QString::number( w ); |
2005 | list << QString::number( h ); | 2006 | list << QString::number( h ); |
2006 | config->writeEntry("EditEventLayout",list ); | 2007 | config->writeEntry("EditEventLayout",list ); |
2007 | 2008 | ||
2008 | wid = mTodoEditor; | 2009 | wid = mTodoEditor; |
2009 | x = wid->geometry().x(); | 2010 | x = wid->geometry().x(); |
2010 | y = wid->geometry().y(); | 2011 | y = wid->geometry().y(); |
2011 | w = wid->width(); | 2012 | w = wid->width(); |
2012 | h = wid->height(); | 2013 | h = wid->height(); |
2013 | list.clear(); | 2014 | list.clear(); |
2014 | list << QString::number( x ); | 2015 | list << QString::number( x ); |
2015 | list << QString::number( y ); | 2016 | list << QString::number( y ); |
2016 | list << QString::number( w ); | 2017 | list << QString::number( w ); |
2017 | list << QString::number( h ); | 2018 | list << QString::number( h ); |
2018 | config->writeEntry("EditTodoLayout",list ); | 2019 | config->writeEntry("EditTodoLayout",list ); |
2019 | wid = getEventViewerDialog(); | 2020 | wid = getEventViewerDialog(); |
2020 | x = wid->geometry().x(); | 2021 | x = wid->geometry().x(); |
2021 | y = wid->geometry().y(); | 2022 | y = wid->geometry().y(); |
2022 | w = wid->width(); | 2023 | w = wid->width(); |
2023 | h = wid->height(); | 2024 | h = wid->height(); |
2024 | list.clear(); | 2025 | list.clear(); |
2025 | list << QString::number( x ); | 2026 | list << QString::number( x ); |
2026 | list << QString::number( y ); | 2027 | list << QString::number( y ); |
2027 | list << QString::number( w ); | 2028 | list << QString::number( w ); |
2028 | list << QString::number( h ); | 2029 | list << QString::number( h ); |
2029 | config->writeEntry("ViewerLayout",list ); | 2030 | config->writeEntry("ViewerLayout",list ); |
2030 | wid = mDialogManager->getSearchDialog(); | 2031 | wid = mDialogManager->getSearchDialog(); |
2031 | if ( wid ) { | 2032 | if ( wid ) { |
2032 | x = wid->geometry().x(); | 2033 | x = wid->geometry().x(); |
2033 | y = wid->geometry().y(); | 2034 | y = wid->geometry().y(); |
2034 | w = wid->width(); | 2035 | w = wid->width(); |
2035 | h = wid->height(); | 2036 | h = wid->height(); |
2036 | list.clear(); | 2037 | list.clear(); |
2037 | list << QString::number( x ); | 2038 | list << QString::number( x ); |
2038 | list << QString::number( y ); | 2039 | list << QString::number( y ); |
2039 | list << QString::number( w ); | 2040 | list << QString::number( w ); |
2040 | list << QString::number( h ); | 2041 | list << QString::number( h ); |
2041 | config->writeEntry("SearchLayout",list ); | 2042 | config->writeEntry("SearchLayout",list ); |
2042 | } | 2043 | } |
2043 | #endif | 2044 | #endif |
2044 | 2045 | ||
2045 | 2046 | ||
2046 | config->sync(); | 2047 | config->sync(); |
2047 | } | 2048 | } |
2048 | 2049 | ||
2049 | void CalendarView::readFilterSettings(KConfig *config) | 2050 | void CalendarView::readFilterSettings(KConfig *config) |
2050 | { | 2051 | { |
2051 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2052 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2052 | 2053 | ||
2053 | mFilters.clear(); | 2054 | mFilters.clear(); |
2054 | 2055 | ||
2055 | config->setGroup("General"); | 2056 | config->setGroup("General"); |
2056 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2057 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2057 | 2058 | ||
2058 | QStringList::ConstIterator it = filterList.begin(); | 2059 | QStringList::ConstIterator it = filterList.begin(); |
2059 | QStringList::ConstIterator end = filterList.end(); | 2060 | QStringList::ConstIterator end = filterList.end(); |
2060 | while(it != end) { | 2061 | while(it != end) { |
2061 | // kdDebug() << " filter: " << (*it) << endl; | 2062 | // kdDebug() << " filter: " << (*it) << endl; |
2062 | 2063 | ||
2063 | CalFilter *filter; | 2064 | CalFilter *filter; |
2064 | filter = new CalFilter(*it); | 2065 | filter = new CalFilter(*it); |
2065 | config->setGroup("Filter_" + (*it).utf8()); | 2066 | config->setGroup("Filter_" + (*it).utf8()); |
2066 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2067 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2067 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2068 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2068 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2069 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2069 | mFilters.append(filter); | 2070 | mFilters.append(filter); |
2070 | 2071 | ||
2071 | ++it; | 2072 | ++it; |
2072 | } | 2073 | } |
2073 | 2074 | ||
2074 | if (mFilters.count() == 0) { | 2075 | if (mFilters.count() == 0) { |
2075 | CalFilter *filter = new CalFilter(i18n("Default")); | 2076 | CalFilter *filter = new CalFilter(i18n("Default")); |
2076 | mFilters.append(filter); | 2077 | mFilters.append(filter); |
2077 | } | 2078 | } |
2078 | mFilterView->updateFilters(); | 2079 | mFilterView->updateFilters(); |
2079 | config->setGroup("FilterView"); | 2080 | config->setGroup("FilterView"); |
2080 | 2081 | ||
2081 | mFilterView->blockSignals(true); | 2082 | mFilterView->blockSignals(true); |
2082 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2083 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2083 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2084 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2084 | mFilterView->blockSignals(false); | 2085 | mFilterView->blockSignals(false); |
2085 | // We do it manually to avoid it being done twice by the above calls | 2086 | // We do it manually to avoid it being done twice by the above calls |
2086 | updateFilter(); | 2087 | updateFilter(); |
2087 | } | 2088 | } |
2088 | 2089 | ||
2089 | void CalendarView::writeFilterSettings(KConfig *config) | 2090 | void CalendarView::writeFilterSettings(KConfig *config) |
2090 | { | 2091 | { |
2091 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2092 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2092 | 2093 | ||
2093 | QStringList filterList; | 2094 | QStringList filterList; |
2094 | 2095 | ||
2095 | CalFilter *filter = mFilters.first(); | 2096 | CalFilter *filter = mFilters.first(); |
2096 | while(filter) { | 2097 | while(filter) { |
2097 | // kdDebug() << " fn: " << filter->name() << endl; | 2098 | // kdDebug() << " fn: " << filter->name() << endl; |
2098 | filterList << filter->name(); | 2099 | filterList << filter->name(); |
2099 | config->setGroup("Filter_" + filter->name().utf8()); | 2100 | config->setGroup("Filter_" + filter->name().utf8()); |
2100 | config->writeEntry("Criteria",filter->criteria()); | 2101 | config->writeEntry("Criteria",filter->criteria()); |
2101 | config->writeEntry("CategoryList",filter->categoryList()); | 2102 | config->writeEntry("CategoryList",filter->categoryList()); |
2102 | filter = mFilters.next(); | 2103 | filter = mFilters.next(); |
2103 | } | 2104 | } |
2104 | config->setGroup("General"); | 2105 | config->setGroup("General"); |
2105 | config->writeEntry("CalendarFilters",filterList); | 2106 | config->writeEntry("CalendarFilters",filterList); |
2106 | 2107 | ||
2107 | config->setGroup("FilterView"); | 2108 | config->setGroup("FilterView"); |
2108 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2109 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2109 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2110 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2110 | } | 2111 | } |
2111 | 2112 | ||
2112 | 2113 | ||
2113 | void CalendarView::goToday() | 2114 | void CalendarView::goToday() |
2114 | { | 2115 | { |
2115 | if ( mViewManager->currentView()->isMonthView() ) | 2116 | if ( mViewManager->currentView()->isMonthView() ) |
2116 | mNavigator->selectTodayMonth(); | 2117 | mNavigator->selectTodayMonth(); |
2117 | else | 2118 | else |
2118 | mNavigator->selectToday(); | 2119 | mNavigator->selectToday(); |
2119 | } | 2120 | } |
2120 | 2121 | ||
2121 | void CalendarView::goNext() | 2122 | void CalendarView::goNext() |
2122 | { | 2123 | { |
2123 | mNavigator->selectNext(); | 2124 | mNavigator->selectNext(); |
2124 | } | 2125 | } |
2125 | 2126 | ||
2126 | void CalendarView::goPrevious() | 2127 | void CalendarView::goPrevious() |
2127 | { | 2128 | { |
2128 | mNavigator->selectPrevious(); | 2129 | mNavigator->selectPrevious(); |
2129 | } | 2130 | } |
2130 | void CalendarView::goNextMonth() | 2131 | void CalendarView::goNextMonth() |
2131 | { | 2132 | { |
2132 | mNavigator->selectNextMonth(); | 2133 | mNavigator->selectNextMonth(); |
2133 | } | 2134 | } |
2134 | 2135 | ||
2135 | void CalendarView::goPreviousMonth() | 2136 | void CalendarView::goPreviousMonth() |
2136 | { | 2137 | { |
2137 | mNavigator->selectPreviousMonth(); | 2138 | mNavigator->selectPreviousMonth(); |
2138 | } | 2139 | } |
2139 | void CalendarView::writeLocale() | 2140 | void CalendarView::writeLocale() |
2140 | { | 2141 | { |
2141 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2142 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2142 | #if 0 | 2143 | #if 0 |
2143 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2144 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2144 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2145 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2145 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2146 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2146 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2147 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2147 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2148 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2148 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2149 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2149 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2150 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2150 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2151 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2151 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2152 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2152 | KOPrefs::instance()->mDaylightsavingStart, | 2153 | KOPrefs::instance()->mDaylightsavingStart, |
2153 | KOPrefs::instance()->mDaylightsavingEnd ); | 2154 | KOPrefs::instance()->mDaylightsavingEnd ); |
2154 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2155 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2155 | #endif | 2156 | #endif |
2156 | } | 2157 | } |
2157 | void CalendarView::updateConfig() | 2158 | void CalendarView::updateConfig() |
2158 | { | 2159 | { |
2159 | writeLocale(); | 2160 | writeLocale(); |
2160 | if ( KOPrefs::instance()->mUseAppColors ) | 2161 | if ( KOPrefs::instance()->mUseAppColors ) |
2161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2162 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2162 | emit configChanged(); | 2163 | emit configChanged(); |
2163 | mTodoList->updateConfig(); | 2164 | mTodoList->updateConfig(); |
2164 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2165 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2165 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2166 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2166 | // To make the "fill window" configurations work | 2167 | // To make the "fill window" configurations work |
2167 | //mViewManager->raiseCurrentView(); | 2168 | //mViewManager->raiseCurrentView(); |
2168 | } | 2169 | } |
2169 | 2170 | ||
2170 | 2171 | ||
2171 | void CalendarView::eventChanged(Event *event) | 2172 | void CalendarView::eventChanged(Event *event) |
2172 | { | 2173 | { |
2173 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2174 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2174 | //updateUnmanagedViews(); | 2175 | //updateUnmanagedViews(); |
2175 | } | 2176 | } |