-rw-r--r-- | korganizer/calendarview.cpp | 103 | ||||
-rw-r--r-- | korganizer/calendarview.h | 5 |
2 files changed, 106 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1de2759..b3b4cdb 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,656 +1,665 @@ | |||
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 (preston.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 | #endif | 87 | #endif |
87 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
88 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
89 | #include "komailclient.h" | 90 | #include "komailclient.h" |
90 | #endif | 91 | #endif |
91 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
92 | #include "calprinter.h" | 93 | #include "calprinter.h" |
93 | #endif | 94 | #endif |
94 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
95 | #include "kocore.h" | 96 | #include "kocore.h" |
96 | #endif | 97 | #endif |
97 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
98 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
99 | #include "koprefs.h" | 100 | #include "koprefs.h" |
100 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
101 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
102 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
103 | #include "koglobals.h" | 104 | #include "koglobals.h" |
104 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
105 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
106 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
107 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
108 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
109 | #include "statusdialog.h" | 110 | #include "statusdialog.h" |
110 | #include "kdatenavigator.h" | 111 | #include "kdatenavigator.h" |
111 | #include "kotodoview.h" | 112 | #include "kotodoview.h" |
112 | #include "datenavigator.h" | 113 | #include "datenavigator.h" |
113 | #include "resourceview.h" | 114 | #include "resourceview.h" |
114 | #include "navigatorbar.h" | 115 | #include "navigatorbar.h" |
115 | #include "searchdialog.h" | 116 | #include "searchdialog.h" |
116 | #include "mainwindow.h" | 117 | #include "mainwindow.h" |
117 | 118 | ||
118 | #include "calendarview.h" | 119 | #include "calendarview.h" |
119 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
120 | #include <qtopia/alarmserver.h> | 121 | #include <qtopia/alarmserver.h> |
121 | #endif | 122 | #endif |
122 | #ifndef _WIN32_ | 123 | #ifndef _WIN32_ |
123 | #include <stdlib.h> | 124 | #include <stdlib.h> |
124 | #include <stdio.h> | 125 | #include <stdio.h> |
125 | #include <unistd.h> | 126 | #include <unistd.h> |
126 | #else | 127 | #else |
127 | #include <qprocess.h> | 128 | #include <qprocess.h> |
128 | #endif | 129 | #endif |
129 | using namespace KOrg; | 130 | using namespace KOrg; |
130 | using namespace KCal; | 131 | using namespace KCal; |
131 | extern int globalFlagBlockAgenda; | 132 | extern int globalFlagBlockAgenda; |
132 | extern int globalFlagBlockStartup; | 133 | extern int globalFlagBlockStartup; |
133 | 134 | ||
134 | 135 | ||
135 | 136 | ||
136 | class KOBeamPrefs : public QDialog | 137 | class KOBeamPrefs : public QDialog |
137 | { | 138 | { |
138 | public: | 139 | public: |
139 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 140 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
140 | QDialog( parent, name, true ) | 141 | QDialog( parent, name, true ) |
141 | { | 142 | { |
142 | setCaption( i18n("Beam Options") ); | 143 | setCaption( i18n("Beam Options") ); |
143 | QVBoxLayout* lay = new QVBoxLayout( this ); | 144 | QVBoxLayout* lay = new QVBoxLayout( this ); |
144 | lay->setSpacing( 3 ); | 145 | lay->setSpacing( 3 ); |
145 | lay->setMargin( 3 ); | 146 | lay->setMargin( 3 ); |
146 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 147 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
147 | lay->addWidget( format ); | 148 | lay->addWidget( format ); |
148 | format->setExclusive ( true ) ; | 149 | format->setExclusive ( true ) ; |
149 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 150 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
150 | lay->addWidget( time ); time->setExclusive ( true ) ; | 151 | lay->addWidget( time ); time->setExclusive ( true ) ; |
151 | vcal = new QRadioButton(" vCalendar ", format ); | 152 | vcal = new QRadioButton(" vCalendar ", format ); |
152 | ical = new QRadioButton(" iCalendar ", format ); | 153 | ical = new QRadioButton(" iCalendar ", format ); |
153 | vcal->setChecked( true ); | 154 | vcal->setChecked( true ); |
154 | tz = new QRadioButton(i18n(" With timezone "), time ); | 155 | tz = new QRadioButton(i18n(" With timezone "), time ); |
155 | local = new QRadioButton(i18n(" Local time "), time ); | 156 | local = new QRadioButton(i18n(" Local time "), time ); |
156 | tz->setChecked( true ); | 157 | tz->setChecked( true ); |
157 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 158 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
158 | lay->addWidget( ok ); | 159 | lay->addWidget( ok ); |
159 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 160 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
160 | lay->addWidget( cancel ); | 161 | lay->addWidget( cancel ); |
161 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 162 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
162 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 163 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
163 | resize( 200, 200 ); | 164 | resize( 200, 200 ); |
164 | } | 165 | } |
165 | 166 | ||
166 | bool beamVcal() { return vcal->isChecked(); } | 167 | bool beamVcal() { return vcal->isChecked(); } |
167 | bool beamLocal() { return local->isChecked(); } | 168 | bool beamLocal() { return local->isChecked(); } |
168 | private: | 169 | private: |
169 | QRadioButton* vcal, *ical, *local, *tz; | 170 | QRadioButton* vcal, *ical, *local, *tz; |
170 | }; | 171 | }; |
171 | class KOCatPrefs : public QDialog | 172 | class KOCatPrefs : public QDialog |
172 | { | 173 | { |
173 | public: | 174 | public: |
174 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 175 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
175 | QDialog( parent, name, true ) | 176 | QDialog( parent, name, true ) |
176 | { | 177 | { |
177 | setCaption( i18n("Manage new Categories") ); | 178 | setCaption( i18n("Manage new Categories") ); |
178 | QVBoxLayout* lay = new QVBoxLayout( this ); | 179 | QVBoxLayout* lay = new QVBoxLayout( this ); |
179 | lay->setSpacing( 3 ); | 180 | lay->setSpacing( 3 ); |
180 | lay->setMargin( 3 ); | 181 | lay->setMargin( 3 ); |
181 | 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 ); | 182 | 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 ); |
182 | lay->addWidget( lab ); | 183 | lay->addWidget( lab ); |
183 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 184 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
184 | lay->addWidget( format ); | 185 | lay->addWidget( format ); |
185 | format->setExclusive ( true ) ; | 186 | format->setExclusive ( true ) ; |
186 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 187 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
187 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 188 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
188 | addCatBut->setChecked( true ); | 189 | addCatBut->setChecked( true ); |
189 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 190 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
190 | lay->addWidget( ok ); | 191 | lay->addWidget( ok ); |
191 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 192 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
192 | lay->addWidget( cancel ); | 193 | lay->addWidget( cancel ); |
193 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 194 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
194 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 195 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
195 | resize( 200, 200 ); | 196 | resize( 200, 200 ); |
196 | } | 197 | } |
197 | 198 | ||
198 | bool addCat() { return addCatBut->isChecked(); } | 199 | bool addCat() { return addCatBut->isChecked(); } |
199 | private: | 200 | private: |
200 | QRadioButton* addCatBut; | 201 | QRadioButton* addCatBut; |
201 | }; | 202 | }; |
202 | 203 | ||
203 | 204 | ||
204 | 205 | ||
205 | CalendarView::CalendarView( CalendarResources *calendar, | 206 | CalendarView::CalendarView( CalendarResources *calendar, |
206 | QWidget *parent, const char *name ) | 207 | QWidget *parent, const char *name ) |
207 | : CalendarViewBase( parent, name ), | 208 | : CalendarViewBase( parent, name ), |
208 | mCalendar( calendar ), | 209 | mCalendar( calendar ), |
209 | mResourceManager( calendar->resourceManager() ) | 210 | mResourceManager( calendar->resourceManager() ) |
210 | { | 211 | { |
211 | 212 | ||
212 | mEventEditor = 0; | 213 | mEventEditor = 0; |
213 | mTodoEditor = 0; | 214 | mTodoEditor = 0; |
214 | 215 | ||
215 | init(); | 216 | init(); |
216 | } | 217 | } |
217 | 218 | ||
218 | CalendarView::CalendarView( Calendar *calendar, | 219 | CalendarView::CalendarView( Calendar *calendar, |
219 | QWidget *parent, const char *name ) | 220 | QWidget *parent, const char *name ) |
220 | : CalendarViewBase( parent, name ), | 221 | : CalendarViewBase( parent, name ), |
221 | mCalendar( calendar ), | 222 | mCalendar( calendar ), |
222 | mResourceManager( 0 ) | 223 | mResourceManager( 0 ) |
223 | { | 224 | { |
224 | 225 | ||
225 | mEventEditor = 0; | 226 | mEventEditor = 0; |
226 | mTodoEditor = 0; | 227 | mTodoEditor = 0; |
227 | init();} | 228 | init();} |
228 | 229 | ||
229 | void CalendarView::init() | 230 | void CalendarView::init() |
230 | { | 231 | { |
231 | beamDialog = new KOBeamPrefs(); | 232 | beamDialog = new KOBeamPrefs(); |
232 | mDatePickerMode = 0; | 233 | mDatePickerMode = 0; |
233 | mCurrentSyncDevice = ""; | 234 | mCurrentSyncDevice = ""; |
234 | writeLocale(); | 235 | writeLocale(); |
235 | mViewManager = new KOViewManager( this ); | 236 | mViewManager = new KOViewManager( this ); |
236 | mDialogManager = new KODialogManager( this ); | 237 | mDialogManager = new KODialogManager( this ); |
237 | mEventViewerDialog = 0; | 238 | mEventViewerDialog = 0; |
238 | mModified = false; | 239 | mModified = false; |
239 | mReadOnly = false; | 240 | mReadOnly = false; |
240 | mSelectedIncidence = 0; | 241 | mSelectedIncidence = 0; |
241 | mCalPrinter = 0; | 242 | mCalPrinter = 0; |
242 | mFilters.setAutoDelete(true); | 243 | mFilters.setAutoDelete(true); |
243 | 244 | ||
244 | mCalendar->registerObserver( this ); | 245 | mCalendar->registerObserver( this ); |
245 | // TODO: Make sure that view is updated, when calendar is changed. | 246 | // TODO: Make sure that view is updated, when calendar is changed. |
246 | 247 | ||
247 | mStorage = new FileStorage( mCalendar ); | 248 | mStorage = new FileStorage( mCalendar ); |
248 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 249 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
249 | 250 | ||
250 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 251 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
251 | #ifndef KORG_NOSPLITTER | 252 | #ifndef KORG_NOSPLITTER |
252 | // create the main layout frames. | 253 | // create the main layout frames. |
253 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 254 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
254 | topLayout->addWidget(mPanner); | 255 | topLayout->addWidget(mPanner); |
255 | 256 | ||
256 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 257 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
257 | "CalendarView::LeftFrame"); | 258 | "CalendarView::LeftFrame"); |
258 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 259 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
259 | 260 | ||
260 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 261 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
261 | "CalendarView::DateNavigator", QDate::currentDate() ); | 262 | "CalendarView::DateNavigator", QDate::currentDate() ); |
262 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 263 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
263 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 264 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
264 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 265 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
265 | 266 | ||
266 | #ifdef KORG_NORESOURCEVIEW | 267 | #ifdef KORG_NORESOURCEVIEW |
267 | mResourceView = 0; | 268 | mResourceView = 0; |
268 | #else | 269 | #else |
269 | if ( mResourceManager ) { | 270 | if ( mResourceManager ) { |
270 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 271 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
271 | mResourceView->updateView(); | 272 | mResourceView->updateView(); |
272 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 273 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
273 | SLOT( updateView() ) ); | 274 | SLOT( updateView() ) ); |
274 | } else { | 275 | } else { |
275 | mResourceView = 0; | 276 | mResourceView = 0; |
276 | } | 277 | } |
277 | #endif | 278 | #endif |
278 | QWidget *rightBox = new QWidget( mPanner ); | 279 | QWidget *rightBox = new QWidget( mPanner ); |
279 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 280 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
280 | 281 | ||
281 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 282 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
282 | rightLayout->addWidget( mNavigatorBar ); | 283 | rightLayout->addWidget( mNavigatorBar ); |
283 | 284 | ||
284 | mRightFrame = new QWidgetStack( rightBox ); | 285 | mRightFrame = new QWidgetStack( rightBox ); |
285 | rightLayout->addWidget( mRightFrame, 1 ); | 286 | rightLayout->addWidget( mRightFrame, 1 ); |
286 | 287 | ||
287 | mLeftFrame = mLeftSplitter; | 288 | mLeftFrame = mLeftSplitter; |
288 | #else | 289 | #else |
289 | QWidget *mainBox = new QWidget( this ); | 290 | QWidget *mainBox = new QWidget( this ); |
290 | QWidget *leftFrame = new QWidget( mainBox ); | 291 | QWidget *leftFrame = new QWidget( mainBox ); |
291 | 292 | ||
292 | QBoxLayout * mainBoxLayout; | 293 | QBoxLayout * mainBoxLayout; |
293 | QBoxLayout * leftFrameLayout; | 294 | QBoxLayout * leftFrameLayout; |
294 | if ( KOPrefs::instance()->mVerticalScreen ) { | 295 | if ( KOPrefs::instance()->mVerticalScreen ) { |
295 | mainBoxLayout = new QVBoxLayout(mainBox); | 296 | mainBoxLayout = new QVBoxLayout(mainBox); |
296 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 297 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
297 | } else { | 298 | } else { |
298 | mainBoxLayout = new QHBoxLayout(mainBox); | 299 | mainBoxLayout = new QHBoxLayout(mainBox); |
299 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 300 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
300 | } | 301 | } |
301 | topLayout->addWidget( mainBox ); | 302 | topLayout->addWidget( mainBox ); |
302 | mainBoxLayout->addWidget (leftFrame); | 303 | mainBoxLayout->addWidget (leftFrame); |
303 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 304 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
304 | "CalendarView::DateNavigator", QDate::currentDate()); | 305 | "CalendarView::DateNavigator", QDate::currentDate()); |
305 | // mDateNavigator->blockSignals( true ); | 306 | // mDateNavigator->blockSignals( true ); |
306 | leftFrameLayout->addWidget( mDateNavigator ); | 307 | leftFrameLayout->addWidget( mDateNavigator ); |
307 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 308 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
308 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); | 309 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); |
309 | 310 | ||
310 | if ( QApplication::desktop()->width() < 480 ) { | 311 | if ( QApplication::desktop()->width() < 480 ) { |
311 | leftFrameLayout->addWidget(mFilterView); | 312 | leftFrameLayout->addWidget(mFilterView); |
312 | leftFrameLayout->addWidget(mTodoList, 2 ); | 313 | leftFrameLayout->addWidget(mTodoList, 2 ); |
313 | 314 | ||
314 | } else { | 315 | } else { |
315 | leftFrameLayout->addWidget(mTodoList,2 ); | 316 | leftFrameLayout->addWidget(mTodoList,2 ); |
316 | leftFrameLayout->addWidget(mFilterView ); | 317 | leftFrameLayout->addWidget(mFilterView ); |
317 | } | 318 | } |
318 | mFilterView->hide(); | 319 | mFilterView->hide(); |
319 | QWidget *rightBox = new QWidget( mainBox ); | 320 | QWidget *rightBox = new QWidget( mainBox ); |
320 | mainBoxLayout->addWidget ( rightBox, 10 ); | 321 | mainBoxLayout->addWidget ( rightBox, 10 ); |
321 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 322 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
322 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 323 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
323 | mRightFrame = new QWidgetStack( rightBox ); | 324 | mRightFrame = new QWidgetStack( rightBox ); |
324 | rightLayout->addWidget( mNavigatorBar ); | 325 | rightLayout->addWidget( mNavigatorBar ); |
325 | rightLayout->addWidget( mRightFrame, 10 ); | 326 | rightLayout->addWidget( mRightFrame, 10 ); |
326 | 327 | ||
327 | mLeftFrame = leftFrame; | 328 | mLeftFrame = leftFrame; |
328 | if ( KOPrefs::instance()->mVerticalScreen ) { | 329 | if ( KOPrefs::instance()->mVerticalScreen ) { |
329 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 330 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
330 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 331 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
331 | } else { | 332 | } else { |
332 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 333 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
333 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 334 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
334 | } | 335 | } |
335 | 336 | ||
336 | //qDebug("Calendarview Size %d %d ", width(), height()); | 337 | //qDebug("Calendarview Size %d %d ", width(), height()); |
337 | #endif | 338 | #endif |
338 | 339 | ||
339 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 340 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
340 | SLOT( showDates( const KCal::DateList & ) ) ); | 341 | SLOT( showDates( const KCal::DateList & ) ) ); |
341 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 342 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
342 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 343 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
343 | 344 | ||
344 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 345 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
345 | mNavigator, SLOT( selectPreviousYear() ) ); | 346 | mNavigator, SLOT( selectPreviousYear() ) ); |
346 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 347 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
347 | mNavigator, SLOT( selectNextYear() ) ); | 348 | mNavigator, SLOT( selectNextYear() ) ); |
348 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
349 | mNavigator, SLOT( selectPreviousMonth() ) ); | 350 | mNavigator, SLOT( selectPreviousMonth() ) ); |
350 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
351 | mNavigator, SLOT( selectNextMonth() ) ); | 352 | mNavigator, SLOT( selectNextMonth() ) ); |
352 | 353 | ||
353 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 354 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
354 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 355 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
355 | 356 | ||
356 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 357 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
357 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 358 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
358 | 359 | ||
359 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 360 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
360 | mNavigator, SLOT( selectPreviousYear() ) ); | 361 | mNavigator, SLOT( selectPreviousYear() ) ); |
361 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 362 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
362 | mNavigator, SLOT( selectNextYear() ) ); | 363 | mNavigator, SLOT( selectNextYear() ) ); |
363 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
364 | mNavigator, SLOT( selectPreviousMonth() ) ); | 365 | mNavigator, SLOT( selectPreviousMonth() ) ); |
365 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 366 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
366 | mNavigator, SLOT( selectNextMonth() ) ); | 367 | mNavigator, SLOT( selectNextMonth() ) ); |
367 | 368 | ||
368 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 369 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
369 | mNavigator, SLOT( selectPrevious() ) ); | 370 | mNavigator, SLOT( selectPrevious() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNext() ), | 371 | connect( mDateNavigator, SIGNAL( goNext() ), |
371 | mNavigator, SLOT( selectNext() ) ); | 372 | mNavigator, SLOT( selectNext() ) ); |
372 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 373 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
373 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 374 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
374 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 375 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
375 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 376 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
376 | 377 | ||
377 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 378 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
378 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 379 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
379 | 380 | ||
380 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 381 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
381 | SLOT( eventAdded( Event *) ) ); | 382 | SLOT( eventAdded( Event *) ) ); |
382 | 383 | ||
383 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 384 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
384 | 385 | ||
385 | connect( this, SIGNAL( configChanged() ), | 386 | connect( this, SIGNAL( configChanged() ), |
386 | mDateNavigator, SLOT( updateConfig() ) ); | 387 | mDateNavigator, SLOT( updateConfig() ) ); |
387 | 388 | ||
388 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 389 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
389 | SLOT( newTodo() ) ); | 390 | SLOT( newTodo() ) ); |
390 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 391 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
391 | SLOT( newSubTodo( Todo * ) ) ); | 392 | SLOT( newSubTodo( Todo * ) ) ); |
392 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 393 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
393 | SLOT( editTodo( Todo * ) ) ); | 394 | SLOT( editTodo( Todo * ) ) ); |
394 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 395 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
395 | SLOT( showTodo( Todo *) ) ); | 396 | SLOT( showTodo( Todo *) ) ); |
396 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 397 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
397 | SLOT( deleteTodo( Todo *) ) ); | 398 | SLOT( deleteTodo( Todo *) ) ); |
398 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 399 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
399 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 400 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
400 | SLOT( purgeCompleted() ) ); | 401 | SLOT( purgeCompleted() ) ); |
401 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 402 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
402 | SIGNAL( todoModified( Todo *, int ) ) ); | 403 | SIGNAL( todoModified( Todo *, int ) ) ); |
403 | 404 | ||
404 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 405 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
405 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 406 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
406 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 407 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
407 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 408 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
408 | 409 | ||
409 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 410 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
410 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 411 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
411 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 412 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
412 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 413 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
413 | 414 | ||
414 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 415 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
415 | this, SLOT ( todo_unsub( Todo * ) ) ); | 416 | this, SLOT ( todo_unsub( Todo * ) ) ); |
416 | 417 | ||
417 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 418 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
418 | SLOT( updateTodo( Todo *, int ) ) ); | 419 | SLOT( updateTodo( Todo *, int ) ) ); |
419 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 420 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
420 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 421 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
421 | 422 | ||
422 | 423 | ||
423 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 424 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
424 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 425 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
425 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 426 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
426 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 427 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
427 | 428 | ||
428 | 429 | ||
429 | 430 | ||
430 | 431 | ||
431 | 432 | ||
432 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 433 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
433 | SLOT(checkClipboard())); | 434 | SLOT(checkClipboard())); |
434 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 435 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
435 | SLOT( processTodoListSelection( Incidence * ) ) ); | 436 | SLOT( processTodoListSelection( Incidence * ) ) ); |
436 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 437 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
437 | 438 | ||
438 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 439 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
439 | 440 | ||
440 | mDateFrame = new QVBox(0,0,WType_Popup); | 441 | mDateFrame = new QVBox(0,0,WType_Popup); |
441 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 442 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
442 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 443 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
443 | mDateFrame->setLineWidth(3); | 444 | mDateFrame->setLineWidth(3); |
444 | mDateFrame->hide(); | 445 | mDateFrame->hide(); |
445 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 446 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
446 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 447 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
447 | 448 | ||
448 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 449 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
449 | 450 | ||
450 | mEventEditor = mDialogManager->getEventEditor(); | 451 | mEventEditor = mDialogManager->getEventEditor(); |
451 | mTodoEditor = mDialogManager->getTodoEditor(); | 452 | mTodoEditor = mDialogManager->getTodoEditor(); |
452 | 453 | ||
453 | mFlagEditDescription = false; | 454 | mFlagEditDescription = false; |
454 | 455 | ||
455 | mSuspendTimer = new QTimer( this ); | 456 | mSuspendTimer = new QTimer( this ); |
456 | mAlarmTimer = new QTimer( this ); | 457 | mAlarmTimer = new QTimer( this ); |
457 | mRecheckAlarmTimer = new QTimer( this ); | 458 | mRecheckAlarmTimer = new QTimer( this ); |
458 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 459 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
459 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 460 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
460 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 461 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
461 | mAlarmDialog = new AlarmDialog( this ); | 462 | mAlarmDialog = new AlarmDialog( this ); |
462 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 463 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
463 | mAlarmDialog->setServerNotification( false ); | 464 | mAlarmDialog->setServerNotification( false ); |
464 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 465 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
466 | |||
467 | |||
468 | #ifndef DESKTOP_VERSION | ||
469 | //US listen for arriving address resultsets | ||
470 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | ||
471 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | ||
472 | #endif | ||
473 | |||
465 | } | 474 | } |
466 | 475 | ||
467 | 476 | ||
468 | CalendarView::~CalendarView() | 477 | CalendarView::~CalendarView() |
469 | { | 478 | { |
470 | // kdDebug() << "~CalendarView()" << endl; | 479 | // kdDebug() << "~CalendarView()" << endl; |
471 | //qDebug("CalendarView::~CalendarView() "); | 480 | //qDebug("CalendarView::~CalendarView() "); |
472 | delete mDialogManager; | 481 | delete mDialogManager; |
473 | delete mViewManager; | 482 | delete mViewManager; |
474 | delete mStorage; | 483 | delete mStorage; |
475 | delete mDateFrame ; | 484 | delete mDateFrame ; |
476 | delete beamDialog; | 485 | delete beamDialog; |
477 | //kdDebug() << "~CalendarView() done" << endl; | 486 | //kdDebug() << "~CalendarView() done" << endl; |
478 | } | 487 | } |
479 | void CalendarView::timerAlarm() | 488 | void CalendarView::timerAlarm() |
480 | { | 489 | { |
481 | //qDebug("CalendarView::timerAlarm() "); | 490 | //qDebug("CalendarView::timerAlarm() "); |
482 | computeAlarm(mAlarmNotification ); | 491 | computeAlarm(mAlarmNotification ); |
483 | } | 492 | } |
484 | 493 | ||
485 | void CalendarView::suspendAlarm() | 494 | void CalendarView::suspendAlarm() |
486 | { | 495 | { |
487 | //qDebug(" CalendarView::suspendAlarm() "); | 496 | //qDebug(" CalendarView::suspendAlarm() "); |
488 | computeAlarm(mSuspendAlarmNotification ); | 497 | computeAlarm(mSuspendAlarmNotification ); |
489 | 498 | ||
490 | } | 499 | } |
491 | 500 | ||
492 | void CalendarView::startAlarm( QString mess , QString filename) | 501 | void CalendarView::startAlarm( QString mess , QString filename) |
493 | { | 502 | { |
494 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 503 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
495 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 504 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
496 | 505 | ||
497 | } | 506 | } |
498 | 507 | ||
499 | void CalendarView::checkNextTimerAlarm() | 508 | void CalendarView::checkNextTimerAlarm() |
500 | { | 509 | { |
501 | mCalendar->checkAlarmForIncidence( 0, true ); | 510 | mCalendar->checkAlarmForIncidence( 0, true ); |
502 | } | 511 | } |
503 | 512 | ||
504 | void CalendarView::computeAlarm( QString msg ) | 513 | void CalendarView::computeAlarm( QString msg ) |
505 | { | 514 | { |
506 | 515 | ||
507 | QString mess = msg; | 516 | QString mess = msg; |
508 | QString mAlarmMessage = mess.mid( 9 ); | 517 | QString mAlarmMessage = mess.mid( 9 ); |
509 | QString filename = MainWindow::resourcePath(); | 518 | QString filename = MainWindow::resourcePath(); |
510 | filename += "koalarm.wav"; | 519 | filename += "koalarm.wav"; |
511 | QString tempfilename; | 520 | QString tempfilename; |
512 | if ( mess.left( 13 ) == "suspend_alarm") { | 521 | if ( mess.left( 13 ) == "suspend_alarm") { |
513 | bool error = false; | 522 | bool error = false; |
514 | int len = mess.mid( 13 ).find("+++"); | 523 | int len = mess.mid( 13 ).find("+++"); |
515 | if ( len < 2 ) | 524 | if ( len < 2 ) |
516 | error = true; | 525 | error = true; |
517 | else { | 526 | else { |
518 | tempfilename = mess.mid( 13, len ); | 527 | tempfilename = mess.mid( 13, len ); |
519 | if ( !QFile::exists( tempfilename ) ) | 528 | if ( !QFile::exists( tempfilename ) ) |
520 | error = true; | 529 | error = true; |
521 | } | 530 | } |
522 | if ( ! error ) { | 531 | if ( ! error ) { |
523 | filename = tempfilename; | 532 | filename = tempfilename; |
524 | } | 533 | } |
525 | mAlarmMessage = mess.mid( 13+len+3 ); | 534 | mAlarmMessage = mess.mid( 13+len+3 ); |
526 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 535 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
527 | startAlarm( mAlarmMessage, filename); | 536 | startAlarm( mAlarmMessage, filename); |
528 | return; | 537 | return; |
529 | } | 538 | } |
530 | if ( mess.left( 11 ) == "timer_alarm") { | 539 | if ( mess.left( 11 ) == "timer_alarm") { |
531 | //mTimerTime = 0; | 540 | //mTimerTime = 0; |
532 | startAlarm( mess.mid( 11 ), filename ); | 541 | startAlarm( mess.mid( 11 ), filename ); |
533 | return; | 542 | return; |
534 | } | 543 | } |
535 | if ( mess.left( 10 ) == "proc_alarm") { | 544 | if ( mess.left( 10 ) == "proc_alarm") { |
536 | bool error = false; | 545 | bool error = false; |
537 | int len = mess.mid( 10 ).find("+++"); | 546 | int len = mess.mid( 10 ).find("+++"); |
538 | if ( len < 2 ) | 547 | if ( len < 2 ) |
539 | error = true; | 548 | error = true; |
540 | else { | 549 | else { |
541 | tempfilename = mess.mid( 10, len ); | 550 | tempfilename = mess.mid( 10, len ); |
542 | if ( !QFile::exists( tempfilename ) ) | 551 | if ( !QFile::exists( tempfilename ) ) |
543 | error = true; | 552 | error = true; |
544 | } | 553 | } |
545 | if ( error ) { | 554 | if ( error ) { |
546 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 555 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
547 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 556 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
548 | } else { | 557 | } else { |
549 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 558 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
550 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 559 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
551 | #ifndef _WIN32_ | 560 | #ifndef _WIN32_ |
552 | if ( vfork () == 0 ) { | 561 | if ( vfork () == 0 ) { |
553 | execl ( tempfilename.latin1(), 0 ); | 562 | execl ( tempfilename.latin1(), 0 ); |
554 | return; | 563 | return; |
555 | } | 564 | } |
556 | #else | 565 | #else |
557 | QProcess* p = new QProcess(); | 566 | QProcess* p = new QProcess(); |
558 | p->addArgument( tempfilename.latin1() ); | 567 | p->addArgument( tempfilename.latin1() ); |
559 | p->start(); | 568 | p->start(); |
560 | return; | 569 | return; |
561 | #endif | 570 | #endif |
562 | 571 | ||
563 | return; | 572 | return; |
564 | } | 573 | } |
565 | 574 | ||
566 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 575 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
567 | } | 576 | } |
568 | if ( mess.left( 11 ) == "audio_alarm") { | 577 | if ( mess.left( 11 ) == "audio_alarm") { |
569 | bool error = false; | 578 | bool error = false; |
570 | int len = mess.mid( 11 ).find("+++"); | 579 | int len = mess.mid( 11 ).find("+++"); |
571 | if ( len < 2 ) | 580 | if ( len < 2 ) |
572 | error = true; | 581 | error = true; |
573 | else { | 582 | else { |
574 | tempfilename = mess.mid( 11, len ); | 583 | tempfilename = mess.mid( 11, len ); |
575 | if ( !QFile::exists( tempfilename ) ) | 584 | if ( !QFile::exists( tempfilename ) ) |
576 | error = true; | 585 | error = true; |
577 | } | 586 | } |
578 | if ( ! error ) { | 587 | if ( ! error ) { |
579 | filename = tempfilename; | 588 | filename = tempfilename; |
580 | } | 589 | } |
581 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 590 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
582 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 591 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
583 | } | 592 | } |
584 | if ( mess.left( 9 ) == "cal_alarm") { | 593 | if ( mess.left( 9 ) == "cal_alarm") { |
585 | mAlarmMessage = mess.mid( 9 ) ; | 594 | mAlarmMessage = mess.mid( 9 ) ; |
586 | } | 595 | } |
587 | 596 | ||
588 | startAlarm( mAlarmMessage, filename ); | 597 | startAlarm( mAlarmMessage, filename ); |
589 | 598 | ||
590 | 599 | ||
591 | } | 600 | } |
592 | 601 | ||
593 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 602 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
594 | { | 603 | { |
595 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 604 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
596 | 605 | ||
597 | mSuspendAlarmNotification = noti; | 606 | mSuspendAlarmNotification = noti; |
598 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 607 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
599 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 608 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
600 | mSuspendTimer->start( ms , true ); | 609 | mSuspendTimer->start( ms , true ); |
601 | 610 | ||
602 | } | 611 | } |
603 | 612 | ||
604 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 613 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
605 | { | 614 | { |
606 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 615 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
607 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 616 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
608 | #ifndef DESKTOP_VERSION | 617 | #ifndef DESKTOP_VERSION |
609 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 618 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
610 | #endif | 619 | #endif |
611 | return; | 620 | return; |
612 | } | 621 | } |
613 | int maxSec; | 622 | int maxSec; |
614 | //maxSec = 5; //testing only | 623 | //maxSec = 5; //testing only |
615 | maxSec = 86400+3600; // one day+1hour | 624 | maxSec = 86400+3600; // one day+1hour |
616 | mAlarmNotification = noti; | 625 | mAlarmNotification = noti; |
617 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 626 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
618 | if ( sec > maxSec ) { | 627 | if ( sec > maxSec ) { |
619 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 628 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
620 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 629 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
621 | return; | 630 | return; |
622 | } else { | 631 | } else { |
623 | mRecheckAlarmTimer->stop(); | 632 | mRecheckAlarmTimer->stop(); |
624 | } | 633 | } |
625 | //qDebug("Alarm timer started with secs: %d ", sec); | 634 | //qDebug("Alarm timer started with secs: %d ", sec); |
626 | mAlarmTimer->start( sec *1000 , true ); | 635 | mAlarmTimer->start( sec *1000 , true ); |
627 | 636 | ||
628 | } | 637 | } |
629 | // called by mRecheckAlarmTimer to get next alarm | 638 | // called by mRecheckAlarmTimer to get next alarm |
630 | // we need this, because a QTimer has only a max range of 25 days | 639 | // we need this, because a QTimer has only a max range of 25 days |
631 | void CalendarView::recheckTimerAlarm() | 640 | void CalendarView::recheckTimerAlarm() |
632 | { | 641 | { |
633 | mAlarmTimer->stop(); | 642 | mAlarmTimer->stop(); |
634 | mRecheckAlarmTimer->stop(); | 643 | mRecheckAlarmTimer->stop(); |
635 | mCalendar->checkAlarmForIncidence( 0, true ); | 644 | mCalendar->checkAlarmForIncidence( 0, true ); |
636 | } | 645 | } |
637 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 646 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
638 | { | 647 | { |
639 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 648 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
640 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 649 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
641 | #ifndef DESKTOP_VERSION | 650 | #ifndef DESKTOP_VERSION |
642 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 651 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
643 | #endif | 652 | #endif |
644 | return; | 653 | return; |
645 | } | 654 | } |
646 | mAlarmTimer->stop(); | 655 | mAlarmTimer->stop(); |
647 | } | 656 | } |
648 | void CalendarView::selectWeekNum ( int num ) | 657 | void CalendarView::selectWeekNum ( int num ) |
649 | { | 658 | { |
650 | dateNavigator()->selectWeek( num ); | 659 | dateNavigator()->selectWeek( num ); |
651 | mViewManager->showWeekView(); | 660 | mViewManager->showWeekView(); |
652 | } | 661 | } |
653 | KOViewManager *CalendarView::viewManager() | 662 | KOViewManager *CalendarView::viewManager() |
654 | { | 663 | { |
655 | return mViewManager; | 664 | return mViewManager; |
656 | } | 665 | } |
@@ -1135,429 +1144,519 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1135 | } | 1144 | } |
1136 | int delFut = 0; | 1145 | int delFut = 0; |
1137 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1146 | if ( KOPrefs::instance()->mWriteBackInFuture ) { |
1138 | er = remote->rawIncidences(); | 1147 | er = remote->rawIncidences(); |
1139 | inR = er.first(); | 1148 | inR = er.first(); |
1140 | QDateTime dt; | 1149 | QDateTime dt; |
1141 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1150 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1142 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); | 1151 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); |
1143 | while ( inR ) { | 1152 | while ( inR ) { |
1144 | if ( inR->type() == "Todo" ) { | 1153 | if ( inR->type() == "Todo" ) { |
1145 | Todo * t = (Todo*)inR; | 1154 | Todo * t = (Todo*)inR; |
1146 | if ( t->hasDueDate() ) | 1155 | if ( t->hasDueDate() ) |
1147 | dt = t->dtDue(); | 1156 | dt = t->dtDue(); |
1148 | else | 1157 | else |
1149 | dt = cur.addSecs( 62 ); | 1158 | dt = cur.addSecs( 62 ); |
1150 | } | 1159 | } |
1151 | else if (inR->type() == "Event" ) { | 1160 | else if (inR->type() == "Event" ) { |
1152 | bool ok; | 1161 | bool ok; |
1153 | dt = inR->getNextOccurence( cur, &ok ); | 1162 | dt = inR->getNextOccurence( cur, &ok ); |
1154 | if ( !ok ) | 1163 | if ( !ok ) |
1155 | dt = cur.addSecs( -62 ); | 1164 | dt = cur.addSecs( -62 ); |
1156 | } | 1165 | } |
1157 | else | 1166 | else |
1158 | dt = inR->dtStart(); | 1167 | dt = inR->dtStart(); |
1159 | if ( dt < cur || dt > end ) { | 1168 | if ( dt < cur || dt > end ) { |
1160 | remote->deleteIncidence( inR ); | 1169 | remote->deleteIncidence( inR ); |
1161 | ++delFut; | 1170 | ++delFut; |
1162 | } | 1171 | } |
1163 | inR = er.next(); | 1172 | inR = er.next(); |
1164 | } | 1173 | } |
1165 | } | 1174 | } |
1166 | bar.hide(); | 1175 | bar.hide(); |
1167 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1176 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1168 | eventLSync->setReadOnly( false ); | 1177 | eventLSync->setReadOnly( false ); |
1169 | eventLSync->setDtStart( mLastCalendarSync ); | 1178 | eventLSync->setDtStart( mLastCalendarSync ); |
1170 | eventRSync->setDtStart( mLastCalendarSync ); | 1179 | eventRSync->setDtStart( mLastCalendarSync ); |
1171 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1180 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1172 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1181 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1173 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1182 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1174 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1183 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1175 | eventLSync->setReadOnly( true ); | 1184 | eventLSync->setReadOnly( true ); |
1176 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1185 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1177 | remote->addEvent( eventRSync ); | 1186 | remote->addEvent( eventRSync ); |
1178 | QString mes; | 1187 | QString mes; |
1179 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1188 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1180 | QString delmess; | 1189 | QString delmess; |
1181 | if ( delFut ) { | 1190 | if ( delFut ) { |
1182 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); | 1191 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); |
1183 | mes += delmess; | 1192 | mes += delmess; |
1184 | } | 1193 | } |
1185 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1194 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1186 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1195 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1187 | } | 1196 | } |
1188 | qDebug( mes ); | 1197 | qDebug( mes ); |
1189 | mCalendar->checkAlarmForIncidence( 0, true ); | 1198 | mCalendar->checkAlarmForIncidence( 0, true ); |
1190 | return syncOK; | 1199 | return syncOK; |
1191 | } | 1200 | } |
1192 | 1201 | ||
1193 | void CalendarView::setSyncDevice( QString s ) | 1202 | void CalendarView::setSyncDevice( QString s ) |
1194 | { | 1203 | { |
1195 | mCurrentSyncDevice= s; | 1204 | mCurrentSyncDevice= s; |
1196 | } | 1205 | } |
1197 | void CalendarView::setSyncName( QString s ) | 1206 | void CalendarView::setSyncName( QString s ) |
1198 | { | 1207 | { |
1199 | mCurrentSyncName= s; | 1208 | mCurrentSyncName= s; |
1200 | } | 1209 | } |
1201 | bool CalendarView::syncCalendar(QString filename, int mode) | 1210 | bool CalendarView::syncCalendar(QString filename, int mode) |
1202 | { | 1211 | { |
1203 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1212 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1204 | CalendarLocal* calendar = new CalendarLocal(); | 1213 | CalendarLocal* calendar = new CalendarLocal(); |
1205 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1214 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1206 | FileStorage* storage = new FileStorage( calendar ); | 1215 | FileStorage* storage = new FileStorage( calendar ); |
1207 | bool syncOK = false; | 1216 | bool syncOK = false; |
1208 | storage->setFileName( filename ); | 1217 | storage->setFileName( filename ); |
1209 | // qDebug("loading ... "); | 1218 | // qDebug("loading ... "); |
1210 | if ( storage->load() ) { | 1219 | if ( storage->load() ) { |
1211 | getEventViewerDialog()->setSyncMode( true ); | 1220 | getEventViewerDialog()->setSyncMode( true ); |
1212 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1221 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1213 | getEventViewerDialog()->setSyncMode( false ); | 1222 | getEventViewerDialog()->setSyncMode( false ); |
1214 | if ( syncOK ) { | 1223 | if ( syncOK ) { |
1215 | if ( KOPrefs::instance()->mWriteBackFile ) | 1224 | if ( KOPrefs::instance()->mWriteBackFile ) |
1216 | { | 1225 | { |
1217 | storage->setSaveFormat( new ICalFormat() ); | 1226 | storage->setSaveFormat( new ICalFormat() ); |
1218 | storage->save(); | 1227 | storage->save(); |
1219 | } | 1228 | } |
1220 | } | 1229 | } |
1221 | setModified( true ); | 1230 | setModified( true ); |
1222 | } | 1231 | } |
1223 | delete storage; | 1232 | delete storage; |
1224 | delete calendar; | 1233 | delete calendar; |
1225 | if ( syncOK ) | 1234 | if ( syncOK ) |
1226 | updateView(); | 1235 | updateView(); |
1227 | return syncOK; | 1236 | return syncOK; |
1228 | } | 1237 | } |
1229 | void CalendarView::syncPhone() | 1238 | void CalendarView::syncPhone() |
1230 | { | 1239 | { |
1231 | syncExternal( 1 ); | 1240 | syncExternal( 1 ); |
1232 | } | 1241 | } |
1233 | void CalendarView::syncExternal( int mode ) | 1242 | void CalendarView::syncExternal( int mode ) |
1234 | { | 1243 | { |
1235 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1244 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1236 | //mCurrentSyncDevice = "sharp-DTM"; | 1245 | //mCurrentSyncDevice = "sharp-DTM"; |
1237 | if ( KOPrefs::instance()->mAskForPreferences ) | 1246 | if ( KOPrefs::instance()->mAskForPreferences ) |
1238 | edit_sync_options(); | 1247 | edit_sync_options(); |
1239 | qApp->processEvents(); | 1248 | qApp->processEvents(); |
1240 | CalendarLocal* calendar = new CalendarLocal(); | 1249 | CalendarLocal* calendar = new CalendarLocal(); |
1241 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1250 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1242 | bool syncOK = false; | 1251 | bool syncOK = false; |
1243 | bool loadSuccess = false; | 1252 | bool loadSuccess = false; |
1244 | PhoneFormat* phoneFormat = 0; | 1253 | PhoneFormat* phoneFormat = 0; |
1245 | #ifndef DESKTOP_VERSION | 1254 | #ifndef DESKTOP_VERSION |
1246 | SharpFormat* sharpFormat = 0; | 1255 | SharpFormat* sharpFormat = 0; |
1247 | if ( mode == 0 ) { // sharp | 1256 | if ( mode == 0 ) { // sharp |
1248 | sharpFormat = new SharpFormat () ; | 1257 | sharpFormat = new SharpFormat () ; |
1249 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1258 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1250 | 1259 | ||
1251 | } else | 1260 | } else |
1252 | #endif | 1261 | #endif |
1253 | if ( mode == 1 ) { // phone | 1262 | if ( mode == 1 ) { // phone |
1254 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1263 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1255 | KOPrefs::instance()->mPhoneDevice, | 1264 | KOPrefs::instance()->mPhoneDevice, |
1256 | KOPrefs::instance()->mPhoneConnection, | 1265 | KOPrefs::instance()->mPhoneConnection, |
1257 | KOPrefs::instance()->mPhoneModel); | 1266 | KOPrefs::instance()->mPhoneModel); |
1258 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1267 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1259 | 1268 | ||
1260 | } else | 1269 | } else |
1261 | return; | 1270 | return; |
1262 | if ( loadSuccess ) { | 1271 | if ( loadSuccess ) { |
1263 | getEventViewerDialog()->setSyncMode( true ); | 1272 | getEventViewerDialog()->setSyncMode( true ); |
1264 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1273 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1265 | getEventViewerDialog()->setSyncMode( false ); | 1274 | getEventViewerDialog()->setSyncMode( false ); |
1266 | qApp->processEvents(); | 1275 | qApp->processEvents(); |
1267 | if ( syncOK ) { | 1276 | if ( syncOK ) { |
1268 | if ( KOPrefs::instance()->mWriteBackFile ) | 1277 | if ( KOPrefs::instance()->mWriteBackFile ) |
1269 | { | 1278 | { |
1270 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1279 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1271 | Incidence* inc = iL.first(); | 1280 | Incidence* inc = iL.first(); |
1272 | if ( phoneFormat ) { | 1281 | if ( phoneFormat ) { |
1273 | while ( inc ) { | 1282 | while ( inc ) { |
1274 | inc->removeID(mCurrentSyncDevice); | 1283 | inc->removeID(mCurrentSyncDevice); |
1275 | inc = iL.next(); | 1284 | inc = iL.next(); |
1276 | } | 1285 | } |
1277 | } | 1286 | } |
1278 | #ifndef DESKTOP_VERSION | 1287 | #ifndef DESKTOP_VERSION |
1279 | if ( sharpFormat ) | 1288 | if ( sharpFormat ) |
1280 | sharpFormat->save(calendar); | 1289 | sharpFormat->save(calendar); |
1281 | #endif | 1290 | #endif |
1282 | if ( phoneFormat ) | 1291 | if ( phoneFormat ) |
1283 | phoneFormat->save(calendar); | 1292 | phoneFormat->save(calendar); |
1284 | iL = calendar->rawIncidences(); | 1293 | iL = calendar->rawIncidences(); |
1285 | inc = iL.first(); | 1294 | inc = iL.first(); |
1286 | Incidence* loc; | 1295 | Incidence* loc; |
1287 | while ( inc ) { | 1296 | while ( inc ) { |
1288 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1297 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1289 | loc = mCalendar->incidence(inc->uid() ); | 1298 | loc = mCalendar->incidence(inc->uid() ); |
1290 | if ( loc ) { | 1299 | if ( loc ) { |
1291 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1300 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1292 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1301 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1293 | } | 1302 | } |
1294 | } | 1303 | } |
1295 | inc = iL.next(); | 1304 | inc = iL.next(); |
1296 | } | 1305 | } |
1297 | Incidence* lse = getLastSyncEvent(); | 1306 | Incidence* lse = getLastSyncEvent(); |
1298 | if ( lse ) { | 1307 | if ( lse ) { |
1299 | lse->setReadOnly( false ); | 1308 | lse->setReadOnly( false ); |
1300 | lse->setDescription( "" ); | 1309 | lse->setDescription( "" ); |
1301 | lse->setReadOnly( true ); | 1310 | lse->setReadOnly( true ); |
1302 | } | 1311 | } |
1303 | } | 1312 | } |
1304 | } | 1313 | } |
1305 | setModified( true ); | 1314 | setModified( true ); |
1306 | } else { | 1315 | } else { |
1307 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1316 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1308 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1317 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1309 | question, i18n("Ok")) ; | 1318 | question, i18n("Ok")) ; |
1310 | 1319 | ||
1311 | } | 1320 | } |
1312 | delete calendar; | 1321 | delete calendar; |
1313 | updateView(); | 1322 | updateView(); |
1314 | return ;//syncOK; | 1323 | return ;//syncOK; |
1315 | 1324 | ||
1316 | } | 1325 | } |
1317 | void CalendarView::syncSharp() | 1326 | void CalendarView::syncSharp() |
1318 | { | 1327 | { |
1319 | syncExternal( 0 ); | 1328 | syncExternal( 0 ); |
1320 | 1329 | ||
1321 | } | 1330 | } |
1322 | 1331 | ||
1323 | 1332 | ||
1324 | //#include <kabc/stdaddressbook.h> | 1333 | //#include <kabc/stdaddressbook.h> |
1325 | bool CalendarView::importBday() | 1334 | bool CalendarView::importBday() |
1326 | { | 1335 | { |
1327 | #if 0 | 1336 | #ifndef KORG_NOKABC |
1337 | |||
1338 | #ifdef DESKTOP_VERSION | ||
1328 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1339 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1329 | KABC::AddressBook::Iterator it; | 1340 | KABC::AddressBook::Iterator it; |
1330 | int count = 0; | 1341 | int count = 0; |
1331 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1342 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1332 | ++count; | 1343 | ++count; |
1333 | } | 1344 | } |
1334 | QProgressBar bar(count,0 ); | 1345 | QProgressBar bar(count,0 ); |
1335 | int w = 300; | 1346 | int w = 300; |
1336 | if ( QApplication::desktop()->width() < 320 ) | 1347 | if ( QApplication::desktop()->width() < 320 ) |
1337 | w = 220; | 1348 | w = 220; |
1338 | int h = bar.sizeHint().height() ; | 1349 | int h = bar.sizeHint().height() ; |
1339 | int dw = QApplication::desktop()->width(); | 1350 | int dw = QApplication::desktop()->width(); |
1340 | int dh = QApplication::desktop()->height(); | 1351 | int dh = QApplication::desktop()->height(); |
1341 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1352 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1342 | bar.show(); | 1353 | bar.show(); |
1343 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1354 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1344 | qApp->processEvents(); | 1355 | qApp->processEvents(); |
1345 | count = 0; | 1356 | count = 0; |
1346 | int addCount = 0; | 1357 | int addCount = 0; |
1347 | KCal::Attendee* a = 0; | 1358 | KCal::Attendee* a = 0; |
1348 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1359 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1349 | if ( ! bar.isVisible() ) | 1360 | if ( ! bar.isVisible() ) |
1350 | return false; | 1361 | return false; |
1351 | bar.setProgress( count++ ); | 1362 | bar.setProgress( count++ ); |
1352 | qApp->processEvents(); | 1363 | qApp->processEvents(); |
1353 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1364 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1354 | if ( (*it).birthday().date().isValid() ){ | 1365 | if ( (*it).birthday().date().isValid() ){ |
1355 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1366 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1356 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1367 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1357 | ++addCount; | 1368 | ++addCount; |
1358 | } | 1369 | } |
1359 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1370 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1360 | if ( anni.isValid() ){ | 1371 | if ( anni.isValid() ){ |
1361 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1372 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1362 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1373 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1363 | ++addCount; | 1374 | ++addCount; |
1364 | } | 1375 | } |
1365 | } | 1376 | } |
1366 | updateView(); | 1377 | updateView(); |
1367 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1378 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1368 | #endif | 1379 | #else //DESKTOP_VERSION |
1380 | |||
1381 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | ||
1382 | // the result should now arrive through method insertBirthdays | ||
1383 | |||
1384 | #endif //DESKTOP_VERSION | ||
1385 | |||
1386 | #endif //KORG_NOKABC | ||
1387 | |||
1388 | |||
1369 | return true; | 1389 | return true; |
1370 | } | 1390 | } |
1371 | 1391 | ||
1392 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | ||
1393 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | ||
1394 | const QStringList& anniversaryList, const QStringList& realNameList, | ||
1395 | const QStringList& emailList, const QStringList& assembledNameList, | ||
1396 | const QStringList& uidList) | ||
1397 | { | ||
1398 | qDebug("CalendarView::insertBirthdays"); | ||
1399 | if (uid == this->name()) | ||
1400 | { | ||
1401 | int count = birthdayList.count(); | ||
1402 | int addCount = 0; | ||
1403 | KCal::Attendee* a = 0; | ||
1404 | |||
1405 | qDebug("CalView 1 %i", count); | ||
1406 | |||
1407 | QProgressBar bar(count,0 ); | ||
1408 | int w = 300; | ||
1409 | if ( QApplication::desktop()->width() < 320 ) | ||
1410 | w = 220; | ||
1411 | int h = bar.sizeHint().height() ; | ||
1412 | int dw = QApplication::desktop()->width(); | ||
1413 | int dh = QApplication::desktop()->height(); | ||
1414 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
1415 | bar.show(); | ||
1416 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | ||
1417 | qApp->processEvents(); | ||
1418 | |||
1419 | QDate birthday; | ||
1420 | QDate anniversary; | ||
1421 | QString realName; | ||
1422 | QString email; | ||
1423 | QString assembledName; | ||
1424 | QString uid; | ||
1425 | bool ok = true; | ||
1426 | for ( int i = 0; i < count; i++) | ||
1427 | { | ||
1428 | if ( ! bar.isVisible() ) | ||
1429 | return; | ||
1430 | bar.setProgress( i ); | ||
1431 | qApp->processEvents(); | ||
1432 | |||
1433 | 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() ); | ||
1434 | |||
1435 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | ||
1436 | if (!ok) | ||
1437 | qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | ||
1438 | |||
1439 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | ||
1440 | if (!ok) | ||
1441 | qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | ||
1442 | realName = realNameList[i]; | ||
1443 | email = emailList[i]; | ||
1444 | assembledName = assembledNameList[i]; | ||
1445 | uid = uidList[i]; | ||
1446 | |||
1447 | if ( birthday.isValid() ){ | ||
1448 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | ||
1449 | KCal::Attendee::ReqParticipant,uid) ; | ||
1450 | if ( addAnniversary( birthday, assembledName, a, true ) ) | ||
1451 | ++addCount; | ||
1452 | } | ||
1453 | |||
1454 | if ( anniversary.isValid() ){ | ||
1455 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | ||
1456 | KCal::Attendee::ReqParticipant,uid) ; | ||
1457 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | ||
1458 | ++addCount; | ||
1459 | } | ||
1460 | } | ||
1461 | |||
1462 | updateView(); | ||
1463 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | ||
1464 | |||
1465 | } | ||
1466 | |||
1467 | } | ||
1468 | |||
1469 | |||
1470 | |||
1372 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1471 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1373 | { | 1472 | { |
1374 | //qDebug("addAnni "); | 1473 | //qDebug("addAnni "); |
1375 | Event * ev = new Event(); | 1474 | Event * ev = new Event(); |
1376 | if ( a ) { | 1475 | if ( a ) { |
1377 | ev->addAttendee( a ); | 1476 | ev->addAttendee( a ); |
1378 | } | 1477 | } |
1379 | QString kind; | 1478 | QString kind; |
1380 | if ( birthday ) | 1479 | if ( birthday ) |
1381 | kind = i18n( "Birthday" ); | 1480 | kind = i18n( "Birthday" ); |
1382 | else | 1481 | else |
1383 | kind = i18n( "Anniversary" ); | 1482 | kind = i18n( "Anniversary" ); |
1384 | ev->setSummary( name + " - " + kind ); | 1483 | ev->setSummary( name + " - " + kind ); |
1385 | ev->setOrganizer( "nobody@nowhere" ); | 1484 | ev->setOrganizer( "nobody@nowhere" ); |
1386 | ev->setCategories( kind ); | 1485 | ev->setCategories( kind ); |
1387 | ev->setDtStart( QDateTime(date) ); | 1486 | ev->setDtStart( QDateTime(date) ); |
1388 | ev->setDtEnd( QDateTime(date) ); | 1487 | ev->setDtEnd( QDateTime(date) ); |
1389 | ev->setFloats( true ); | 1488 | ev->setFloats( true ); |
1390 | Recurrence * rec = ev->recurrence(); | 1489 | Recurrence * rec = ev->recurrence(); |
1391 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1490 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1392 | rec->addYearlyNum( date.month() ); | 1491 | rec->addYearlyNum( date.month() ); |
1393 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1492 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1394 | delete ev; | 1493 | delete ev; |
1395 | return false; | 1494 | return false; |
1396 | } | 1495 | } |
1397 | return true; | 1496 | return true; |
1398 | 1497 | ||
1399 | } | 1498 | } |
1400 | bool CalendarView::importQtopia( const QString &categories, | 1499 | bool CalendarView::importQtopia( const QString &categories, |
1401 | const QString &datebook, | 1500 | const QString &datebook, |
1402 | const QString &todolist ) | 1501 | const QString &todolist ) |
1403 | { | 1502 | { |
1404 | 1503 | ||
1405 | QtopiaFormat qtopiaFormat; | 1504 | QtopiaFormat qtopiaFormat; |
1406 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1505 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1407 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1506 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1408 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1507 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1409 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1508 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1410 | 1509 | ||
1411 | updateView(); | 1510 | updateView(); |
1412 | return true; | 1511 | return true; |
1413 | 1512 | ||
1414 | #if 0 | 1513 | #if 0 |
1415 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1514 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1416 | mCurrentSyncDevice = "qtopia-XML"; | 1515 | mCurrentSyncDevice = "qtopia-XML"; |
1417 | if ( KOPrefs::instance()->mAskForPreferences ) | 1516 | if ( KOPrefs::instance()->mAskForPreferences ) |
1418 | edit_sync_options(); | 1517 | edit_sync_options(); |
1419 | qApp->processEvents(); | 1518 | qApp->processEvents(); |
1420 | CalendarLocal* calendar = new CalendarLocal(); | 1519 | CalendarLocal* calendar = new CalendarLocal(); |
1421 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1520 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1422 | bool syncOK = false; | 1521 | bool syncOK = false; |
1423 | QtopiaFormat qtopiaFormat; | 1522 | QtopiaFormat qtopiaFormat; |
1424 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1523 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1425 | bool loadOk = true; | 1524 | bool loadOk = true; |
1426 | if ( !categories.isEmpty() ) | 1525 | if ( !categories.isEmpty() ) |
1427 | loadOk = qtopiaFormat.load( calendar, categories ); | 1526 | loadOk = qtopiaFormat.load( calendar, categories ); |
1428 | if ( loadOk && !datebook.isEmpty() ) | 1527 | if ( loadOk && !datebook.isEmpty() ) |
1429 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1528 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1430 | if ( loadOk && !todolist.isEmpty() ) | 1529 | if ( loadOk && !todolist.isEmpty() ) |
1431 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1530 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1432 | 1531 | ||
1433 | if ( loadOk ) { | 1532 | if ( loadOk ) { |
1434 | getEventViewerDialog()->setSyncMode( true ); | 1533 | getEventViewerDialog()->setSyncMode( true ); |
1435 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1534 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1436 | getEventViewerDialog()->setSyncMode( false ); | 1535 | getEventViewerDialog()->setSyncMode( false ); |
1437 | qApp->processEvents(); | 1536 | qApp->processEvents(); |
1438 | if ( syncOK ) { | 1537 | if ( syncOK ) { |
1439 | if ( KOPrefs::instance()->mWriteBackFile ) | 1538 | if ( KOPrefs::instance()->mWriteBackFile ) |
1440 | { | 1539 | { |
1441 | // write back XML file | 1540 | // write back XML file |
1442 | 1541 | ||
1443 | } | 1542 | } |
1444 | setModified( true ); | 1543 | setModified( true ); |
1445 | } | 1544 | } |
1446 | } else { | 1545 | } else { |
1447 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1546 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1448 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1547 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1449 | question, i18n("Ok")) ; | 1548 | question, i18n("Ok")) ; |
1450 | } | 1549 | } |
1451 | delete calendar; | 1550 | delete calendar; |
1452 | updateView(); | 1551 | updateView(); |
1453 | return syncOK; | 1552 | return syncOK; |
1454 | 1553 | ||
1455 | 1554 | ||
1456 | #endif | 1555 | #endif |
1457 | 1556 | ||
1458 | } | 1557 | } |
1459 | 1558 | ||
1460 | void CalendarView::setSyncEventsReadOnly() | 1559 | void CalendarView::setSyncEventsReadOnly() |
1461 | { | 1560 | { |
1462 | Event * ev; | 1561 | Event * ev; |
1463 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1562 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1464 | ev = eL.first(); | 1563 | ev = eL.first(); |
1465 | while ( ev ) { | 1564 | while ( ev ) { |
1466 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1565 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1467 | ev->setReadOnly( true ); | 1566 | ev->setReadOnly( true ); |
1468 | ev = eL.next(); | 1567 | ev = eL.next(); |
1469 | } | 1568 | } |
1470 | } | 1569 | } |
1471 | bool CalendarView::openCalendar(QString filename, bool merge) | 1570 | bool CalendarView::openCalendar(QString filename, bool merge) |
1472 | { | 1571 | { |
1473 | 1572 | ||
1474 | if (filename.isEmpty()) { | 1573 | if (filename.isEmpty()) { |
1475 | return false; | 1574 | return false; |
1476 | } | 1575 | } |
1477 | 1576 | ||
1478 | if (!QFile::exists(filename)) { | 1577 | if (!QFile::exists(filename)) { |
1479 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1578 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1480 | return false; | 1579 | return false; |
1481 | } | 1580 | } |
1482 | 1581 | ||
1483 | globalFlagBlockAgenda = 1; | 1582 | globalFlagBlockAgenda = 1; |
1484 | if (!merge) mCalendar->close(); | 1583 | if (!merge) mCalendar->close(); |
1485 | 1584 | ||
1486 | mStorage->setFileName( filename ); | 1585 | mStorage->setFileName( filename ); |
1487 | 1586 | ||
1488 | if ( mStorage->load() ) { | 1587 | if ( mStorage->load() ) { |
1489 | if ( merge ) ;//setModified( true ); | 1588 | if ( merge ) ;//setModified( true ); |
1490 | else { | 1589 | else { |
1491 | //setModified( true ); | 1590 | //setModified( true ); |
1492 | mViewManager->setDocumentId( filename ); | 1591 | mViewManager->setDocumentId( filename ); |
1493 | mDialogManager->setDocumentId( filename ); | 1592 | mDialogManager->setDocumentId( filename ); |
1494 | mTodoList->setDocumentId( filename ); | 1593 | mTodoList->setDocumentId( filename ); |
1495 | } | 1594 | } |
1496 | globalFlagBlockAgenda = 2; | 1595 | globalFlagBlockAgenda = 2; |
1497 | // if ( getLastSyncEvent() ) | 1596 | // if ( getLastSyncEvent() ) |
1498 | // getLastSyncEvent()->setReadOnly( true ); | 1597 | // getLastSyncEvent()->setReadOnly( true ); |
1499 | mCalendar->reInitAlarmSettings(); | 1598 | mCalendar->reInitAlarmSettings(); |
1500 | setSyncEventsReadOnly(); | 1599 | setSyncEventsReadOnly(); |
1501 | updateUnmanagedViews(); | 1600 | updateUnmanagedViews(); |
1502 | updateView(); | 1601 | updateView(); |
1503 | setLoadedFileVersion( QDateTime::currentDateTime().addSecs( -1 )); | 1602 | setLoadedFileVersion( QDateTime::currentDateTime().addSecs( -1 )); |
1504 | if ( filename != MainWindow::defaultFileName() ) { | 1603 | if ( filename != MainWindow::defaultFileName() ) { |
1505 | saveCalendar( MainWindow::defaultFileName() ); | 1604 | saveCalendar( MainWindow::defaultFileName() ); |
1506 | watchSavedFile(); | 1605 | watchSavedFile(); |
1507 | } | 1606 | } |
1508 | return true; | 1607 | return true; |
1509 | } else { | 1608 | } else { |
1510 | // while failing to load, the calendar object could | 1609 | // while failing to load, the calendar object could |
1511 | // have become partially populated. Clear it out. | 1610 | // have become partially populated. Clear it out. |
1512 | if ( !merge ) { | 1611 | if ( !merge ) { |
1513 | mCalendar->close(); | 1612 | mCalendar->close(); |
1514 | mViewManager->setDocumentId( filename ); | 1613 | mViewManager->setDocumentId( filename ); |
1515 | mDialogManager->setDocumentId( filename ); | 1614 | mDialogManager->setDocumentId( filename ); |
1516 | mTodoList->setDocumentId( filename ); | 1615 | mTodoList->setDocumentId( filename ); |
1517 | } | 1616 | } |
1518 | 1617 | ||
1519 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1618 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1520 | 1619 | ||
1521 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1620 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1522 | globalFlagBlockAgenda = 2; | 1621 | globalFlagBlockAgenda = 2; |
1523 | mCalendar->reInitAlarmSettings(); | 1622 | mCalendar->reInitAlarmSettings(); |
1524 | setSyncEventsReadOnly(); | 1623 | setSyncEventsReadOnly(); |
1525 | updateUnmanagedViews(); | 1624 | updateUnmanagedViews(); |
1526 | updateView(); | 1625 | updateView(); |
1527 | } | 1626 | } |
1528 | return false; | 1627 | return false; |
1529 | } | 1628 | } |
1530 | void CalendarView::showOpenError() | 1629 | void CalendarView::showOpenError() |
1531 | { | 1630 | { |
1532 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1631 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1533 | } | 1632 | } |
1534 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1633 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1535 | { | 1634 | { |
1536 | loadedFileVersion = dt; | 1635 | loadedFileVersion = dt; |
1537 | } | 1636 | } |
1538 | bool CalendarView::checkFileChanged(QString fn) | 1637 | bool CalendarView::checkFileChanged(QString fn) |
1539 | { | 1638 | { |
1540 | QFileInfo finf ( fn ); | 1639 | QFileInfo finf ( fn ); |
1541 | if ( !finf.exists() ) | 1640 | if ( !finf.exists() ) |
1542 | return true; | 1641 | return true; |
1543 | QDateTime dt = finf.lastModified (); | 1642 | QDateTime dt = finf.lastModified (); |
1544 | if ( dt <= loadedFileVersion ) | 1643 | if ( dt <= loadedFileVersion ) |
1545 | return false; | 1644 | return false; |
1546 | return true; | 1645 | return true; |
1547 | 1646 | ||
1548 | } | 1647 | } |
1549 | void CalendarView::watchSavedFile() | 1648 | void CalendarView::watchSavedFile() |
1550 | { | 1649 | { |
1551 | QFileInfo finf ( MainWindow::defaultFileName()); | 1650 | QFileInfo finf ( MainWindow::defaultFileName()); |
1552 | if ( !finf.exists() ) | 1651 | if ( !finf.exists() ) |
1553 | return; | 1652 | return; |
1554 | QDateTime dt = finf.lastModified (); | 1653 | QDateTime dt = finf.lastModified (); |
1555 | if ( dt < loadedFileVersion ) { | 1654 | if ( dt < loadedFileVersion ) { |
1556 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1655 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1557 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1656 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1558 | return; | 1657 | return; |
1559 | } | 1658 | } |
1560 | loadedFileVersion = dt; | 1659 | loadedFileVersion = dt; |
1561 | } | 1660 | } |
1562 | 1661 | ||
1563 | bool CalendarView::checkFileVersion(QString fn) | 1662 | bool CalendarView::checkFileVersion(QString fn) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 0f7e696..8d329a9 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,377 +1,382 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | 116 | ||
117 | signals: | 117 | signals: |
118 | /** This todo has been modified */ | 118 | /** This todo has been modified */ |
119 | void todoModified(Todo *, int); | 119 | void todoModified(Todo *, int); |
120 | 120 | ||
121 | /** when change is made to options dialog, the topwidget will catch this | 121 | /** when change is made to options dialog, the topwidget will catch this |
122 | * and emit this signal which notifies all widgets which have registered | 122 | * and emit this signal which notifies all widgets which have registered |
123 | * for notification to update their settings. */ | 123 | * for notification to update their settings. */ |
124 | void configChanged(); | 124 | void configChanged(); |
125 | /** emitted when the topwidget is closing down, so that any attached | 125 | /** emitted when the topwidget is closing down, so that any attached |
126 | child windows can also close. */ | 126 | child windows can also close. */ |
127 | void closingDown(); | 127 | void closingDown(); |
128 | /** emitted right before we die */ | 128 | /** emitted right before we die */ |
129 | void closed(QWidget *); | 129 | void closed(QWidget *); |
130 | 130 | ||
131 | /** Emitted when state of modified flag changes */ | 131 | /** Emitted when state of modified flag changes */ |
132 | void modifiedChanged(bool); | 132 | void modifiedChanged(bool); |
133 | void signalmodified(); | 133 | void signalmodified(); |
134 | 134 | ||
135 | /** Emitted when state of read-only flag changes */ | 135 | /** Emitted when state of read-only flag changes */ |
136 | void readOnlyChanged(bool); | 136 | void readOnlyChanged(bool); |
137 | 137 | ||
138 | /** Emitted when the unit of navigation changes */ | 138 | /** Emitted when the unit of navigation changes */ |
139 | void changeNavStringPrev(const QString &); | 139 | void changeNavStringPrev(const QString &); |
140 | void changeNavStringNext(const QString &); | 140 | void changeNavStringNext(const QString &); |
141 | 141 | ||
142 | /** Emitted when state of events selection has changed and user is organizer*/ | 142 | /** Emitted when state of events selection has changed and user is organizer*/ |
143 | void organizerEventsSelected(bool); | 143 | void organizerEventsSelected(bool); |
144 | /** Emitted when state of events selection has changed and user is attendee*/ | 144 | /** Emitted when state of events selection has changed and user is attendee*/ |
145 | void groupEventsSelected(bool); | 145 | void groupEventsSelected(bool); |
146 | /** | 146 | /** |
147 | Emitted when an incidence gets selected. If the selection is cleared the | 147 | Emitted when an incidence gets selected. If the selection is cleared the |
148 | signal is emitted with 0 as argument. | 148 | signal is emitted with 0 as argument. |
149 | */ | 149 | */ |
150 | void incidenceSelected( Incidence * ); | 150 | void incidenceSelected( Incidence * ); |
151 | /** Emitted, when a todoitem is selected or deselected. */ | 151 | /** Emitted, when a todoitem is selected or deselected. */ |
152 | void todoSelected( bool ); | 152 | void todoSelected( bool ); |
153 | 153 | ||
154 | /** | 154 | /** |
155 | Emitted, when clipboard content changes. Parameter indicates if paste | 155 | Emitted, when clipboard content changes. Parameter indicates if paste |
156 | is possible or not. | 156 | is possible or not. |
157 | */ | 157 | */ |
158 | void pasteEnabled(bool); | 158 | void pasteEnabled(bool); |
159 | 159 | ||
160 | /** Emitted, when the number of incoming messages has changed. */ | 160 | /** Emitted, when the number of incoming messages has changed. */ |
161 | void numIncomingChanged(int); | 161 | void numIncomingChanged(int); |
162 | 162 | ||
163 | /** Emitted, when the number of outgoing messages has changed. */ | 163 | /** Emitted, when the number of outgoing messages has changed. */ |
164 | void numOutgoingChanged(int); | 164 | void numOutgoingChanged(int); |
165 | 165 | ||
166 | /** Send status message, which can e.g. be displayed in the status bar. */ | 166 | /** Send status message, which can e.g. be displayed in the status bar. */ |
167 | void statusMessage(const QString &); | 167 | void statusMessage(const QString &); |
168 | 168 | ||
169 | void calendarViewExpanded( bool ); | 169 | void calendarViewExpanded( bool ); |
170 | void updateSearchDialog(); | 170 | void updateSearchDialog(); |
171 | 171 | ||
172 | 172 | ||
173 | public slots: | 173 | public slots: |
174 | void showOpenError(); | 174 | void showOpenError(); |
175 | void watchSavedFile(); | 175 | void watchSavedFile(); |
176 | void recheckTimerAlarm(); | 176 | void recheckTimerAlarm(); |
177 | void checkNextTimerAlarm(); | 177 | void checkNextTimerAlarm(); |
178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
181 | 181 | ||
182 | /** options dialog made a changed to the configuration. we catch this | 182 | /** options dialog made a changed to the configuration. we catch this |
183 | * and notify all widgets which need to update their configuration. */ | 183 | * and notify all widgets which need to update their configuration. */ |
184 | void updateConfig(); | 184 | void updateConfig(); |
185 | 185 | ||
186 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | ||
187 | const QStringList& anniversaryList, const QStringList& realNameList, | ||
188 | const QStringList& emailList, const QStringList& assembledNameList, | ||
189 | const QStringList& uidList); | ||
190 | |||
186 | /** | 191 | /** |
187 | Load calendar from file \a filename. If \a merge is true, load | 192 | Load calendar from file \a filename. If \a merge is true, load |
188 | calendar into existing one, if it is false, clear calendar, before | 193 | calendar into existing one, if it is false, clear calendar, before |
189 | loading. Return true, if calendar could be successfully loaded. | 194 | loading. Return true, if calendar could be successfully loaded. |
190 | */ | 195 | */ |
191 | bool openCalendar(QString filename, bool merge=false); | 196 | bool openCalendar(QString filename, bool merge=false); |
192 | bool syncCalendar(QString filename,int mode = 0 ); | 197 | bool syncCalendar(QString filename,int mode = 0 ); |
193 | 198 | ||
194 | /** | 199 | /** |
195 | Save calendar data to file. Return true if calendar could be | 200 | Save calendar data to file. Return true if calendar could be |
196 | successfully saved. | 201 | successfully saved. |
197 | */ | 202 | */ |
198 | bool saveCalendar(QString filename); | 203 | bool saveCalendar(QString filename); |
199 | 204 | ||
200 | /** | 205 | /** |
201 | Close calendar. Clear calendar data and reset views to display an empty | 206 | Close calendar. Clear calendar data and reset views to display an empty |
202 | calendar. | 207 | calendar. |
203 | */ | 208 | */ |
204 | void closeCalendar(); | 209 | void closeCalendar(); |
205 | 210 | ||
206 | /** Archive old events of calendar */ | 211 | /** Archive old events of calendar */ |
207 | void archiveCalendar(); | 212 | void archiveCalendar(); |
208 | 213 | ||
209 | void showIncidence(); | 214 | void showIncidence(); |
210 | void editIncidence(); | 215 | void editIncidence(); |
211 | void editIncidenceDescription(); | 216 | void editIncidenceDescription(); |
212 | void deleteIncidence(); | 217 | void deleteIncidence(); |
213 | void cloneIncidence(); | 218 | void cloneIncidence(); |
214 | void moveIncidence(); | 219 | void moveIncidence(); |
215 | void beamIncidence(); | 220 | void beamIncidence(); |
216 | void toggleCancelIncidence(); | 221 | void toggleCancelIncidence(); |
217 | 222 | ||
218 | /** create an editeventwin with supplied date/time, and if bool is true, | 223 | /** create an editeventwin with supplied date/time, and if bool is true, |
219 | * make the event take all day. */ | 224 | * make the event take all day. */ |
220 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 225 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
221 | void newEvent(QDateTime fh); | 226 | void newEvent(QDateTime fh); |
222 | void newEvent(QDate dt); | 227 | void newEvent(QDate dt); |
223 | /** create new event without having a date hint. Takes current date as | 228 | /** create new event without having a date hint. Takes current date as |
224 | default hint. */ | 229 | default hint. */ |
225 | void newEvent(); | 230 | void newEvent(); |
226 | void newFloatingEvent(); | 231 | void newFloatingEvent(); |
227 | 232 | ||
228 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 233 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
229 | void showIncidence(Incidence *); | 234 | void showIncidence(Incidence *); |
230 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 235 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
231 | void editIncidence(Incidence *); | 236 | void editIncidence(Incidence *); |
232 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 237 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
233 | void deleteIncidence(Incidence *); | 238 | void deleteIncidence(Incidence *); |
234 | void cloneIncidence(Incidence *); | 239 | void cloneIncidence(Incidence *); |
235 | void cancelIncidence(Incidence *); | 240 | void cancelIncidence(Incidence *); |
236 | /** Create an editor for the supplied event. */ | 241 | /** Create an editor for the supplied event. */ |
237 | void editEvent(Event *); | 242 | void editEvent(Event *); |
238 | /** Delete the supplied event. */ | 243 | /** Delete the supplied event. */ |
239 | void deleteEvent(Event *); | 244 | void deleteEvent(Event *); |
240 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 245 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
241 | found. */ | 246 | found. */ |
242 | bool deleteEvent(const QString &uid); | 247 | bool deleteEvent(const QString &uid); |
243 | /** Create a read-only viewer dialog for the supplied event. */ | 248 | /** Create a read-only viewer dialog for the supplied event. */ |
244 | void showEvent(Event *); | 249 | void showEvent(Event *); |
245 | 250 | ||
246 | void editJournal(Journal *); | 251 | void editJournal(Journal *); |
247 | void showJournal(Journal *); | 252 | void showJournal(Journal *); |
248 | void deleteJournal(Journal *); | 253 | void deleteJournal(Journal *); |
249 | /** Create an editor dialog for a todo */ | 254 | /** Create an editor dialog for a todo */ |
250 | void editTodo(Todo *); | 255 | void editTodo(Todo *); |
251 | /** Create a read-only viewer dialog for the supplied todo */ | 256 | /** Create a read-only viewer dialog for the supplied todo */ |
252 | void showTodo(Todo *); | 257 | void showTodo(Todo *); |
253 | /** create new todo */ | 258 | /** create new todo */ |
254 | void newTodo(); | 259 | void newTodo(); |
255 | /** create new todo with a parent todo */ | 260 | /** create new todo with a parent todo */ |
256 | void newSubTodo(); | 261 | void newSubTodo(); |
257 | /** create new todo with a parent todo */ | 262 | /** create new todo with a parent todo */ |
258 | void newSubTodo(Todo *); | 263 | void newSubTodo(Todo *); |
259 | /** Delete todo */ | 264 | /** Delete todo */ |
260 | void deleteTodo(Todo *); | 265 | void deleteTodo(Todo *); |
261 | 266 | ||
262 | 267 | ||
263 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 268 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
264 | * emitted as result. */ | 269 | * emitted as result. */ |
265 | void checkClipboard(); | 270 | void checkClipboard(); |
266 | 271 | ||
267 | /** using the KConfig associated with the kapp variable, read in the | 272 | /** using the KConfig associated with the kapp variable, read in the |
268 | * settings from the config file. | 273 | * settings from the config file. |
269 | */ | 274 | */ |
270 | void readSettings(); | 275 | void readSettings(); |
271 | 276 | ||
272 | /** write current state to config file. */ | 277 | /** write current state to config file. */ |
273 | void writeSettings(); | 278 | void writeSettings(); |
274 | 279 | ||
275 | /** read settings for calendar filters */ | 280 | /** read settings for calendar filters */ |
276 | void readFilterSettings(KConfig *config); | 281 | void readFilterSettings(KConfig *config); |
277 | 282 | ||
278 | /** write settings for calendar filters */ | 283 | /** write settings for calendar filters */ |
279 | void writeFilterSettings(KConfig *config); | 284 | void writeFilterSettings(KConfig *config); |
280 | 285 | ||
281 | /** passes on the message that an event has changed to the currently | 286 | /** passes on the message that an event has changed to the currently |
282 | * activated view so that it can make appropriate display changes. */ | 287 | * activated view so that it can make appropriate display changes. */ |
283 | void changeEventDisplay(Event *, int); | 288 | void changeEventDisplay(Event *, int); |
284 | void changeIncidenceDisplay(Incidence *, int); | 289 | void changeIncidenceDisplay(Incidence *, int); |
285 | void changeTodoDisplay(Todo *, int); | 290 | void changeTodoDisplay(Todo *, int); |
286 | 291 | ||
287 | void eventAdded(Event *); | 292 | void eventAdded(Event *); |
288 | void eventChanged(Event *); | 293 | void eventChanged(Event *); |
289 | void eventToBeDeleted(Event *); | 294 | void eventToBeDeleted(Event *); |
290 | void eventDeleted(); | 295 | void eventDeleted(); |
291 | 296 | ||
292 | void todoAdded(Todo *); | 297 | void todoAdded(Todo *); |
293 | void todoChanged(Todo *); | 298 | void todoChanged(Todo *); |
294 | void todoToBeDeleted(Todo *); | 299 | void todoToBeDeleted(Todo *); |
295 | void todoDeleted(); | 300 | void todoDeleted(); |
296 | 301 | ||
297 | void updateView(const QDate &start, const QDate &end); | 302 | void updateView(const QDate &start, const QDate &end); |
298 | void updateView(); | 303 | void updateView(); |
299 | 304 | ||
300 | /** Full update of visible todo views */ | 305 | /** Full update of visible todo views */ |
301 | void updateTodoViews(); | 306 | void updateTodoViews(); |
302 | 307 | ||
303 | void updateUnmanagedViews(); | 308 | void updateUnmanagedViews(); |
304 | 309 | ||
305 | /** cut the current appointment to the clipboard */ | 310 | /** cut the current appointment to the clipboard */ |
306 | void edit_cut(); | 311 | void edit_cut(); |
307 | 312 | ||
308 | /** copy the current appointment(s) to the clipboard */ | 313 | /** copy the current appointment(s) to the clipboard */ |
309 | void edit_copy(); | 314 | void edit_copy(); |
310 | 315 | ||
311 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 316 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
312 | void edit_paste(); | 317 | void edit_paste(); |
313 | 318 | ||
314 | /** edit viewing and configuration options. */ | 319 | /** edit viewing and configuration options. */ |
315 | void edit_options(); | 320 | void edit_options(); |
316 | void edit_sync_options(); | 321 | void edit_sync_options(); |
317 | /** | 322 | /** |
318 | Functions for printing, previewing a print, and setting up printing | 323 | Functions for printing, previewing a print, and setting up printing |
319 | parameters. | 324 | parameters. |
320 | */ | 325 | */ |
321 | void print(); | 326 | void print(); |
322 | void printSetup(); | 327 | void printSetup(); |
323 | void printPreview(); | 328 | void printPreview(); |
324 | 329 | ||
325 | /** Export as iCalendar file */ | 330 | /** Export as iCalendar file */ |
326 | void exportICalendar(); | 331 | void exportICalendar(); |
327 | 332 | ||
328 | /** Export as vCalendar file */ | 333 | /** Export as vCalendar file */ |
329 | bool exportVCalendar( QString fn); | 334 | bool exportVCalendar( QString fn); |
330 | 335 | ||
331 | /** pop up a dialog to show an existing appointment. */ | 336 | /** pop up a dialog to show an existing appointment. */ |
332 | void appointment_show(); | 337 | void appointment_show(); |
333 | /** | 338 | /** |
334 | * pop up an Appointment Dialog to edit an existing appointment.Get | 339 | * pop up an Appointment Dialog to edit an existing appointment.Get |
335 | * information on the appointment from the list of unique IDs that is | 340 | * information on the appointment from the list of unique IDs that is |
336 | * currently in the View, called currIds. | 341 | * currently in the View, called currIds. |
337 | */ | 342 | */ |
338 | void appointment_edit(); | 343 | void appointment_edit(); |
339 | /** | 344 | /** |
340 | * pop up dialog confirming deletion of currently selected event in the | 345 | * pop up dialog confirming deletion of currently selected event in the |
341 | * View. | 346 | * View. |
342 | */ | 347 | */ |
343 | void appointment_delete(); | 348 | void appointment_delete(); |
344 | 349 | ||
345 | /** mails the currently selected event to a particular user as a vCalendar | 350 | /** mails the currently selected event to a particular user as a vCalendar |
346 | attachment. */ | 351 | attachment. */ |
347 | void action_mail(); | 352 | void action_mail(); |
348 | 353 | ||
349 | /* frees a subtodo from it's relation */ | 354 | /* frees a subtodo from it's relation */ |
350 | void todo_unsub( Todo * ); | 355 | void todo_unsub( Todo * ); |
351 | 356 | ||
352 | /** Take ownership of selected event. */ | 357 | /** Take ownership of selected event. */ |
353 | void takeOverEvent(); | 358 | void takeOverEvent(); |
354 | 359 | ||
355 | /** Take ownership of all events in calendar. */ | 360 | /** Take ownership of all events in calendar. */ |
356 | void takeOverCalendar(); | 361 | void takeOverCalendar(); |
357 | 362 | ||
358 | /** query whether or not the calendar is "dirty". */ | 363 | /** query whether or not the calendar is "dirty". */ |
359 | bool isModified(); | 364 | bool isModified(); |
360 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 365 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
361 | void setModified(bool modified=true); | 366 | void setModified(bool modified=true); |
362 | 367 | ||
363 | /** query if the calendar is read-only. */ | 368 | /** query if the calendar is read-only. */ |
364 | bool isReadOnly(); | 369 | bool isReadOnly(); |
365 | /** set state of calendar to read-only */ | 370 | /** set state of calendar to read-only */ |
366 | void setReadOnly(bool readOnly=true); | 371 | void setReadOnly(bool readOnly=true); |
367 | 372 | ||
368 | void eventUpdated(Incidence *); | 373 | void eventUpdated(Incidence *); |
369 | 374 | ||
370 | /* iTIP scheduling actions */ | 375 | /* iTIP scheduling actions */ |
371 | void schedule_publish(Incidence *incidence = 0); | 376 | void schedule_publish(Incidence *incidence = 0); |
372 | void schedule_request(Incidence *incidence = 0); | 377 | void schedule_request(Incidence *incidence = 0); |
373 | void schedule_refresh(Incidence *incidence = 0); | 378 | void schedule_refresh(Incidence *incidence = 0); |
374 | void schedule_cancel(Incidence *incidence = 0); | 379 | void schedule_cancel(Incidence *incidence = 0); |
375 | void schedule_add(Incidence *incidence = 0); | 380 | void schedule_add(Incidence *incidence = 0); |
376 | void schedule_reply(Incidence *incidence = 0); | 381 | void schedule_reply(Incidence *incidence = 0); |
377 | void schedule_counter(Incidence *incidence = 0); | 382 | void schedule_counter(Incidence *incidence = 0); |