author | zautrix <zautrix> | 2005-02-02 15:21:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-02 15:21:26 (UTC) |
commit | f94c5075fdd356c7a73b23150287034216ef0bdf (patch) (unidiff) | |
tree | de0cc9b2b2caf41f4c1d3a7a81de8579030abab3 | |
parent | 66c1429e6d29331dac4182d2c42aaf1630916c7d (diff) | |
download | kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.zip kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.tar.gz kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.tar.bz2 |
fihix
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 6 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 7 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 34 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 2 |
5 files changed, 41 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index be78057..e0380fa 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -233,256 +233,258 @@ CalendarView::CalendarView( Calendar *calendar, | |||
233 | 233 | ||
234 | void CalendarView::init() | 234 | void CalendarView::init() |
235 | { | 235 | { |
236 | mBlockShowDates = false; | 236 | mBlockShowDates = false; |
237 | beamDialog = new KOBeamPrefs(); | 237 | beamDialog = new KOBeamPrefs(); |
238 | mDatePickerMode = 0; | 238 | mDatePickerMode = 0; |
239 | mCurrentSyncDevice = ""; | 239 | mCurrentSyncDevice = ""; |
240 | writeLocale(); | 240 | writeLocale(); |
241 | mViewManager = new KOViewManager( this ); | 241 | mViewManager = new KOViewManager( this ); |
242 | mDialogManager = new KODialogManager( this ); | 242 | mDialogManager = new KODialogManager( this ); |
243 | mEventViewerDialog = 0; | 243 | mEventViewerDialog = 0; |
244 | mModified = false; | 244 | mModified = false; |
245 | mReadOnly = false; | 245 | mReadOnly = false; |
246 | mSelectedIncidence = 0; | 246 | mSelectedIncidence = 0; |
247 | mCalPrinter = 0; | 247 | mCalPrinter = 0; |
248 | mFilters.setAutoDelete(true); | 248 | mFilters.setAutoDelete(true); |
249 | 249 | ||
250 | mCalendar->registerObserver( this ); | 250 | mCalendar->registerObserver( this ); |
251 | // TODO: Make sure that view is updated, when calendar is changed. | 251 | // TODO: Make sure that view is updated, when calendar is changed. |
252 | 252 | ||
253 | mStorage = new FileStorage( mCalendar ); | 253 | mStorage = new FileStorage( mCalendar ); |
254 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 254 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
255 | 255 | ||
256 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 256 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
257 | #ifndef KORG_NOSPLITTER | 257 | #ifndef KORG_NOSPLITTER |
258 | // create the main layout frames. | 258 | // create the main layout frames. |
259 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 259 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
260 | topLayout->addWidget(mPanner); | 260 | topLayout->addWidget(mPanner); |
261 | 261 | ||
262 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 262 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
263 | "CalendarView::LeftFrame"); | 263 | "CalendarView::LeftFrame"); |
264 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 264 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
265 | 265 | ||
266 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 266 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
267 | "CalendarView::DateNavigator", QDate::currentDate() ); | 267 | "CalendarView::DateNavigator", QDate::currentDate() ); |
268 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 268 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
269 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 269 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
270 | mTodoList->setNavigator( mNavigator ); | 270 | mTodoList->setNavigator( mNavigator ); |
271 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 271 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
272 | 272 | ||
273 | #ifdef KORG_NORESOURCEVIEW | 273 | #ifdef KORG_NORESOURCEVIEW |
274 | mResourceView = 0; | 274 | mResourceView = 0; |
275 | #else | 275 | #else |
276 | if ( mResourceManager ) { | 276 | if ( mResourceManager ) { |
277 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 277 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
278 | mResourceView->updateView(); | 278 | mResourceView->updateView(); |
279 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 279 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
280 | SLOT( updateView() ) ); | 280 | SLOT( updateView() ) ); |
281 | } else { | 281 | } else { |
282 | mResourceView = 0; | 282 | mResourceView = 0; |
283 | } | 283 | } |
284 | #endif | 284 | #endif |
285 | QWidget *rightBox = new QWidget( mPanner ); | 285 | QWidget *rightBox = new QWidget( mPanner ); |
286 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 286 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
287 | 287 | ||
288 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 288 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
289 | rightLayout->addWidget( mNavigatorBar ); | 289 | rightLayout->addWidget( mNavigatorBar ); |
290 | 290 | ||
291 | mRightFrame = new QWidgetStack( rightBox ); | 291 | mRightFrame = new QWidgetStack( rightBox ); |
292 | rightLayout->addWidget( mRightFrame, 1 ); | 292 | rightLayout->addWidget( mRightFrame, 1 ); |
293 | 293 | ||
294 | mLeftFrame = mLeftSplitter; | 294 | mLeftFrame = mLeftSplitter; |
295 | #else | 295 | #else |
296 | QWidget *mainBox = new QWidget( this ); | 296 | QWidget *mainBox = new QWidget( this ); |
297 | QWidget *leftFrame = new QWidget( mainBox ); | 297 | QWidget *leftFrame = new QWidget( mainBox ); |
298 | 298 | ||
299 | QBoxLayout * mainBoxLayout; | 299 | QBoxLayout * mainBoxLayout; |
300 | QBoxLayout * leftFrameLayout; | 300 | QBoxLayout * leftFrameLayout; |
301 | if ( KOPrefs::instance()->mVerticalScreen ) { | 301 | if ( KOPrefs::instance()->mVerticalScreen ) { |
302 | mainBoxLayout = new QVBoxLayout(mainBox); | 302 | mainBoxLayout = new QVBoxLayout(mainBox); |
303 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 303 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
304 | } else { | 304 | } else { |
305 | mainBoxLayout = new QHBoxLayout(mainBox); | 305 | mainBoxLayout = new QHBoxLayout(mainBox); |
306 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 306 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
307 | } | 307 | } |
308 | topLayout->addWidget( mainBox ); | 308 | topLayout->addWidget( mainBox ); |
309 | mainBoxLayout->addWidget (leftFrame); | 309 | mainBoxLayout->addWidget (leftFrame); |
310 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 310 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
311 | "CalendarView::DateNavigator", QDate::currentDate()); | 311 | "CalendarView::DateNavigator", QDate::currentDate()); |
312 | // mDateNavigator->blockSignals( true ); | 312 | // mDateNavigator->blockSignals( true ); |
313 | leftFrameLayout->addWidget( mDateNavigator ); | 313 | leftFrameLayout->addWidget( mDateNavigator ); |
314 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 314 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
315 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 315 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
316 | mTodoList->setNavigator( mNavigator ); | 316 | mTodoList->setNavigator( mNavigator ); |
317 | 317 | ||
318 | if ( QApplication::desktop()->width() < 480 ) { | 318 | if ( QApplication::desktop()->width() < 480 ) { |
319 | leftFrameLayout->addWidget(mFilterView); | 319 | leftFrameLayout->addWidget(mFilterView); |
320 | leftFrameLayout->addWidget(mTodoList, 2 ); | 320 | leftFrameLayout->addWidget(mTodoList, 2 ); |
321 | 321 | ||
322 | } else { | 322 | } else { |
323 | leftFrameLayout->addWidget(mTodoList,2 ); | 323 | leftFrameLayout->addWidget(mTodoList,2 ); |
324 | leftFrameLayout->addWidget(mFilterView ); | 324 | leftFrameLayout->addWidget(mFilterView ); |
325 | } | 325 | } |
326 | mFilterView->hide(); | 326 | mFilterView->hide(); |
327 | QWidget *rightBox = new QWidget( mainBox ); | 327 | QWidget *rightBox = new QWidget( mainBox ); |
328 | mainBoxLayout->addWidget ( rightBox, 10 ); | 328 | mainBoxLayout->addWidget ( rightBox, 10 ); |
329 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 329 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
330 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 330 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
331 | mRightFrame = new QWidgetStack( rightBox ); | 331 | mRightFrame = new QWidgetStack( rightBox ); |
332 | rightLayout->addWidget( mNavigatorBar ); | 332 | rightLayout->addWidget( mNavigatorBar ); |
333 | rightLayout->addWidget( mRightFrame, 10 ); | 333 | rightLayout->addWidget( mRightFrame, 10 ); |
334 | 334 | ||
335 | mLeftFrame = leftFrame; | 335 | mLeftFrame = leftFrame; |
336 | if ( KOPrefs::instance()->mVerticalScreen ) { | 336 | if ( KOPrefs::instance()->mVerticalScreen ) { |
337 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 337 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
338 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 338 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
339 | } else { | 339 | } else { |
340 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 340 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
341 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 341 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
342 | } | 342 | } |
343 | if ( !KOPrefs::instance()->mShowDateNavigator) | 343 | if ( !KOPrefs::instance()->mShowDateNavigator) |
344 | mDateNavigator->hide(); | 344 | mDateNavigator->hide(); |
345 | //qDebug("Calendarview Size %d %d ", width(), height()); | 345 | //qDebug("Calendarview Size %d %d ", width(), height()); |
346 | #endif | 346 | #endif |
347 | 347 | ||
348 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 348 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
349 | SLOT( showDates( const KCal::DateList & ) ) ); | 349 | SLOT( showDates( const KCal::DateList & ) ) ); |
350 | 350 | ||
351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
352 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 352 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
354 | mNavigator, SLOT( selectPreviousYear() ) ); | 354 | mNavigator, SLOT( selectPreviousYear() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
356 | mNavigator, SLOT( selectNextYear() ) ); | 356 | mNavigator, SLOT( selectNextYear() ) ); |
357 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 357 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
358 | mNavigator, SLOT( selectPreviousMonth() ) ); | 358 | mNavigator, SLOT( selectPreviousMonth() ) ); |
359 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 359 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
360 | mNavigator, SLOT( selectNextMonth() ) ); | 360 | mNavigator, SLOT( selectNextMonth() ) ); |
361 | connect( mNavigatorBar, SIGNAL( selectWeek( int ) ), | ||
362 | mNavigator, SLOT( selectWeek( int ) ) ); | ||
361 | 363 | ||
362 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
363 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 365 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
364 | 366 | ||
365 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 367 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
366 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 368 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
367 | 369 | ||
368 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 370 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
369 | mNavigator, SLOT( selectPreviousYear() ) ); | 371 | mNavigator, SLOT( selectPreviousYear() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 372 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
371 | mNavigator, SLOT( selectNextYear() ) ); | 373 | mNavigator, SLOT( selectNextYear() ) ); |
372 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 374 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
373 | mNavigator, SLOT( selectPreviousMonth() ) ); | 375 | mNavigator, SLOT( selectPreviousMonth() ) ); |
374 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 376 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
375 | mNavigator, SLOT( selectNextMonth() ) ); | 377 | mNavigator, SLOT( selectNextMonth() ) ); |
376 | 378 | ||
377 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 379 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
378 | mNavigator, SLOT( selectPrevious() ) ); | 380 | mNavigator, SLOT( selectPrevious() ) ); |
379 | connect( mDateNavigator, SIGNAL( goNext() ), | 381 | connect( mDateNavigator, SIGNAL( goNext() ), |
380 | mNavigator, SLOT( selectNext() ) ); | 382 | mNavigator, SLOT( selectNext() ) ); |
381 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 383 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
382 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 384 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
383 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 385 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
384 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 386 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
385 | 387 | ||
386 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 388 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
387 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 389 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
388 | 390 | ||
389 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 391 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
390 | SLOT( eventAdded( Event *) ) ); | 392 | SLOT( eventAdded( Event *) ) ); |
391 | 393 | ||
392 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 394 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
393 | 395 | ||
394 | connect( this, SIGNAL( configChanged() ), | 396 | connect( this, SIGNAL( configChanged() ), |
395 | mDateNavigator, SLOT( updateConfig() ) ); | 397 | mDateNavigator, SLOT( updateConfig() ) ); |
396 | 398 | ||
397 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 399 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
398 | SLOT( newTodo() ) ); | 400 | SLOT( newTodo() ) ); |
399 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
400 | SLOT( newSubTodo( Todo * ) ) ); | 402 | SLOT( newSubTodo( Todo * ) ) ); |
401 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 403 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
402 | SLOT( editTodo( Todo * ) ) ); | 404 | SLOT( editTodo( Todo * ) ) ); |
403 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 405 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
404 | SLOT( showTodo( Todo *) ) ); | 406 | SLOT( showTodo( Todo *) ) ); |
405 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 407 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
406 | SLOT( deleteTodo( Todo *) ) ); | 408 | SLOT( deleteTodo( Todo *) ) ); |
407 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 409 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
408 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 410 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
409 | SLOT( purgeCompleted() ) ); | 411 | SLOT( purgeCompleted() ) ); |
410 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 412 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
411 | SIGNAL( todoModified( Todo *, int ) ) ); | 413 | SIGNAL( todoModified( Todo *, int ) ) ); |
412 | 414 | ||
413 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 415 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
414 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 416 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
415 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 417 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
416 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 418 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
417 | 419 | ||
418 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 420 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
419 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 421 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
420 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 422 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
421 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 423 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
422 | 424 | ||
423 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 425 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
424 | this, SLOT ( todo_unsub( Todo * ) ) ); | 426 | this, SLOT ( todo_unsub( Todo * ) ) ); |
425 | 427 | ||
426 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 428 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
427 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 429 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
428 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 430 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
429 | SLOT( updateTodo( Todo *, int ) ) ); | 431 | SLOT( updateTodo( Todo *, int ) ) ); |
430 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 432 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
431 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 433 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
432 | 434 | ||
433 | 435 | ||
434 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 436 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
435 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 437 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
436 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 438 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
437 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 439 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
438 | 440 | ||
439 | 441 | ||
440 | 442 | ||
441 | 443 | ||
442 | 444 | ||
443 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 445 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
444 | SLOT(checkClipboard())); | 446 | SLOT(checkClipboard())); |
445 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 447 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
446 | SLOT( processTodoListSelection( Incidence * ) ) ); | 448 | SLOT( processTodoListSelection( Incidence * ) ) ); |
447 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 449 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
448 | 450 | ||
449 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 451 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
450 | 452 | ||
451 | mDateFrame = new QVBox(0,0,WType_Popup); | 453 | mDateFrame = new QVBox(0,0,WType_Popup); |
452 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 454 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
453 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 455 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
454 | mDateFrame->setLineWidth(3); | 456 | mDateFrame->setLineWidth(3); |
455 | mDateFrame->hide(); | 457 | mDateFrame->hide(); |
456 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 458 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
457 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 459 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
458 | 460 | ||
459 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 461 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
460 | 462 | ||
461 | mEventEditor = mDialogManager->getEventEditor(); | 463 | mEventEditor = mDialogManager->getEventEditor(); |
462 | mTodoEditor = mDialogManager->getTodoEditor(); | 464 | mTodoEditor = mDialogManager->getTodoEditor(); |
463 | 465 | ||
464 | mFlagEditDescription = false; | 466 | mFlagEditDescription = false; |
465 | 467 | ||
466 | mSuspendTimer = new QTimer( this ); | 468 | mSuspendTimer = new QTimer( this ); |
467 | mAlarmTimer = new QTimer( this ); | 469 | mAlarmTimer = new QTimer( this ); |
468 | mRecheckAlarmTimer = new QTimer( this ); | 470 | mRecheckAlarmTimer = new QTimer( this ); |
469 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 471 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
470 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 472 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
471 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 473 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
472 | mAlarmDialog = new AlarmDialog( this ); | 474 | mAlarmDialog = new AlarmDialog( this ); |
473 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 475 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
474 | mAlarmDialog->setServerNotification( false ); | 476 | mAlarmDialog->setServerNotification( false ); |
475 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 477 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
476 | 478 | ||
477 | 479 | ||
478 | #ifndef DESKTOP_VERSION | 480 | #ifndef DESKTOP_VERSION |
479 | //US listen for arriving address resultsets | 481 | //US listen for arriving address resultsets |
480 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 482 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
481 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 483 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
482 | #endif | 484 | #endif |
483 | 485 | ||
484 | } | 486 | } |
485 | 487 | ||
486 | 488 | ||
487 | CalendarView::~CalendarView() | 489 | CalendarView::~CalendarView() |
488 | { | 490 | { |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index aed9bae..c018dc7 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -312,258 +312,262 @@ void EventIndicator::drawContents(QPainter *p) | |||
312 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 312 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
313 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 313 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
314 | //qDebug("222draw pix %d ",xOffset ); | 314 | //qDebug("222draw pix %d ",xOffset ); |
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | } | 318 | } |
319 | pa.end(); | 319 | pa.end(); |
320 | 320 | ||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void EventIndicator::setXOffset( int x ) | 324 | void EventIndicator::setXOffset( int x ) |
325 | { | 325 | { |
326 | mXOffset = x; | 326 | mXOffset = x; |
327 | } | 327 | } |
328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
329 | { | 329 | { |
330 | mPaintWidget = w; | 330 | mPaintWidget = w; |
331 | } | 331 | } |
332 | void EventIndicator::changeColumns(int columns) | 332 | void EventIndicator::changeColumns(int columns) |
333 | { | 333 | { |
334 | mColumns = columns; | 334 | mColumns = columns; |
335 | mEnabled.resize(mColumns); | 335 | mEnabled.resize(mColumns); |
336 | 336 | ||
337 | update(); | 337 | update(); |
338 | } | 338 | } |
339 | 339 | ||
340 | void EventIndicator::enableColumn(int column, bool enable) | 340 | void EventIndicator::enableColumn(int column, bool enable) |
341 | { | 341 | { |
342 | mEnabled[column] = enable; | 342 | mEnabled[column] = enable; |
343 | } | 343 | } |
344 | 344 | ||
345 | 345 | ||
346 | //////////////////////////////////////////////////////////////////////////// | 346 | //////////////////////////////////////////////////////////////////////////// |
347 | //////////////////////////////////////////////////////////////////////////// | 347 | //////////////////////////////////////////////////////////////////////////// |
348 | //////////////////////////////////////////////////////////////////////////// | 348 | //////////////////////////////////////////////////////////////////////////// |
349 | 349 | ||
350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
351 | KOEventView (cal,parent,name) | 351 | KOEventView (cal,parent,name) |
352 | { | 352 | { |
353 | mBlockUpdating = true; | 353 | mBlockUpdating = true; |
354 | mStartHour = 8; | 354 | mStartHour = 8; |
355 | mSelectedDates.append(QDate::currentDate()); | 355 | mSelectedDates.append(QDate::currentDate()); |
356 | 356 | ||
357 | mLayoutDayLabels = 0; | 357 | mLayoutDayLabels = 0; |
358 | mDayLabelsFrame = 0; | 358 | mDayLabelsFrame = 0; |
359 | mDayLabels = 0; | 359 | mDayLabels = 0; |
360 | bool isRTL = KOGlobals::self()->reverseLayout(); | 360 | bool isRTL = KOGlobals::self()->reverseLayout(); |
361 | 361 | ||
362 | if ( KOPrefs::instance()->mVerticalScreen ) { | 362 | if ( KOPrefs::instance()->mVerticalScreen ) { |
363 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 363 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
365 | } else { | 365 | } else { |
366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
368 | } | 368 | } |
369 | 369 | ||
370 | QBoxLayout *topLayout = new QVBoxLayout(this); | 370 | QBoxLayout *topLayout = new QVBoxLayout(this); |
371 | 371 | ||
372 | // Create day name labels for agenda columns | 372 | // Create day name labels for agenda columns |
373 | mDayLabelsFrame = new QHBox(this); | 373 | mDayLabelsFrame = new QHBox(this); |
374 | topLayout->addWidget(mDayLabelsFrame); | 374 | topLayout->addWidget(mDayLabelsFrame); |
375 | mDayLabels = new QFrame (mDayLabelsFrame); | 375 | mDayLabels = new QFrame (mDayLabelsFrame); |
376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
377 | // Create agenda splitter | 377 | // Create agenda splitter |
378 | #ifndef KORG_NOSPLITTER | 378 | #ifndef KORG_NOSPLITTER |
379 | mSplitterAgenda = new QSplitter(Vertical,this); | 379 | mSplitterAgenda = new QSplitter(Vertical,this); |
380 | topLayout->addWidget(mSplitterAgenda); | 380 | topLayout->addWidget(mSplitterAgenda); |
381 | mSplitterAgenda->setOpaqueResize(); | 381 | mSplitterAgenda->setOpaqueResize(); |
382 | 382 | ||
383 | mAllDayFrame = new QHBox(mSplitterAgenda); | 383 | mAllDayFrame = new QHBox(mSplitterAgenda); |
384 | 384 | ||
385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
386 | #else | 386 | #else |
387 | #if 0 | 387 | #if 0 |
388 | QWidget *mainBox = new QWidget( this ); | 388 | QWidget *mainBox = new QWidget( this ); |
389 | topLayout->addWidget( mainBox ); | 389 | topLayout->addWidget( mainBox ); |
390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
391 | mAllDayFrame = new QHBox(mainBox); | 391 | mAllDayFrame = new QHBox(mainBox); |
392 | mainLayout->addWidget(mAllDayFrame); | 392 | mainLayout->addWidget(mAllDayFrame); |
393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
394 | mAllDayFrame->setFocusPolicy(NoFocus); | 394 | mAllDayFrame->setFocusPolicy(NoFocus); |
395 | QWidget *agendaFrame = new QWidget(mainBox); | 395 | QWidget *agendaFrame = new QWidget(mainBox); |
396 | mainLayout->addWidget(agendaFrame); | 396 | mainLayout->addWidget(agendaFrame); |
397 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 397 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
398 | 398 | ||
399 | agendaFrame->setFocusPolicy(NoFocus); | 399 | agendaFrame->setFocusPolicy(NoFocus); |
400 | #endif | 400 | #endif |
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
408 | 408 | ||
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | // Create all-day agenda widget | 411 | // Create all-day agenda widget |
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); |
429 | 429 | ||
430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | 430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); |
431 | QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight ); | 431 | QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight ); |
432 | 432 | ||
433 | dummyAllDayRightB->setFlat( true ); | 433 | dummyAllDayRightB->setFlat( true ); |
434 | dummyAllDayRightB->setFocusPolicy(NoFocus); | 434 | dummyAllDayRightB->setFocusPolicy(NoFocus); |
435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
436 | //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 ); | 436 | //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 ); |
437 | QPopupMenu * wpo = new QPopupMenu (this); | 437 | QPopupMenu * wpo = new QPopupMenu (this); |
438 | wpo->insertItem( i18n("W#"), 0 ); | 438 | wpo->insertItem( i18n("W#"), 0 ); |
439 | int i; | 439 | int i; |
440 | for ( i = 1; i < 54; i++ ) | 440 | for ( i = 1; i < 53; i++ ) |
441 | wpo->insertItem( QString::number( i ),i ); | 441 | wpo->insertItem( QString::number( i ),i ); |
442 | //Qt bug - we must add some empty fields... | ||
443 | for ( i = 53; i < 54; ++i ) { | ||
444 | wpo->insertItem( "", 52 ); | ||
445 | } | ||
442 | dummyAllDayRightB->setPopup( wpo ); | 446 | dummyAllDayRightB->setPopup( wpo ); |
443 | 447 | ||
444 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | 448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); |
445 | 449 | ||
446 | // Create event context menu for all day agenda | 450 | // Create event context menu for all day agenda |
447 | mAllDayAgendaPopup = eventPopup(); | 451 | mAllDayAgendaPopup = eventPopup(); |
448 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
449 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
450 | 454 | ||
451 | // Create agenda frame | 455 | // Create agenda frame |
452 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
453 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
454 | 458 | ||
455 | // create event indicator bars | 459 | // create event indicator bars |
456 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
457 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
458 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
459 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
460 | agendaFrame); | 464 | agendaFrame); |
461 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
462 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
463 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 467 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
464 | 468 | ||
465 | // Create time labels | 469 | // Create time labels |
466 | mTimeLabels = new TimeLabels(24,agendaFrame); | 470 | mTimeLabels = new TimeLabels(24,agendaFrame); |
467 | agendaLayout->addWidget(mTimeLabels,1,0); | 471 | agendaLayout->addWidget(mTimeLabels,1,0); |
468 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 472 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
469 | this,SLOT(updateConfig())); | 473 | this,SLOT(updateConfig())); |
470 | 474 | ||
471 | // Create agenda | 475 | // Create agenda |
472 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 476 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
473 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 477 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
474 | agendaLayout->setColStretch(1,1); | 478 | agendaLayout->setColStretch(1,1); |
475 | mAgenda->setFocusPolicy(NoFocus); | 479 | mAgenda->setFocusPolicy(NoFocus); |
476 | // Create event context menu for agenda | 480 | // Create event context menu for agenda |
477 | mAgendaPopup = eventPopup(); | 481 | mAgendaPopup = eventPopup(); |
478 | 482 | ||
479 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 483 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
480 | i18n("Toggle Alarm"),mAgenda, | 484 | i18n("Toggle Alarm"),mAgenda, |
481 | SLOT(popupAlarm()),true); | 485 | SLOT(popupAlarm()),true); |
482 | 486 | ||
483 | 487 | ||
484 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 488 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
485 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 489 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
486 | 490 | ||
487 | // make connections between dependent widgets | 491 | // make connections between dependent widgets |
488 | mTimeLabels->setAgenda(mAgenda); | 492 | mTimeLabels->setAgenda(mAgenda); |
489 | 493 | ||
490 | // Update widgets to reflect user preferences | 494 | // Update widgets to reflect user preferences |
491 | // updateConfig(); | 495 | // updateConfig(); |
492 | 496 | ||
493 | // createDayLabels(); | 497 | // createDayLabels(); |
494 | 498 | ||
495 | // these blank widgets make the All Day Event box line up with the agenda | 499 | // these blank widgets make the All Day Event box line up with the agenda |
496 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 500 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
497 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 501 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
498 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 502 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
499 | 503 | ||
500 | // Scrolling | 504 | // Scrolling |
501 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 505 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
502 | mTimeLabels, SLOT(positionChanged())); | 506 | mTimeLabels, SLOT(positionChanged())); |
503 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 507 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
504 | SLOT(setContentsPos(int))); | 508 | SLOT(setContentsPos(int))); |
505 | 509 | ||
506 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 510 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
507 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 511 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
508 | 512 | ||
509 | // Create/Show/Edit/Delete Event | 513 | // Create/Show/Edit/Delete Event |
510 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 514 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
511 | SLOT(newEvent(int,int))); | 515 | SLOT(newEvent(int,int))); |
512 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 516 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
513 | SLOT(newTodo(int,int))); | 517 | SLOT(newTodo(int,int))); |
514 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 518 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
515 | SLOT(newEvent(int,int,int,int))); | 519 | SLOT(newEvent(int,int,int,int))); |
516 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 520 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
517 | SLOT(newEventAllDay(int,int))); | 521 | SLOT(newEventAllDay(int,int))); |
518 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 522 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
519 | SLOT(newTodoAllDay(int,int))); | 523 | SLOT(newTodoAllDay(int,int))); |
520 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 524 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
521 | SLOT(newEventAllDay(int,int))); | 525 | SLOT(newEventAllDay(int,int))); |
522 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 526 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
523 | SLOT(newTimeSpanSelected(int,int,int,int))); | 527 | SLOT(newTimeSpanSelected(int,int,int,int))); |
524 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 528 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
525 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 529 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
526 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 530 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
527 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 531 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
528 | 532 | ||
529 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 533 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
530 | SIGNAL(editIncidenceSignal(Incidence *))); | 534 | SIGNAL(editIncidenceSignal(Incidence *))); |
531 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 535 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
532 | SIGNAL(editIncidenceSignal(Incidence *))); | 536 | SIGNAL(editIncidenceSignal(Incidence *))); |
533 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 537 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
534 | SIGNAL(showIncidenceSignal(Incidence *))); | 538 | SIGNAL(showIncidenceSignal(Incidence *))); |
535 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 539 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
536 | SIGNAL(showIncidenceSignal(Incidence *))); | 540 | SIGNAL(showIncidenceSignal(Incidence *))); |
537 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 541 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
538 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 542 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
539 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 543 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
540 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 544 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
541 | 545 | ||
542 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 546 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
543 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 547 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
544 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 548 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
545 | SLOT(updateEventDates(KOAgendaItem *, int))); | 549 | SLOT(updateEventDates(KOAgendaItem *, int))); |
546 | 550 | ||
547 | // event indicator update | 551 | // event indicator update |
548 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
549 | SLOT(updateEventIndicatorTop(int))); | 553 | SLOT(updateEventIndicatorTop(int))); |
550 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 554 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
551 | SLOT(updateEventIndicatorBottom(int))); | 555 | SLOT(updateEventIndicatorBottom(int))); |
552 | // drag signals | 556 | // drag signals |
553 | /* | 557 | /* |
554 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
555 | SLOT(startDrag(Event *))); | 559 | SLOT(startDrag(Event *))); |
556 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
557 | SLOT(startDrag(Event *))); | 561 | SLOT(startDrag(Event *))); |
558 | */ | 562 | */ |
559 | // synchronize selections | 563 | // synchronize selections |
560 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
561 | mAllDayAgenda, SLOT( deselectItem() ) ); | 565 | mAllDayAgenda, SLOT( deselectItem() ) ); |
562 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
563 | mAgenda, SLOT( deselectItem() ) ); | 567 | mAgenda, SLOT( deselectItem() ) ); |
564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
565 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 569 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
567 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 571 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
568 | connect( mAgenda, SIGNAL( resizedSignal() ), | 572 | connect( mAgenda, SIGNAL( resizedSignal() ), |
569 | SLOT( updateConfig( ) ) ); | 573 | SLOT( updateConfig( ) ) ); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ab96786..9c1e4c3 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -684,281 +684,276 @@ void MonthViewCell::deselect() | |||
684 | void MonthViewCell::select() | 684 | void MonthViewCell::select() |
685 | { | 685 | { |
686 | ;// updateCell(); | 686 | ;// updateCell(); |
687 | } | 687 | } |
688 | 688 | ||
689 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 689 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
690 | { | 690 | { |
691 | if ( !mMonthView->isUpdatePossible() ) | 691 | if ( !mMonthView->isUpdatePossible() ) |
692 | return; | 692 | return; |
693 | 693 | ||
694 | int size = height() - mLabel->height() - 2; | 694 | int size = height() - mLabel->height() - 2; |
695 | if ( size > 0 ) | 695 | if ( size > 0 ) |
696 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 696 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
697 | size = width() - mLabel->width() -2; | 697 | size = width() - mLabel->width() -2; |
698 | if ( size > 0 ) | 698 | if ( size > 0 ) |
699 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 699 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
700 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 700 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
701 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 701 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
702 | } | 702 | } |
703 | 703 | ||
704 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 704 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
705 | { | 705 | { |
706 | if ( !item ) return; | 706 | if ( !item ) return; |
707 | 707 | ||
708 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 708 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
709 | Incidence *incidence = eventItem->incidence(); | 709 | Incidence *incidence = eventItem->incidence(); |
710 | if ( incidence ) mMonthView->defaultAction( incidence ); | 710 | if ( incidence ) mMonthView->defaultAction( incidence ); |
711 | } | 711 | } |
712 | void MonthViewCell::showDay() | 712 | void MonthViewCell::showDay() |
713 | { | 713 | { |
714 | emit showDaySignal( date() ); | 714 | emit showDaySignal( date() ); |
715 | } | 715 | } |
716 | void MonthViewCell::newEvent() | 716 | void MonthViewCell::newEvent() |
717 | { | 717 | { |
718 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 718 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
719 | emit newEventSignal( dt ); | 719 | emit newEventSignal( dt ); |
720 | } | 720 | } |
721 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 721 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
722 | { | 722 | { |
723 | static QListBoxItem * lastClicked = 0; | 723 | static QListBoxItem * lastClicked = 0; |
724 | if ( item == 0 ) { | 724 | if ( item == 0 ) { |
725 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 725 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
726 | emit newEventSignal( dt ); | 726 | emit newEventSignal( dt ); |
727 | return; | 727 | return; |
728 | } | 728 | } |
729 | /* | 729 | /* |
730 | if ( lastClicked ) | 730 | if ( lastClicked ) |
731 | if ( ! item ) { | 731 | if ( ! item ) { |
732 | if ( lastClicked->listBox() != item->listBox() ) | 732 | if ( lastClicked->listBox() != item->listBox() ) |
733 | lastClicked->listBox()->clearSelection(); | 733 | lastClicked->listBox()->clearSelection(); |
734 | } | 734 | } |
735 | */ | 735 | */ |
736 | 736 | ||
737 | mMonthView->setSelectedCell( this ); | 737 | mMonthView->setSelectedCell( this ); |
738 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 738 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
739 | select(); | 739 | select(); |
740 | } | 740 | } |
741 | 741 | ||
742 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 742 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
743 | { | 743 | { |
744 | if ( !item ) return; | 744 | if ( !item ) return; |
745 | 745 | ||
746 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 746 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
747 | Incidence *incidence = eventItem->incidence(); | 747 | Incidence *incidence = eventItem->incidence(); |
748 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 748 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
749 | } | 749 | } |
750 | 750 | ||
751 | void MonthViewCell::selection( QListBoxItem *item ) | 751 | void MonthViewCell::selection( QListBoxItem *item ) |
752 | { | 752 | { |
753 | if ( !item ) return; | 753 | if ( !item ) return; |
754 | 754 | ||
755 | mMonthView->setSelectedCell( this ); | 755 | mMonthView->setSelectedCell( this ); |
756 | } | 756 | } |
757 | 757 | ||
758 | 758 | ||
759 | // ******************************************************************************* | 759 | // ******************************************************************************* |
760 | // ******************************************************************************* | 760 | // ******************************************************************************* |
761 | // ******************************************************************************* | 761 | // ******************************************************************************* |
762 | 762 | ||
763 | 763 | ||
764 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 764 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
765 | : KOEventView( calendar, parent, name ), | 765 | : KOEventView( calendar, parent, name ), |
766 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 766 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
767 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 767 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
768 | { | 768 | { |
769 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 769 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
770 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 770 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
771 | if ( mShowWeekView ) | 771 | if ( mShowWeekView ) |
772 | mWeekStartsMonday = true; | 772 | mWeekStartsMonday = true; |
773 | updatePossible = false; | 773 | updatePossible = false; |
774 | mCells.setAutoDelete( true ); | 774 | mCells.setAutoDelete( true ); |
775 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 775 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
776 | // mDayLayout = new QGridLayout( this ); | 776 | // mDayLayout = new QGridLayout( this ); |
777 | // create the day of the week labels (Sun, Mon, etc) and add them to | 777 | // create the day of the week labels (Sun, Mon, etc) and add them to |
778 | // the layout. | 778 | // the layout. |
779 | mDayLabels.resize( mDaysPerWeek ); | 779 | mDayLabels.resize( mDaysPerWeek ); |
780 | QFont bfont = font(); | 780 | QFont bfont = font(); |
781 | if ( QApplication::desktop()->width() < 650 ) { | 781 | if ( QApplication::desktop()->width() < 650 ) { |
782 | bfont.setPointSize( bfont.pointSize() - 2 ); | 782 | bfont.setPointSize( bfont.pointSize() - 2 ); |
783 | } | 783 | } |
784 | bfont.setBold( true ); | 784 | bfont.setBold( true ); |
785 | int i; | 785 | int i; |
786 | 786 | ||
787 | for( i = 0; i < mDaysPerWeek; i++ ) { | 787 | for( i = 0; i < mDaysPerWeek; i++ ) { |
788 | QLabel *label = new QLabel( this ); | 788 | QLabel *label = new QLabel( this ); |
789 | label->setFont(bfont); | 789 | label->setFont(bfont); |
790 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 790 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
791 | label->setLineWidth(1); | 791 | label->setLineWidth(1); |
792 | label->setAlignment(AlignCenter); | 792 | label->setAlignment(AlignCenter); |
793 | mDayLabels.insert( i, label ); | 793 | mDayLabels.insert( i, label ); |
794 | } | 794 | } |
795 | 795 | ||
796 | bfont.setBold( false ); | 796 | bfont.setBold( false ); |
797 | mWeekLabels.resize( mNumWeeks+1 ); | 797 | mWeekLabels.resize( mNumWeeks+1 ); |
798 | for( i = 0; i < mNumWeeks+1; i++ ) { | 798 | for( i = 0; i < mNumWeeks+1; i++ ) { |
799 | KOWeekButton *label = new KOWeekButton( this ); | 799 | KOWeekButton *label = new KOWeekButton( this ); |
800 | label->setFont(bfont); | 800 | label->setFont(bfont); |
801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
802 | label->setFlat(true); | 802 | label->setFlat(true); |
803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
805 | //label->setLineWidth(1); | 805 | //label->setLineWidth(1); |
806 | //label->setAlignment(AlignCenter); | 806 | //label->setAlignment(AlignCenter); |
807 | mWeekLabels.insert( i, label ); | 807 | mWeekLabels.insert( i, label ); |
808 | } | 808 | } |
809 | mWeekLabels[mNumWeeks]->setText( i18n("")); | 809 | mWeekLabels[mNumWeeks]->setText( i18n("")); |
810 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 810 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
811 | int row, col; | 811 | int row, col; |
812 | QPopupMenu * wpo = new QPopupMenu (this); | ||
813 | wpo->insertItem( i18n("W#"), 0 ); | ||
814 | for ( i = 1; i < 54; i++ ) | ||
815 | wpo->insertItem( i18n("%1").arg(i), i ); | ||
816 | mWeekLabels[mNumWeeks]->setPopup( wpo ); | ||
817 | mCells.resize( mNumCells ); | 812 | mCells.resize( mNumCells ); |
818 | for( row = 0; row < mNumWeeks; ++row ) { | 813 | for( row = 0; row < mNumWeeks; ++row ) { |
819 | for( col = 0; col < mDaysPerWeek; ++col ) { | 814 | for( col = 0; col < mDaysPerWeek; ++col ) { |
820 | MonthViewCell *cell = new MonthViewCell( this ); | 815 | MonthViewCell *cell = new MonthViewCell( this ); |
821 | mCells.insert( row * mDaysPerWeek + col, cell ); | 816 | mCells.insert( row * mDaysPerWeek + col, cell ); |
822 | 817 | ||
823 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 818 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
824 | SLOT( defaultAction( Incidence * ) ) ); | 819 | SLOT( defaultAction( Incidence * ) ) ); |
825 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 820 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
826 | SIGNAL( newEventSignal( QDateTime ) ) ); | 821 | SIGNAL( newEventSignal( QDateTime ) ) ); |
827 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 822 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
828 | SIGNAL( showDaySignal( QDate ) ) ); | 823 | SIGNAL( showDaySignal( QDate ) ) ); |
829 | } | 824 | } |
830 | } | 825 | } |
831 | 826 | ||
832 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 827 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
833 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | ||
834 | mContextMenu = eventPopup(); | 828 | mContextMenu = eventPopup(); |
835 | // updateConfig(); //useless here | 829 | // updateConfig(); //useless here |
836 | 830 | ||
831 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
837 | emit incidenceSelected( 0 ); | 832 | emit incidenceSelected( 0 ); |
838 | } | 833 | } |
839 | 834 | ||
840 | KOMonthView::~KOMonthView() | 835 | KOMonthView::~KOMonthView() |
841 | { | 836 | { |
842 | delete mContextMenu; | 837 | delete mContextMenu; |
843 | } | 838 | } |
844 | void KOMonthView::selectDateWeekNum ( int ) | 839 | void KOMonthView::selectDateWeekNum ( int ) |
845 | { | 840 | { |
846 | 841 | ||
847 | } | 842 | } |
848 | void KOMonthView::selectInternalWeekNum ( int n ) | 843 | void KOMonthView::selectInternalWeekNum ( int n ) |
849 | { | 844 | { |
850 | emit selectWeekNum ( n ); | 845 | emit selectWeekNum ( n ); |
851 | switchView(); | 846 | switchView(); |
852 | } | 847 | } |
853 | 848 | ||
854 | void KOMonthView::switchView() | 849 | void KOMonthView::switchView() |
855 | { | 850 | { |
856 | if ( selectedCell( ) ) | 851 | if ( selectedCell( ) ) |
857 | selectedCell()->deselect(); | 852 | selectedCell()->deselect(); |
858 | mShowWeekView = !mShowWeekView; | 853 | mShowWeekView = !mShowWeekView; |
859 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 854 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
860 | //emit showNavigator( !mShowWeekView ); | 855 | //emit showNavigator( !mShowWeekView ); |
861 | computeLayout(); | 856 | computeLayout(); |
862 | updateConfig(); | 857 | updateConfig(); |
863 | } | 858 | } |
864 | 859 | ||
865 | int KOMonthView::maxDatesHint() | 860 | int KOMonthView::maxDatesHint() |
866 | { | 861 | { |
867 | return mNumCells; | 862 | return mNumCells; |
868 | } | 863 | } |
869 | 864 | ||
870 | int KOMonthView::currentDateCount() | 865 | int KOMonthView::currentDateCount() |
871 | { | 866 | { |
872 | return mNumCells; | 867 | return mNumCells; |
873 | } | 868 | } |
874 | 869 | ||
875 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 870 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
876 | { | 871 | { |
877 | QPtrList<Incidence> selected; | 872 | QPtrList<Incidence> selected; |
878 | 873 | ||
879 | if ( mSelectedCell ) { | 874 | if ( mSelectedCell ) { |
880 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 875 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
881 | if ( incidence ) selected.append( incidence ); | 876 | if ( incidence ) selected.append( incidence ); |
882 | } | 877 | } |
883 | 878 | ||
884 | return selected; | 879 | return selected; |
885 | } | 880 | } |
886 | 881 | ||
887 | DateList KOMonthView::selectedDates() | 882 | DateList KOMonthView::selectedDates() |
888 | { | 883 | { |
889 | DateList selected; | 884 | DateList selected; |
890 | 885 | ||
891 | if ( mSelectedCell ) { | 886 | if ( mSelectedCell ) { |
892 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 887 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
893 | if ( qd.isValid() ) selected.append( qd ); | 888 | if ( qd.isValid() ) selected.append( qd ); |
894 | } | 889 | } |
895 | 890 | ||
896 | return selected; | 891 | return selected; |
897 | } | 892 | } |
898 | 893 | ||
899 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 894 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
900 | const QDate &td) | 895 | const QDate &td) |
901 | { | 896 | { |
902 | #ifndef KORG_NOPRINTER | 897 | #ifndef KORG_NOPRINTER |
903 | calPrinter->preview(CalPrinter::Month, fd, td); | 898 | calPrinter->preview(CalPrinter::Month, fd, td); |
904 | #endif | 899 | #endif |
905 | } | 900 | } |
906 | 901 | ||
907 | void KOMonthView::updateConfig() | 902 | void KOMonthView::updateConfig() |
908 | { | 903 | { |
909 | 904 | ||
910 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 905 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
911 | 906 | ||
912 | if ( mShowWeekView ) { | 907 | if ( mShowWeekView ) { |
913 | mWeekStartsMonday = true; | 908 | mWeekStartsMonday = true; |
914 | } | 909 | } |
915 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 910 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
916 | mWidthLongDayLabel = 0; | 911 | mWidthLongDayLabel = 0; |
917 | 912 | ||
918 | for (int i = 0; i < 7; i++) { | 913 | for (int i = 0; i < 7; i++) { |
919 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
920 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
921 | } | 916 | } |
922 | bool temp = mShowSatSunComp ; | 917 | bool temp = mShowSatSunComp ; |
923 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 918 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
924 | if ( ! mShowWeekView ) { | 919 | if ( ! mShowWeekView ) { |
925 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 920 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
926 | computeLayout(); | 921 | computeLayout(); |
927 | } | 922 | } |
928 | updateDayLabels(); | 923 | updateDayLabels(); |
929 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 924 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
930 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 925 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
931 | //resizeEvent( 0 ); | 926 | //resizeEvent( 0 ); |
932 | for (uint i = 0; i < mCells.count(); ++i) { | 927 | for (uint i = 0; i < mCells.count(); ++i) { |
933 | mCells[i]->updateConfig(); | 928 | mCells[i]->updateConfig(); |
934 | } | 929 | } |
935 | #ifdef DESKTOP_VERSION | 930 | #ifdef DESKTOP_VERSION |
936 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 931 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
937 | #endif | 932 | #endif |
938 | updateView(); | 933 | updateView(); |
939 | } | 934 | } |
940 | 935 | ||
941 | void KOMonthView::updateDayLabels() | 936 | void KOMonthView::updateDayLabels() |
942 | { | 937 | { |
943 | 938 | ||
944 | for (int i = 0; i < 7; i++) { | 939 | for (int i = 0; i < 7; i++) { |
945 | if (mWeekStartsMonday) { | 940 | if (mWeekStartsMonday) { |
946 | bool show = mShortDayLabels; | 941 | bool show = mShortDayLabels; |
947 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 942 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
948 | show = true; | 943 | show = true; |
949 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 944 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
950 | } else { | 945 | } else { |
951 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 946 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
952 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 947 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
953 | 948 | ||
954 | } | 949 | } |
955 | } | 950 | } |
956 | } | 951 | } |
957 | 952 | ||
958 | void KOMonthView::showDates(const QDate &start, const QDate &) | 953 | void KOMonthView::showDates(const QDate &start, const QDate &) |
959 | { | 954 | { |
960 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 955 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
961 | 956 | ||
962 | 957 | ||
963 | mStartDate = start; | 958 | mStartDate = start; |
964 | 959 | ||
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index f339c67..2406bb5 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,198 +1,228 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 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 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | ||
31 | #include <qapplication.h> | 32 | #include <qapplication.h> |
32 | 33 | ||
33 | #include <kdebug.h> | 34 | #include <kdebug.h> |
34 | #include <klocale.h> | 35 | #include <klocale.h> |
35 | #include <kglobal.h> | 36 | #include <kglobal.h> |
36 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
37 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
38 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
39 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
40 | 41 | ||
41 | #include "koglobals.h" | 42 | #include "koglobals.h" |
42 | #include "koprefs.h" | 43 | #include "koprefs.h" |
43 | #ifndef KORG_NOPLUGINS | 44 | #ifndef KORG_NOPLUGINS |
44 | #include "kocore.h" | 45 | #include "kocore.h" |
45 | #endif | 46 | #endif |
46 | 47 | ||
47 | #include <kcalendarsystem.h> | 48 | #include <kcalendarsystem.h> |
48 | 49 | ||
49 | #include "navigatorbar.h" | 50 | #include "navigatorbar.h" |
50 | 51 | ||
51 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 52 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
52 | : QWidget( parent, name ) | 53 | : QWidget( parent, name ) |
53 | { | 54 | { |
54 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 55 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
55 | 56 | ||
56 | // Set up the control buttons and date label | 57 | // Set up the control buttons and date label |
57 | mCtrlFrame = new QFrame( this ); | 58 | mCtrlFrame = new QFrame( this ); |
58 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
59 | mCtrlFrame->setLineWidth(1); | 60 | mCtrlFrame->setLineWidth(1); |
60 | 61 | ||
61 | topLayout->addWidget( mCtrlFrame ); | 62 | topLayout->addWidget( mCtrlFrame ); |
62 | 63 | ||
63 | QFont tfont = font(); | 64 | QFont tfont = font(); |
64 | if ( QApplication::desktop()->width() >= 480 ) | 65 | if ( QApplication::desktop()->width() >= 480 ) |
65 | tfont.setPointSize(tfont.pointSize()+2); | 66 | tfont.setPointSize(tfont.pointSize()+2); |
66 | tfont.setBold(true); | 67 | tfont.setBold(true); |
67 | 68 | ||
68 | bool isRTL = KOGlobals::self()->reverseLayout(); | 69 | bool isRTL = KOGlobals::self()->reverseLayout(); |
69 | #ifndef DESKTOP_VERSION | 70 | #ifndef DESKTOP_VERSION |
70 | bool isDesktop = false; | 71 | bool isDesktop = false; |
71 | #else | 72 | #else |
72 | bool isDesktop = true; | 73 | bool isDesktop = true; |
73 | #endif | 74 | #endif |
74 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 75 | bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; |
76 | if ( insertWeek && QApplication::desktop()->width() > 320 ) | ||
75 | isDesktop = true; | 77 | isDesktop = true; |
76 | // Create backward navigation buttons | 78 | // Create backward navigation buttons |
77 | mPrevYear = new QPushButton( mCtrlFrame ); | 79 | mPrevYear = new QPushButton( mCtrlFrame ); |
78 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
79 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
80 | 82 | ||
81 | mPrevMonth = new QPushButton( mCtrlFrame ); | 83 | mPrevMonth = new QPushButton( mCtrlFrame ); |
82 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
83 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
84 | 86 | ||
85 | // Create forward navigation buttons | 87 | // Create forward navigation buttons |
86 | mNextMonth = new QPushButton( mCtrlFrame ); | 88 | mNextMonth = new QPushButton( mCtrlFrame ); |
87 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
88 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 90 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
89 | 91 | ||
92 | QPushButton * selWeek = 0; | ||
93 | if ( insertWeek ) { | ||
94 | selWeek = new QPushButton( mCtrlFrame ); | ||
95 | QToolTip::add( selWeek, i18n("Select Week") ); | ||
96 | selWeek->setFocusPolicy(NoFocus); | ||
97 | } | ||
98 | |||
90 | mNextYear = new QPushButton( mCtrlFrame ); | 99 | mNextYear = new QPushButton( mCtrlFrame ); |
91 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 100 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
92 | QToolTip::add( mNextYear, i18n("Next Year") ); | 101 | QToolTip::add( mNextYear, i18n("Next Year") ); |
93 | mSelectMonth = new QPushButton( mCtrlFrame ); | 102 | mSelectMonth = new QPushButton( mCtrlFrame ); |
94 | // Create month name label | 103 | // Create month name label |
95 | //selectMonth->setFont( tfont ); | 104 | //selectMonth->setFont( tfont ); |
96 | // selectMonth->setAlignment( AlignCenter ); | 105 | // selectMonth->setAlignment( AlignCenter ); |
97 | //mDateLabel = new QLabel( selectMonth ); | 106 | //mDateLabel = new QLabel( selectMonth ); |
98 | //mDateLabel->setFont( tfont ); | 107 | //mDateLabel->setFont( tfont ); |
99 | //mDateLabel->setAlignment( AlignCenter ); | 108 | //mDateLabel->setAlignment( AlignCenter ); |
100 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 109 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
101 | mNextMonth->setFlat( true); | 110 | mNextMonth->setFlat( true); |
102 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
103 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
104 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
105 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | if ( insertWeek ) | ||
116 | selWeek->setFlat( true); | ||
106 | } | 117 | } |
107 | mSelectMonth->setFont( tfont ); | 118 | mSelectMonth->setFont( tfont ); |
108 | // Set minimum width to width of widest month name label | 119 | // Set minimum width to width of widest month name label |
109 | int i; | 120 | int i; |
110 | int maxwidth = 0; | 121 | int maxwidth = 0; |
111 | QFontMetrics fm ( mSelectMonth->font() ); | 122 | QFontMetrics fm ( mSelectMonth->font() ); |
112 | int width = fm.width("September '00" ); | 123 | int width = fm.width("September '00" ); |
113 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 124 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
114 | // ++i ) { | 125 | // ++i ) { |
115 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 126 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
116 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 127 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
117 | // int width = fm.width("September 2000" ); | 128 | // int width = fm.width("September 2000" ); |
118 | // if ( width > maxwidth ) maxwidth = width; | 129 | // if ( width > maxwidth ) maxwidth = width; |
119 | // } | 130 | // } |
120 | maxwidth = width+2; | 131 | maxwidth = width+2; |
121 | int size = fm.height()+2; | 132 | int size = fm.height()+2; |
122 | if ( QApplication::desktop()->width() >= 480 ) { | 133 | if ( QApplication::desktop()->width() >= 480 ) { |
123 | size += 6; | 134 | size += 6; |
124 | maxwidth+= 6; | 135 | maxwidth+= 6; |
125 | } | 136 | } |
137 | |||
138 | if ( insertWeek ) { | ||
139 | //shit : bug in Qt. after inserting 53 item, only 51 are shown... | ||
140 | QPopupMenu * wpo = new QPopupMenu (this); | ||
141 | wpo->insertItem( i18n("W#"), 0 ); | ||
142 | for ( i = 1; i < 53; ++i ) { | ||
143 | wpo->insertItem( QString::number(i), i ); | ||
144 | } | ||
145 | for ( i = 53; i < 54; ++i ) { | ||
146 | wpo->insertItem( "", 52 ); | ||
147 | } | ||
148 | selWeek->setPopup( wpo ); | ||
149 | selWeek->setFixedWidth( (size/4)*3 ); | ||
150 | selWeek->setFixedHeight( size ); | ||
151 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
152 | } | ||
126 | mSelectMonth->setFixedWidth( maxwidth ); | 153 | mSelectMonth->setFixedWidth( maxwidth ); |
127 | mSelectMonth->setFixedHeight( size ); | 154 | mSelectMonth->setFixedHeight( size ); |
128 | mPrevYear->setFixedHeight( size ); | 155 | mPrevYear->setFixedHeight( size ); |
129 | mPrevMonth->setFixedHeight( size ); | 156 | mPrevMonth->setFixedHeight( size ); |
130 | mNextMonth->setFixedHeight( size ); | 157 | mNextMonth->setFixedHeight( size ); |
131 | mNextYear->setFixedHeight ( size ); | 158 | mNextYear->setFixedHeight ( size ); |
132 | // set up control frame layout | 159 | // set up control frame layout |
133 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 160 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
134 | ctrlLayout->addWidget( mPrevYear, 3 ); | 161 | ctrlLayout->addWidget( mPrevYear, 3 ); |
135 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 162 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
136 | //ctrlLayout->addStretch( 1 ); | 163 | //ctrlLayout->addStretch( 1 ); |
137 | // ctrlLayout->addSpacing( 1 ); | 164 | // ctrlLayout->addSpacing( 1 ); |
138 | // ctrlLayout->addWidget( mDateLabel ); | 165 | // ctrlLayout->addWidget( mDateLabel ); |
139 | ctrlLayout->addWidget( mSelectMonth ); | 166 | ctrlLayout->addWidget( mSelectMonth ); |
140 | // ctrlLayout->addSpacing( 1 ); | 167 | // ctrlLayout->addSpacing( 1 ); |
141 | // ctrlLayout->addStretch( 1 ); | 168 | // ctrlLayout->addStretch( 1 ); |
142 | ctrlLayout->addWidget( mNextMonth, 3 ); | 169 | ctrlLayout->addWidget( mNextMonth, 3 ); |
143 | ctrlLayout->addWidget( mNextYear, 3 ); | 170 | ctrlLayout->addWidget( mNextYear, 3 ); |
171 | if ( insertWeek ) | ||
172 | ctrlLayout->addWidget( selWeek ); | ||
144 | 173 | ||
145 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 174 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
146 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 175 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
147 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 176 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
148 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 177 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
149 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 178 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
150 | mPrevYear->setFocusPolicy(NoFocus); | 179 | mPrevYear->setFocusPolicy(NoFocus); |
151 | mPrevMonth->setFocusPolicy(NoFocus); | 180 | mPrevMonth->setFocusPolicy(NoFocus); |
152 | mNextMonth->setFocusPolicy(NoFocus); | 181 | mNextMonth->setFocusPolicy(NoFocus); |
153 | mNextYear->setFocusPolicy(NoFocus); | 182 | mNextYear->setFocusPolicy(NoFocus); |
154 | mSelectMonth->setFocusPolicy(NoFocus); | 183 | mSelectMonth->setFocusPolicy(NoFocus); |
184 | |||
155 | } | 185 | } |
156 | 186 | ||
157 | NavigatorBar::~NavigatorBar() | 187 | NavigatorBar::~NavigatorBar() |
158 | { | 188 | { |
159 | } | 189 | } |
160 | 190 | ||
161 | void NavigatorBar::selectMonth() | 191 | void NavigatorBar::selectMonth() |
162 | { | 192 | { |
163 | 193 | ||
164 | int month; | 194 | int month; |
165 | KPopupFrame* popup = new KPopupFrame(this); | 195 | KPopupFrame* popup = new KPopupFrame(this); |
166 | int size = 12; | 196 | int size = 12; |
167 | if ( QApplication::desktop()->width() >= 480 ) | 197 | if ( QApplication::desktop()->width() >= 480 ) |
168 | size = 18; | 198 | size = 18; |
169 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); | 199 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); |
170 | // ----- | 200 | // ----- |
171 | picker->resize(picker->sizeHint()); | 201 | picker->resize(picker->sizeHint()); |
172 | popup->setMainWidget(picker); | 202 | popup->setMainWidget(picker); |
173 | picker->setFocus(); | 203 | picker->setFocus(); |
174 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 204 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
175 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 205 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
176 | { | 206 | { |
177 | month = picker->getResult(); | 207 | month = picker->getResult(); |
178 | emit monthSelected ( month ); | 208 | emit monthSelected ( month ); |
179 | } else { | 209 | } else { |
180 | KNotifyClient::beep(); | 210 | KNotifyClient::beep(); |
181 | } | 211 | } |
182 | delete popup; | 212 | delete popup; |
183 | } | 213 | } |
184 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 214 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
185 | { | 215 | { |
186 | if (dateList.count() > 0) { | 216 | if (dateList.count() > 0) { |
187 | QDate date = dateList.first(); | 217 | QDate date = dateList.first(); |
188 | 218 | ||
189 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 219 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
190 | 220 | ||
191 | // compute the label at the top of the navigator | 221 | // compute the label at the top of the navigator |
192 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 222 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
193 | QString::number( calSys->year( date ) ).right(2); | 223 | QString::number( calSys->year( date ) ).right(2); |
194 | 224 | ||
195 | mSelectMonth->setText( dtstr ); | 225 | mSelectMonth->setText( dtstr ); |
196 | } | 226 | } |
197 | } | 227 | } |
198 | 228 | ||
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 9c5c0cf..ee4c06d 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h | |||
@@ -1,66 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 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 NAVIGATORBAR_H | 24 | #ifndef NAVIGATORBAR_H |
25 | #define NAVIGATORBAR_H | 25 | #define NAVIGATORBAR_H |
26 | 26 | ||
27 | #include <libkcal/incidencebase.h> | 27 | #include <libkcal/incidencebase.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | 30 | ||
31 | class QPushButton; | 31 | class QPushButton; |
32 | class QFrame; | 32 | class QFrame; |
33 | class QLabel; | 33 | class QLabel; |
34 | 34 | ||
35 | class NavigatorBar: public QWidget | 35 | class NavigatorBar: public QWidget |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); | 39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); |
40 | ~NavigatorBar(); | 40 | ~NavigatorBar(); |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | void selectDates( const KCal::DateList & ); | 43 | void selectDates( const KCal::DateList & ); |
44 | void selectMonth(); | 44 | void selectMonth(); |
45 | 45 | ||
46 | signals: | 46 | signals: |
47 | void goNextMonth(); | 47 | void goNextMonth(); |
48 | void goPrevMonth(); | 48 | void goPrevMonth(); |
49 | void goNextYear(); | 49 | void goNextYear(); |
50 | void goPrevYear(); | 50 | void goPrevYear(); |
51 | void monthSelected( int ); | 51 | void monthSelected( int ); |
52 | 52 | void selectWeek( int ); | |
53 | 53 | ||
54 | private: | 54 | private: |
55 | QFrame *mCtrlFrame; | 55 | QFrame *mCtrlFrame; |
56 | 56 | ||
57 | QPushButton *mPrevYear; | 57 | QPushButton *mPrevYear; |
58 | QPushButton *mPrevMonth; | 58 | QPushButton *mPrevMonth; |
59 | QPushButton *mNextMonth; | 59 | QPushButton *mNextMonth; |
60 | QPushButton *mNextYear; | 60 | QPushButton *mNextYear; |
61 | QPushButton *mSelectMonth; | 61 | QPushButton *mSelectMonth; |
62 | 62 | ||
63 | //QLabel *mDateLabel; | 63 | //QLabel *mDateLabel; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #endif | 66 | #endif |