-rw-r--r-- | korganizer/kdatenavigator.cpp | 16 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 83a57ca..1474e4b 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -22,128 +22,129 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qkeycode.h> | 25 | #include <qkeycode.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qframe.h> | 28 | #include <qframe.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | 35 | ||
36 | #include "koglobals.h" | 36 | #include "koglobals.h" |
37 | #include "koprefs.h" | 37 | #include "koprefs.h" |
38 | #ifndef KORG_NOPLUGINS | 38 | #ifndef KORG_NOPLUGINS |
39 | #include "kocore.h" | 39 | #include "kocore.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #include "navigatorbar.h" | 44 | #include "navigatorbar.h" |
45 | 45 | ||
46 | #include "kdatenavigator.h" | 46 | #include "kdatenavigator.h" |
47 | 47 | ||
48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | 48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) |
49 | : QFrame(parent, name), | 49 | : QFrame(parent, name), |
50 | updateTimer(0L) | 50 | updateTimer(0L) |
51 | { | 51 | { |
52 | setFrameStyle(QFrame::NoFrame); | 52 | setFrameStyle(QFrame::NoFrame); |
53 | QDate startDate = QDate::currentDate(); | 53 | QDate startDate = QDate::currentDate(); |
54 | QGridLayout *topLayout = new QGridLayout(this,8,8); | 54 | QGridLayout *topLayout = new QGridLayout(this,8,8); |
55 | 55 | ||
56 | if (! startDate.isValid()) { | 56 | if (! startDate.isValid()) { |
57 | qDebug("KDateNavigator::invalid startdate "); | 57 | qDebug("KDateNavigator::invalid startdate "); |
58 | startDate = QDate::currentDate(); | 58 | startDate = QDate::currentDate(); |
59 | } | 59 | } |
60 | mMonthSignalOffset = 0; | 60 | mMonthSignalOffset = 0; |
61 | mSelectedDates.append(startDate); | 61 | mSelectedDates.append(startDate); |
62 | m_MthYr = startDate; | 62 | m_MthYr = startDate; |
63 | m_bShowWeekNums = true; | 63 | m_bShowWeekNums = true; |
64 | 64 | ||
65 | setFont( KOPrefs::instance()->mDateNavigatorFont ); | 65 | setFont( KOPrefs::instance()->mDateNavigatorFont ); |
66 | mNavigatorBar = new NavigatorBar( startDate, this ); | 66 | mNavigatorBar = new NavigatorBar( startDate, this ); |
67 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); | 67 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); |
68 | //mNavigatorBar->resize( 1,1); | 68 | //mNavigatorBar->resize( 1,1); |
69 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 69 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
70 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 70 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
71 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 71 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
72 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 72 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
73 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); | 73 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); |
74 | 74 | ||
75 | // get the day of the week on the first day | 75 | // get the day of the week on the first day |
76 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 76 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
77 | m_fstDayOfWk = dayone.dayOfWeek(); | 77 | m_fstDayOfWk = dayone.dayOfWeek(); |
78 | 78 | ||
79 | int i; | 79 | int i; |
80 | 80 | ||
81 | // Set up the heading fields. | 81 | // Set up the heading fields. |
82 | for( i = 0; i < 7; i++ ) { | 82 | for( i = 0; i < 7; i++ ) { |
83 | headings[i] = new QLabel("",this); | 83 | headings[i] = new QLabel("",this); |
84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); | 84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); |
85 | headings[i]->setAlignment(AlignCenter); | 85 | headings[i]->setAlignment(AlignCenter); |
86 | headings[i]->installEventFilter(this); | ||
86 | 87 | ||
87 | topLayout->addWidget(headings[i],1,i+1); | 88 | topLayout->addWidget(headings[i],1,i+1); |
88 | } | 89 | } |
89 | 90 | ||
90 | // Create the weeknumber labels | 91 | // Create the weeknumber labels |
91 | for( i = 0; i < 6; i++ ) { | 92 | for( i = 0; i < 6; i++ ) { |
92 | weeknos[i] = new QLabel(this); | 93 | weeknos[i] = new QLabel(this); |
93 | weeknos[i]->setAlignment(AlignCenter); | 94 | weeknos[i]->setAlignment(AlignCenter); |
94 | //weeknos[i]->setFont(QFont("Arial", 10)); | 95 | //weeknos[i]->setFont(QFont("Arial", 10)); |
95 | if(!m_bShowWeekNums) { | 96 | if(!m_bShowWeekNums) { |
96 | weeknos[i]->hide(); | 97 | weeknos[i]->hide(); |
97 | } | 98 | } |
98 | weeknos[i]->installEventFilter(this); | 99 | weeknos[i]->installEventFilter(this); |
99 | 100 | ||
100 | topLayout->addWidget(weeknos[i],i+2,0); | 101 | topLayout->addWidget(weeknos[i],i+2,0); |
101 | } | 102 | } |
102 | 103 | ||
103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 104 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 105 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
105 | daymatrix->setLineWidth(1); | 106 | daymatrix->setLineWidth(1); |
106 | 107 | ||
107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 108 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 109 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
109 | 110 | ||
110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 111 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
111 | SIGNAL( eventDropped( Event * ) ) ); | 112 | SIGNAL( eventDropped( Event * ) ) ); |
112 | 113 | ||
113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 114 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
114 | 115 | ||
115 | // read settings from configuration file. | 116 | // read settings from configuration file. |
116 | updateConfig(); | 117 | updateConfig(); |
117 | enableRollover(FollowMonth); | 118 | enableRollover(FollowMonth); |
118 | mySizeHint = sizeHintTwoButtons(); | 119 | mySizeHint = sizeHintTwoButtons(); |
119 | myFullSizeHint = sizeHintTwoButtons( 4 ); | 120 | myFullSizeHint = sizeHintTwoButtons( 4 ); |
120 | mFontChanged = false; | 121 | mFontChanged = false; |
121 | } | 122 | } |
122 | void KDateNavigator::changeFont ( QFont fo ) | 123 | void KDateNavigator::changeFont ( QFont fo ) |
123 | { | 124 | { |
124 | setFont( fo ); | 125 | setFont( fo ); |
125 | mNavigatorBar->resetFont( fo ); | 126 | mNavigatorBar->resetFont( fo ); |
126 | } | 127 | } |
127 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 128 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
128 | { | 129 | { |
129 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 130 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
130 | *b = false; | 131 | *b = false; |
131 | int fontPoint = fo.pointSize(); | 132 | int fontPoint = fo.pointSize(); |
132 | while ( fontPoint > 5 ) { | 133 | while ( fontPoint > 5 ) { |
133 | --fontPoint; | 134 | --fontPoint; |
134 | fo.setPointSize( fontPoint ); | 135 | fo.setPointSize( fontPoint ); |
135 | setFont( fo ); | 136 | setFont( fo ); |
136 | mFontChanged = true; | 137 | mFontChanged = true; |
137 | mNavigatorBar->resetFont( fo ); | 138 | mNavigatorBar->resetFont( fo ); |
138 | QSize sh = sizeHintTwoButtons( 2 ); | 139 | QSize sh = sizeHintTwoButtons( 2 ); |
139 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 140 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); |
140 | if ( si.width() > sh.width() && si.height() > sh.height()) { | 141 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
141 | if ( si.width() / sh.width() == 1 ) { | 142 | if ( si.width() / sh.width() == 1 ) { |
142 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) | 143 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) |
143 | continue; | 144 | continue; |
144 | } | 145 | } |
145 | *b = true; | 146 | *b = true; |
146 | //qDebug("fooooooooooooooooooooooouuuuund "); | 147 | //qDebug("fooooooooooooooooooooooouuuuund "); |
147 | break; | 148 | break; |
148 | } | 149 | } |
149 | } | 150 | } |
@@ -378,71 +379,86 @@ void KDateNavigator::setShowWeekNums(bool enabled) | |||
378 | resize(size()); | 379 | resize(size()); |
379 | } | 380 | } |
380 | 381 | ||
381 | void KDateNavigator::selectDates(const DateList& dateList) | 382 | void KDateNavigator::selectDates(const DateList& dateList) |
382 | { | 383 | { |
383 | 384 | ||
384 | if (dateList.count() > 0) { | 385 | if (dateList.count() > 0) { |
385 | mNavigatorBar->selectDates( dateList ); | 386 | mNavigatorBar->selectDates( dateList ); |
386 | mSelectedDates = dateList; | 387 | mSelectedDates = dateList; |
387 | 388 | ||
388 | // set our record of the month and year that this datetbl is | 389 | // set our record of the month and year that this datetbl is |
389 | // displaying. | 390 | // displaying. |
390 | m_MthYr = mSelectedDates.first(); | 391 | m_MthYr = mSelectedDates.first(); |
391 | 392 | ||
392 | 393 | ||
393 | // set our record of the first day of the week of the current | 394 | // set our record of the first day of the week of the current |
394 | // month. This needs to be done before calling dayToIndex, since it | 395 | // month. This needs to be done before calling dayToIndex, since it |
395 | // relies on this information being up to date. | 396 | // relies on this information being up to date. |
396 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 397 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
397 | m_fstDayOfWk = dayone.dayOfWeek(); | 398 | m_fstDayOfWk = dayone.dayOfWeek(); |
398 | 399 | ||
399 | updateDates(); | 400 | updateDates(); |
400 | 401 | ||
401 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 402 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
402 | 403 | ||
403 | updateView(); | 404 | updateView(); |
404 | } | 405 | } |
405 | } | 406 | } |
406 | 407 | ||
407 | int KDateNavigator::dayNum(int row, int col) | 408 | int KDateNavigator::dayNum(int row, int col) |
408 | { | 409 | { |
409 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; | 410 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; |
410 | } | 411 | } |
411 | 412 | ||
412 | int KDateNavigator::dayToIndex(int dayNum) | 413 | int KDateNavigator::dayToIndex(int dayNum) |
413 | { | 414 | { |
414 | int row, col; | 415 | int row, col; |
415 | 416 | ||
416 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; | 417 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; |
417 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) | 418 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) |
418 | row++; | 419 | row++; |
419 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; | 420 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; |
420 | return row * 7 + col; | 421 | return row * 7 + col; |
421 | } | 422 | } |
422 | 423 | ||
423 | void KDateNavigator::wheelEvent (QWheelEvent *e) | 424 | void KDateNavigator::wheelEvent (QWheelEvent *e) |
424 | { | 425 | { |
425 | if(e->delta()>0) emit goPrevious(); | 426 | if(e->delta()>0) emit goPrevious(); |
426 | else emit goNext(); | 427 | else emit goNext(); |
427 | 428 | ||
428 | e->accept(); | 429 | e->accept(); |
429 | } | 430 | } |
430 | 431 | ||
431 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) | 432 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) |
432 | { | 433 | { |
433 | if (e->type() == QEvent::MouseButtonPress) { | 434 | if (e->type() == QEvent::MouseButtonPress) { |
434 | int i; | 435 | int i; |
435 | for(i=0;i<6;++i) { | 436 | for(i=0;i<6;++i) { |
436 | if (o == weeknos[i]) { | 437 | if (o == weeknos[i]) { |
437 | QDate weekstart = daymatrix->getDate(i*7); | 438 | QDate weekstart = daymatrix->getDate(i*7); |
438 | emit weekClicked(weekstart); | 439 | emit weekClicked(weekstart); |
439 | break; | 440 | break; |
440 | } | 441 | } |
441 | } | 442 | } |
443 | for(i=0;i<7;++i) { | ||
444 | if (o == headings[i]) { | ||
445 | KCal::DateList selDays; | ||
446 | QDate date = daymatrix->getDate(14); | ||
447 | int dio = date.daysInMonth(); | ||
448 | int j; | ||
449 | int ye = date.year(); | ||
450 | int mo = date.month(); | ||
451 | for ( j = 1; j <= dio; ++j ) { | ||
452 | selDays.append( QDate( ye, mo, j ) ); | ||
453 | } | ||
454 | emit datesSelected( selDays ); | ||
455 | break; | ||
456 | } | ||
457 | } | ||
442 | return true; | 458 | return true; |
443 | } else { | 459 | } else { |
444 | return false; | 460 | return false; |
445 | } | 461 | } |
446 | } | 462 | } |
447 | 463 | ||
448 | //#include "kdatenavigator.moc" | 464 | //#include "kdatenavigator.moc" |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index a9f5a41..cc0ce9b 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -359,170 +359,173 @@ void KOViewManager::showAgendaView( bool fullScreen ) | |||
359 | bool full; | 359 | bool full; |
360 | full = fullScreen; | 360 | full = fullScreen; |
361 | if (!mAgendaView) { | 361 | if (!mAgendaView) { |
362 | full = false; | 362 | full = false; |
363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
364 | addView(mAgendaView); | 364 | addView(mAgendaView); |
365 | #ifndef DESKTOP_VERSION | 365 | #ifndef DESKTOP_VERSION |
366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
367 | #endif | 367 | #endif |
368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
370 | 370 | ||
371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
372 | 372 | ||
373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
374 | 374 | ||
375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
378 | mMainView, SLOT(newEvent(QDateTime))); | 378 | mMainView, SLOT(newEvent(QDateTime))); |
379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
382 | mMainView, SLOT(newEvent(QDate))); | 382 | mMainView, SLOT(newEvent(QDate))); |
383 | 383 | ||
384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
385 | mMainView, SLOT(editIncidence(Incidence *))); | 385 | mMainView, SLOT(editIncidence(Incidence *))); |
386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
387 | mMainView, SLOT(showIncidence(Incidence *))); | 387 | mMainView, SLOT(showIncidence(Incidence *))); |
388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
389 | mMainView, SLOT(deleteIncidence(Incidence *))); | 389 | mMainView, SLOT(deleteIncidence(Incidence *))); |
390 | 390 | ||
391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
393 | 393 | ||
394 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 394 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
395 | mMainView, SLOT( toggleExpand() ) ); | 395 | mMainView, SLOT( toggleExpand() ) ); |
396 | 396 | ||
397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
405 | SLOT( updateTodo( Todo *, int ) ) ); | 405 | SLOT( updateTodo( Todo *, int ) ) ); |
406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
407 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 407 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
414 | mAgendaView->readSettings(); | 414 | mAgendaView->readSettings(); |
415 | mAgendaView->updateConfig(); | 415 | mAgendaView->updateConfig(); |
416 | } | 416 | } |
417 | 417 | ||
418 | showView( mAgendaView, full); | 418 | showView( mAgendaView, full); |
419 | 419 | ||
420 | } | 420 | } |
421 | 421 | ||
422 | void KOViewManager::showDayView() | 422 | void KOViewManager::showDayView() |
423 | { | 423 | { |
424 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
424 | mFlagShowNextxDays = false; | 425 | mFlagShowNextxDays = false; |
425 | globalFlagBlockLabel = 1; | 426 | globalFlagBlockLabel = 1; |
426 | globalFlagBlockAgenda = 1; | 427 | globalFlagBlockAgenda = 1; |
427 | if ( mCurrentAgendaView != 1 ) | 428 | if ( mCurrentAgendaView != 1 ) |
428 | mCurrentAgendaView = -1; | 429 | mCurrentAgendaView = -1; |
429 | showAgendaView(); | 430 | showAgendaView(); |
430 | qApp->processEvents(); | 431 | qApp->processEvents(); |
431 | globalFlagBlockAgenda = 2; | 432 | globalFlagBlockAgenda = 2; |
432 | globalFlagBlockLabel = 0; | 433 | globalFlagBlockLabel = 0; |
433 | mMainView->dateNavigator()->selectDates( 1 ); | 434 | mMainView->dateNavigator()->selectDates( 1 ); |
434 | mCurrentAgendaView = 1 ; | 435 | mCurrentAgendaView = 1 ; |
435 | 436 | ||
436 | } | 437 | } |
437 | 438 | ||
438 | void KOViewManager::showWorkWeekView() | 439 | void KOViewManager::showWorkWeekView() |
439 | { | 440 | { |
441 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
440 | mFlagShowNextxDays = false; | 442 | mFlagShowNextxDays = false; |
441 | globalFlagBlockAgenda = 1; | 443 | globalFlagBlockAgenda = 1; |
442 | globalFlagBlockLabel = 1; | 444 | globalFlagBlockLabel = 1; |
443 | if ( mCurrentAgendaView != 5 ) | 445 | if ( mCurrentAgendaView != 5 ) |
444 | mCurrentAgendaView = -1; | 446 | mCurrentAgendaView = -1; |
445 | showAgendaView(); | 447 | showAgendaView(); |
446 | qApp->processEvents(); | 448 | qApp->processEvents(); |
447 | globalFlagBlockAgenda = 2; | 449 | globalFlagBlockAgenda = 2; |
448 | globalFlagBlockLabel = 0; | 450 | globalFlagBlockLabel = 0; |
449 | mMainView->dateNavigator()->selectWorkWeek(); | 451 | mMainView->dateNavigator()->selectWorkWeek(); |
450 | mCurrentAgendaView = 5 ; | 452 | mCurrentAgendaView = 5 ; |
451 | 453 | ||
452 | } | 454 | } |
453 | 455 | ||
454 | void KOViewManager::showWeekView() | 456 | void KOViewManager::showWeekView() |
455 | { | 457 | { |
456 | /* | 458 | /* |
457 | globalFlagBlockAgenda = 2; | 459 | globalFlagBlockAgenda = 2; |
458 | qDebug("4globalFlagBlockAgenda = 2; "); | 460 | qDebug("4globalFlagBlockAgenda = 2; "); |
459 | //globalFlagBlockPainting = true; | 461 | //globalFlagBlockPainting = true; |
460 | mMainView->dateNavigator()->selectWeek(); | 462 | mMainView->dateNavigator()->selectWeek(); |
461 | showAgendaView(); | 463 | showAgendaView(); |
462 | */ | 464 | */ |
463 | 465 | ||
464 | 466 | ||
467 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
465 | mFlagShowNextxDays = false; | 468 | mFlagShowNextxDays = false; |
466 | globalFlagBlockAgenda = 1; | 469 | globalFlagBlockAgenda = 1; |
467 | globalFlagBlockLabel = 1; | 470 | globalFlagBlockLabel = 1; |
468 | if ( mCurrentAgendaView != 7 ) | 471 | if ( mCurrentAgendaView != 7 ) |
469 | mCurrentAgendaView = -1; | 472 | mCurrentAgendaView = -1; |
470 | showAgendaView(); | 473 | showAgendaView(); |
471 | qApp->processEvents(); | 474 | qApp->processEvents(); |
472 | globalFlagBlockAgenda = 2; | 475 | globalFlagBlockAgenda = 2; |
473 | globalFlagBlockLabel = 0; | 476 | globalFlagBlockLabel = 0; |
474 | mMainView->dateNavigator()->selectWeek(); | 477 | mMainView->dateNavigator()->selectWeek(); |
475 | mCurrentAgendaView = 7 ; | 478 | mCurrentAgendaView = 7 ; |
476 | } | 479 | } |
477 | 480 | ||
478 | void KOViewManager::showNextXView() | 481 | void KOViewManager::showNextXView() |
479 | { | 482 | { |
480 | 483 | ||
481 | globalFlagBlockAgenda = 1; | 484 | globalFlagBlockAgenda = 1; |
482 | if ( mCurrentAgendaView != 3 ) | 485 | if ( mCurrentAgendaView != 3 ) |
483 | mCurrentAgendaView = -1; | 486 | mCurrentAgendaView = -1; |
484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 487 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
485 | globalFlagBlockAgenda = 2; | 488 | globalFlagBlockAgenda = 2; |
486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 489 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
487 | KOPrefs::instance()->mNextXDays ); | 490 | KOPrefs::instance()->mNextXDays ); |
488 | mFlagShowNextxDays = true; | 491 | mFlagShowNextxDays = true; |
489 | mCurrentAgendaView = 3 ; | 492 | mCurrentAgendaView = 3 ; |
490 | } | 493 | } |
491 | bool KOViewManager::showsNextDays() | 494 | bool KOViewManager::showsNextDays() |
492 | { | 495 | { |
493 | return mFlagShowNextxDays; | 496 | return mFlagShowNextxDays; |
494 | } | 497 | } |
495 | void KOViewManager::createMonthView() | 498 | void KOViewManager::createMonthView() |
496 | { | 499 | { |
497 | if (!mMonthView) { | 500 | if (!mMonthView) { |
498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 501 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
499 | 502 | ||
500 | addView(mMonthView); | 503 | addView(mMonthView); |
501 | // mMonthView->show(); | 504 | // mMonthView->show(); |
502 | // SIGNALS/SLOTS FOR MONTH VIEW | 505 | // SIGNALS/SLOTS FOR MONTH VIEW |
503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 506 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
504 | mMainView, SLOT(newEvent(QDateTime))); | 507 | mMainView, SLOT(newEvent(QDateTime))); |
505 | 508 | ||
506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 509 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
507 | mMainView, SLOT(showIncidence(Incidence *))); | 510 | mMainView, SLOT(showIncidence(Incidence *))); |
508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 511 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
509 | mMainView, SLOT(editIncidence(Incidence *))); | 512 | mMainView, SLOT(editIncidence(Incidence *))); |
510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 513 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
511 | mMainView, SLOT(deleteIncidence(Incidence *))); | 514 | mMainView, SLOT(deleteIncidence(Incidence *))); |
512 | 515 | ||
513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 516 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 517 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 518 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 519 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
519 | 522 | ||
520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 523 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 524 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 525 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 526 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 527 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
525 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); | 528 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); |
526 | connect( mMonthView, SIGNAL( selectMonth() ), | 529 | connect( mMonthView, SIGNAL( selectMonth() ), |
527 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); | 530 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); |
528 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 531 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |