summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/datenavigator.cpp3
-rw-r--r--korganizer/komonthview.cpp9
-rw-r--r--korganizer/koviewmanager.cpp4
4 files changed, 8 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 96fb5ca..db33017 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3644,97 +3644,97 @@ DateNavigator *CalendarView::dateNavigator()
3644 return mNavigator; 3644 return mNavigator;
3645} 3645}
3646 3646
3647KDateNavigator* CalendarView::dateNavigatorWidget() 3647KDateNavigator* CalendarView::dateNavigatorWidget()
3648{ 3648{
3649 return mDateNavigator; 3649 return mDateNavigator;
3650} 3650}
3651void CalendarView::toggleDateNavigatorWidget() 3651void CalendarView::toggleDateNavigatorWidget()
3652{ 3652{
3653 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3653 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3654 if (!KOPrefs::instance()->mShowDateNavigator ) 3654 if (!KOPrefs::instance()->mShowDateNavigator )
3655 mDateNavigator->hide(); 3655 mDateNavigator->hide();
3656 else 3656 else
3657 mDateNavigator->show(); 3657 mDateNavigator->show();
3658} 3658}
3659void CalendarView::addView(KOrg::BaseView *view) 3659void CalendarView::addView(KOrg::BaseView *view)
3660{ 3660{
3661 mViewManager->addView(view); 3661 mViewManager->addView(view);
3662} 3662}
3663 3663
3664void CalendarView::showView(KOrg::BaseView *view) 3664void CalendarView::showView(KOrg::BaseView *view)
3665{ 3665{
3666 mViewManager->showView(view, mLeftFrame->isVisible()); 3666 mViewManager->showView(view, mLeftFrame->isVisible());
3667} 3667}
3668 3668
3669Incidence *CalendarView::currentSelection() 3669Incidence *CalendarView::currentSelection()
3670{ 3670{
3671 return mViewManager->currentSelection(); 3671 return mViewManager->currentSelection();
3672} 3672}
3673void CalendarView::toggleAllDaySize() 3673void CalendarView::toggleAllDaySize()
3674{ 3674{
3675 /* 3675 /*
3676 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3676 if ( KOPrefs::instance()->mAllDaySize > 47 )
3677 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3677 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3678 else 3678 else
3679 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3679 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3680 */ 3680 */
3681 viewManager()->agendaView()->toggleAllDay(); 3681 viewManager()->agendaView()->toggleAllDay();
3682} 3682}
3683void CalendarView::toggleExpand() 3683void CalendarView::toggleExpand()
3684{ 3684{
3685 // if ( mLeftFrame->isHidden() ) { 3685 // if ( mLeftFrame->isHidden() ) {
3686 // mLeftFrame->show(); 3686 // mLeftFrame->show();
3687 // emit calendarViewExpanded( false ); 3687 // emit calendarViewExpanded( false );
3688 // } else { 3688 // } else {
3689 // mLeftFrame->hide(); 3689 // mLeftFrame->hide();
3690 // emit calendarViewExpanded( true ); 3690 // emit calendarViewExpanded( true );
3691 // } 3691 // }
3692 3692 //qDebug(" CalendarView::toggleExpand()");
3693 globalFlagBlockAgenda = 1; 3693 globalFlagBlockAgenda = 1;
3694 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3694 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3695 globalFlagBlockAgenda = 5; 3695 globalFlagBlockAgenda = 5;
3696 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3696 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3697 //mViewManager->showView( 0, true ); 3697 //mViewManager->showView( 0, true );
3698} 3698}
3699 3699
3700void CalendarView::calendarModified( bool modified, Calendar * ) 3700void CalendarView::calendarModified( bool modified, Calendar * )
3701{ 3701{
3702 setModified( modified ); 3702 setModified( modified );
3703} 3703}
3704 3704
3705Todo *CalendarView::selectedTodo() 3705Todo *CalendarView::selectedTodo()
3706{ 3706{
3707 Incidence *incidence = currentSelection(); 3707 Incidence *incidence = currentSelection();
3708 if ( incidence && incidence->type() == "Todo" ) { 3708 if ( incidence && incidence->type() == "Todo" ) {
3709 return static_cast<Todo *>( incidence ); 3709 return static_cast<Todo *>( incidence );
3710 } 3710 }
3711 3711
3712 incidence = mTodoList->selectedIncidences().first(); 3712 incidence = mTodoList->selectedIncidences().first();
3713 if ( incidence && incidence->type() == "Todo" ) { 3713 if ( incidence && incidence->type() == "Todo" ) {
3714 return static_cast<Todo *>( incidence ); 3714 return static_cast<Todo *>( incidence );
3715 } 3715 }
3716 3716
3717 return 0; 3717 return 0;
3718} 3718}
3719 3719
3720void CalendarView::dialogClosing(Incidence *in) 3720void CalendarView::dialogClosing(Incidence *in)
3721{ 3721{
3722 // mDialogList.remove(in); 3722 // mDialogList.remove(in);
3723} 3723}
3724 3724
3725void CalendarView::showIncidence() 3725void CalendarView::showIncidence()
3726{ 3726{
3727 Incidence *incidence = currentSelection(); 3727 Incidence *incidence = currentSelection();
3728 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3728 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3729 if ( incidence ) { 3729 if ( incidence ) {
3730 ShowIncidenceVisitor v; 3730 ShowIncidenceVisitor v;
3731 v.act( incidence, this ); 3731 v.act( incidence, this );
3732 } 3732 }
3733} 3733}
3734void CalendarView::editIncidenceDescription() 3734void CalendarView::editIncidenceDescription()
3735{ 3735{
3736 mFlagEditDescription = true; 3736 mFlagEditDescription = true;
3737 editIncidence(); 3737 editIncidence();
3738 mFlagEditDescription = false; 3738 mFlagEditDescription = false;
3739} 3739}
3740void CalendarView::editIncidence() 3740void CalendarView::editIncidence()
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp
index 3156b2b..d2824de 100644
--- a/korganizer/datenavigator.cpp
+++ b/korganizer/datenavigator.cpp
@@ -165,98 +165,97 @@ void DateNavigator::selectWeek( int num )
165 selectWeek( d.addDays ( (num-1) *7 ) ); 165 selectWeek( d.addDays ( (num-1) *7 ) );
166} 166}
167void DateNavigator::selectWeek( const QDate &d ) 167void DateNavigator::selectWeek( const QDate &d )
168{ 168{
169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
170 170
171 int weekStart = KGlobal::locale()->weekStartDay(); 171 int weekStart = KGlobal::locale()->weekStartDay();
172 QDate firstDate = d.addDays( weekStart - dayOfWeek ); 172 QDate firstDate = d.addDays( weekStart - dayOfWeek );
173 173
174 if ( weekStart != 1 && dayOfWeek < weekStart ) { 174 if ( weekStart != 1 && dayOfWeek < weekStart ) {
175 firstDate = firstDate.addDays(-7 ); 175 firstDate = firstDate.addDays(-7 );
176 } 176 }
177 177
178 178
179 selectDates( firstDate, 7 ); 179 selectDates( firstDate, 7 );
180} 180}
181 181
182void DateNavigator::selectWorkWeek() 182void DateNavigator::selectWorkWeek()
183{ 183{
184 QDate d = mSelectedDates.first(); 184 QDate d = mSelectedDates.first();
185 selectWorkWeek( d ); 185 selectWorkWeek( d );
186} 186}
187 187
188void DateNavigator::selectWorkWeek( const QDate &d ) 188void DateNavigator::selectWorkWeek( const QDate &d )
189{ 189{
190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
191 191
192 QDate firstDate = d.addDays( 1 - dayOfWeek ); 192 QDate firstDate = d.addDays( 1 - dayOfWeek );
193 193
194 int weekStart = KGlobal::locale()->weekStartDay(); 194 int weekStart = KGlobal::locale()->weekStartDay();
195 if ( weekStart != 1 && dayOfWeek >= weekStart ) { 195 if ( weekStart != 1 && dayOfWeek >= weekStart ) {
196 firstDate = firstDate.addDays( 7 ); 196 firstDate = firstDate.addDays( 7 );
197 } 197 }
198 198
199 selectDates( firstDate, 5 ); 199 selectDates( firstDate, 5 );
200} 200}
201 201
202void DateNavigator::selectTodayMonth() 202void DateNavigator::selectTodayMonth()
203{ 203{
204 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); 204 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() );
205 selectDates( date , date.daysInMonth ()); 205 selectDates( date , date.daysInMonth ());
206 206
207} 207}
208void DateNavigator::selectToday() 208void DateNavigator::selectToday()
209{ 209{
210 QDate d = QDate::currentDate(); 210 QDate d = QDate::currentDate();
211 211
212 int dateCount = mSelectedDates.count(); 212 int dateCount = mSelectedDates.count();
213 213 if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d );
214 if ( dateCount == 5 ) selectWorkWeek( d );
215 else if ( dateCount == 7 ) selectWeek( d ); 214 else if ( dateCount == 7 ) selectWeek( d );
216 else selectDates( d, dateCount ); 215 else selectDates( d, dateCount );
217} 216}
218 217
219void DateNavigator::selectPreviousYear() 218void DateNavigator::selectPreviousYear()
220{ 219{
221 QDate firstSelected = mSelectedDates.first(); 220 QDate firstSelected = mSelectedDates.first();
222 int weekDay = firstSelected.dayOfWeek(); 221 int weekDay = firstSelected.dayOfWeek();
223 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); 222 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 );
224 223
225 selectWeekByDay( weekDay, firstSelected ); 224 selectWeekByDay( weekDay, firstSelected );
226} 225}
227 226
228void DateNavigator::selectPreviousMonth() 227void DateNavigator::selectPreviousMonth()
229{ 228{
230 QDate firstSelected = mSelectedDates.first(); 229 QDate firstSelected = mSelectedDates.first();
231 int weekDay = firstSelected.dayOfWeek(); 230 int weekDay = firstSelected.dayOfWeek();
232 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); 231 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 );
233 232
234 233
235 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 234 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
236 selectMonthByDate( firstSelected ); 235 selectMonthByDate( firstSelected );
237 else 236 else
238 selectWeekByDay( weekDay, firstSelected ); 237 selectWeekByDay( weekDay, firstSelected );
239} 238}
240 239
241void DateNavigator::selectNextMonth() 240void DateNavigator::selectNextMonth()
242{ 241{
243 QDate firstSelected = mSelectedDates.first(); 242 QDate firstSelected = mSelectedDates.first();
244 int weekDay = firstSelected.dayOfWeek(); 243 int weekDay = firstSelected.dayOfWeek();
245 244
246 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); 245 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 );
247 246
248 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 247 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
249 selectMonthByDate( firstSelected ); 248 selectMonthByDate( firstSelected );
250 else 249 else
251 selectWeekByDay( weekDay, firstSelected ); 250 selectWeekByDay( weekDay, firstSelected );
252 251
253} 252}
254 253
255void DateNavigator::selectNextYear() 254void DateNavigator::selectNextYear()
256{ 255{
257 QDate firstSelected = mSelectedDates.first(); 256 QDate firstSelected = mSelectedDates.first();
258 int weekDay = firstSelected.dayOfWeek(); 257 int weekDay = firstSelected.dayOfWeek();
259 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); 258 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 );
260 259
261 selectWeekByDay( weekDay, firstSelected ); 260 selectWeekByDay( weekDay, firstSelected );
262} 261}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 10e4f1d..4cefb26 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -922,97 +922,97 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
922 QString hstring(KOCore::self()->holiday(date)); 922 QString hstring(KOCore::self()->holiday(date));
923 mCells[i]->setHoliday( hstring ); 923 mCells[i]->setHoliday( hstring );
924#endif 924#endif
925 925
926 } 926 }
927 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 927 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
928 for( i = 0; i < 6; ++i ) { 928 for( i = 0; i < 6; ++i ) {
929 int wno; 929 int wno;
930 // remember, according to ISO 8601, the first week of the year is the 930 // remember, according to ISO 8601, the first week of the year is the
931 // first week that contains a thursday. Thus we must subtract off 4, 931 // first week that contains a thursday. Thus we must subtract off 4,
932 // not just 1. 932 // not just 1.
933 int dayOfYear = date.dayOfYear(); 933 int dayOfYear = date.dayOfYear();
934 if (dayOfYear % 7 != 0) 934 if (dayOfYear % 7 != 0)
935 wno = dayOfYear / 7 + 1; 935 wno = dayOfYear / 7 + 1;
936 else 936 else
937 wno =dayOfYear / 7; 937 wno =dayOfYear / 7;
938 mWeekLabels[i]->setWeekNum( wno ); 938 mWeekLabels[i]->setWeekNum( wno );
939 date = date.addDays( 7 ); 939 date = date.addDays( 7 );
940 } 940 }
941 updateView(); 941 updateView();
942} 942}
943 943
944void KOMonthView::showEvents(QPtrList<Event>) 944void KOMonthView::showEvents(QPtrList<Event>)
945{ 945{
946 qDebug("KOMonthView::selectEvents is not implemented yet. "); 946 qDebug("KOMonthView::selectEvents is not implemented yet. ");
947} 947}
948 948
949void KOMonthView::changeEventDisplay(Event *, int) 949void KOMonthView::changeEventDisplay(Event *, int)
950{ 950{
951 // this should be re-written to be much more efficient, but this 951 // this should be re-written to be much more efficient, but this
952 // quick-and-dirty-hack gets the job done for right now. 952 // quick-and-dirty-hack gets the job done for right now.
953 updateView(); 953 updateView();
954} 954}
955 955
956void KOMonthView::updateView() 956void KOMonthView::updateView()
957{ 957{
958 958
959 if ( !updatePossible ) 959 if ( !updatePossible )
960 return; 960 return;
961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
962 int i; 962 int i;
963 for( i = 0; i < mCells.count(); ++i ) { 963 for( i = 0; i < mCells.count(); ++i ) {
964 mCells[i]->updateCell(); 964 mCells[i]->updateCell();
965 } 965 }
966 966
967 //qDebug("KOMonthView::updateView() "); 967 //qDebug("KOMonthView::updateView() ");
968 processSelectionChange(); 968 processSelectionChange();
969 // qDebug("---------------------------------------------------------------------+ "); 969 // qDebug("---------------------------------------------------------------------+ ");
970 setFocus(); 970 mCells[0]->setFocus();
971} 971}
972 972
973void KOMonthView::resizeEvent(QResizeEvent * e) 973void KOMonthView::resizeEvent(QResizeEvent * e)
974{ 974{
975 computeLayout(); 975 computeLayout();
976} 976}
977void KOMonthView::computeLayout() 977void KOMonthView::computeLayout()
978{ 978{
979 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 979 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
980 // note this only changes the text if the requested size crosses the 980 // note this only changes the text if the requested size crosses the
981 // threshold between big enough to support the full name and not big 981 // threshold between big enough to support the full name and not big
982 // enough. 982 // enough.
983 983
984 int daysToShow = 7; 984 int daysToShow = 7;
985 bool combinedSatSun = false; 985 bool combinedSatSun = false;
986 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 986 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
987 daysToShow = 6; 987 daysToShow = 6;
988 combinedSatSun = true; 988 combinedSatSun = true;
989 } 989 }
990 int tWid = topLevelWidget()->size().width(); 990 int tWid = topLevelWidget()->size().width();
991 int tHei = topLevelWidget()->size().height(); 991 int tHei = topLevelWidget()->size().height();
992 992
993 int wid = size().width();//e 993 int wid = size().width();//e
994 int hei = size().height()-1; 994 int hei = size().height()-1;
995 995
996 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 996 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
997 return; 997 return;
998 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 998 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
999 QFontMetrics fm ( mWeekLabels[0]->font() ); 999 QFontMetrics fm ( mWeekLabels[0]->font() );
1000 int weeklabelwid = fm.width( "888" ); 1000 int weeklabelwid = fm.width( "888" );
1001 wid -= weeklabelwid; 1001 wid -= weeklabelwid;
1002 1002
1003 int colWid = wid / daysToShow; 1003 int colWid = wid / daysToShow;
1004 int lastCol = wid - ( colWid*6 ); 1004 int lastCol = wid - ( colWid*6 );
1005 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1005 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1006 int cellHei = (hei - dayLabelHei) /6; 1006 int cellHei = (hei - dayLabelHei) /6;
1007 int colModulo = wid % daysToShow; 1007 int colModulo = wid % daysToShow;
1008 int rowModulo = (hei- dayLabelHei) % 6; 1008 int rowModulo = (hei- dayLabelHei) % 6;
1009 //qDebug("rowmod %d ", rowModulo); 1009 //qDebug("rowmod %d ", rowModulo);
1010 int i; 1010 int i;
1011 int x,y,w,h; 1011 int x,y,w,h;
1012 x= 0; 1012 x= 0;
1013 y= 0; 1013 y= 0;
1014 w = colWid; 1014 w = colWid;
1015 h = dayLabelHei ; 1015 h = dayLabelHei ;
1016 for ( i = 0; i < 7; i++) { 1016 for ( i = 0; i < 7; i++) {
1017 if ( i == daysToShow-colModulo ) 1017 if ( i == daysToShow-colModulo )
1018 ++w; 1018 ++w;
@@ -1086,69 +1086,70 @@ void KOMonthView::showContextMenu( Incidence *incidence )
1086 if( incidence && incidence->type() == "Event" ) { 1086 if( incidence && incidence->type() == "Event" ) {
1087 Event *event = static_cast<Event *>(incidence); 1087 Event *event = static_cast<Event *>(incidence);
1088 mContextMenu->showEventPopup(event); 1088 mContextMenu->showEventPopup(event);
1089 } else { 1089 } else {
1090 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1090 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1091 } 1091 }
1092 */ 1092 */
1093} 1093}
1094MonthViewCell * KOMonthView::selectedCell( ) 1094MonthViewCell * KOMonthView::selectedCell( )
1095{ 1095{
1096 return mSelectedCell; 1096 return mSelectedCell;
1097} 1097}
1098void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1098void KOMonthView::setSelectedCell( MonthViewCell *cell )
1099{ 1099{
1100 // qDebug("KOMonthView::setSelectedCell "); 1100 // qDebug("KOMonthView::setSelectedCell ");
1101 if ( mSelectedCell && mSelectedCell != cell ) { 1101 if ( mSelectedCell && mSelectedCell != cell ) {
1102 MonthViewCell * mvc = mSelectedCell; 1102 MonthViewCell * mvc = mSelectedCell;
1103 mSelectedCell = cell; 1103 mSelectedCell = cell;
1104 mvc->deselect(); 1104 mvc->deselect();
1105 } else 1105 } else
1106 mSelectedCell = cell; 1106 mSelectedCell = cell;
1107 // if ( mSelectedCell ) 1107 // if ( mSelectedCell )
1108 // mSelectedCell->select(); 1108 // mSelectedCell->select();
1109 if ( !mSelectedCell ) 1109 if ( !mSelectedCell )
1110 emit incidenceSelected( 0 ); 1110 emit incidenceSelected( 0 );
1111 else 1111 else
1112 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1112 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1113} 1113}
1114 1114
1115void KOMonthView::processSelectionChange() 1115void KOMonthView::processSelectionChange()
1116{ 1116{
1117 QPtrList<Incidence> incidences = selectedIncidences(); 1117 QPtrList<Incidence> incidences = selectedIncidences();
1118 if (incidences.count() > 0) { 1118 if (incidences.count() > 0) {
1119 emit incidenceSelected( incidences.first() ); 1119 emit incidenceSelected( incidences.first() );
1120 } else { 1120 } else {
1121 emit incidenceSelected( 0 ); 1121 emit incidenceSelected( 0 );
1122 } 1122 }
1123} 1123}
1124 1124
1125void KOMonthView::clearSelection() 1125void KOMonthView::clearSelection()
1126{ 1126{
1127 if ( mSelectedCell ) { 1127 if ( mSelectedCell ) {
1128 mSelectedCell->deselect(); 1128 mSelectedCell->deselect();
1129 mSelectedCell = 0; 1129 mSelectedCell = 0;
1130 } 1130 }
1131} 1131}
1132void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1132void KOMonthView::keyPressEvent ( QKeyEvent * e )
1133{ 1133{
1134 //qDebug("KOMonthView::keyPressEvent ");
1134 switch(e->key()) { 1135 switch(e->key()) {
1135 break;
1136 case Key_Up: 1136 case Key_Up:
1137 { 1137 {
1138 emit prevMonth(); 1138 emit prevMonth();
1139 setFocus(); 1139 mCells[0]->setFocus();
1140 } 1140 }
1141 e->accept(); 1141 e->accept();
1142 break; 1142 break;
1143 case Key_Down: 1143 case Key_Down:
1144 { 1144 {
1145 emit nextMonth(); 1145 emit nextMonth();
1146 setFocus(); 1146 mCells[0]->setFocus();
1147
1147 } 1148 }
1148 e->accept(); 1149 e->accept();
1149 break; 1150 break;
1150 default: 1151 default:
1151 e->ignore(); 1152 e->ignore();
1152 break; 1153 break;
1153 } 1154 }
1154} 1155}
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 6da4799..4c03f9a 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -57,205 +57,203 @@ int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") showMonthView(); 91 else if (view == "Month") showMonthView();
92 else if (view == "List") showListView(); 92 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 93 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 94 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101 101
102void KOViewManager::showDateView( int view, QDate date) 102void KOViewManager::showDateView( int view, QDate date)
103{ 103{
104 104
105 qDebug("date %d %s", view, date.toString().latin1()); 105 //qDebug("date %d %s", view, date.toString().latin1());
106#if 0 106#if 0
107 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 107 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
108 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); 108 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 );
109 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); 109 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 );
110 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); 110 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 );
111 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 111 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
112#endif 112#endif
113 if ( view == 3 ) { 113 if ( view == 3 ) {
114 mMainView->showDay( date ); 114 mMainView->showDay( date );
115 } else if (view == 4 ) { 115 } else if (view == 4 ) {
116 mMainView->dateNavigator()->selectDates( date, 7 ); 116 mMainView->dateNavigator()->selectDates( date, 7 );
117 } else if (view == 5 ) { 117 } else if (view == 5 ) {
118 mMainView->dateNavigator()->selectDates( date, 14); 118 mMainView->dateNavigator()->selectDates( date, 14);
119 } else if (view == 6 ) { 119 } else if (view == 6 ) {
120 showMonthView(); 120 showMonthView();
121 mMainView->dateNavigator()->selectMonthByDate( date ); 121 mMainView->dateNavigator()->selectMonthByDate( date );
122 mMainView->dateNavigator()->selectDate( date ); 122 mMainView->dateNavigator()->selectDate( date );
123 } else if (view == 7 ) { 123 } else if (view == 7 ) {
124 mMainView->dateNavigator()->selectDate( date ); 124 mMainView->dateNavigator()->selectDate( date );
125 showJournalView(); 125 showJournalView();
126 } else if (view == 8 ) { 126 } else if (view == 8 ) {
127 globalFlagBlockAgenda = 1; 127 globalFlagBlockAgenda = 1;
128 if ( mCurrentAgendaView != 3 ) 128 if ( mCurrentAgendaView != 3 )
129 mCurrentAgendaView = -1; 129 mCurrentAgendaView = -1;
130 showAgendaView(KOPrefs::instance()->mFullViewMonth); 130 showAgendaView(KOPrefs::instance()->mFullViewMonth);
131 globalFlagBlockAgenda = 2; 131 globalFlagBlockAgenda = 2;
132 mMainView->dateNavigator()->selectDates( date , 132 mMainView->dateNavigator()->selectDates( date ,
133 KOPrefs::instance()->mNextXDays ); 133 KOPrefs::instance()->mNextXDays );
134 mFlagShowNextxDays = true; 134 mFlagShowNextxDays = true;
135 mCurrentAgendaView = 3 ; 135 mCurrentAgendaView = 3 ;
136 } 136 }
137 137
138#if 0 138#if 0
139 dateNavigator()->blockSignals( true ); 139 dateNavigator()->blockSignals( true );
140 dateNavigator()->selectDate( d ); 140 dateNavigator()->selectDate( d );
141 dateNavigator()->blockSignals( false ); 141 dateNavigator()->blockSignals( false );
142 mViewManager->showDayView(); 142 mViewManager->showDayView();
143#endif 143#endif
144 144
145} 145}
146 146
147 147
148 148
149void KOViewManager::writeSettings(KConfig *config) 149void KOViewManager::writeSettings(KConfig *config)
150{ 150{
151 config->setGroup("General"); 151 config->setGroup("General");
152 152
153 QString view; 153 QString view;
154 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 154 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
155 else if (mCurrentView == mMonthView) view = "Month"; 155 else if (mCurrentView == mMonthView) view = "Month";
156 else if (mCurrentView == mListView) view = "List"; 156 else if (mCurrentView == mListView) view = "List";
157 else if (mCurrentView == mJournalView) view = "Journal"; 157 else if (mCurrentView == mJournalView) view = "Journal";
158 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 158 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
159 else if (mCurrentView == mTodoView) view = "Todo"; 159 else if (mCurrentView == mTodoView) view = "Todo";
160 else view = "Agenda"; 160 else view = "Agenda";
161 161
162 config->writeEntry("Current View",view); 162 config->writeEntry("Current View",view);
163 163
164 if (mAgendaView) { 164 if (mAgendaView) {
165 mAgendaView->writeSettings(config); 165 mAgendaView->writeSettings(config);
166 } 166 }
167 if (mTimeSpanView) { 167 if (mTimeSpanView) {
168 mTimeSpanView->writeSettings(config); 168 mTimeSpanView->writeSettings(config);
169 } 169 }
170 if (mListView) { 170 if (mListView) {
171 mListView->writeSettings(config); 171 mListView->writeSettings(config);
172 } 172 }
173 if (mTodoView) { 173 if (mTodoView) {
174 mTodoView->saveLayout(config,"Todo View"); 174 mTodoView->saveLayout(config,"Todo View");
175 } 175 }
176} 176}
177 177
178void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 178void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
179{ 179{
180 180
181 //mFlagShowNextxDays = false; 181 //mFlagShowNextxDays = false;
182 //if(view == mCurrentView) return; 182 //if(view == mCurrentView) return;
183 if ( view == 0 ) { 183 if ( view == 0 ) {
184 view = mCurrentView; 184 view = mCurrentView;
185 if ( view == 0 ) 185 if ( view == 0 )
186 return; 186 return;
187 } 187 }
188 bool full = fullScreen; 188 bool full = fullScreen;
189 if(view == mCurrentView && view != mWhatsNextView ) { 189 if(view == mCurrentView && view != mWhatsNextView ) {
190 if ( mCurrentAgendaView < 0 ) 190 if ( mCurrentAgendaView < 0 )
191 return; 191 return;
192 full = mMainView->leftFrame()->isVisible(); 192 full = mMainView->leftFrame()->isVisible();
193 } else { 193 } else {
194 mCurrentView = view; 194 mCurrentView = view;
195
196 // bool full = fullScreen; 195 // bool full = fullScreen;
197 bool isFull = !mMainView->leftFrame()->isVisible(); 196 bool isFull = !mMainView->leftFrame()->isVisible();
198 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 197 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
199 full = true; 198 full = true;
200 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 199 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
201 full = false; 200 full = false;
202 } 201 }
203 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 202 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
204 //raiseCurrentView( full ); 203 //raiseCurrentView( full );
205 mMainView->processIncidenceSelection( 0 ); 204 mMainView->processIncidenceSelection( 0 );
206 mMainView->updateView(); 205 mMainView->updateView();
207 raiseCurrentView( full ); 206 raiseCurrentView( full );
208 mMainView->adaptNavigationUnits(); 207 mMainView->adaptNavigationUnits();
209} 208}
210 209
211void KOViewManager::raiseCurrentView( bool fullScreen ) 210void KOViewManager::raiseCurrentView( bool fullScreen )
212{ 211{
213 //qDebug("raiseCurrentView ");
214 mCurrentAgendaView = 0; 212 mCurrentAgendaView = 0;
215 int wid = mMainView->width() ; 213 int wid = mMainView->width() ;
216 int hei = mMainView->height(); 214 int hei = mMainView->height();
217 if ( mCurrentView == mMonthView ) { 215 if ( mCurrentView == mMonthView ) {
218 mMainView->navigatorBar()->show(); 216 mMainView->navigatorBar()->show();
219 hei -= mMainView->navigatorBar()->sizeHint().height(); 217 hei -= mMainView->navigatorBar()->sizeHint().height();
220 //mMainView->navigatorBar()->hide(); 218 //mMainView->navigatorBar()->hide();
221 } else { 219 } else {
222 mMainView->navigatorBar()->hide(); 220 mMainView->navigatorBar()->hide();
223 } 221 }
224 if ( fullScreen ) { 222 if ( fullScreen ) {
225 mMainView->leftFrame()->hide(); 223 mMainView->leftFrame()->hide();
226 } else { 224 } else {
227 mMainView->leftFrame()->show(); 225 mMainView->leftFrame()->show();
228 if ( KOPrefs::instance()->mVerticalScreen ) 226 if ( KOPrefs::instance()->mVerticalScreen )
229 hei -= mMainView->leftFrame()->height(); 227 hei -= mMainView->leftFrame()->height();
230 else 228 else
231 wid -= mMainView->leftFrame()->width(); 229 wid -= mMainView->leftFrame()->width();
232 } 230 }
233 emit signalFullScreen( !fullScreen ); 231 emit signalFullScreen( !fullScreen );
234 if ( globalFlagBlockAgenda == 5 ) { 232 if ( globalFlagBlockAgenda == 5 ) {
235 globalFlagBlockAgenda = 4; 233 globalFlagBlockAgenda = 4;
236 globalFlagBlockAgendaItemPaint = 1; 234 globalFlagBlockAgendaItemPaint = 1;
237 } 235 }
238 mMainView->viewStack()->raiseWidget(mCurrentView); 236 mMainView->viewStack()->raiseWidget(mCurrentView);
239 if ( globalFlagBlockAgenda == 4 ) { 237 if ( globalFlagBlockAgenda == 4 ) {
240 if ( mCurrentView == mAgendaView ) { 238 if ( mCurrentView == mAgendaView ) {
241 //globalFlagBlockAgenda =1 ; 239 //globalFlagBlockAgenda =1 ;
242 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 240 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
243 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 241 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
244 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 242 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
245 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 243 mAgendaView->setStartHour( QTime::currentTime ().hour() );
246 qApp->processEvents(); 244 qApp->processEvents();
247 //qDebug("qApp->processEvents() "); 245 //qDebug("qApp->processEvents() ");
248 globalFlagBlockAgenda = 0; 246 globalFlagBlockAgenda = 0;
249 mAgendaView->repaintAgenda(); 247 mAgendaView->repaintAgenda();
250 248
251 } 249 }
252 globalFlagBlockAgenda = 0; 250 globalFlagBlockAgenda = 0;
253 } 251 }
254 emit signalAgendaView( mCurrentView == mAgendaView ); 252 emit signalAgendaView( mCurrentView == mAgendaView );
255 //qDebug("raiseCurrentView ende "); 253 //qDebug("raiseCurrentView ende ");
256 254
257} 255}
258 256
259void KOViewManager::updateView() 257void KOViewManager::updateView()
260{ 258{
261 // qDebug("KOViewManager::updateView() "); 259 // qDebug("KOViewManager::updateView() ");