-rw-r--r-- | korganizer/calendarview.cpp | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3ce123c..ab59d00 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -107,439 +107,443 @@ | |||
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "datenavigatorcontainer.h" | 110 | #include "datenavigatorcontainer.h" |
111 | #include "statusdialog.h" | 111 | #include "statusdialog.h" |
112 | #include "kdatenavigator.h" | 112 | #include "kdatenavigator.h" |
113 | #include "kotodoview.h" | 113 | #include "kotodoview.h" |
114 | #include "datenavigator.h" | 114 | #include "datenavigator.h" |
115 | #include "resourceview.h" | 115 | #include "resourceview.h" |
116 | #include "navigatorbar.h" | 116 | #include "navigatorbar.h" |
117 | #include "searchdialog.h" | 117 | #include "searchdialog.h" |
118 | #include "mainwindow.h" | 118 | #include "mainwindow.h" |
119 | 119 | ||
120 | #include "calendarview.h" | 120 | #include "calendarview.h" |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | #include <qtopia/alarmserver.h> | 122 | #include <qtopia/alarmserver.h> |
123 | #endif | 123 | #endif |
124 | #ifndef _WIN32_ | 124 | #ifndef _WIN32_ |
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | class KOBeamPrefs : public QDialog | 142 | class KOBeamPrefs : public QDialog |
143 | { | 143 | { |
144 | public: | 144 | public: |
145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
146 | QDialog( parent, name, true ) | 146 | QDialog( parent, name, true ) |
147 | { | 147 | { |
148 | setCaption( i18n("Beam Options") ); | 148 | setCaption( i18n("Beam Options") ); |
149 | QVBoxLayout* lay = new QVBoxLayout( this ); | 149 | QVBoxLayout* lay = new QVBoxLayout( this ); |
150 | lay->setSpacing( 3 ); | 150 | lay->setSpacing( 3 ); |
151 | lay->setMargin( 3 ); | 151 | lay->setMargin( 3 ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
153 | lay->addWidget( format ); | 153 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 154 | format->setExclusive ( true ) ; |
155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
156 | lay->addWidget( time ); time->setExclusive ( true ) ; | 156 | lay->addWidget( time ); time->setExclusive ( true ) ; |
157 | vcal = new QRadioButton(" vCalendar ", format ); | 157 | vcal = new QRadioButton(" vCalendar ", format ); |
158 | ical = new QRadioButton(" iCalendar ", format ); | 158 | ical = new QRadioButton(" iCalendar ", format ); |
159 | vcal->setChecked( true ); | 159 | vcal->setChecked( true ); |
160 | tz = new QRadioButton(i18n(" With timezone "), time ); | 160 | tz = new QRadioButton(i18n(" With timezone "), time ); |
161 | local = new QRadioButton(i18n(" Local time "), time ); | 161 | local = new QRadioButton(i18n(" Local time "), time ); |
162 | tz->setChecked( true ); | 162 | tz->setChecked( true ); |
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 164 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 166 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 169 | resize( 200, 200 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 172 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 173 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 174 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 176 | }; |
177 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
178 | { | 178 | { |
179 | public: | 179 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
182 | { | 182 | { |
183 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
202 | } | 202 | } |
203 | 203 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 205 | private: |
206 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 211 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 212 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 213 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 214 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 215 | mResourceManager( calendar->resourceManager() ) |
216 | { | 216 | { |
217 | 217 | ||
218 | mEventEditor = 0; | 218 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 219 | mTodoEditor = 0; |
220 | 220 | ||
221 | init(); | 221 | init(); |
222 | } | 222 | } |
223 | 223 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 224 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 225 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 226 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 227 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 228 | mResourceManager( 0 ) |
229 | { | 229 | { |
230 | 230 | ||
231 | mEventEditor = 0; | 231 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 232 | mTodoEditor = 0; |
233 | init(); | 233 | init(); |
234 | } | 234 | } |
235 | 235 | ||
236 | void CalendarView::init() | 236 | void CalendarView::init() |
237 | { | 237 | { |
238 | 238 | ||
239 | setFocusPolicy ( WheelFocus ); | 239 | setFocusPolicy ( WheelFocus ); |
240 | mViewerCallerIsSearchDialog = false; | 240 | mViewerCallerIsSearchDialog = false; |
241 | mBlockShowDates = false; | 241 | mBlockShowDates = false; |
242 | beamDialog = new KOBeamPrefs(); | 242 | beamDialog = new KOBeamPrefs(); |
243 | mDatePickerMode = 0; | 243 | mDatePickerMode = 0; |
244 | mCurrentSyncDevice = ""; | 244 | mCurrentSyncDevice = ""; |
245 | writeLocale(); | 245 | writeLocale(); |
246 | mViewManager = new KOViewManager( this ); | 246 | mViewManager = new KOViewManager( this ); |
247 | mDialogManager = new KODialogManager( this ); | 247 | mDialogManager = new KODialogManager( this ); |
248 | mEventViewerDialog = 0; | 248 | mEventViewerDialog = 0; |
249 | mModified = false; | 249 | mModified = false; |
250 | mReadOnly = false; | 250 | mReadOnly = false; |
251 | mSelectedIncidence = 0; | 251 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 252 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 253 | mFilters.setAutoDelete(true); |
254 | 254 | ||
255 | mCalendar->registerObserver( this ); | 255 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 256 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 257 | ||
258 | mStorage = new FileStorage( mCalendar ); | 258 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 260 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 262 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 263 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 265 | topLayout->addWidget(mPanner); |
266 | 266 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 268 | "CalendarView::LeftFrame"); |
269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
270 | 270 | ||
271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
272 | "CalendarView::DateNavigator" ); | 272 | "CalendarView::DateNavigator" ); |
273 | 273 | ||
274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
276 | mTodoList->setNavigator( mNavigator ); | 276 | mTodoList->setNavigator( mNavigator ); |
277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
278 | 278 | ||
279 | #ifdef KORG_NORESOURCEVIEW | 279 | #ifdef KORG_NORESOURCEVIEW |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | #else | 281 | #else |
282 | if ( mResourceManager ) { | 282 | if ( mResourceManager ) { |
283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
284 | mResourceView->updateView(); | 284 | mResourceView->updateView(); |
285 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 285 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
286 | SLOT( updateView() ) ); | 286 | SLOT( updateView() ) ); |
287 | } else { | 287 | } else { |
288 | mResourceView = 0; | 288 | mResourceView = 0; |
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | QWidget *rightBox = new QWidget( mPanner ); | 291 | QWidget *rightBox = new QWidget( mPanner ); |
292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
293 | 293 | ||
294 | mRightFrame = new QWidgetStack( rightBox ); | 294 | mRightFrame = new QWidgetStack( rightBox ); |
295 | rightLayout->addWidget( mRightFrame, 1 ); | 295 | rightLayout->addWidget( mRightFrame, 1 ); |
296 | 296 | ||
297 | mLeftFrame = mLeftSplitter; | 297 | mLeftFrame = mLeftSplitter; |
298 | #else | 298 | #else |
299 | QWidget *mainBox = new QWidget( this ); | 299 | //QWidget *mainBox = new QWidget( this ); |
300 | //QWidget *leftFrame = new QWidget( mainBox ); | 300 | //QWidget *leftFrame = new QWidget( mainBox ); |
301 | QBoxLayout * mainBoxLayout; | 301 | //QBoxLayout * mainBoxLayout; |
302 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
303 | mainBoxLayout = new QVBoxLayout(mainBox); | 303 | //mainBoxLayout = new QVBoxLayout(mainBox); |
304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
305 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; | 305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
306 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); | 306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | ||
308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
307 | } else { | 309 | } else { |
308 | mainBoxLayout = new QHBoxLayout(mainBox); | 310 | //mainBoxLayout = new QHBoxLayout(mainBox); |
309 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
310 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; | 312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | ||
314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | ||
311 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
312 | } | 316 | } |
313 | //QBoxLayout * leftFrameLayout; | 317 | //QBoxLayout * leftFrameLayout; |
314 | topLayout->addWidget( mainBox ); | 318 | topLayout->addWidget( mMainFrame ); |
315 | mainBoxLayout->addWidget (mLeftFrame); | 319 | //mainBoxLayout->addWidget (mLeftFrame); |
316 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 320 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
317 | "CalendarView::DateNavigator" ); | 321 | "CalendarView::DateNavigator" ); |
318 | #if 0 | 322 | #if 0 |
319 | // FIXME | 323 | // FIXME |
320 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 324 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
321 | "CalendarView::DateNavigator", QDate::currentDate()); | 325 | "CalendarView::DateNavigator", QDate::currentDate()); |
322 | #endif | 326 | #endif |
323 | // mDateNavigator->blockSignals( true ); | 327 | // mDateNavigator->blockSignals( true ); |
324 | //leftFrameLayout->addWidget( mDateNavigator ); | 328 | //leftFrameLayout->addWidget( mDateNavigator ); |
325 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 329 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
326 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 330 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
327 | mTodoList->setNavigator( mNavigator ); | 331 | mTodoList->setNavigator( mNavigator ); |
328 | #if 0 | 332 | #if 0 |
329 | if ( QApplication::desktop()->width() < 480 ) { | 333 | if ( QApplication::desktop()->width() < 480 ) { |
330 | leftFrameLayout->addWidget(mFilterView); | 334 | leftFrameLayout->addWidget(mFilterView); |
331 | leftFrameLayout->addWidget(mTodoList, 2 ); | 335 | leftFrameLayout->addWidget(mTodoList, 2 ); |
332 | 336 | ||
333 | } else { | 337 | } else { |
334 | leftFrameLayout->addWidget(mTodoList,2 ); | 338 | leftFrameLayout->addWidget(mTodoList,2 ); |
335 | leftFrameLayout->addWidget(mFilterView ); | 339 | leftFrameLayout->addWidget(mFilterView ); |
336 | } | 340 | } |
337 | #endif | 341 | #endif |
338 | mFilterView->hide(); | 342 | mFilterView->hide(); |
339 | QWidget *rightBox = new QWidget( mainBox ); | 343 | QWidget *rightBox = new QWidget( mMainFrame ); |
340 | mainBoxLayout->addWidget ( rightBox, 10 ); | 344 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 345 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
342 | mRightFrame = new QWidgetStack( rightBox ); | 346 | mRightFrame = new QWidgetStack( rightBox ); |
343 | rightLayout->addWidget( mRightFrame, 10 ); | 347 | rightLayout->addWidget( mRightFrame, 10 ); |
344 | 348 | ||
345 | //mLeftFrame = (QWidget *)leftFrame; | 349 | //mLeftFrame = (QWidget *)leftFrame; |
346 | if ( KOPrefs::instance()->mVerticalScreen ) { | 350 | if ( KOPrefs::instance()->mVerticalScreen ) { |
347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 351 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 352 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
349 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 353 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 354 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
351 | } else { | 355 | } else { |
352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 356 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
353 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 357 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 358 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
355 | } | 359 | } |
356 | if ( !KOPrefs::instance()->mShowDateNavigator) | 360 | if ( !KOPrefs::instance()->mShowDateNavigator) |
357 | mDateNavigator->hide(); | 361 | mDateNavigator->hide(); |
358 | //qDebug("Calendarview Size %d %d ", width(), height()); | 362 | //qDebug("Calendarview Size %d %d ", width(), height()); |
359 | #endif | 363 | #endif |
360 | 364 | ||
361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 365 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
362 | SLOT( showDates( const KCal::DateList & ) ) ); | 366 | SLOT( showDates( const KCal::DateList & ) ) ); |
363 | 367 | ||
364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 368 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
365 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 369 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
366 | 370 | ||
367 | 371 | ||
368 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 372 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
369 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 373 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
370 | 374 | ||
371 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 375 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
372 | mNavigator, SLOT( selectPreviousYear() ) ); | 376 | mNavigator, SLOT( selectPreviousYear() ) ); |
373 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 377 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
374 | mNavigator, SLOT( selectNextYear() ) ); | 378 | mNavigator, SLOT( selectNextYear() ) ); |
375 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 379 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
376 | mNavigator, SLOT( selectPreviousMonth() ) ); | 380 | mNavigator, SLOT( selectPreviousMonth() ) ); |
377 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 381 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
378 | mNavigator, SLOT( selectNextMonth() ) ); | 382 | mNavigator, SLOT( selectNextMonth() ) ); |
379 | 383 | ||
380 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 384 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
381 | mNavigator, SLOT( selectPrevious() ) ); | 385 | mNavigator, SLOT( selectPrevious() ) ); |
382 | connect( mDateNavigator, SIGNAL( goNext() ), | 386 | connect( mDateNavigator, SIGNAL( goNext() ), |
383 | mNavigator, SLOT( selectNext() ) ); | 387 | mNavigator, SLOT( selectNext() ) ); |
384 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 388 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
385 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 389 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
386 | 390 | ||
387 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 391 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
388 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 392 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
389 | #if 0 | 393 | #if 0 |
390 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 394 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
391 | SLOT( incidenceAdded( Incidence *) ) ); | 395 | SLOT( incidenceAdded( Incidence *) ) ); |
392 | #endif | 396 | #endif |
393 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 397 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
394 | 398 | ||
395 | connect( this, SIGNAL( configChanged() ), | 399 | connect( this, SIGNAL( configChanged() ), |
396 | mDateNavigator, SLOT( updateConfig() ) ); | 400 | mDateNavigator, SLOT( updateConfig() ) ); |
397 | 401 | ||
398 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 402 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
399 | SLOT( newTodo() ) ); | 403 | SLOT( newTodo() ) ); |
400 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 404 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
401 | SLOT( newSubTodo( Todo * ) ) ); | 405 | SLOT( newSubTodo( Todo * ) ) ); |
402 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 406 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
403 | SLOT( editTodo( Todo * ) ) ); | 407 | SLOT( editTodo( Todo * ) ) ); |
404 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 408 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
405 | SLOT( showTodo( Todo *) ) ); | 409 | SLOT( showTodo( Todo *) ) ); |
406 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 410 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
407 | SLOT( deleteTodo( Todo *) ) ); | 411 | SLOT( deleteTodo( Todo *) ) ); |
408 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 412 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
409 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 413 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
410 | SLOT( purgeCompleted() ) ); | 414 | SLOT( purgeCompleted() ) ); |
411 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 415 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
412 | SIGNAL( todoModified( Todo *, int ) ) ); | 416 | SIGNAL( todoModified( Todo *, int ) ) ); |
413 | 417 | ||
414 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 418 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
415 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 419 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
416 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 420 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
417 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 421 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
418 | 422 | ||
419 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 423 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
420 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 424 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
421 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 425 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
422 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 426 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
423 | 427 | ||
424 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 428 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
425 | this, SLOT ( todo_unsub( Todo * ) ) ); | 429 | this, SLOT ( todo_unsub( Todo * ) ) ); |
426 | 430 | ||
427 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 431 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
428 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 432 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
429 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 433 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
430 | SLOT( updateTodo( Todo *, int ) ) ); | 434 | SLOT( updateTodo( Todo *, int ) ) ); |
431 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 435 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
432 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 436 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
433 | 437 | ||
434 | 438 | ||
435 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 439 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
436 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 440 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
437 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 441 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
438 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 442 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
439 | 443 | ||
440 | 444 | ||
441 | 445 | ||
442 | 446 | ||
443 | 447 | ||
444 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 448 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
445 | SLOT(checkClipboard())); | 449 | SLOT(checkClipboard())); |
446 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 450 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
447 | SLOT( processTodoListSelection( Incidence * ) ) ); | 451 | SLOT( processTodoListSelection( Incidence * ) ) ); |
448 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 452 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
449 | 453 | ||
450 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 454 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
451 | 455 | ||
452 | mDateFrame = new QVBox(0,0,WType_Popup); | 456 | mDateFrame = new QVBox(0,0,WType_Popup); |
453 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 457 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
454 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 458 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
455 | mDateFrame->setLineWidth(3); | 459 | mDateFrame->setLineWidth(3); |
456 | mDateFrame->hide(); | 460 | mDateFrame->hide(); |
457 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 461 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
458 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 462 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
459 | 463 | ||
460 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 464 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
461 | 465 | ||
462 | mEventEditor = mDialogManager->getEventEditor(); | 466 | mEventEditor = mDialogManager->getEventEditor(); |
463 | mTodoEditor = mDialogManager->getTodoEditor(); | 467 | mTodoEditor = mDialogManager->getTodoEditor(); |
464 | 468 | ||
465 | mFlagEditDescription = false; | 469 | mFlagEditDescription = false; |
466 | 470 | ||
467 | mSuspendTimer = new QTimer( this ); | 471 | mSuspendTimer = new QTimer( this ); |
468 | mAlarmTimer = new QTimer( this ); | 472 | mAlarmTimer = new QTimer( this ); |
469 | mRecheckAlarmTimer = new QTimer( this ); | 473 | mRecheckAlarmTimer = new QTimer( this ); |
470 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 474 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
471 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 475 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
472 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 476 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
473 | mAlarmDialog = new AlarmDialog( this ); | 477 | mAlarmDialog = new AlarmDialog( this ); |
474 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 478 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
475 | mAlarmDialog->setServerNotification( false ); | 479 | mAlarmDialog->setServerNotification( false ); |
476 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 480 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
477 | 481 | ||
478 | 482 | ||
479 | #ifndef DESKTOP_VERSION | 483 | #ifndef DESKTOP_VERSION |
480 | //US listen for arriving address resultsets | 484 | //US listen for arriving address resultsets |
481 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 485 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
482 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 486 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
483 | #endif | 487 | #endif |
484 | mDateNavigator->setCalendar( mCalendar ); | 488 | mDateNavigator->setCalendar( mCalendar ); |
485 | } | 489 | } |
486 | 490 | ||
487 | 491 | ||
488 | CalendarView::~CalendarView() | 492 | CalendarView::~CalendarView() |
489 | { | 493 | { |
490 | // kdDebug() << "~CalendarView()" << endl; | 494 | // kdDebug() << "~CalendarView()" << endl; |
491 | //qDebug("CalendarView::~CalendarView() "); | 495 | //qDebug("CalendarView::~CalendarView() "); |
492 | delete mDialogManager; | 496 | delete mDialogManager; |
493 | delete mViewManager; | 497 | delete mViewManager; |
494 | delete mStorage; | 498 | delete mStorage; |
495 | delete mDateFrame ; | 499 | delete mDateFrame ; |
496 | delete beamDialog; | 500 | delete beamDialog; |
497 | delete mEventViewerDialog; | 501 | delete mEventViewerDialog; |
498 | //kdDebug() << "~CalendarView() done" << endl; | 502 | //kdDebug() << "~CalendarView() done" << endl; |
499 | } | 503 | } |
500 | 504 | ||
501 | void CalendarView::showDay( QDate d ) | 505 | void CalendarView::showDay( QDate d ) |
502 | { | 506 | { |
503 | dateNavigator()->blockSignals( true ); | 507 | dateNavigator()->blockSignals( true ); |
504 | dateNavigator()->selectDate( d ); | 508 | dateNavigator()->selectDate( d ); |
505 | dateNavigator()->blockSignals( false ); | 509 | dateNavigator()->blockSignals( false ); |
506 | mViewManager->showDayView(); | 510 | mViewManager->showDayView(); |
507 | //dateNavigator()->selectDate( d ); | 511 | //dateNavigator()->selectDate( d ); |
508 | } | 512 | } |
509 | void CalendarView::timerAlarm() | 513 | void CalendarView::timerAlarm() |
510 | { | 514 | { |
511 | //qDebug("CalendarView::timerAlarm() "); | 515 | //qDebug("CalendarView::timerAlarm() "); |
512 | computeAlarm(mAlarmNotification ); | 516 | computeAlarm(mAlarmNotification ); |
513 | } | 517 | } |
514 | 518 | ||
515 | void CalendarView::suspendAlarm() | 519 | void CalendarView::suspendAlarm() |
516 | { | 520 | { |
517 | //qDebug(" CalendarView::suspendAlarm() "); | 521 | //qDebug(" CalendarView::suspendAlarm() "); |
518 | computeAlarm(mSuspendAlarmNotification ); | 522 | computeAlarm(mSuspendAlarmNotification ); |
519 | 523 | ||
520 | } | 524 | } |
521 | 525 | ||
522 | void CalendarView::startAlarm( QString mess , QString filename) | 526 | void CalendarView::startAlarm( QString mess , QString filename) |
523 | { | 527 | { |
524 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 528 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
525 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 529 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
526 | 530 | ||
527 | } | 531 | } |
528 | 532 | ||
529 | void CalendarView::checkNextTimerAlarm() | 533 | void CalendarView::checkNextTimerAlarm() |
530 | { | 534 | { |
531 | mCalendar->checkAlarmForIncidence( 0, true ); | 535 | mCalendar->checkAlarmForIncidence( 0, true ); |
532 | } | 536 | } |
533 | 537 | ||
534 | void CalendarView::computeAlarm( QString msg ) | 538 | void CalendarView::computeAlarm( QString msg ) |
535 | { | 539 | { |
536 | 540 | ||
537 | QString mess = msg; | 541 | QString mess = msg; |
538 | QString mAlarmMessage = mess.mid( 9 ); | 542 | QString mAlarmMessage = mess.mid( 9 ); |
539 | QString filename = MainWindow::resourcePath(); | 543 | QString filename = MainWindow::resourcePath(); |
540 | filename += "koalarm.wav"; | 544 | filename += "koalarm.wav"; |
541 | QString tempfilename; | 545 | QString tempfilename; |
542 | if ( mess.left( 13 ) == "suspend_alarm") { | 546 | if ( mess.left( 13 ) == "suspend_alarm") { |
543 | bool error = false; | 547 | bool error = false; |
544 | int len = mess.mid( 13 ).find("+++"); | 548 | int len = mess.mid( 13 ).find("+++"); |
545 | if ( len < 2 ) | 549 | if ( len < 2 ) |
@@ -1646,478 +1650,510 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1646 | mTodoList->setDocumentId( filename ); | 1650 | mTodoList->setDocumentId( filename ); |
1647 | } | 1651 | } |
1648 | globalFlagBlockAgenda = 2; | 1652 | globalFlagBlockAgenda = 2; |
1649 | // if ( getLastSyncEvent() ) | 1653 | // if ( getLastSyncEvent() ) |
1650 | // getLastSyncEvent()->setReadOnly( true ); | 1654 | // getLastSyncEvent()->setReadOnly( true ); |
1651 | mCalendar->reInitAlarmSettings(); | 1655 | mCalendar->reInitAlarmSettings(); |
1652 | setSyncEventsReadOnly(); | 1656 | setSyncEventsReadOnly(); |
1653 | updateUnmanagedViews(); | 1657 | updateUnmanagedViews(); |
1654 | updateView(); | 1658 | updateView(); |
1655 | if ( filename != MainWindow::defaultFileName() ) { | 1659 | if ( filename != MainWindow::defaultFileName() ) { |
1656 | saveCalendar( MainWindow::defaultFileName() ); | 1660 | saveCalendar( MainWindow::defaultFileName() ); |
1657 | } else { | 1661 | } else { |
1658 | QFileInfo finf ( MainWindow::defaultFileName()); | 1662 | QFileInfo finf ( MainWindow::defaultFileName()); |
1659 | if ( finf.exists() ) { | 1663 | if ( finf.exists() ) { |
1660 | setLoadedFileVersion( finf.lastModified () ); | 1664 | setLoadedFileVersion( finf.lastModified () ); |
1661 | } | 1665 | } |
1662 | } | 1666 | } |
1663 | return true; | 1667 | return true; |
1664 | } else { | 1668 | } else { |
1665 | // while failing to load, the calendar object could | 1669 | // while failing to load, the calendar object could |
1666 | // have become partially populated. Clear it out. | 1670 | // have become partially populated. Clear it out. |
1667 | if ( !merge ) { | 1671 | if ( !merge ) { |
1668 | mCalendar->close(); | 1672 | mCalendar->close(); |
1669 | mViewManager->setDocumentId( filename ); | 1673 | mViewManager->setDocumentId( filename ); |
1670 | mDialogManager->setDocumentId( filename ); | 1674 | mDialogManager->setDocumentId( filename ); |
1671 | mTodoList->setDocumentId( filename ); | 1675 | mTodoList->setDocumentId( filename ); |
1672 | } | 1676 | } |
1673 | 1677 | ||
1674 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1678 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1675 | 1679 | ||
1676 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1680 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1677 | globalFlagBlockAgenda = 2; | 1681 | globalFlagBlockAgenda = 2; |
1678 | mCalendar->reInitAlarmSettings(); | 1682 | mCalendar->reInitAlarmSettings(); |
1679 | setSyncEventsReadOnly(); | 1683 | setSyncEventsReadOnly(); |
1680 | updateUnmanagedViews(); | 1684 | updateUnmanagedViews(); |
1681 | updateView(); | 1685 | updateView(); |
1682 | } | 1686 | } |
1683 | return false; | 1687 | return false; |
1684 | } | 1688 | } |
1685 | void CalendarView::showOpenError() | 1689 | void CalendarView::showOpenError() |
1686 | { | 1690 | { |
1687 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1691 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1688 | } | 1692 | } |
1689 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1693 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1690 | { | 1694 | { |
1691 | loadedFileVersion = dt; | 1695 | loadedFileVersion = dt; |
1692 | } | 1696 | } |
1693 | bool CalendarView::checkFileChanged(QString fn) | 1697 | bool CalendarView::checkFileChanged(QString fn) |
1694 | { | 1698 | { |
1695 | QFileInfo finf ( fn ); | 1699 | QFileInfo finf ( fn ); |
1696 | if ( !finf.exists() ) | 1700 | if ( !finf.exists() ) |
1697 | return true; | 1701 | return true; |
1698 | QDateTime dt = finf.lastModified (); | 1702 | QDateTime dt = finf.lastModified (); |
1699 | if ( dt <= loadedFileVersion ) | 1703 | if ( dt <= loadedFileVersion ) |
1700 | return false; | 1704 | return false; |
1701 | return true; | 1705 | return true; |
1702 | 1706 | ||
1703 | } | 1707 | } |
1704 | void CalendarView::watchSavedFile() | 1708 | void CalendarView::watchSavedFile() |
1705 | { | 1709 | { |
1706 | QFileInfo finf ( MainWindow::defaultFileName()); | 1710 | QFileInfo finf ( MainWindow::defaultFileName()); |
1707 | if ( !finf.exists() ) | 1711 | if ( !finf.exists() ) |
1708 | return; | 1712 | return; |
1709 | QDateTime dt = finf.lastModified (); | 1713 | QDateTime dt = finf.lastModified (); |
1710 | if ( dt < loadedFileVersion ) { | 1714 | if ( dt < loadedFileVersion ) { |
1711 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1715 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1712 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1716 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1713 | return; | 1717 | return; |
1714 | } | 1718 | } |
1715 | loadedFileVersion = dt; | 1719 | loadedFileVersion = dt; |
1716 | } | 1720 | } |
1717 | 1721 | ||
1718 | bool CalendarView::checkFileVersion(QString fn) | 1722 | bool CalendarView::checkFileVersion(QString fn) |
1719 | { | 1723 | { |
1720 | QFileInfo finf ( fn ); | 1724 | QFileInfo finf ( fn ); |
1721 | if ( !finf.exists() ) | 1725 | if ( !finf.exists() ) |
1722 | return true; | 1726 | return true; |
1723 | QDateTime dt = finf.lastModified (); | 1727 | QDateTime dt = finf.lastModified (); |
1724 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1728 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1725 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1729 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1726 | if ( dt <= loadedFileVersion ) | 1730 | if ( dt <= loadedFileVersion ) |
1727 | return true; | 1731 | return true; |
1728 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1732 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1729 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1733 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1730 | i18n("Sync+save")); | 1734 | i18n("Sync+save")); |
1731 | 1735 | ||
1732 | if ( km == KMessageBox::Cancel ) | 1736 | if ( km == KMessageBox::Cancel ) |
1733 | return false; | 1737 | return false; |
1734 | if ( km == KMessageBox::Yes ) | 1738 | if ( km == KMessageBox::Yes ) |
1735 | return true; | 1739 | return true; |
1736 | 1740 | ||
1737 | setSyncDevice("deleteaftersync" ); | 1741 | setSyncDevice("deleteaftersync" ); |
1738 | mSyncManager->mAskForPreferences = true; | 1742 | mSyncManager->mAskForPreferences = true; |
1739 | mSyncManager->mSyncAlgoPrefs = 3; | 1743 | mSyncManager->mSyncAlgoPrefs = 3; |
1740 | mSyncManager->mWriteBackFile = false; | 1744 | mSyncManager->mWriteBackFile = false; |
1741 | mSyncManager->mWriteBackExistingOnly = false; | 1745 | mSyncManager->mWriteBackExistingOnly = false; |
1742 | mSyncManager->mShowSyncSummary = false; | 1746 | mSyncManager->mShowSyncSummary = false; |
1743 | syncCalendar( fn, 3 ); | 1747 | syncCalendar( fn, 3 ); |
1744 | Event * e = getLastSyncEvent(); | 1748 | Event * e = getLastSyncEvent(); |
1745 | mCalendar->deleteEvent ( e ); | 1749 | mCalendar->deleteEvent ( e ); |
1746 | updateView(); | 1750 | updateView(); |
1747 | return true; | 1751 | return true; |
1748 | } | 1752 | } |
1749 | 1753 | ||
1750 | bool CalendarView::saveCalendar( QString filename ) | 1754 | bool CalendarView::saveCalendar( QString filename ) |
1751 | { | 1755 | { |
1752 | 1756 | ||
1753 | // Store back all unsaved data into calendar object | 1757 | // Store back all unsaved data into calendar object |
1754 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1758 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1755 | if ( mViewManager->currentView() ) | 1759 | if ( mViewManager->currentView() ) |
1756 | mViewManager->currentView()->flushView(); | 1760 | mViewManager->currentView()->flushView(); |
1757 | 1761 | ||
1758 | 1762 | ||
1759 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1763 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1760 | mStorage->setSaveFormat( new ICalFormat() ); | 1764 | mStorage->setSaveFormat( new ICalFormat() ); |
1761 | mStorage->setFileName( filename ); | 1765 | mStorage->setFileName( filename ); |
1762 | bool success; | 1766 | bool success; |
1763 | success = mStorage->save(); | 1767 | success = mStorage->save(); |
1764 | if ( !success ) { | 1768 | if ( !success ) { |
1765 | return false; | 1769 | return false; |
1766 | } | 1770 | } |
1767 | if ( filename == MainWindow::defaultFileName() ) { | 1771 | if ( filename == MainWindow::defaultFileName() ) { |
1768 | setLoadedFileVersion( lfv ); | 1772 | setLoadedFileVersion( lfv ); |
1769 | watchSavedFile(); | 1773 | watchSavedFile(); |
1770 | } | 1774 | } |
1771 | return true; | 1775 | return true; |
1772 | } | 1776 | } |
1773 | 1777 | ||
1774 | void CalendarView::closeCalendar() | 1778 | void CalendarView::closeCalendar() |
1775 | { | 1779 | { |
1776 | 1780 | ||
1777 | // child windows no longer valid | 1781 | // child windows no longer valid |
1778 | emit closingDown(); | 1782 | emit closingDown(); |
1779 | 1783 | ||
1780 | mCalendar->close(); | 1784 | mCalendar->close(); |
1781 | setModified(false); | 1785 | setModified(false); |
1782 | updateView(); | 1786 | updateView(); |
1783 | } | 1787 | } |
1784 | 1788 | ||
1785 | void CalendarView::archiveCalendar() | 1789 | void CalendarView::archiveCalendar() |
1786 | { | 1790 | { |
1787 | mDialogManager->showArchiveDialog(); | 1791 | mDialogManager->showArchiveDialog(); |
1788 | } | 1792 | } |
1789 | 1793 | ||
1790 | 1794 | ||
1791 | void CalendarView::readSettings() | 1795 | void CalendarView::readSettings() |
1792 | { | 1796 | { |
1793 | 1797 | ||
1794 | 1798 | ||
1795 | // mViewManager->showAgendaView(); | 1799 | // mViewManager->showAgendaView(); |
1796 | QString str; | 1800 | QString str; |
1797 | //qDebug("CalendarView::readSettings() "); | 1801 | //qDebug("CalendarView::readSettings() "); |
1798 | // read settings from the KConfig, supplying reasonable | 1802 | // read settings from the KConfig, supplying reasonable |
1799 | // defaults where none are to be found | 1803 | // defaults where none are to be found |
1800 | KConfig *config = KOGlobals::config(); | 1804 | KConfig *config = KOGlobals::config(); |
1801 | #ifndef KORG_NOSPLITTER | 1805 | #ifndef KORG_NOSPLITTER |
1802 | config->setGroup("KOrganizer Geometry"); | 1806 | config->setGroup("KOrganizer Geometry"); |
1803 | 1807 | ||
1804 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1808 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1805 | if (sizes.count() != 2) { | 1809 | if (sizes.count() != 2) { |
1806 | sizes << mDateNavigator->minimumSizeHint().width(); | 1810 | sizes << mDateNavigator->minimumSizeHint().width(); |
1807 | sizes << 300; | 1811 | sizes << 300; |
1808 | } | 1812 | } |
1809 | mPanner->setSizes(sizes); | 1813 | mPanner->setSizes(sizes); |
1810 | 1814 | ||
1811 | sizes = config->readIntListEntry("Separator2"); | 1815 | sizes = config->readIntListEntry("Separator2"); |
1812 | if ( ( mResourceView && sizes.count() == 4 ) || | 1816 | if ( ( mResourceView && sizes.count() == 4 ) || |
1813 | ( !mResourceView && sizes.count() == 3 ) ) { | 1817 | ( !mResourceView && sizes.count() == 3 ) ) { |
1814 | mLeftSplitter->setSizes(sizes); | 1818 | mLeftSplitter->setSizes(sizes); |
1815 | } | 1819 | } |
1816 | #endif | 1820 | #endif |
1817 | globalFlagBlockAgenda = 1; | 1821 | globalFlagBlockAgenda = 1; |
1818 | mViewManager->showAgendaView(); | 1822 | mViewManager->showAgendaView(); |
1819 | //mViewManager->readSettings( config ); | 1823 | //mViewManager->readSettings( config ); |
1820 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1824 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1821 | readFilterSettings(config); | 1825 | readFilterSettings(config); |
1822 | config->setGroup( "Views" ); | 1826 | config->setGroup( "Views" ); |
1823 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1827 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1824 | 1828 | ||
1825 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1829 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1826 | 1830 | ||
1827 | int resetval = 0; | 1831 | int resetval = 0; |
1828 | int maxVal = 0; | 1832 | int maxVal = 0; |
1829 | if (sizes.count() != 3) { | 1833 | if (sizes.count() != 3) { |
1830 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1834 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1831 | resetval = mDateNavigator->sizeHint().width()+2; | 1835 | resetval = mDateNavigator->sizeHint().width()+2; |
1832 | } else { | 1836 | } else { |
1833 | resetval = mDateNavigator->sizeHint().height()+2; | 1837 | resetval = mDateNavigator->sizeHint().height()+2; |
1834 | } | 1838 | } |
1835 | } | 1839 | } |
1836 | if ( !resetval ){// i.e. sizes.count() == 3 | 1840 | if ( !resetval ){// i.e. sizes.count() == 3 |
1837 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1841 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | 1842 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) |
1839 | resetval = mDateNavigator->sizeHint().width()+2; | 1843 | resetval = mDateNavigator->sizeHint().width()+2; |
1840 | } else { | 1844 | } else { |
1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | 1845 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) |
1842 | resetval = mDateNavigator->sizeHint().height()+2; | 1846 | resetval = mDateNavigator->sizeHint().height()+2; |
1843 | } | 1847 | } |
1844 | } | 1848 | } |
1845 | if ( resetval ) { | 1849 | if ( resetval ) { |
1846 | sizes.clear(); | 1850 | sizes.clear(); |
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1851 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1848 | maxVal = QApplication::desktop()->width() -10; | 1852 | maxVal = QApplication::desktop()->width() -10; |
1849 | } else { | 1853 | } else { |
1850 | maxVal = QApplication::desktop()->height()-10; | 1854 | maxVal = QApplication::desktop()->height()-10; |
1851 | } | 1855 | } |
1852 | sizes << resetval; | 1856 | sizes << resetval; |
1853 | if ( maxVal < resetval + resetval) | 1857 | if ( maxVal < resetval + resetval) |
1854 | resetval = maxVal - resetval; | 1858 | resetval = maxVal - resetval; |
1855 | sizes << resetval; | 1859 | sizes << resetval; |
1856 | sizes << 100; | 1860 | sizes << 100; |
1857 | } | 1861 | } |
1858 | mLeftFrame->setSizes(sizes); | 1862 | mLeftFrame->setSizes(sizes); |
1863 | sizes = config->readIntListEntry("Main Splitter Frame"); | ||
1864 | if (sizes.count() != 3) { | ||
1865 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1866 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1867 | } else { | ||
1868 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1869 | } | ||
1870 | } | ||
1871 | if ( !resetval ){// i.e. sizes.count() == 3 | ||
1872 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1873 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | ||
1874 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1875 | } else { | ||
1876 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | ||
1877 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1878 | } | ||
1879 | } | ||
1880 | if ( resetval ) { | ||
1881 | sizes.clear(); | ||
1882 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1883 | maxVal = QApplication::desktop()->width() -10; | ||
1884 | } else { | ||
1885 | maxVal = QApplication::desktop()->height()-10; | ||
1886 | } | ||
1887 | sizes << resetval; | ||
1888 | if ( maxVal < resetval + resetval) | ||
1889 | resetval = maxVal - resetval; | ||
1890 | sizes << resetval; | ||
1891 | } | ||
1892 | mMainFrame->setSizes(sizes); | ||
1893 | |||
1859 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1894 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1860 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1895 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1861 | else mNavigator->selectDates( dateCount ); | 1896 | else mNavigator->selectDates( dateCount ); |
1862 | // mViewManager->readSettings( config ); | 1897 | // mViewManager->readSettings( config ); |
1863 | updateConfig(); | 1898 | updateConfig(); |
1864 | globalFlagBlockAgenda = 2; | 1899 | globalFlagBlockAgenda = 2; |
1865 | mViewManager->readSettings( config ); | 1900 | mViewManager->readSettings( config ); |
1866 | #ifdef DESKTOP_VERSION | 1901 | #ifdef DESKTOP_VERSION |
1867 | config->setGroup("WidgetLayout"); | 1902 | config->setGroup("WidgetLayout"); |
1868 | QStringList list; | 1903 | QStringList list; |
1869 | list = config->readListEntry("MainLayout"); | 1904 | list = config->readListEntry("MainLayout"); |
1870 | int x,y,w,h; | 1905 | int x,y,w,h; |
1871 | if ( ! list.isEmpty() ) { | 1906 | if ( ! list.isEmpty() ) { |
1872 | x = list[0].toInt(); | 1907 | x = list[0].toInt(); |
1873 | y = list[1].toInt(); | 1908 | y = list[1].toInt(); |
1874 | w = list[2].toInt(); | 1909 | w = list[2].toInt(); |
1875 | h = list[3].toInt(); | 1910 | h = list[3].toInt(); |
1876 | topLevelWidget()->setGeometry(x,y,w,h); | 1911 | topLevelWidget()->setGeometry(x,y,w,h); |
1877 | 1912 | ||
1878 | } else { | 1913 | } else { |
1879 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1914 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1880 | } | 1915 | } |
1881 | list = config->readListEntry("EditEventLayout"); | 1916 | list = config->readListEntry("EditEventLayout"); |
1882 | if ( ! list.isEmpty() ) { | 1917 | if ( ! list.isEmpty() ) { |
1883 | x = list[0].toInt(); | 1918 | x = list[0].toInt(); |
1884 | y = list[1].toInt(); | 1919 | y = list[1].toInt(); |
1885 | w = list[2].toInt(); | 1920 | w = list[2].toInt(); |
1886 | h = list[3].toInt(); | 1921 | h = list[3].toInt(); |
1887 | mEventEditor->setGeometry(x,y,w,h); | 1922 | mEventEditor->setGeometry(x,y,w,h); |
1888 | 1923 | ||
1889 | } | 1924 | } |
1890 | list = config->readListEntry("EditTodoLayout"); | 1925 | list = config->readListEntry("EditTodoLayout"); |
1891 | if ( ! list.isEmpty() ) { | 1926 | if ( ! list.isEmpty() ) { |
1892 | x = list[0].toInt(); | 1927 | x = list[0].toInt(); |
1893 | y = list[1].toInt(); | 1928 | y = list[1].toInt(); |
1894 | w = list[2].toInt(); | 1929 | w = list[2].toInt(); |
1895 | h = list[3].toInt(); | 1930 | h = list[3].toInt(); |
1896 | mTodoEditor->setGeometry(x,y,w,h); | 1931 | mTodoEditor->setGeometry(x,y,w,h); |
1897 | 1932 | ||
1898 | } | 1933 | } |
1899 | list = config->readListEntry("ViewerLayout"); | 1934 | list = config->readListEntry("ViewerLayout"); |
1900 | if ( ! list.isEmpty() ) { | 1935 | if ( ! list.isEmpty() ) { |
1901 | x = list[0].toInt(); | 1936 | x = list[0].toInt(); |
1902 | y = list[1].toInt(); | 1937 | y = list[1].toInt(); |
1903 | w = list[2].toInt(); | 1938 | w = list[2].toInt(); |
1904 | h = list[3].toInt(); | 1939 | h = list[3].toInt(); |
1905 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1940 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1906 | } | 1941 | } |
1907 | #endif | 1942 | #endif |
1908 | 1943 | ||
1909 | } | 1944 | } |
1910 | 1945 | ||
1911 | 1946 | ||
1912 | void CalendarView::writeSettings() | 1947 | void CalendarView::writeSettings() |
1913 | { | 1948 | { |
1914 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1949 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1915 | 1950 | ||
1916 | KConfig *config = KOGlobals::config(); | 1951 | KConfig *config = KOGlobals::config(); |
1917 | 1952 | ||
1918 | mViewManager->writeSettings( config ); | 1953 | mViewManager->writeSettings( config ); |
1919 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1954 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1920 | mDialogManager->writeSettings( config ); | 1955 | mDialogManager->writeSettings( config ); |
1921 | //KOPrefs::instance()->usrWriteConfig(); | 1956 | //KOPrefs::instance()->usrWriteConfig(); |
1922 | KOPrefs::instance()->writeConfig(); | 1957 | KOPrefs::instance()->writeConfig(); |
1923 | 1958 | ||
1924 | writeFilterSettings(config); | 1959 | writeFilterSettings(config); |
1925 | 1960 | ||
1926 | config->setGroup( "Views" ); | 1961 | config->setGroup( "Views" ); |
1927 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1962 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1928 | 1963 | ||
1929 | QValueList<int> listINT = mLeftFrame->sizes(); | 1964 | QValueList<int> listINT = mLeftFrame->sizes(); |
1930 | config->writeEntry("Left Splitter Frame",listINT); | 1965 | config->writeEntry("Left Splitter Frame",listINT); |
1931 | 1966 | listINT = mMainFrame->sizes(); | |
1967 | config->writeEntry("Main Splitter Frame",listINT); | ||
1932 | #ifdef DESKTOP_VERSION | 1968 | #ifdef DESKTOP_VERSION |
1933 | config->setGroup("WidgetLayout"); | 1969 | config->setGroup("WidgetLayout"); |
1934 | QStringList list ;//= config->readListEntry("MainLayout"); | 1970 | QStringList list ;//= config->readListEntry("MainLayout"); |
1935 | int x,y,w,h; | 1971 | int x,y,w,h; |
1936 | QWidget* wid; | 1972 | QWidget* wid; |
1937 | wid = topLevelWidget(); | 1973 | wid = topLevelWidget(); |
1938 | x = wid->geometry().x(); | 1974 | x = wid->geometry().x(); |
1939 | y = wid->geometry().y(); | 1975 | y = wid->geometry().y(); |
1940 | w = wid->width(); | 1976 | w = wid->width(); |
1941 | h = wid->height(); | 1977 | h = wid->height(); |
1942 | list.clear(); | 1978 | list.clear(); |
1943 | list << QString::number( x ); | 1979 | list << QString::number( x ); |
1944 | list << QString::number( y ); | 1980 | list << QString::number( y ); |
1945 | list << QString::number( w ); | 1981 | list << QString::number( w ); |
1946 | list << QString::number( h ); | 1982 | list << QString::number( h ); |
1947 | config->writeEntry("MainLayout",list ); | 1983 | config->writeEntry("MainLayout",list ); |
1948 | 1984 | ||
1949 | wid = mEventEditor; | 1985 | wid = mEventEditor; |
1950 | x = wid->geometry().x(); | 1986 | x = wid->geometry().x(); |
1951 | y = wid->geometry().y(); | 1987 | y = wid->geometry().y(); |
1952 | w = wid->width(); | 1988 | w = wid->width(); |
1953 | h = wid->height(); | 1989 | h = wid->height(); |
1954 | list.clear(); | 1990 | list.clear(); |
1955 | list << QString::number( x ); | 1991 | list << QString::number( x ); |
1956 | list << QString::number( y ); | 1992 | list << QString::number( y ); |
1957 | list << QString::number( w ); | 1993 | list << QString::number( w ); |
1958 | list << QString::number( h ); | 1994 | list << QString::number( h ); |
1959 | config->writeEntry("EditEventLayout",list ); | 1995 | config->writeEntry("EditEventLayout",list ); |
1960 | 1996 | ||
1961 | wid = mTodoEditor; | 1997 | wid = mTodoEditor; |
1962 | x = wid->geometry().x(); | 1998 | x = wid->geometry().x(); |
1963 | y = wid->geometry().y(); | 1999 | y = wid->geometry().y(); |
1964 | w = wid->width(); | 2000 | w = wid->width(); |
1965 | h = wid->height(); | 2001 | h = wid->height(); |
1966 | list.clear(); | 2002 | list.clear(); |
1967 | list << QString::number( x ); | 2003 | list << QString::number( x ); |
1968 | list << QString::number( y ); | 2004 | list << QString::number( y ); |
1969 | list << QString::number( w ); | 2005 | list << QString::number( w ); |
1970 | list << QString::number( h ); | 2006 | list << QString::number( h ); |
1971 | config->writeEntry("EditTodoLayout",list ); | 2007 | config->writeEntry("EditTodoLayout",list ); |
1972 | wid = getEventViewerDialog(); | 2008 | wid = getEventViewerDialog(); |
1973 | x = wid->geometry().x(); | 2009 | x = wid->geometry().x(); |
1974 | y = wid->geometry().y(); | 2010 | y = wid->geometry().y(); |
1975 | w = wid->width(); | 2011 | w = wid->width(); |
1976 | h = wid->height(); | 2012 | h = wid->height(); |
1977 | list.clear(); | 2013 | list.clear(); |
1978 | list << QString::number( x ); | 2014 | list << QString::number( x ); |
1979 | list << QString::number( y ); | 2015 | list << QString::number( y ); |
1980 | list << QString::number( w ); | 2016 | list << QString::number( w ); |
1981 | list << QString::number( h ); | 2017 | list << QString::number( h ); |
1982 | config->writeEntry("ViewerLayout",list ); | 2018 | config->writeEntry("ViewerLayout",list ); |
1983 | wid = mDialogManager->getSearchDialog(); | 2019 | wid = mDialogManager->getSearchDialog(); |
1984 | if ( wid ) { | 2020 | if ( wid ) { |
1985 | x = wid->geometry().x(); | 2021 | x = wid->geometry().x(); |
1986 | y = wid->geometry().y(); | 2022 | y = wid->geometry().y(); |
1987 | w = wid->width(); | 2023 | w = wid->width(); |
1988 | h = wid->height(); | 2024 | h = wid->height(); |
1989 | list.clear(); | 2025 | list.clear(); |
1990 | list << QString::number( x ); | 2026 | list << QString::number( x ); |
1991 | list << QString::number( y ); | 2027 | list << QString::number( y ); |
1992 | list << QString::number( w ); | 2028 | list << QString::number( w ); |
1993 | list << QString::number( h ); | 2029 | list << QString::number( h ); |
1994 | config->writeEntry("SearchLayout",list ); | 2030 | config->writeEntry("SearchLayout",list ); |
1995 | } | 2031 | } |
1996 | #endif | 2032 | #endif |
1997 | 2033 | ||
1998 | 2034 | ||
1999 | config->sync(); | 2035 | config->sync(); |
2000 | } | 2036 | } |
2001 | 2037 | ||
2002 | void CalendarView::readFilterSettings(KConfig *config) | 2038 | void CalendarView::readFilterSettings(KConfig *config) |
2003 | { | 2039 | { |
2004 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2040 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2005 | 2041 | ||
2006 | mFilters.clear(); | 2042 | mFilters.clear(); |
2007 | 2043 | ||
2008 | config->setGroup("General"); | 2044 | config->setGroup("General"); |
2009 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2045 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2010 | 2046 | ||
2011 | QStringList::ConstIterator it = filterList.begin(); | 2047 | QStringList::ConstIterator it = filterList.begin(); |
2012 | QStringList::ConstIterator end = filterList.end(); | 2048 | QStringList::ConstIterator end = filterList.end(); |
2013 | while(it != end) { | 2049 | while(it != end) { |
2014 | // kdDebug() << " filter: " << (*it) << endl; | 2050 | // kdDebug() << " filter: " << (*it) << endl; |
2015 | 2051 | ||
2016 | CalFilter *filter; | 2052 | CalFilter *filter; |
2017 | filter = new CalFilter(*it); | 2053 | filter = new CalFilter(*it); |
2018 | config->setGroup("Filter_" + (*it)); | 2054 | config->setGroup("Filter_" + (*it)); |
2019 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2055 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2020 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2056 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2021 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2057 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2022 | mFilters.append(filter); | 2058 | mFilters.append(filter); |
2023 | 2059 | ||
2024 | ++it; | 2060 | ++it; |
2025 | } | 2061 | } |
2026 | 2062 | ||
2027 | if (mFilters.count() == 0) { | 2063 | if (mFilters.count() == 0) { |
2028 | CalFilter *filter = new CalFilter(i18n("Default")); | 2064 | CalFilter *filter = new CalFilter(i18n("Default")); |
2029 | mFilters.append(filter); | 2065 | mFilters.append(filter); |
2030 | } | 2066 | } |
2031 | mFilterView->updateFilters(); | 2067 | mFilterView->updateFilters(); |
2032 | config->setGroup("FilterView"); | 2068 | config->setGroup("FilterView"); |
2033 | 2069 | ||
2034 | mFilterView->blockSignals(true); | 2070 | mFilterView->blockSignals(true); |
2035 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2071 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2036 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2072 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2037 | mFilterView->blockSignals(false); | 2073 | mFilterView->blockSignals(false); |
2038 | // We do it manually to avoid it being done twice by the above calls | 2074 | // We do it manually to avoid it being done twice by the above calls |
2039 | updateFilter(); | 2075 | updateFilter(); |
2040 | } | 2076 | } |
2041 | 2077 | ||
2042 | void CalendarView::writeFilterSettings(KConfig *config) | 2078 | void CalendarView::writeFilterSettings(KConfig *config) |
2043 | { | 2079 | { |
2044 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2080 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2045 | 2081 | ||
2046 | QStringList filterList; | 2082 | QStringList filterList; |
2047 | 2083 | ||
2048 | CalFilter *filter = mFilters.first(); | 2084 | CalFilter *filter = mFilters.first(); |
2049 | while(filter) { | 2085 | while(filter) { |
2050 | // kdDebug() << " fn: " << filter->name() << endl; | 2086 | // kdDebug() << " fn: " << filter->name() << endl; |
2051 | filterList << filter->name(); | 2087 | filterList << filter->name(); |
2052 | config->setGroup("Filter_" + filter->name()); | 2088 | config->setGroup("Filter_" + filter->name()); |
2053 | config->writeEntry("Criteria",filter->criteria()); | 2089 | config->writeEntry("Criteria",filter->criteria()); |
2054 | config->writeEntry("CategoryList",filter->categoryList()); | 2090 | config->writeEntry("CategoryList",filter->categoryList()); |
2055 | filter = mFilters.next(); | 2091 | filter = mFilters.next(); |
2056 | } | 2092 | } |
2057 | config->setGroup("General"); | 2093 | config->setGroup("General"); |
2058 | config->writeEntry("CalendarFilters",filterList); | 2094 | config->writeEntry("CalendarFilters",filterList); |
2059 | 2095 | ||
2060 | config->setGroup("FilterView"); | 2096 | config->setGroup("FilterView"); |
2061 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2097 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2062 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2098 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2063 | } | 2099 | } |
2064 | 2100 | ||
2065 | 2101 | ||
2066 | void CalendarView::goToday() | 2102 | void CalendarView::goToday() |
2067 | { | 2103 | { |
2068 | if ( mViewManager->currentView()->isMonthView() ) | 2104 | if ( mViewManager->currentView()->isMonthView() ) |
2069 | mNavigator->selectTodayMonth(); | 2105 | mNavigator->selectTodayMonth(); |
2070 | else | 2106 | else |
2071 | mNavigator->selectToday(); | 2107 | mNavigator->selectToday(); |
2072 | } | 2108 | } |
2073 | 2109 | ||
2074 | void CalendarView::goNext() | 2110 | void CalendarView::goNext() |
2075 | { | 2111 | { |
2076 | mNavigator->selectNext(); | 2112 | mNavigator->selectNext(); |
2077 | } | 2113 | } |
2078 | 2114 | ||
2079 | void CalendarView::goPrevious() | 2115 | void CalendarView::goPrevious() |
2080 | { | 2116 | { |
2081 | mNavigator->selectPrevious(); | 2117 | mNavigator->selectPrevious(); |
2082 | } | 2118 | } |
2083 | void CalendarView::goNextMonth() | 2119 | void CalendarView::goNextMonth() |
2084 | { | 2120 | { |
2085 | mNavigator->selectNextMonth(); | 2121 | mNavigator->selectNextMonth(); |
2086 | } | 2122 | } |
2087 | 2123 | ||
2088 | void CalendarView::goPreviousMonth() | 2124 | void CalendarView::goPreviousMonth() |
2089 | { | 2125 | { |
2090 | mNavigator->selectPreviousMonth(); | 2126 | mNavigator->selectPreviousMonth(); |
2091 | } | 2127 | } |
2092 | void CalendarView::writeLocale() | 2128 | void CalendarView::writeLocale() |
2093 | { | 2129 | { |
2094 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2130 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2095 | #if 0 | 2131 | #if 0 |
2096 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2132 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2097 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2133 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2098 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2134 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2099 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2135 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2100 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2136 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2101 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2137 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2102 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2138 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2103 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2139 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2104 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2140 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2105 | KOPrefs::instance()->mDaylightsavingStart, | 2141 | KOPrefs::instance()->mDaylightsavingStart, |
2106 | KOPrefs::instance()->mDaylightsavingEnd ); | 2142 | KOPrefs::instance()->mDaylightsavingEnd ); |
2107 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2143 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2108 | #endif | 2144 | #endif |
2109 | } | 2145 | } |
2110 | void CalendarView::updateConfig() | 2146 | void CalendarView::updateConfig() |
2111 | { | 2147 | { |
2112 | writeLocale(); | 2148 | writeLocale(); |
2113 | if ( KOPrefs::instance()->mUseAppColors ) | 2149 | if ( KOPrefs::instance()->mUseAppColors ) |
2114 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2150 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2115 | emit configChanged(); | 2151 | emit configChanged(); |
2116 | mTodoList->updateConfig(); | 2152 | mTodoList->updateConfig(); |
2117 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2153 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2118 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2154 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2119 | // To make the "fill window" configurations work | 2155 | // To make the "fill window" configurations work |
2120 | //mViewManager->raiseCurrentView(); | 2156 | //mViewManager->raiseCurrentView(); |
2121 | } | 2157 | } |
2122 | 2158 | ||
2123 | 2159 | ||