author | zautrix <zautrix> | 2005-03-21 13:08:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 13:08:02 (UTC) |
commit | 098a3c6dd844a880beb2851be53314613c3a038d (patch) (unidiff) | |
tree | bac6a915e906760c48b1756c5b0564b04def0b63 | |
parent | ad4ecbb0cbf79f37140041eb9a14e71e6fd393f1 (diff) | |
download | kdepimpi-098a3c6dd844a880beb2851be53314613c3a038d.zip kdepimpi-098a3c6dd844a880beb2851be53314613c3a038d.tar.gz kdepimpi-098a3c6dd844a880beb2851be53314613c3a038d.tar.bz2 |
fixes
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 3 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 5941337..d4173e8 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -67,193 +67,194 @@ void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) | |||
67 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); | 67 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); |
68 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); | 68 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); |
69 | 69 | ||
70 | connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 70 | connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
71 | connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 71 | connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
72 | connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 72 | connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
73 | connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 73 | connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
74 | 74 | ||
75 | connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); | 75 | connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); |
76 | } | 76 | } |
77 | 77 | ||
78 | void DateNavigatorContainer::setCalendar( Calendar *cal ) | 78 | void DateNavigatorContainer::setCalendar( Calendar *cal ) |
79 | { | 79 | { |
80 | mCalendar = cal; | 80 | mCalendar = cal; |
81 | mNavigatorView->setCalendar( cal ); | 81 | mNavigatorView->setCalendar( cal ); |
82 | KDateNavigator *n; | 82 | KDateNavigator *n; |
83 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 83 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
84 | n->setCalendar( cal ); | 84 | n->setCalendar( cal ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void DateNavigatorContainer::updateDayMatrix() | 88 | void DateNavigatorContainer::updateDayMatrix() |
89 | { | 89 | { |
90 | mNavigatorView->updateDayMatrix(); | 90 | mNavigatorView->updateDayMatrix(); |
91 | KDateNavigator *n; | 91 | KDateNavigator *n; |
92 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 92 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
93 | n->updateDayMatrix(); | 93 | n->updateDayMatrix(); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | void DateNavigatorContainer::updateToday() | 97 | void DateNavigatorContainer::updateToday() |
98 | { | 98 | { |
99 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); | 99 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); |
100 | #if 0 | 100 | #if 0 |
101 | mNavigatorView->updateToday(); | 101 | mNavigatorView->updateToday(); |
102 | KDateNavigator *n; | 102 | KDateNavigator *n; |
103 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 103 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
104 | n->updateToday(); | 104 | n->updateToday(); |
105 | } | 105 | } |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | 108 | ||
109 | void DateNavigatorContainer::updateView() | 109 | void DateNavigatorContainer::updateView() |
110 | { | 110 | { |
111 | mNavigatorView->updateView(); | 111 | mNavigatorView->updateView(); |
112 | KDateNavigator *n; | 112 | KDateNavigator *n; |
113 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 113 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
114 | n->updateView(); | 114 | n->updateView(); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | void DateNavigatorContainer::updateConfig() | 118 | void DateNavigatorContainer::updateConfig() |
119 | { | 119 | { |
120 | mNavigatorView->updateConfig(); | 120 | mNavigatorView->updateConfig(); |
121 | KDateNavigator *n; | 121 | KDateNavigator *n; |
122 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 122 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
123 | n->updateConfig(); | 123 | n->updateConfig(); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | void DateNavigatorContainer::selectDates( const DateList &dateList ) | 127 | void DateNavigatorContainer::selectDates( const DateList &dateList ) |
128 | { | 128 | { |
129 | mNavigatorView->selectDates( dateList ); | 129 | mNavigatorView->selectDates( dateList ); |
130 | setBaseDates(); | 130 | setBaseDates(); |
131 | if ( mExtraViews.count() ) { | 131 | if ( mExtraViews.count() ) { |
132 | KDateNavigator *view = mExtraViews.at( 0 ); | 132 | KDateNavigator *view = mExtraViews.at( 0 ); |
133 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 133 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
134 | view->dayMatrix()->repaint(); | 134 | view->dayMatrix()->repaint(); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | void DateNavigatorContainer::setBaseDates() | 138 | void DateNavigatorContainer::setBaseDates() |
139 | { | 139 | { |
140 | KCal::DateList dateList = mNavigatorView->selectedDates(); | 140 | KCal::DateList dateList = mNavigatorView->selectedDates(); |
141 | if ( dateList.isEmpty() ) { | 141 | if ( dateList.isEmpty() ) { |
142 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; | 142 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; |
143 | } | 143 | } |
144 | QDate baseDate = dateList.first(); | 144 | QDate baseDate = dateList.first(); |
145 | KDateNavigator *n; | 145 | KDateNavigator *n; |
146 | bool doRepaint = false; // skip first repaint | 146 | bool doRepaint = false; // skip first repaint |
147 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 147 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
148 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); | 148 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
149 | n->setBaseDate( baseDate, doRepaint ); | 149 | n->setBaseDate( baseDate, doRepaint ); |
150 | doRepaint = true; | 150 | doRepaint = true; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | 154 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
155 | { | 155 | { |
156 | #if 0 | 156 | #if 0 |
157 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; | 157 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; |
158 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; | 158 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; |
159 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; | 159 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; |
160 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; | 160 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; |
161 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; | 161 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; |
162 | #endif | 162 | #endif |
163 | QSize minSize = mNavigatorView->sizeHintTwoButtons(); | 163 | //QSize minSize = mNavigatorView->sizeHintTwoButtons(); |
164 | QSize minSize = mNavigatorView->yourSizeHint(); | ||
164 | 165 | ||
165 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; | 166 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; |
166 | 167 | ||
167 | int verticalCount = size().height() / minSize.height(); | 168 | int verticalCount = size().height() / minSize.height(); |
168 | int horizontalCount = size().width() / minSize.width(); | 169 | int horizontalCount = size().width() / minSize.width(); |
169 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | 170 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); |
170 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 171 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
171 | bool fontchange = false; | 172 | bool fontchange = false; |
172 | QFont fo; | 173 | QFont fo; |
173 | if ( horizontalCount != mHorizontalCount || | 174 | if ( horizontalCount != mHorizontalCount || |
174 | verticalCount != mVerticalCount ) { | 175 | verticalCount != mVerticalCount ) { |
175 | uint count = horizontalCount * verticalCount; | 176 | uint count = horizontalCount * verticalCount; |
176 | if ( count == 0 ) { | 177 | if ( count == 0 ) { |
177 | bool ok; | 178 | bool ok; |
178 | fo = mNavigatorView->yourFontHint( size() , &ok); | 179 | fo = mNavigatorView->yourFontHint( size() , &ok); |
179 | //mNavigatorView->resize( size() ); | 180 | //mNavigatorView->resize( size() ); |
180 | //if ( ! ok ) | 181 | //if ( ! ok ) |
181 | // return; | 182 | // return; |
182 | minSize = mNavigatorView->sizeHintTwoButtons(); | 183 | minSize = mNavigatorView->sizeHintTwoButtons(); |
183 | verticalCount = size().height() / minSize.height(); | 184 | verticalCount = size().height() / minSize.height(); |
184 | horizontalCount = size().width() / minSize.width(); | 185 | horizontalCount = size().width() / minSize.width(); |
185 | if ( horizontalCount == 0 ) | 186 | if ( horizontalCount == 0 ) |
186 | horizontalCount = 1; | 187 | horizontalCount = 1; |
187 | if ( verticalCount == 0 ) | 188 | if ( verticalCount == 0 ) |
188 | verticalCount = 1; | 189 | verticalCount = 1; |
189 | fontchange = true; | 190 | fontchange = true; |
190 | count = horizontalCount * verticalCount; | 191 | count = horizontalCount * verticalCount; |
191 | } else { | 192 | } else { |
192 | if ( mNavigatorView->fontChanged() ) { | 193 | if ( mNavigatorView->fontChanged() ) { |
193 | fontchange = true; | 194 | fontchange = true; |
194 | fo = KOPrefs::instance()->mDateNavigatorFont; | 195 | fo = KOPrefs::instance()->mDateNavigatorFont; |
195 | mNavigatorView->changeFont( fo ); | 196 | mNavigatorView->changeFont( fo ); |
196 | mNavigatorView->unsetFontChanged(); | 197 | mNavigatorView->unsetFontChanged(); |
197 | } | 198 | } |
198 | } | 199 | } |
199 | 200 | ||
200 | while ( count > ( mExtraViews.count() + 1 ) ) { | 201 | while ( count > ( mExtraViews.count() + 1 ) ) { |
201 | KDateNavigator *n = new KDateNavigator( this ); | 202 | KDateNavigator *n = new KDateNavigator( this ); |
202 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 203 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
203 | mExtraViews.append( n ); | 204 | mExtraViews.append( n ); |
204 | n->setCalendar( mCalendar ); | 205 | n->setCalendar( mCalendar ); |
205 | setBaseDates(); | 206 | setBaseDates(); |
206 | connectNavigatorView( n ); | 207 | connectNavigatorView( n ); |
207 | n->show(); | 208 | n->show(); |
208 | } | 209 | } |
209 | int iii = 0; | 210 | int iii = 0; |
210 | while ( iii < ( mExtraViews.count() ) ) { | 211 | while ( iii < ( mExtraViews.count() ) ) { |
211 | if ( iii < count-1 ) | 212 | if ( iii < count-1 ) |
212 | mExtraViews.at( iii )->show(); | 213 | mExtraViews.at( iii )->show(); |
213 | else | 214 | else |
214 | mExtraViews.at( iii )->hide(); | 215 | mExtraViews.at( iii )->hide(); |
215 | ++iii; | 216 | ++iii; |
216 | } | 217 | } |
217 | if ( fontchange ) { | 218 | if ( fontchange ) { |
218 | //mNavigatorView->changeFont( fo ); | 219 | //mNavigatorView->changeFont( fo ); |
219 | uint i; | 220 | uint i; |
220 | for( i = 0; i < mExtraViews.count(); ++i ) { | 221 | for( i = 0; i < mExtraViews.count(); ++i ) { |
221 | KDateNavigator *view = mExtraViews.at( i ); | 222 | KDateNavigator *view = mExtraViews.at( i ); |
222 | view->changeFont( fo ); | 223 | view->changeFont( fo ); |
223 | } | 224 | } |
224 | } | 225 | } |
225 | mHorizontalCount = horizontalCount; | 226 | mHorizontalCount = horizontalCount; |
226 | mVerticalCount = verticalCount; | 227 | mVerticalCount = verticalCount; |
227 | } | 228 | } |
228 | int height = size().height() / verticalCount; | 229 | int height = size().height() / verticalCount; |
229 | int width = size().width() / horizontalCount; | 230 | int width = size().width() / horizontalCount; |
230 | 231 | ||
231 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 232 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
232 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); | 233 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); |
233 | else bar->showButtons( true, true ); | 234 | else bar->showButtons( true, true ); |
234 | 235 | ||
235 | mNavigatorView->setGeometry(0, | 236 | mNavigatorView->setGeometry(0, |
236 | 0, width, height ); | 237 | 0, width, height ); |
237 | for( uint i = 0; i < mExtraViews.count(); ++i ) { | 238 | for( uint i = 0; i < mExtraViews.count(); ++i ) { |
238 | int x = ( i + 1 ) % horizontalCount; | 239 | int x = ( i + 1 ) % horizontalCount; |
239 | int y = ( i + 1 ) / horizontalCount; | 240 | int y = ( i + 1 ) / horizontalCount; |
240 | 241 | ||
241 | KDateNavigator *view = mExtraViews.at( i ); | 242 | KDateNavigator *view = mExtraViews.at( i ); |
242 | bar = view->navigatorBar(); | 243 | bar = view->navigatorBar(); |
243 | if ( y > 0 ) bar->showButtons( false, false ); | 244 | if ( y > 0 ) bar->showButtons( false, false ); |
244 | else { | 245 | else { |
245 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); | 246 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); |
246 | else bar->showButtons( false, false ); | 247 | else bar->showButtons( false, false ); |
247 | } | 248 | } |
248 | view->setGeometry( x * width, | 249 | view->setGeometry( x * width, |
249 | y * height, width, height ); | 250 | y * height, width, height ); |
250 | } | 251 | } |
251 | } | 252 | } |
252 | 253 | ||
253 | QSize DateNavigatorContainer::minimumSizeHint() const | 254 | QSize DateNavigatorContainer::minimumSizeHint() const |
254 | { | 255 | { |
255 | return mNavigatorView->minimumSizeHint(); | 256 | return mNavigatorView->minimumSizeHint(); |
256 | } | 257 | } |
257 | 258 | ||
258 | QSize DateNavigatorContainer::sizeHint() const | 259 | QSize DateNavigatorContainer::sizeHint() const |
259 | { | 260 | { |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index a5dbc5d..4b50b5a 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -22,193 +22,193 @@ | |||
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 | 86 | ||
87 | topLayout->addWidget(headings[i],1,i+1); | 87 | topLayout->addWidget(headings[i],1,i+1); |
88 | } | 88 | } |
89 | 89 | ||
90 | // Create the weeknumber labels | 90 | // Create the weeknumber labels |
91 | for( i = 0; i < 6; i++ ) { | 91 | for( i = 0; i < 6; i++ ) { |
92 | weeknos[i] = new QLabel(this); | 92 | weeknos[i] = new QLabel(this); |
93 | weeknos[i]->setAlignment(AlignCenter); | 93 | weeknos[i]->setAlignment(AlignCenter); |
94 | //weeknos[i]->setFont(QFont("Arial", 10)); | 94 | //weeknos[i]->setFont(QFont("Arial", 10)); |
95 | if(!m_bShowWeekNums) { | 95 | if(!m_bShowWeekNums) { |
96 | weeknos[i]->hide(); | 96 | weeknos[i]->hide(); |
97 | } | 97 | } |
98 | weeknos[i]->installEventFilter(this); | 98 | weeknos[i]->installEventFilter(this); |
99 | 99 | ||
100 | topLayout->addWidget(weeknos[i],i+2,0); | 100 | topLayout->addWidget(weeknos[i],i+2,0); |
101 | } | 101 | } |
102 | 102 | ||
103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
105 | daymatrix->setLineWidth(1); | 105 | daymatrix->setLineWidth(1); |
106 | 106 | ||
107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
109 | 109 | ||
110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
111 | SIGNAL( eventDropped( Event * ) ) ); | 111 | SIGNAL( eventDropped( Event * ) ) ); |
112 | 112 | ||
113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
114 | 114 | ||
115 | // read settings from configuration file. | 115 | // read settings from configuration file. |
116 | updateConfig(); | 116 | updateConfig(); |
117 | enableRollover(FollowMonth); | 117 | enableRollover(FollowMonth); |
118 | mySizeHint = sizeHint(); | 118 | mySizeHint = sizeHintTwoButtons(); |
119 | mFontChanged = false; | 119 | mFontChanged = false; |
120 | } | 120 | } |
121 | void KDateNavigator::changeFont ( QFont fo ) | 121 | void KDateNavigator::changeFont ( QFont fo ) |
122 | { | 122 | { |
123 | setFont( fo ); | 123 | setFont( fo ); |
124 | mNavigatorBar->resetFont( fo ); | 124 | mNavigatorBar->resetFont( fo ); |
125 | } | 125 | } |
126 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 126 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
127 | { | 127 | { |
128 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 128 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
129 | *b = false; | 129 | *b = false; |
130 | int fontPoint = fo.pointSize(); | 130 | int fontPoint = fo.pointSize(); |
131 | while ( fontPoint > 5 ) { | 131 | while ( fontPoint > 5 ) { |
132 | --fontPoint; | 132 | --fontPoint; |
133 | fo.setPointSize( fontPoint ); | 133 | fo.setPointSize( fontPoint ); |
134 | setFont( fo ); | 134 | setFont( fo ); |
135 | mFontChanged = true; | 135 | mFontChanged = true; |
136 | mNavigatorBar->resetFont( fo ); | 136 | mNavigatorBar->resetFont( fo ); |
137 | QSize sh = sizeHintTwoButtons(); | 137 | QSize sh = sizeHintTwoButtons(); |
138 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 138 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); |
139 | if ( si.width() > sh.width() && si.height() > sh.height()) { | 139 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
140 | *b = true; | 140 | *b = true; |
141 | //qDebug("fooooooooooooooooooooooouuuuund "); | 141 | //qDebug("fooooooooooooooooooooooouuuuund "); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); | 145 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); |
146 | return fo; | 146 | return fo; |
147 | } | 147 | } |
148 | QSize KDateNavigator::sizeHint() const | 148 | QSize KDateNavigator::sizeHint() const |
149 | { | 149 | { |
150 | QFontMetrics fm ( font() ); | 150 | QFontMetrics fm ( font() ); |
151 | QSize day = daymatrix->sizeHint(); | 151 | QSize day = daymatrix->sizeHint(); |
152 | QSize nav = mNavigatorBar->sizeHint(); | 152 | QSize nav = mNavigatorBar->sizeHint(); |
153 | int wid = fm.width( "30") + day.width()+3; | 153 | int wid = fm.width( "30") + day.width()+3; |
154 | int hei = fm.height() +day.height()+nav.height()+2; | 154 | int hei = fm.height() +day.height()+nav.height()+2; |
155 | if ( wid < nav.width() ) | 155 | if ( wid < nav.width() ) |
156 | wid = nav.width() ; | 156 | wid = nav.width() ; |
157 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 157 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
158 | return QSize ( wid, hei ); | 158 | return QSize ( wid, hei ); |
159 | } | 159 | } |
160 | QSize KDateNavigator::sizeHintTwoButtons() const | 160 | QSize KDateNavigator::sizeHintTwoButtons() const |
161 | { | 161 | { |
162 | QFontMetrics fm ( font() ); | 162 | QFontMetrics fm ( font() ); |
163 | QSize day = daymatrix->sizeHint(); | 163 | QSize day = daymatrix->sizeHint(); |
164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); | 164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); |
165 | int wid = fm.width( "30") + day.width()+3; | 165 | int wid = fm.width( "30") + day.width()+3; |
166 | int hei = fm.height() +day.height()+nav.height()+2; | 166 | int hei = fm.height() +day.height()+nav.height()+2; |
167 | if ( wid < nav.width() ) | 167 | if ( wid < nav.width() ) |
168 | wid = nav.width() ; | 168 | wid = nav.width() ; |
169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
170 | return QSize ( wid, hei ); | 170 | return QSize ( wid, hei ); |
171 | } | 171 | } |
172 | void KDateNavigator::slotMonthSelected( int m ) | 172 | void KDateNavigator::slotMonthSelected( int m ) |
173 | { | 173 | { |
174 | if ( m_MthYr.month() <= mMonthSignalOffset) | 174 | if ( m_MthYr.month() <= mMonthSignalOffset) |
175 | m += 12; | 175 | m += 12; |
176 | int mo = m - mMonthSignalOffset; | 176 | int mo = m - mMonthSignalOffset; |
177 | emit monthSelected( m - mMonthSignalOffset ); | 177 | emit monthSelected( m - mMonthSignalOffset ); |
178 | 178 | ||
179 | } | 179 | } |
180 | void KDateNavigator::setCalendar( Calendar *cal ) | 180 | void KDateNavigator::setCalendar( Calendar *cal ) |
181 | { | 181 | { |
182 | daymatrix->setCalendar( cal ); | 182 | daymatrix->setCalendar( cal ); |
183 | } | 183 | } |
184 | 184 | ||
185 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true | 185 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true |
186 | { | 186 | { |
187 | m_MthYr = date; | 187 | m_MthYr = date; |
188 | 188 | ||
189 | updateDates(); | 189 | updateDates(); |
190 | updateView(); | 190 | updateView(); |
191 | 191 | ||
192 | KCal::DateList dates; | 192 | KCal::DateList dates; |
193 | dates.append( date ); | 193 | dates.append( date ); |
194 | mNavigatorBar->selectDates( dates ); | 194 | mNavigatorBar->selectDates( dates ); |
195 | 195 | ||
196 | daymatrix->clearSelection(); | 196 | daymatrix->clearSelection(); |
197 | if ( doRepaint ) | 197 | if ( doRepaint ) |
198 | daymatrix->repaint(); | 198 | daymatrix->repaint(); |
199 | } | 199 | } |
200 | 200 | ||
201 | void KDateNavigator::enableRollover(RolloverType r) | 201 | void KDateNavigator::enableRollover(RolloverType r) |
202 | { | 202 | { |
203 | switch(r) | 203 | switch(r) |
204 | { | 204 | { |
205 | case None : | 205 | case None : |
206 | if (updateTimer) | 206 | if (updateTimer) |
207 | { | 207 | { |
208 | updateTimer->stop(); | 208 | updateTimer->stop(); |
209 | delete updateTimer; | 209 | delete updateTimer; |
210 | updateTimer=0L; | 210 | updateTimer=0L; |
211 | } | 211 | } |
212 | break; | 212 | break; |
213 | case FollowDay : | 213 | case FollowDay : |
214 | case FollowMonth : | 214 | case FollowMonth : |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 582b2ef..9baff20 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -352,203 +352,203 @@ void KODayMatrix::updateViewTimed() | |||
352 | holiStr += event->summary(); | 352 | holiStr += event->summary(); |
353 | if ( !event->location().isEmpty() ) | 353 | if ( !event->location().isEmpty() ) |
354 | holiStr += " (" + event->location() + ")"; | 354 | holiStr += " (" + event->location() + ")"; |
355 | } | 355 | } |
356 | if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) { | 356 | if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) { |
357 | if ( !holiStr.isEmpty() ) | 357 | if ( !holiStr.isEmpty() ) |
358 | holiStr += "\n"; | 358 | holiStr += "\n"; |
359 | holiStr += i18n("Birthday") + ": "+event->summary(); | 359 | holiStr += i18n("Birthday") + ": "+event->summary(); |
360 | if ( !event->location().isEmpty() ) | 360 | if ( !event->location().isEmpty() ) |
361 | holiStr += " (" + event->location() + ")"; | 361 | holiStr += " (" + event->location() + ")"; |
362 | bDays.setBit(i); | 362 | bDays.setBit(i); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | events[i] = numEvents; | 365 | events[i] = numEvents; |
366 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 366 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
367 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 367 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
368 | !holiStr.isEmpty()) { | 368 | !holiStr.isEmpty()) { |
369 | mHolidays[i] = holiStr; | 369 | mHolidays[i] = holiStr; |
370 | } else { | 370 | } else { |
371 | mHolidays[i] = QString::null; | 371 | mHolidays[i] = QString::null; |
372 | } | 372 | } |
373 | } | 373 | } |
374 | if ( ! mPendingUpdateBeforeRepaint ) | 374 | if ( ! mPendingUpdateBeforeRepaint ) |
375 | repaint(false); | 375 | repaint(false); |
376 | } | 376 | } |
377 | void KODayMatrix::updateView(QDate actdate) | 377 | void KODayMatrix::updateView(QDate actdate) |
378 | { | 378 | { |
379 | 379 | ||
380 | if ( ! actdate.isValid() ) { | 380 | if ( ! actdate.isValid() ) { |
381 | //qDebug("date not valid "); | 381 | //qDebug("date not valid "); |
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | mDayChanged = false; | 384 | mDayChanged = false; |
385 | //flag to indicate if the starting day of the matrix has changed by this call | 385 | //flag to indicate if the starting day of the matrix has changed by this call |
386 | //mDayChanged = false; | 386 | //mDayChanged = false; |
387 | // if a new startdate is to be set then apply Cornelius's calculation | 387 | // if a new startdate is to be set then apply Cornelius's calculation |
388 | // of the first day to be shown | 388 | // of the first day to be shown |
389 | if (actdate != startdate) { | 389 | if (actdate != startdate) { |
390 | // reset index of selection according to shift of starting date from startdate to actdate | 390 | // reset index of selection according to shift of starting date from startdate to actdate |
391 | if (mSelStart != NOSELECTION) { | 391 | if (mSelStart != NOSELECTION) { |
392 | int tmp = actdate.daysTo(startdate); | 392 | int tmp = actdate.daysTo(startdate); |
393 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 393 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
394 | // shift selection if new one would be visible at least partly ! | 394 | // shift selection if new one would be visible at least partly ! |
395 | 395 | ||
396 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 396 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
397 | // nested if is required for next X display pushed from a different month - correction required | 397 | // nested if is required for next X display pushed from a different month - correction required |
398 | // otherwise, for month forward and backward, it must be avoided | 398 | // otherwise, for month forward and backward, it must be avoided |
399 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 399 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
400 | mSelStart = mSelStart + tmp; | 400 | mSelStart = mSelStart + tmp; |
401 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 401 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
402 | mSelEnd = mSelEnd + tmp; | 402 | mSelEnd = mSelEnd + tmp; |
403 | } | 403 | } |
404 | } | 404 | } |
405 | startdate = actdate; | 405 | startdate = actdate; |
406 | mDayChanged = true; | 406 | mDayChanged = true; |
407 | recalculateToday(); | 407 | recalculateToday(); |
408 | } | 408 | } |
409 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 409 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
410 | if ( !isVisible() ) { | 410 | if ( !isVisible() ) { |
411 | mPendingUpdateBeforeRepaint = true; | 411 | mPendingUpdateBeforeRepaint = true; |
412 | } else { | 412 | } else { |
413 | #ifdef DESKTOP_VERSION | 413 | #ifdef DESKTOP_VERSION |
414 | //mRepaintTimer->start( 150 ); | 414 | //mRepaintTimer->start( 150 ); |
415 | mUpdateTimer->start( 150 ); | 415 | mUpdateTimer->start( 150 ); |
416 | #else | 416 | #else |
417 | mRepaintTimer->start( 350 ); | 417 | mRepaintTimer->start( 350 ); |
418 | mUpdateTimer->start( 1200 ); | 418 | mUpdateTimer->start( 1200 ); |
419 | #endif | 419 | #endif |
420 | } | 420 | } |
421 | } | 421 | } |
422 | void KODayMatrix::updateEvents() | 422 | void KODayMatrix::updateEvents() |
423 | { | 423 | { |
424 | if ( !mCalendar ) return; | 424 | if ( !mCalendar ) return; |
425 | 425 | ||
426 | for( int i = 0; i < NUMDAYS; i++ ) { | 426 | for( int i = 0; i < NUMDAYS; i++ ) { |
427 | // if events are set for the day then remember to draw it bold | 427 | // if events are set for the day then remember to draw it bold |
428 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 428 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
429 | int numEvents = eventlist.count(); | 429 | int numEvents = eventlist.count(); |
430 | Event *event; | 430 | Event *event; |
431 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 431 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
432 | ushort recurType = event->doesRecur(); | 432 | ushort recurType = event->doesRecur(); |
433 | 433 | ||
434 | if ( ( recurType == Recurrence::rDaily && | 434 | if ( ( recurType == Recurrence::rDaily && |
435 | !KOPrefs::instance()->mDailyRecur ) || | 435 | !KOPrefs::instance()->mDailyRecur ) || |
436 | ( recurType == Recurrence::rWeekly && | 436 | ( recurType == Recurrence::rWeekly && |
437 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 437 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
438 | numEvents--; | 438 | numEvents--; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | events[ i ] = numEvents; | 441 | events[ i ] = numEvents; |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | const QDate& KODayMatrix::getDate(int offset) | 445 | const QDate& KODayMatrix::getDate(int offset) |
446 | { | 446 | { |
447 | if (offset < 0 || offset > NUMDAYS-1) { | 447 | if (offset < 0 || offset > NUMDAYS-1) { |
448 | qDebug("Wrong offset2 "); | 448 | qDebug("Wrong offset2 %d", offset); |
449 | return days[0]; | 449 | return days[0]; |
450 | } | 450 | } |
451 | return days[offset]; | 451 | return days[offset]; |
452 | } | 452 | } |
453 | 453 | ||
454 | QString KODayMatrix::getHolidayLabel(int offset) | 454 | QString KODayMatrix::getHolidayLabel(int offset) |
455 | { | 455 | { |
456 | if (offset < 0 || offset > NUMDAYS-1) { | 456 | if (offset < 0 || offset > NUMDAYS-1) { |
457 | qDebug("Wrong offset1 "); | 457 | qDebug("Wrong offset1 %d", offset); |
458 | return 0; | 458 | return QString(); |
459 | } | 459 | } |
460 | return mHolidays[offset]; | 460 | return mHolidays[offset]; |
461 | } | 461 | } |
462 | 462 | ||
463 | int KODayMatrix::getDayIndexFrom(int x, int y) | 463 | int KODayMatrix::getDayIndexFrom(int x, int y) |
464 | { | 464 | { |
465 | int colModulo = (width()-2) % 7; | 465 | int colModulo = (width()-2) % 7; |
466 | int rowModulo = (height()-2) % 6; | 466 | int rowModulo = (height()-2) % 6; |
467 | #if 0 | 467 | #if 0 |
468 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 468 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
469 | 6 - x/daysize.width() : x/daysize.width()); | 469 | 6 - x/daysize.width() : x/daysize.width()); |
470 | #endif | 470 | #endif |
471 | int xVal = (x-colModulo/2-2)/daysize.width(); | 471 | int xVal = (x-colModulo/2-2)/daysize.width(); |
472 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 472 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
473 | 473 | ||
474 | 474 | ||
475 | return 7*(yVal) + xVal; | 475 | return 7*(yVal) + xVal; |
476 | 476 | ||
477 | } | 477 | } |
478 | 478 | ||
479 | // ---------------------------------------------------------------------------- | 479 | // ---------------------------------------------------------------------------- |
480 | // M O U S E E V E N T H A N D L I N G | 480 | // M O U S E E V E N T H A N D L I N G |
481 | // ---------------------------------------------------------------------------- | 481 | // ---------------------------------------------------------------------------- |
482 | 482 | ||
483 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 483 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
484 | { | 484 | { |
485 | 485 | ||
486 | if ( e->button() == LeftButton ) | 486 | if ( e->button() == LeftButton ) |
487 | mouseDown = true; | 487 | mouseDown = true; |
488 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 488 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
489 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 489 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
490 | mSelInit = mSelStart; | 490 | mSelInit = mSelStart; |
491 | mSelEnd = mSelStart; | 491 | mSelEnd = mSelStart; |
492 | repaint(false); | 492 | repaint(false); |
493 | } | 493 | } |
494 | 494 | ||
495 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 495 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
496 | { | 496 | { |
497 | if ( e->button() == LeftButton ) | 497 | if ( e->button() == LeftButton ) |
498 | if ( ! mouseDown ) { | 498 | if ( ! mouseDown ) { |
499 | return; | 499 | return; |
500 | } | 500 | } |
501 | else | 501 | else |
502 | mouseDown = false; | 502 | mouseDown = false; |
503 | int tmp = getDayIndexFrom(e->x(), e->y()); | 503 | int tmp = getDayIndexFrom(e->x(), e->y()); |
504 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 504 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
505 | 505 | ||
506 | if (mSelInit > tmp) { | 506 | if (mSelInit > tmp) { |
507 | mSelEnd = mSelInit; | 507 | mSelEnd = mSelInit; |
508 | if (tmp != mSelStart) { | 508 | if (tmp != mSelStart) { |
509 | mSelStart = tmp; | 509 | mSelStart = tmp; |
510 | repaint(false); | 510 | repaint(false); |
511 | } | 511 | } |
512 | } else { | 512 | } else { |
513 | mSelStart = mSelInit; | 513 | mSelStart = mSelInit; |
514 | 514 | ||
515 | //repaint only if selection has changed | 515 | //repaint only if selection has changed |
516 | if (tmp != mSelEnd) { | 516 | if (tmp != mSelEnd) { |
517 | mSelEnd = tmp; | 517 | mSelEnd = tmp; |
518 | repaint(false); | 518 | repaint(false); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | DateList daylist; | 522 | DateList daylist; |
523 | if ( mSelStart < 0 ) | 523 | if ( mSelStart < 0 ) |
524 | mSelStart = 0; | 524 | mSelStart = 0; |
525 | for (int i = mSelStart; i <= mSelEnd; i++) { | 525 | for (int i = mSelStart; i <= mSelEnd; i++) { |
526 | daylist.append(days[i]); | 526 | daylist.append(days[i]); |
527 | } | 527 | } |
528 | emit selected((const DateList)daylist); | 528 | emit selected((const DateList)daylist); |
529 | 529 | ||
530 | } | 530 | } |
531 | 531 | ||
532 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 532 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
533 | { | 533 | { |
534 | if ( ! mouseDown ) { | 534 | if ( ! mouseDown ) { |
535 | return; | 535 | return; |
536 | } | 536 | } |
537 | int tmp = getDayIndexFrom(e->x(), e->y()); | 537 | int tmp = getDayIndexFrom(e->x(), e->y()); |
538 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 538 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
539 | 539 | ||
540 | if (mSelInit > tmp) { | 540 | if (mSelInit > tmp) { |
541 | mSelEnd = mSelInit; | 541 | mSelEnd = mSelInit; |
542 | if (tmp != mSelStart) { | 542 | if (tmp != mSelStart) { |
543 | mSelStart = tmp; | 543 | mSelStart = tmp; |
544 | repaint(false); | 544 | repaint(false); |
545 | } | 545 | } |
546 | } else { | 546 | } else { |
547 | mSelStart = mSelInit; | 547 | mSelStart = mSelInit; |
548 | 548 | ||
549 | //repaint only if selection has changed | 549 | //repaint only if selection has changed |
550 | if (tmp != mSelEnd) { | 550 | if (tmp != mSelEnd) { |
551 | mSelEnd = tmp; | 551 | mSelEnd = tmp; |
552 | repaint(false); | 552 | repaint(false); |
553 | } | 553 | } |
554 | } | 554 | } |