summaryrefslogtreecommitdiffabout
path: root/korganizer/datenavigatorcontainer.cpp
Unidiff
Diffstat (limited to 'korganizer/datenavigatorcontainer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index e57daa4..f9c8b73 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -74,110 +74,109 @@ void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
74 connect( v, SIGNAL( showMonth( const QDate & ) ), 74 connect( v, SIGNAL( showMonth( const QDate & ) ),
75 SIGNAL( showMonth( const QDate & ) ) ); 75 SIGNAL( showMonth( const QDate & ) ) );
76 76
77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
79 79
80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); 80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); 81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); 82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); 83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
84 84
85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
86} 86}
87void DateNavigatorContainer::slotgoNextYear() 87void DateNavigatorContainer::slotgoNextYear()
88{ 88{
89 jumpMonth( 12 ); 89 jumpMonth( 12 );
90 emit goNextYear(); 90 emit goNextYear();
91 91
92} 92}
93void DateNavigatorContainer::slotgoPrevYear() 93void DateNavigatorContainer::slotgoPrevYear()
94{ 94{
95 jumpMonth( -12 ); 95 jumpMonth( -12 );
96 emit goPrevYear(); 96 emit goPrevYear();
97 97
98} 98}
99void DateNavigatorContainer::slotgoPrevMonth() 99void DateNavigatorContainer::slotgoPrevMonth()
100{ 100{
101 jumpMonth( -1 ); 101 jumpMonth( -1 );
102 emit goPrevMonth(); 102 emit goPrevMonth();
103 103
104} 104}
105void DateNavigatorContainer::slotgoNextMonth() 105void DateNavigatorContainer::slotgoNextMonth()
106{ 106{
107 jumpMonth( 1 ); 107 jumpMonth( 1 );
108 emit goNextMonth(); 108 emit goNextMonth();
109} 109}
110void DateNavigatorContainer::jumpMonth( int month ) 110void DateNavigatorContainer::jumpMonth( int month )
111{ 111{
112 112
113 QDate baseDate = mNavigatorView->baseDate(); 113 QDate baseDate = mNavigatorView->baseDate();
114 computeMonthSelected( baseDate.month() + month, false ); 114 computeMonthSelected( baseDate.month() + month, false );
115} 115}
116void DateNavigatorContainer::slotMonthSelected( int month ) 116void DateNavigatorContainer::slotMonthSelected( int month )
117{ 117{
118 computeMonthSelected( month, true ); 118 computeMonthSelected( month, true );
119} 119}
120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
121{ 121{
122 //qDebug("slotMonthSelected %d ", month); 122 //qDebug("slotMonthSelected %d ", month);
123 QDate baseDate = mNavigatorView->baseDate(); 123 QDate baseDate = mNavigatorView->baseDate();
124 if ( baseDate.month() == month ) 124 if ( baseDate.month() == month )
125 return; 125 return;
126 //qDebug("month %d %d ",baseDate.month(),month); 126 //qDebug("month %d %d ",baseDate.month(),month);
127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
128 date = date.addDays( -(baseDate.month()-month ) *30 ); 128 date = date.addDays( -(baseDate.month()-month ) *30 );
129 QDate newBase = QDate ( date.year(), date.month() ,1 ); 129 QDate newBase = QDate ( date.year(), date.month() ,1 );
130 130
131 //qDebug("NEW BASE %s", newBase.toString().latin1()); 131 //qDebug("NEW BASE %s", newBase.toString().latin1());
132 mNavigatorView->setBaseDate( newBase ); 132 mNavigatorView->setBaseDate( newBase );
133 QDate last = lastAvailableDate(); 133 QDate last = lastAvailableDate();
134 QDate first = firstAvailableDate(); 134 QDate first = firstAvailableDate();
135
136 QDate selFirst = mFirstSelectedDate; 135 QDate selFirst = mFirstSelectedDate;
137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 136 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
138 if ( selFirst >= first && selLast <= last ) { 137 if ( selFirst >= first && selLast <= last ) {
139 setBaseDates(); 138 setBaseDates();
140 if ( forceEmit ) 139 if ( forceEmit )
141 updateDayMatrixDates(); 140 updateDayMatrixDates();
142 } 141 }
143 else { 142 else {
144 setBaseDates(); 143 setBaseDates();
145 if ( forceEmit ) 144 if ( forceEmit )
146 updateDayMatrixDates(); 145 updateDayMatrixDates();
147 if ( forceEmit ) 146 if ( forceEmit )
148 emit monthSelected( month ); 147 emit monthSelected( month );
149 } 148 }
150} 149}
151void DateNavigatorContainer::setCalendar( Calendar *cal ) 150void DateNavigatorContainer::setCalendar( Calendar *cal )
152{ 151{
153 mCalendar = cal; 152 mCalendar = cal;
154 mNavigatorView->setCalendar( cal ); 153 mNavigatorView->setCalendar( cal );
155 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 154 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
156 KDateNavigator *n = mExtraViews.at( i ); 155 KDateNavigator *n = mExtraViews.at( i );
157 n->setCalendar( cal ); 156 n->setCalendar( cal );
158 } 157 }
159} 158}
160void DateNavigatorContainer::checkUpdateDayMatrixDates() 159void DateNavigatorContainer::checkUpdateDayMatrixDates()
161{ 160{
162 //qDebug("KODNC: wid %d hei %d ", width(), height()); 161 //qDebug("KODNC: wid %d hei %d ", width(), height());
163 mUpdateTimer->stop(); 162 mUpdateTimer->stop();
164 //return; 163 //return;
165 if ( width() < 3 || height() < 3 ) 164 if ( width() < 3 || height() < 3 )
166 return; 165 return;
167 static int lastWid = 0; 166 static int lastWid = 0;
168 static int lastHei = 0; 167 static int lastHei = 0;
169 if ( lastWid == width() && height() == lastHei ) { 168 if ( lastWid == width() && height() == lastHei ) {
170 qDebug("KODNC: No layout computing needed. "); 169 qDebug("KODNC: No layout computing needed. ");
171 } else { 170 } else {
172 lastWid = width(); 171 lastWid = width();
173 lastHei = height(); 172 lastHei = height();
174 173
175 QSize minSize = mNavigatorView->yourSizeHint(); 174 QSize minSize = mNavigatorView->yourSizeHint();
176 175
177 int verticalCount = size().height() / minSize.height(); 176 int verticalCount = size().height() / minSize.height();
178 int horizontalCount = size().width() / minSize.width(); 177 int horizontalCount = size().width() / minSize.width();
179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 178 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 179 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
181 bool fontchange = false; 180 bool fontchange = false;
182 if ( horizontalCount == 1) 181 if ( horizontalCount == 1)
183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 182 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();