author | zautrix <zautrix> | 2005-03-22 09:31:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-22 09:31:41 (UTC) |
commit | d18536f758f4cf64d5c59d7a7c814e6ff12f9a3d (patch) (unidiff) | |
tree | 326186e1a65db5a9ba174fa2bdbd3dffc7f23b9f | |
parent | 8888389a4511e0bda23774b993dcfdeb7f837c31 (diff) | |
download | kdepimpi-d18536f758f4cf64d5c59d7a7c814e6ff12f9a3d.zip kdepimpi-d18536f758f4cf64d5c59d7a7c814e6ff12f9a3d.tar.gz kdepimpi-d18536f758f4cf64d5c59d7a7c814e6ff12f9a3d.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 13 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 11 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 6 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 7 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 4 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 2 |
8 files changed, 32 insertions, 14 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 90b36ac..8100e25 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -125,384 +125,385 @@ | |||
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | class KOBeamPrefs : public QDialog | 142 | class KOBeamPrefs : public QDialog |
143 | { | 143 | { |
144 | public: | 144 | public: |
145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
146 | QDialog( parent, name, true ) | 146 | QDialog( parent, name, true ) |
147 | { | 147 | { |
148 | setCaption( i18n("Beam Options") ); | 148 | setCaption( i18n("Beam Options") ); |
149 | QVBoxLayout* lay = new QVBoxLayout( this ); | 149 | QVBoxLayout* lay = new QVBoxLayout( this ); |
150 | lay->setSpacing( 3 ); | 150 | lay->setSpacing( 3 ); |
151 | lay->setMargin( 3 ); | 151 | lay->setMargin( 3 ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
153 | lay->addWidget( format ); | 153 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 154 | format->setExclusive ( true ) ; |
155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
156 | lay->addWidget( time ); time->setExclusive ( true ) ; | 156 | lay->addWidget( time ); time->setExclusive ( true ) ; |
157 | vcal = new QRadioButton(" vCalendar ", format ); | 157 | vcal = new QRadioButton(" vCalendar ", format ); |
158 | ical = new QRadioButton(" iCalendar ", format ); | 158 | ical = new QRadioButton(" iCalendar ", format ); |
159 | vcal->setChecked( true ); | 159 | vcal->setChecked( true ); |
160 | tz = new QRadioButton(i18n(" With timezone "), time ); | 160 | tz = new QRadioButton(i18n(" With timezone "), time ); |
161 | local = new QRadioButton(i18n(" Local time "), time ); | 161 | local = new QRadioButton(i18n(" Local time "), time ); |
162 | tz->setChecked( true ); | 162 | tz->setChecked( true ); |
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 164 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 166 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 169 | resize( 200, 200 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 172 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 173 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 174 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 176 | }; |
177 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
178 | { | 178 | { |
179 | public: | 179 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
182 | { | 182 | { |
183 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
202 | } | 202 | } |
203 | 203 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 205 | private: |
206 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 211 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 212 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 213 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 214 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 215 | mResourceManager( calendar->resourceManager() ) |
216 | { | 216 | { |
217 | 217 | ||
218 | mEventEditor = 0; | 218 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 219 | mTodoEditor = 0; |
220 | 220 | ||
221 | init(); | 221 | init(); |
222 | } | 222 | } |
223 | 223 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 224 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 225 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 226 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 227 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 228 | mResourceManager( 0 ) |
229 | { | 229 | { |
230 | 230 | ||
231 | mEventEditor = 0; | 231 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 232 | mTodoEditor = 0; |
233 | init(); | 233 | init(); |
234 | } | 234 | } |
235 | 235 | ||
236 | void CalendarView::init() | 236 | void CalendarView::init() |
237 | { | 237 | { |
238 | 238 | ||
239 | setFocusPolicy ( WheelFocus ); | 239 | setFocusPolicy ( WheelFocus ); |
240 | mViewerCallerIsSearchDialog = false; | 240 | mViewerCallerIsSearchDialog = false; |
241 | mBlockShowDates = false; | 241 | mBlockShowDates = false; |
242 | beamDialog = new KOBeamPrefs(); | 242 | beamDialog = new KOBeamPrefs(); |
243 | mDatePickerMode = 0; | 243 | mDatePickerMode = 0; |
244 | mCurrentSyncDevice = ""; | 244 | mCurrentSyncDevice = ""; |
245 | writeLocale(); | 245 | writeLocale(); |
246 | mViewManager = new KOViewManager( this ); | 246 | mViewManager = new KOViewManager( this ); |
247 | mDialogManager = new KODialogManager( this ); | 247 | mDialogManager = new KODialogManager( this ); |
248 | mEventViewerDialog = 0; | 248 | mEventViewerDialog = 0; |
249 | mModified = false; | 249 | mModified = false; |
250 | mReadOnly = false; | 250 | mReadOnly = false; |
251 | mSelectedIncidence = 0; | 251 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 252 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 253 | mFilters.setAutoDelete(true); |
254 | 254 | ||
255 | mCalendar->registerObserver( this ); | 255 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 256 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 257 | ||
258 | mStorage = new FileStorage( mCalendar ); | 258 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 260 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 262 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 263 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 265 | topLayout->addWidget(mPanner); |
266 | 266 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 268 | "CalendarView::LeftFrame"); |
269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
270 | 270 | ||
271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
272 | "CalendarView::DateNavigator" ); | 272 | "CalendarView::DateNavigator" ); |
273 | 273 | ||
274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
276 | mTodoList->setNavigator( mNavigator ); | 276 | mTodoList->setNavigator( mNavigator ); |
277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
278 | 278 | ||
279 | #ifdef KORG_NORESOURCEVIEW | 279 | #ifdef KORG_NORESOURCEVIEW |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | #else | 281 | #else |
282 | if ( mResourceManager ) { | 282 | if ( mResourceManager ) { |
283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
284 | mResourceView->updateView(); | 284 | mResourceView->updateView(); |
285 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 285 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
286 | SLOT( updateView() ) ); | 286 | SLOT( updateView() ) ); |
287 | } else { | 287 | } else { |
288 | mResourceView = 0; | 288 | mResourceView = 0; |
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | QWidget *rightBox = new QWidget( mPanner ); | 291 | QWidget *rightBox = new QWidget( mPanner ); |
292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
293 | 293 | ||
294 | mRightFrame = new QWidgetStack( rightBox ); | 294 | mRightFrame = new QWidgetStack( rightBox ); |
295 | rightLayout->addWidget( mRightFrame, 1 ); | 295 | rightLayout->addWidget( mRightFrame, 1 ); |
296 | 296 | ||
297 | mLeftFrame = mLeftSplitter; | 297 | mLeftFrame = mLeftSplitter; |
298 | #else | 298 | #else |
299 | //QWidget *mainBox = new QWidget( this ); | 299 | //QWidget *mainBox = new QWidget( this ); |
300 | //QWidget *leftFrame = new QWidget( mainBox ); | 300 | //QWidget *leftFrame = new QWidget( mainBox ); |
301 | //QBoxLayout * mainBoxLayout; | 301 | //QBoxLayout * mainBoxLayout; |
302 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
303 | //mainBoxLayout = new QVBoxLayout(mainBox); | 303 | //mainBoxLayout = new QVBoxLayout(mainBox); |
304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
309 | } else { | 309 | } else { |
310 | //mainBoxLayout = new QHBoxLayout(mainBox); | 310 | //mainBoxLayout = new QHBoxLayout(mainBox); |
311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
316 | } | 316 | } |
317 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | ||
317 | //QBoxLayout * leftFrameLayout; | 318 | //QBoxLayout * leftFrameLayout; |
318 | topLayout->addWidget( mMainFrame ); | 319 | topLayout->addWidget( mMainFrame ); |
319 | //mainBoxLayout->addWidget (mLeftFrame); | 320 | //mainBoxLayout->addWidget (mLeftFrame); |
320 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 321 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
321 | "CalendarView::DateNavigator" ); | 322 | "CalendarView::DateNavigator" ); |
322 | #if 0 | 323 | #if 0 |
323 | // FIXME | 324 | // FIXME |
324 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 325 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
325 | "CalendarView::DateNavigator", QDate::currentDate()); | 326 | "CalendarView::DateNavigator", QDate::currentDate()); |
326 | #endif | 327 | #endif |
327 | // mDateNavigator->blockSignals( true ); | 328 | // mDateNavigator->blockSignals( true ); |
328 | //leftFrameLayout->addWidget( mDateNavigator ); | 329 | //leftFrameLayout->addWidget( mDateNavigator ); |
329 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 330 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
330 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 331 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
331 | mTodoList->setNavigator( mNavigator ); | 332 | mTodoList->setNavigator( mNavigator ); |
332 | #if 0 | 333 | #if 0 |
333 | if ( QApplication::desktop()->width() < 480 ) { | 334 | if ( QApplication::desktop()->width() < 480 ) { |
334 | leftFrameLayout->addWidget(mFilterView); | 335 | leftFrameLayout->addWidget(mFilterView); |
335 | leftFrameLayout->addWidget(mTodoList, 2 ); | 336 | leftFrameLayout->addWidget(mTodoList, 2 ); |
336 | 337 | ||
337 | } else { | 338 | } else { |
338 | leftFrameLayout->addWidget(mTodoList,2 ); | 339 | leftFrameLayout->addWidget(mTodoList,2 ); |
339 | leftFrameLayout->addWidget(mFilterView ); | 340 | leftFrameLayout->addWidget(mFilterView ); |
340 | } | 341 | } |
341 | #endif | 342 | #endif |
342 | mFilterView->hide(); | 343 | mFilterView->hide(); |
343 | QWidget *rightBox = new QWidget( mMainFrame ); | 344 | QWidget *rightBox = new QWidget( mMainFrame ); |
344 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 345 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
345 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 346 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
346 | mRightFrame = new QWidgetStack( rightBox ); | 347 | mRightFrame = new QWidgetStack( rightBox ); |
347 | rightLayout->addWidget( mRightFrame, 10 ); | 348 | rightLayout->addWidget( mRightFrame, 10 ); |
348 | 349 | ||
349 | //mLeftFrame = (QWidget *)leftFrame; | 350 | //mLeftFrame = (QWidget *)leftFrame; |
350 | if ( KOPrefs::instance()->mVerticalScreen ) { | 351 | if ( KOPrefs::instance()->mVerticalScreen ) { |
351 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 352 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
352 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 353 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
353 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 354 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
354 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 355 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
355 | } else { | 356 | } else { |
356 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 357 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
357 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 358 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
358 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 359 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
359 | } | 360 | } |
360 | if ( !KOPrefs::instance()->mShowDateNavigator) | 361 | if ( !KOPrefs::instance()->mShowDateNavigator) |
361 | mDateNavigator->hide(); | 362 | mDateNavigator->hide(); |
362 | //qDebug("Calendarview Size %d %d ", width(), height()); | 363 | //qDebug("Calendarview Size %d %d ", width(), height()); |
363 | #endif | 364 | #endif |
364 | 365 | ||
365 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 366 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
366 | SLOT( showDates( const KCal::DateList & ) ) ); | 367 | SLOT( showDates( const KCal::DateList & ) ) ); |
367 | 368 | ||
368 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 369 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
369 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 370 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
370 | 371 | ||
371 | 372 | ||
372 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 373 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
373 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 374 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
374 | 375 | ||
375 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 376 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
376 | mNavigator, SLOT( selectPreviousYear() ) ); | 377 | mNavigator, SLOT( selectPreviousYear() ) ); |
377 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 378 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
378 | mNavigator, SLOT( selectNextYear() ) ); | 379 | mNavigator, SLOT( selectNextYear() ) ); |
379 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 380 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
380 | mNavigator, SLOT( selectPreviousMonth() ) ); | 381 | mNavigator, SLOT( selectPreviousMonth() ) ); |
381 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 382 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
382 | mNavigator, SLOT( selectNextMonth() ) ); | 383 | mNavigator, SLOT( selectNextMonth() ) ); |
383 | 384 | ||
384 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 385 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
385 | mNavigator, SLOT( selectPrevious() ) ); | 386 | mNavigator, SLOT( selectPrevious() ) ); |
386 | connect( mDateNavigator, SIGNAL( goNext() ), | 387 | connect( mDateNavigator, SIGNAL( goNext() ), |
387 | mNavigator, SLOT( selectNext() ) ); | 388 | mNavigator, SLOT( selectNext() ) ); |
388 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 389 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
389 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 390 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
390 | 391 | ||
391 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 392 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
392 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 393 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
393 | #if 0 | 394 | #if 0 |
394 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 395 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
395 | SLOT( incidenceAdded( Incidence *) ) ); | 396 | SLOT( incidenceAdded( Incidence *) ) ); |
396 | #endif | 397 | #endif |
397 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 398 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
398 | 399 | ||
399 | connect( this, SIGNAL( configChanged() ), | 400 | connect( this, SIGNAL( configChanged() ), |
400 | mDateNavigator, SLOT( updateConfig() ) ); | 401 | mDateNavigator, SLOT( updateConfig() ) ); |
401 | 402 | ||
402 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 403 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
403 | SLOT( newTodo() ) ); | 404 | SLOT( newTodo() ) ); |
404 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 405 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
405 | SLOT( newSubTodo( Todo * ) ) ); | 406 | SLOT( newSubTodo( Todo * ) ) ); |
406 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 407 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
407 | SLOT( editTodo( Todo * ) ) ); | 408 | SLOT( editTodo( Todo * ) ) ); |
408 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 409 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
409 | SLOT( showTodo( Todo *) ) ); | 410 | SLOT( showTodo( Todo *) ) ); |
410 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 411 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
411 | SLOT( deleteTodo( Todo *) ) ); | 412 | SLOT( deleteTodo( Todo *) ) ); |
412 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 413 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
413 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 414 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
414 | SLOT( purgeCompleted() ) ); | 415 | SLOT( purgeCompleted() ) ); |
415 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 416 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
416 | SIGNAL( todoModified( Todo *, int ) ) ); | 417 | SIGNAL( todoModified( Todo *, int ) ) ); |
417 | 418 | ||
418 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 419 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
419 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 420 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
420 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 421 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
421 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 422 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
422 | 423 | ||
423 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 424 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
424 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 425 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
425 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 426 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
426 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 427 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
427 | 428 | ||
428 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 429 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
429 | this, SLOT ( todo_unsub( Todo * ) ) ); | 430 | this, SLOT ( todo_unsub( Todo * ) ) ); |
430 | 431 | ||
431 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 432 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
432 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 433 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
433 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 434 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
434 | SLOT( updateTodo( Todo *, int ) ) ); | 435 | SLOT( updateTodo( Todo *, int ) ) ); |
435 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 436 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
436 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 437 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
437 | 438 | ||
438 | 439 | ||
439 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 440 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
440 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 441 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
441 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 442 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
442 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 443 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
443 | 444 | ||
444 | 445 | ||
445 | 446 | ||
446 | 447 | ||
447 | 448 | ||
448 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 449 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
449 | SLOT(checkClipboard())); | 450 | SLOT(checkClipboard())); |
450 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 451 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
451 | SLOT( processTodoListSelection( Incidence * ) ) ); | 452 | SLOT( processTodoListSelection( Incidence * ) ) ); |
452 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 453 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
453 | 454 | ||
454 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 455 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
455 | 456 | ||
456 | mDateFrame = new QVBox(0,0,WType_Popup); | 457 | mDateFrame = new QVBox(0,0,WType_Popup); |
457 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 458 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
458 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 459 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
459 | mDateFrame->setLineWidth(3); | 460 | mDateFrame->setLineWidth(3); |
460 | mDateFrame->hide(); | 461 | mDateFrame->hide(); |
461 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 462 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
462 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 463 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
463 | 464 | ||
464 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 465 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
465 | 466 | ||
466 | mEventEditor = mDialogManager->getEventEditor(); | 467 | mEventEditor = mDialogManager->getEventEditor(); |
467 | mTodoEditor = mDialogManager->getTodoEditor(); | 468 | mTodoEditor = mDialogManager->getTodoEditor(); |
468 | 469 | ||
469 | mFlagEditDescription = false; | 470 | mFlagEditDescription = false; |
470 | 471 | ||
471 | mSuspendTimer = new QTimer( this ); | 472 | mSuspendTimer = new QTimer( this ); |
472 | mAlarmTimer = new QTimer( this ); | 473 | mAlarmTimer = new QTimer( this ); |
473 | mRecheckAlarmTimer = new QTimer( this ); | 474 | mRecheckAlarmTimer = new QTimer( this ); |
474 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 475 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
475 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 476 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
476 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 477 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
477 | mAlarmDialog = new AlarmDialog( this ); | 478 | mAlarmDialog = new AlarmDialog( this ); |
478 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 479 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
479 | mAlarmDialog->setServerNotification( false ); | 480 | mAlarmDialog->setServerNotification( false ); |
480 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 481 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
481 | 482 | ||
482 | 483 | ||
483 | #ifndef DESKTOP_VERSION | 484 | #ifndef DESKTOP_VERSION |
484 | //US listen for arriving address resultsets | 485 | //US listen for arriving address resultsets |
485 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 486 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
486 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 487 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
487 | #endif | 488 | #endif |
488 | mDateNavigator->setCalendar( mCalendar ); | 489 | mDateNavigator->setCalendar( mCalendar ); |
489 | } | 490 | } |
490 | 491 | ||
491 | 492 | ||
492 | CalendarView::~CalendarView() | 493 | CalendarView::~CalendarView() |
493 | { | 494 | { |
494 | // kdDebug() << "~CalendarView()" << endl; | 495 | // kdDebug() << "~CalendarView()" << endl; |
495 | //qDebug("CalendarView::~CalendarView() "); | 496 | //qDebug("CalendarView::~CalendarView() "); |
496 | delete mDialogManager; | 497 | delete mDialogManager; |
497 | delete mViewManager; | 498 | delete mViewManager; |
498 | delete mStorage; | 499 | delete mStorage; |
499 | delete mDateFrame ; | 500 | delete mDateFrame ; |
500 | delete beamDialog; | 501 | delete beamDialog; |
501 | delete mEventViewerDialog; | 502 | delete mEventViewerDialog; |
502 | //kdDebug() << "~CalendarView() done" << endl; | 503 | //kdDebug() << "~CalendarView() done" << endl; |
503 | } | 504 | } |
504 | 505 | ||
505 | void CalendarView::showDay( QDate d ) | 506 | void CalendarView::showDay( QDate d ) |
506 | { | 507 | { |
507 | dateNavigator()->blockSignals( true ); | 508 | dateNavigator()->blockSignals( true ); |
508 | dateNavigator()->selectDate( d ); | 509 | dateNavigator()->selectDate( d ); |
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index b147427..ab0dd50 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -1,267 +1,276 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> |
5 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> | 5 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdebug.h> | 26 | #include <kdebug.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | //#include "koglobals.h" | 29 | //#include "koglobals.h" |
30 | #include "navigatorbar.h" | 30 | #include "navigatorbar.h" |
31 | #include "kdatenavigator.h" | 31 | #include "kdatenavigator.h" |
32 | 32 | ||
33 | #include <kcalendarsystem.h> | 33 | #include <kcalendarsystem.h> |
34 | 34 | ||
35 | #include "datenavigatorcontainer.h" | 35 | #include "datenavigatorcontainer.h" |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | 37 | ||
38 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, | 38 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, |
39 | const char *name ) | 39 | const char *name ) |
40 | : QWidget( parent, name ), mCalendar( 0 ), | 40 | : QWidget( parent, name ), mCalendar( 0 ), |
41 | mHorizontalCount( 1 ), mVerticalCount( 1 ) | 41 | mHorizontalCount( 1 ), mVerticalCount( 1 ) |
42 | { | 42 | { |
43 | mExtraViews.setAutoDelete( true ); | 43 | mExtraViews.setAutoDelete( true ); |
44 | 44 | ||
45 | mNavigatorView = new KDateNavigator( this, name ); | 45 | mNavigatorView = new KDateNavigator( this, name ); |
46 | 46 | ||
47 | connectNavigatorView( mNavigatorView ); | 47 | connectNavigatorView( mNavigatorView ); |
48 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | ||
48 | } | 49 | } |
49 | 50 | ||
50 | DateNavigatorContainer::~DateNavigatorContainer() | 51 | DateNavigatorContainer::~DateNavigatorContainer() |
51 | { | 52 | { |
52 | } | 53 | } |
53 | 54 | ||
54 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) | 55 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) |
55 | { | 56 | { |
56 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), | 57 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), |
57 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 58 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
58 | #if 0 | 59 | #if 0 |
59 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), | 60 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), |
60 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); | 61 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); |
61 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), | 62 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), |
62 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); | 63 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); |
63 | #endif | 64 | #endif |
64 | connect( v, SIGNAL( weekClicked( const QDate & ) ), | 65 | connect( v, SIGNAL( weekClicked( const QDate & ) ), |
65 | SIGNAL( weekClicked( const QDate & ) ) ); | 66 | SIGNAL( weekClicked( const QDate & ) ) ); |
66 | 67 | ||
67 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); | 68 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); |
68 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); | 69 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); |
69 | 70 | ||
70 | connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 71 | connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
71 | connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 72 | connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
72 | connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 73 | connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
73 | connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 74 | connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
74 | 75 | ||
75 | connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); | 76 | connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); |
76 | } | 77 | } |
77 | 78 | ||
78 | void DateNavigatorContainer::setCalendar( Calendar *cal ) | 79 | void DateNavigatorContainer::setCalendar( Calendar *cal ) |
79 | { | 80 | { |
80 | mCalendar = cal; | 81 | mCalendar = cal; |
81 | mNavigatorView->setCalendar( cal ); | 82 | mNavigatorView->setCalendar( cal ); |
82 | KDateNavigator *n; | 83 | KDateNavigator *n; |
83 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 84 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
84 | n->setCalendar( cal ); | 85 | n->setCalendar( cal ); |
85 | } | 86 | } |
86 | } | 87 | } |
87 | 88 | ||
88 | void DateNavigatorContainer::updateDayMatrix() | 89 | void DateNavigatorContainer::updateDayMatrix() |
89 | { | 90 | { |
90 | mNavigatorView->updateDayMatrix(); | 91 | mNavigatorView->updateDayMatrix(); |
91 | KDateNavigator *n; | 92 | KDateNavigator *n; |
92 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 93 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
93 | n->updateDayMatrix(); | 94 | n->updateDayMatrix(); |
94 | } | 95 | } |
95 | } | 96 | } |
96 | 97 | ||
97 | void DateNavigatorContainer::updateToday() | 98 | void DateNavigatorContainer::updateToday() |
98 | { | 99 | { |
99 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); | 100 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); |
100 | #if 0 | 101 | #if 0 |
101 | mNavigatorView->updateToday(); | 102 | mNavigatorView->updateToday(); |
102 | KDateNavigator *n; | 103 | KDateNavigator *n; |
103 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 104 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
104 | n->updateToday(); | 105 | n->updateToday(); |
105 | } | 106 | } |
106 | #endif | 107 | #endif |
107 | } | 108 | } |
108 | 109 | ||
109 | void DateNavigatorContainer::updateView() | 110 | void DateNavigatorContainer::updateView() |
110 | { | 111 | { |
111 | mNavigatorView->updateView(); | 112 | mNavigatorView->updateView(); |
112 | KDateNavigator *n; | 113 | KDateNavigator *n; |
113 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 114 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
114 | n->updateView(); | 115 | n->updateView(); |
115 | } | 116 | } |
116 | } | 117 | } |
117 | 118 | ||
118 | void DateNavigatorContainer::updateConfig() | 119 | void DateNavigatorContainer::updateConfig() |
119 | { | 120 | { |
120 | mNavigatorView->updateConfig(); | 121 | mNavigatorView->updateConfig(); |
121 | KDateNavigator *n; | 122 | KDateNavigator *n; |
122 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 123 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
123 | n->updateConfig(); | 124 | n->updateConfig(); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
127 | void DateNavigatorContainer::selectDates( const DateList &dateList ) | 128 | void DateNavigatorContainer::selectDates( const DateList &dateList ) |
128 | { | 129 | { |
129 | mNavigatorView->selectDates( dateList ); | 130 | mNavigatorView->selectDates( dateList ); |
130 | setBaseDates(); | 131 | setBaseDates(); |
131 | if ( mExtraViews.count() ) { | 132 | if ( mExtraViews.count() ) { |
132 | KDateNavigator *view = mExtraViews.at( 0 ); | 133 | KDateNavigator *view = mExtraViews.at( 0 ); |
133 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 134 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
134 | view->dayMatrix()->repaint( false ); | 135 | view->dayMatrix()->repaint( false ); |
135 | if ( mExtraViews.count() > 1 ) { | 136 | if ( mExtraViews.count() > 1 ) { |
136 | KDateNavigator *view = mExtraViews.at( 1 ); | 137 | KDateNavigator *view = mExtraViews.at( 1 ); |
137 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 138 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
138 | view->dayMatrix()->repaint( false ); | 139 | view->dayMatrix()->repaint( false ); |
139 | } | 140 | } |
140 | } | 141 | } |
141 | } | 142 | } |
142 | 143 | ||
143 | void DateNavigatorContainer::setBaseDates() | 144 | void DateNavigatorContainer::setBaseDates() |
144 | { | 145 | { |
145 | KCal::DateList dateList = mNavigatorView->selectedDates(); | 146 | KCal::DateList dateList = mNavigatorView->selectedDates(); |
146 | if ( dateList.isEmpty() ) { | 147 | if ( dateList.isEmpty() ) { |
147 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; | 148 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; |
148 | } | 149 | } |
149 | QDate baseDate = dateList.first(); | 150 | QDate baseDate = dateList.first(); |
150 | KDateNavigator *n; | 151 | KDateNavigator *n; |
151 | bool doRepaint = false; // skip first repaint | 152 | bool doRepaint = false; // skip first repaint |
152 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 153 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
153 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); | 154 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
154 | n->setBaseDate( baseDate, doRepaint ); | 155 | n->setBaseDate( baseDate, doRepaint ); |
155 | doRepaint = true; | 156 | doRepaint = true; |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | 160 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
160 | { | 161 | { |
161 | #if 0 | 162 | #if 0 |
162 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; | 163 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; |
163 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; | 164 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; |
164 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; | 165 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; |
165 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; | 166 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; |
166 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; | 167 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; |
167 | #endif | 168 | #endif |
168 | //QSize minSize = mNavigatorView->sizeHintTwoButtons(); | 169 | //QSize minSize = mNavigatorView->sizeHintTwoButtons(); |
169 | QSize minSize = mNavigatorView->yourSizeHint(); | 170 | QSize minSize = mNavigatorView->yourSizeHint(); |
170 | 171 | ||
171 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; | 172 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; |
172 | 173 | ||
173 | int verticalCount = size().height() / minSize.height(); | 174 | int verticalCount = size().height() / minSize.height(); |
174 | int horizontalCount = size().width() / minSize.width(); | 175 | int horizontalCount = size().width() / minSize.width(); |
175 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | 176 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); |
176 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 177 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
177 | bool fontchange = false; | 178 | bool fontchange = false; |
179 | if ( horizontalCount == 1) | ||
180 | horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); | ||
178 | QFont fo; | 181 | QFont fo; |
179 | if ( horizontalCount != mHorizontalCount || | 182 | if ( horizontalCount != mHorizontalCount || |
180 | verticalCount != mVerticalCount ) { | 183 | verticalCount != mVerticalCount ) { |
181 | uint count = horizontalCount * verticalCount; | 184 | uint count = horizontalCount * verticalCount; |
182 | if ( count == 0 ) { | 185 | if ( count == 0 ) { |
183 | bool ok; | 186 | bool ok; |
184 | fo = mNavigatorView->yourFontHint( size() , &ok); | 187 | fo = mNavigatorView->yourFontHint( size() , &ok ); |
185 | //mNavigatorView->resize( size() ); | 188 | //mNavigatorView->resize( size() ); |
186 | //if ( ! ok ) | 189 | //if ( ! ok ) |
187 | // return; | 190 | // return; |
188 | minSize = mNavigatorView->sizeHintTwoButtons(); | 191 | int butt = 2; |
192 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); | ||
193 | if ( horizontalCount <= 1 ) | ||
194 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); | ||
195 | else | ||
196 | minSize = mNavigatorView->sizeHintTwoButtons(); | ||
189 | verticalCount = size().height() / minSize.height(); | 197 | verticalCount = size().height() / minSize.height(); |
190 | horizontalCount = size().width() / minSize.width(); | 198 | horizontalCount = size().width() / minSize.width(); |
191 | if ( horizontalCount == 0 ) | 199 | if ( horizontalCount == 0 ) |
192 | horizontalCount = 1; | 200 | horizontalCount = 1; |
193 | if ( verticalCount == 0 ) | 201 | if ( verticalCount == 0 ) |
194 | verticalCount = 1; | 202 | verticalCount = 1; |
195 | fontchange = true; | 203 | fontchange = true; |
196 | count = horizontalCount * verticalCount; | 204 | count = horizontalCount * verticalCount; |
197 | } else { | 205 | } else { |
198 | if ( mNavigatorView->fontChanged() ) { | 206 | if ( mNavigatorView->fontChanged() ) { |
199 | fontchange = true; | 207 | fontchange = true; |
200 | fo = KOPrefs::instance()->mDateNavigatorFont; | 208 | fo = KOPrefs::instance()->mDateNavigatorFont; |
201 | mNavigatorView->changeFont( fo ); | 209 | mNavigatorView->changeFont( fo ); |
202 | mNavigatorView->unsetFontChanged(); | 210 | mNavigatorView->unsetFontChanged(); |
203 | } | 211 | } |
204 | } | 212 | } |
205 | 213 | ||
206 | while ( count > ( mExtraViews.count() + 1 ) ) { | 214 | while ( count > ( mExtraViews.count() + 1 ) ) { |
207 | KDateNavigator *n = new KDateNavigator( this ); | 215 | KDateNavigator *n = new KDateNavigator( this ); |
208 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 216 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
209 | mExtraViews.append( n ); | 217 | mExtraViews.append( n ); |
210 | n->setCalendar( mCalendar ); | 218 | n->setCalendar( mCalendar ); |
211 | setBaseDates(); | 219 | setBaseDates(); |
212 | connectNavigatorView( n ); | 220 | connectNavigatorView( n ); |
213 | n->show(); | 221 | n->show(); |
214 | } | 222 | } |
215 | int iii = 0; | 223 | int iii = 0; |
216 | while ( iii < ( mExtraViews.count() ) ) { | 224 | while ( iii < ( mExtraViews.count() ) ) { |
217 | if ( iii < count-1 ) | 225 | if ( iii < count-1 ) |
218 | mExtraViews.at( iii )->show(); | 226 | mExtraViews.at( iii )->show(); |
219 | else | 227 | else |
220 | mExtraViews.at( iii )->hide(); | 228 | mExtraViews.at( iii )->hide(); |
221 | ++iii; | 229 | ++iii; |
222 | } | 230 | } |
223 | if ( fontchange ) { | 231 | if ( fontchange ) { |
224 | //mNavigatorView->changeFont( fo ); | 232 | //mNavigatorView->changeFont( fo ); |
225 | uint i; | 233 | uint i; |
226 | for( i = 0; i < mExtraViews.count(); ++i ) { | 234 | for( i = 0; i < mExtraViews.count(); ++i ) { |
227 | KDateNavigator *view = mExtraViews.at( i ); | 235 | KDateNavigator *view = mExtraViews.at( i ); |
228 | view->changeFont( fo ); | 236 | view->changeFont( fo ); |
229 | } | 237 | } |
230 | } | 238 | } |
231 | mHorizontalCount = horizontalCount; | 239 | mHorizontalCount = horizontalCount; |
232 | mVerticalCount = verticalCount; | 240 | mVerticalCount = verticalCount; |
233 | } | 241 | } |
242 | //qDebug("COUNT %d ", mExtraViews.count()); | ||
234 | int height = size().height() / verticalCount; | 243 | int height = size().height() / verticalCount; |
235 | int width = size().width() / horizontalCount; | 244 | int width = size().width() / horizontalCount; |
236 | 245 | ||
237 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 246 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
238 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); | 247 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); |
239 | else bar->showButtons( true, true ); | 248 | else bar->showButtons( true, true ); |
240 | 249 | ||
241 | mNavigatorView->setGeometry(0, | 250 | mNavigatorView->setGeometry(0, |
242 | 0, width, height ); | 251 | 0, width, height ); |
243 | for( uint i = 0; i < mExtraViews.count(); ++i ) { | 252 | for( uint i = 0; i < mExtraViews.count(); ++i ) { |
244 | int x = ( i + 1 ) % horizontalCount; | 253 | int x = ( i + 1 ) % horizontalCount; |
245 | int y = ( i + 1 ) / horizontalCount; | 254 | int y = ( i + 1 ) / horizontalCount; |
246 | 255 | ||
247 | KDateNavigator *view = mExtraViews.at( i ); | 256 | KDateNavigator *view = mExtraViews.at( i ); |
248 | bar = view->navigatorBar(); | 257 | bar = view->navigatorBar(); |
249 | if ( y > 0 ) bar->showButtons( false, false ); | 258 | if ( y > 0 ) bar->showButtons( false, false ); |
250 | else { | 259 | else { |
251 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); | 260 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); |
252 | else bar->showButtons( false, false ); | 261 | else bar->showButtons( false, false ); |
253 | } | 262 | } |
254 | view->setGeometry( x * width, | 263 | view->setGeometry( x * width, |
255 | y * height, width, height ); | 264 | y * height, width, height ); |
256 | } | 265 | } |
257 | } | 266 | } |
258 | 267 | ||
259 | QSize DateNavigatorContainer::minimumSizeHint() const | 268 | QSize DateNavigatorContainer::minimumSizeHint() const |
260 | { | 269 | { |
261 | return mNavigatorView->minimumSizeHint(); | 270 | return mNavigatorView->minimumSizeHint(); |
262 | } | 271 | } |
263 | 272 | ||
264 | QSize DateNavigatorContainer::sizeHint() const | 273 | QSize DateNavigatorContainer::sizeHint() const |
265 | { | 274 | { |
266 | return mNavigatorView->sizeHint(); | 275 | return mNavigatorView->sizeHint(); |
267 | } | 276 | } |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index fe83e09..231095f 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -1,356 +1,361 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
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 = sizeHintTwoButtons(); | 118 | mySizeHint = sizeHintTwoButtons(); |
119 | myFullSizeHint = sizeHintTwoButtons( 4 ); | ||
119 | mFontChanged = false; | 120 | mFontChanged = false; |
120 | } | 121 | } |
121 | void KDateNavigator::changeFont ( QFont fo ) | 122 | void KDateNavigator::changeFont ( QFont fo ) |
122 | { | 123 | { |
123 | setFont( fo ); | 124 | setFont( fo ); |
124 | mNavigatorBar->resetFont( fo ); | 125 | mNavigatorBar->resetFont( fo ); |
125 | } | 126 | } |
126 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 127 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
127 | { | 128 | { |
128 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 129 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
129 | *b = false; | 130 | *b = false; |
130 | int fontPoint = fo.pointSize(); | 131 | int fontPoint = fo.pointSize(); |
131 | while ( fontPoint > 5 ) { | 132 | while ( fontPoint > 5 ) { |
132 | --fontPoint; | 133 | --fontPoint; |
133 | fo.setPointSize( fontPoint ); | 134 | fo.setPointSize( fontPoint ); |
134 | setFont( fo ); | 135 | setFont( fo ); |
135 | mFontChanged = true; | 136 | mFontChanged = true; |
136 | mNavigatorBar->resetFont( fo ); | 137 | mNavigatorBar->resetFont( fo ); |
137 | QSize sh = sizeHintTwoButtons(); | 138 | QSize sh = sizeHintTwoButtons( 2 ); |
138 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 139 | //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()) { | 140 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
141 | if ( si.width() / sh.width() == 1 ) { | ||
142 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) | ||
143 | continue; | ||
144 | } | ||
140 | *b = true; | 145 | *b = true; |
141 | //qDebug("fooooooooooooooooooooooouuuuund "); | 146 | //qDebug("fooooooooooooooooooooooouuuuund "); |
142 | break; | 147 | break; |
143 | } | 148 | } |
144 | } | 149 | } |
145 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); | 150 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); |
146 | return fo; | 151 | return fo; |
147 | } | 152 | } |
148 | QSize KDateNavigator::sizeHint() const | 153 | QSize KDateNavigator::sizeHint() const |
149 | { | 154 | { |
150 | QFontMetrics fm ( font() ); | 155 | QFontMetrics fm ( font() ); |
151 | QSize day = daymatrix->sizeHint(); | 156 | QSize day = daymatrix->sizeHint(); |
152 | QSize nav = mNavigatorBar->sizeHint(); | 157 | QSize nav = mNavigatorBar->sizeHint(); |
153 | int wid = fm.width( "30") + day.width()+3; | 158 | int wid = fm.width( "30") + day.width()+3; |
154 | int hei = fm.height() +day.height()+nav.height()+2; | 159 | int hei = fm.height() +day.height()+nav.height()+2; |
155 | if ( wid < nav.width() ) | 160 | if ( wid < nav.width() ) |
156 | wid = nav.width() ; | 161 | wid = nav.width() ; |
157 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 162 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
158 | return QSize ( wid, hei ); | 163 | return QSize ( wid, hei ); |
159 | } | 164 | } |
160 | QSize KDateNavigator::sizeHintTwoButtons() const | 165 | QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const |
161 | { | 166 | { |
162 | QFontMetrics fm ( font() ); | 167 | QFontMetrics fm ( font() ); |
163 | QSize day = daymatrix->sizeHint(); | 168 | QSize day = daymatrix->sizeHint(); |
164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); | 169 | QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); |
165 | int wid = fm.width( "30") + day.width()+3; | 170 | int wid = fm.width( "30") + day.width()+3; |
166 | int hei = fm.height() +day.height()+nav.height()+2; | 171 | int hei = fm.height() +day.height()+nav.height()+2; |
167 | if ( wid < nav.width() ) | 172 | if ( wid < nav.width() ) |
168 | wid = nav.width() ; | 173 | wid = nav.width() ; |
169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 174 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
170 | return QSize ( wid, hei ); | 175 | return QSize ( wid, hei ); |
171 | } | 176 | } |
172 | void KDateNavigator::slotMonthSelected( int m ) | 177 | void KDateNavigator::slotMonthSelected( int m ) |
173 | { | 178 | { |
174 | if ( m_MthYr.month() <= mMonthSignalOffset) | 179 | if ( m_MthYr.month() <= mMonthSignalOffset) |
175 | m += 12; | 180 | m += 12; |
176 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); | 181 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); |
177 | emit monthSelected( m - mMonthSignalOffset ); | 182 | emit monthSelected( m - mMonthSignalOffset ); |
178 | 183 | ||
179 | } | 184 | } |
180 | void KDateNavigator::setCalendar( Calendar *cal ) | 185 | void KDateNavigator::setCalendar( Calendar *cal ) |
181 | { | 186 | { |
182 | daymatrix->setCalendar( cal ); | 187 | daymatrix->setCalendar( cal ); |
183 | } | 188 | } |
184 | 189 | ||
185 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true | 190 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true |
186 | { | 191 | { |
187 | m_MthYr = date; | 192 | m_MthYr = date; |
188 | 193 | ||
189 | updateDates(); | 194 | updateDates(); |
190 | updateView(); | 195 | updateView(); |
191 | 196 | ||
192 | KCal::DateList dates; | 197 | KCal::DateList dates; |
193 | dates.append( date ); | 198 | dates.append( date ); |
194 | mNavigatorBar->selectDates( dates ); | 199 | mNavigatorBar->selectDates( dates ); |
195 | 200 | ||
196 | daymatrix->clearSelection(); | 201 | daymatrix->clearSelection(); |
197 | if ( doRepaint ) | 202 | if ( doRepaint ) |
198 | daymatrix->repaint( false ); | 203 | daymatrix->repaint( false ); |
199 | } | 204 | } |
200 | 205 | ||
201 | void KDateNavigator::enableRollover(RolloverType r) | 206 | void KDateNavigator::enableRollover(RolloverType r) |
202 | { | 207 | { |
203 | switch(r) | 208 | switch(r) |
204 | { | 209 | { |
205 | case None : | 210 | case None : |
206 | if (updateTimer) | 211 | if (updateTimer) |
207 | { | 212 | { |
208 | updateTimer->stop(); | 213 | updateTimer->stop(); |
209 | delete updateTimer; | 214 | delete updateTimer; |
210 | updateTimer=0L; | 215 | updateTimer=0L; |
211 | } | 216 | } |
212 | break; | 217 | break; |
213 | case FollowDay : | 218 | case FollowDay : |
214 | case FollowMonth : | 219 | case FollowMonth : |
215 | if (!updateTimer) | 220 | if (!updateTimer) |
216 | { | 221 | { |
217 | updateTimer = new QTimer(this); | 222 | updateTimer = new QTimer(this); |
218 | QObject::connect(updateTimer,SIGNAL(timeout()), | 223 | QObject::connect(updateTimer,SIGNAL(timeout()), |
219 | this,SLOT(possiblyPastMidnight())); | 224 | this,SLOT(possiblyPastMidnight())); |
220 | } | 225 | } |
221 | updateTimer->start(0,true); | 226 | updateTimer->start(0,true); |
222 | lastDayChecked = QDate::currentDate(); | 227 | lastDayChecked = QDate::currentDate(); |
223 | } | 228 | } |
224 | updateRollover=r; | 229 | updateRollover=r; |
225 | } | 230 | } |
226 | 231 | ||
227 | 232 | ||
228 | KDateNavigator::~KDateNavigator() | 233 | KDateNavigator::~KDateNavigator() |
229 | { | 234 | { |
230 | } | 235 | } |
231 | 236 | ||
232 | 237 | ||
233 | void KDateNavigator::passedMidnight() | 238 | void KDateNavigator::passedMidnight() |
234 | { | 239 | { |
235 | QDate today = QDate::currentDate(); | 240 | QDate today = QDate::currentDate(); |
236 | bool emitMonth = false; | 241 | bool emitMonth = false; |
237 | 242 | ||
238 | if (today.month() != lastDayChecked.month()) | 243 | if (today.month() != lastDayChecked.month()) |
239 | { | 244 | { |
240 | if (updateRollover==FollowMonth && | 245 | if (updateRollover==FollowMonth && |
241 | daymatrix->isEndOfMonth()) { | 246 | daymatrix->isEndOfMonth()) { |
242 | goNextMonth(); | 247 | goNextMonth(); |
243 | emitMonth=true; | 248 | emitMonth=true; |
244 | } | 249 | } |
245 | } | 250 | } |
246 | daymatrix->recalculateToday(); | 251 | daymatrix->recalculateToday(); |
247 | daymatrix->repaint( false ); | 252 | daymatrix->repaint( false ); |
248 | emit dayPassed(today); | 253 | emit dayPassed(today); |
249 | if (emitMonth) { emit monthPassed(today); } | 254 | if (emitMonth) { emit monthPassed(today); } |
250 | } | 255 | } |
251 | 256 | ||
252 | /* slot */ void KDateNavigator::possiblyPastMidnight() | 257 | /* slot */ void KDateNavigator::possiblyPastMidnight() |
253 | { | 258 | { |
254 | if (lastDayChecked!=QDate::currentDate()) | 259 | if (lastDayChecked!=QDate::currentDate()) |
255 | { | 260 | { |
256 | passedMidnight(); | 261 | passedMidnight(); |
257 | lastDayChecked=QDate::currentDate(); | 262 | lastDayChecked=QDate::currentDate(); |
258 | } | 263 | } |
259 | // Set the timer to go off 1 second after midnight | 264 | // Set the timer to go off 1 second after midnight |
260 | // or after 8 minutes, whichever comes first. | 265 | // or after 8 minutes, whichever comes first. |
261 | if (updateTimer) | 266 | if (updateTimer) |
262 | { | 267 | { |
263 | QTime now = QTime::currentTime(); | 268 | QTime now = QTime::currentTime(); |
264 | QTime midnight = QTime(23,59,59); | 269 | QTime midnight = QTime(23,59,59); |
265 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); | 270 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); |
266 | 271 | ||
267 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) | 272 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) |
268 | //.arg(now.toString()).arg(midnight.toString())); | 273 | //.arg(now.toString()).arg(midnight.toString())); |
269 | 274 | ||
270 | updateTimer->stop(); | 275 | updateTimer->stop(); |
271 | updateTimer->start(msecsWait,true); | 276 | updateTimer->start(msecsWait,true); |
272 | } | 277 | } |
273 | } | 278 | } |
274 | 279 | ||
275 | void KDateNavigator::updateDates() | 280 | void KDateNavigator::updateDates() |
276 | { | 281 | { |
277 | // Find the first day of the week of the current month. | 282 | // Find the first day of the week of the current month. |
278 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); | 283 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); |
279 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); | 284 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); |
280 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); | 285 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); |
281 | //int di = d1 - d2 + 1; | 286 | //int di = d1 - d2 + 1; |
282 | dayone = dayone.addDays( -d2 + 1 ); | 287 | dayone = dayone.addDays( -d2 + 1 ); |
283 | 288 | ||
284 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); | 289 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); |
285 | 290 | ||
286 | // If month begins on Monday and Monday is first day of week, | 291 | // If month begins on Monday and Monday is first day of week, |
287 | // month should begin on second line. Sunday doesn't have this problem. | 292 | // month should begin on second line. Sunday doesn't have this problem. |
288 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && | 293 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && |
289 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; | 294 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; |
290 | 295 | ||
291 | // update the matrix dates | 296 | // update the matrix dates |
292 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; | 297 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; |
293 | 298 | ||
294 | 299 | ||
295 | daymatrix->updateView(dayone.addDays(index)); | 300 | daymatrix->updateView(dayone.addDays(index)); |
296 | //each updateDates is followed by an updateView -> repaint is issued there ! | 301 | //each updateDates is followed by an updateView -> repaint is issued there ! |
297 | // daymatrix->repaint(); | 302 | // daymatrix->repaint(); |
298 | } | 303 | } |
299 | 304 | ||
300 | void KDateNavigator::updateDayMatrix() | 305 | void KDateNavigator::updateDayMatrix() |
301 | { | 306 | { |
302 | daymatrix->updateView(); | 307 | daymatrix->updateView(); |
303 | //daymatrix->repaint(); | 308 | //daymatrix->repaint(); |
304 | } | 309 | } |
305 | 310 | ||
306 | 311 | ||
307 | void KDateNavigator::updateView() | 312 | void KDateNavigator::updateView() |
308 | { | 313 | { |
309 | 314 | ||
310 | setUpdatesEnabled( false ); | 315 | setUpdatesEnabled( false ); |
311 | 316 | ||
312 | int i; | 317 | int i; |
313 | 318 | ||
314 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; | 319 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; |
315 | daymatrix->updateView(); | 320 | daymatrix->updateView(); |
316 | 321 | ||
317 | // set the week numbers. | 322 | // set the week numbers. |
318 | for(i = 0; i < 6; i++) { | 323 | for(i = 0; i < 6; i++) { |
319 | QString weeknum; | 324 | QString weeknum; |
320 | // remember, according to ISO 8601, the first week of the year is the | 325 | // remember, according to ISO 8601, the first week of the year is the |
321 | // first week that contains a thursday. Thus we must subtract off 4, | 326 | // first week that contains a thursday. Thus we must subtract off 4, |
322 | // not just 1. | 327 | // not just 1. |
323 | 328 | ||
324 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); | 329 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); |
325 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); | 330 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); |
326 | 331 | ||
327 | int add = 0; | 332 | int add = 0; |
328 | if ( ! KGlobal::locale()->weekStartsMonday() ) | 333 | if ( ! KGlobal::locale()->weekStartsMonday() ) |
329 | ++add; | 334 | ++add; |
330 | if (dayOfYear % 7 != 0) | 335 | if (dayOfYear % 7 != 0) |
331 | weeknum.setNum(dayOfYear / 7 + 1+add); | 336 | weeknum.setNum(dayOfYear / 7 + 1+add); |
332 | else | 337 | else |
333 | weeknum.setNum(dayOfYear / 7 +add); | 338 | weeknum.setNum(dayOfYear / 7 +add); |
334 | weeknos[i]->setText(weeknum); | 339 | weeknos[i]->setText(weeknum); |
335 | } | 340 | } |
336 | 341 | ||
337 | setUpdatesEnabled( true ); | 342 | setUpdatesEnabled( true ); |
338 | // kdDebug() << "updateView() -> repaint()" << endl; | 343 | // kdDebug() << "updateView() -> repaint()" << endl; |
339 | repaint(); | 344 | repaint(); |
340 | // daymatrix->repaint(); | 345 | // daymatrix->repaint(); |
341 | } | 346 | } |
342 | 347 | ||
343 | void KDateNavigator::updateConfig() | 348 | void KDateNavigator::updateConfig() |
344 | { | 349 | { |
345 | int day; | 350 | int day; |
346 | for(int i=0; i<7; i++) { | 351 | for(int i=0; i<7; i++) { |
347 | // take the first letter of the day name to be the abbreviation | 352 | // take the first letter of the day name to be the abbreviation |
348 | if (KGlobal::locale()->weekStartsMonday()) { | 353 | if (KGlobal::locale()->weekStartsMonday()) { |
349 | day = i+1; | 354 | day = i+1; |
350 | } else { | 355 | } else { |
351 | if (i==0) day = 7; | 356 | if (i==0) day = 7; |
352 | else day = i; | 357 | else day = i; |
353 | } | 358 | } |
354 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, | 359 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, |
355 | true ); | 360 | true ); |
356 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); | 361 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); |
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 77b9b7c..10bc1be 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -1,161 +1,163 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KDATENAVIGATOR_H | 23 | #ifndef KDATENAVIGATOR_H |
24 | #define KDATENAVIGATOR_H | 24 | #define KDATENAVIGATOR_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | 29 | ||
30 | #include <libkcal/calendar.h> | 30 | #include <libkcal/calendar.h> |
31 | 31 | ||
32 | #include "kodaymatrix.h" | 32 | #include "kodaymatrix.h" |
33 | 33 | ||
34 | class QPushButton; | 34 | class QPushButton; |
35 | class QTimer; | 35 | class QTimer; |
36 | 36 | ||
37 | class KCalendarSystem; | 37 | class KCalendarSystem; |
38 | 38 | ||
39 | class NavigatorBar; | 39 | class NavigatorBar; |
40 | 40 | ||
41 | class KDateNavigator: public QFrame | 41 | class KDateNavigator: public QFrame |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); | 45 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); |
46 | ~KDateNavigator(); | 46 | ~KDateNavigator(); |
47 | 47 | ||
48 | /** The DateNavigator automatically checks for | 48 | /** The DateNavigator automatically checks for |
49 | * the passage of midnight. If rollover type is | 49 | * the passage of midnight. If rollover type is |
50 | * set to None, no signals are emitted and no | 50 | * set to None, no signals are emitted and no |
51 | * processing is done. With rollover set to | 51 | * processing is done. With rollover set to |
52 | * FollowDay, the day highlighter changes at | 52 | * FollowDay, the day highlighter changes at |
53 | * midnight and dayPassed() is emitted. | 53 | * midnight and dayPassed() is emitted. |
54 | * With FollowMonth, it has the same effect | 54 | * With FollowMonth, it has the same effect |
55 | * as FollowDay but also adjusts the month that is | 55 | * as FollowDay but also adjusts the month that is |
56 | * visible and emits monthPassed() when the month changes. | 56 | * visible and emits monthPassed() when the month changes. |
57 | */ | 57 | */ |
58 | enum RolloverType { None, FollowDay, FollowMonth } ; | 58 | enum RolloverType { None, FollowDay, FollowMonth } ; |
59 | void enableRollover( RolloverType ); | 59 | void enableRollover( RolloverType ); |
60 | 60 | ||
61 | void setShowWeekNums( bool enabled ); | 61 | void setShowWeekNums( bool enabled ); |
62 | void setCalendar( Calendar * ); | 62 | void setCalendar( Calendar * ); |
63 | void setBaseDate( const QDate & , bool doRepaint = true ); | 63 | void setBaseDate( const QDate & , bool doRepaint = true ); |
64 | KCal::DateList selectedDates() const { return mSelectedDates; } | 64 | KCal::DateList selectedDates() const { return mSelectedDates; } |
65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } | 65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } |
66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} | 66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} |
67 | QSize yourSizeHint() { return mySizeHint; } | 67 | QSize yourSizeHint()const { return mySizeHint; }; |
68 | QSize yourFullSizeHint() const { return myFullSizeHint;}; | ||
68 | QFont yourFontHint( QSize , bool * b); | 69 | QFont yourFontHint( QSize , bool * b); |
69 | bool fontChanged() {return mFontChanged; } | 70 | bool fontChanged() {return mFontChanged; } |
70 | void unsetFontChanged() { mFontChanged = false; } | 71 | void unsetFontChanged() { mFontChanged = false; } |
71 | KODayMatrix *dayMatrix() { return daymatrix ;} | 72 | KODayMatrix *dayMatrix() { return daymatrix ;} |
72 | QSize sizeHint() const; | 73 | QSize sizeHint() const; |
73 | QSize sizeHintTwoButtons() const; | 74 | QSize sizeHintTwoButtons( int butnum = 2 ) const; |
74 | void changeFont ( QFont fo ); | 75 | void changeFont ( QFont fo ); |
75 | public slots: | 76 | public slots: |
76 | void selectDates( const KCal::DateList & ); | 77 | void selectDates( const KCal::DateList & ); |
77 | void updateView(); | 78 | void updateView(); |
78 | void updateConfig(); | 79 | void updateConfig(); |
79 | void updateDayMatrix(); | 80 | void updateDayMatrix(); |
80 | 81 | ||
81 | signals: | 82 | signals: |
82 | void datesSelected( const KCal::DateList & ); | 83 | void datesSelected( const KCal::DateList & ); |
83 | void eventDropped( Event * ); | 84 | void eventDropped( Event * ); |
84 | void weekClicked( const QDate &); | 85 | void weekClicked( const QDate &); |
85 | 86 | ||
86 | void goPrevious(); | 87 | void goPrevious(); |
87 | void goNext(); | 88 | void goNext(); |
88 | 89 | ||
89 | void goNextMonth(); | 90 | void goNextMonth(); |
90 | void goPrevMonth(); | 91 | void goPrevMonth(); |
91 | void goNextYear(); | 92 | void goNextYear(); |
92 | void goPrevYear(); | 93 | void goPrevYear(); |
93 | void monthSelected( int ); | 94 | void monthSelected( int ); |
94 | 95 | ||
95 | // Signals emitted at midnight carrying the new date. | 96 | // Signals emitted at midnight carrying the new date. |
96 | void dayPassed( QDate ); | 97 | void dayPassed( QDate ); |
97 | void monthPassed( QDate ); | 98 | void monthPassed( QDate ); |
98 | 99 | ||
99 | protected slots: | 100 | protected slots: |
100 | 101 | ||
101 | /** | 102 | /** |
102 | * Called regularly to see if we need to update the view | 103 | * Called regularly to see if we need to update the view |
103 | * wrt. the today box and the month box. Only important | 104 | * wrt. the today box and the month box. Only important |
104 | * if you leave KOrganizer idle for long periods of time. | 105 | * if you leave KOrganizer idle for long periods of time. |
105 | * | 106 | * |
106 | * Until we have a reliable way of setting QTimers to go | 107 | * Until we have a reliable way of setting QTimers to go |
107 | * off at a particular wall-clock time, we need this, | 108 | * off at a particular wall-clock time, we need this, |
108 | * which calls passedMidnight() at the right moments. | 109 | * which calls passedMidnight() at the right moments. |
109 | */ | 110 | */ |
110 | void possiblyPastMidnight(); | 111 | void possiblyPastMidnight(); |
111 | 112 | ||
112 | /** handles updating the view when midnight has come by due to idle time. | 113 | /** handles updating the view when midnight has come by due to idle time. |
113 | * | 114 | * |
114 | */ | 115 | */ |
115 | void passedMidnight(); | 116 | void passedMidnight(); |
116 | void slotMonthSelected( int m ); | 117 | void slotMonthSelected( int m ); |
117 | protected: | 118 | protected: |
118 | void updateDates(); | 119 | void updateDates(); |
119 | 120 | ||
120 | void wheelEvent (QWheelEvent *); | 121 | void wheelEvent (QWheelEvent *); |
121 | 122 | ||
122 | bool eventFilter (QObject *,QEvent *); | 123 | bool eventFilter (QObject *,QEvent *); |
123 | 124 | ||
124 | private: | 125 | private: |
125 | QSize mySizeHint; | 126 | QSize mySizeHint; |
127 | QSize myFullSizeHint; | ||
126 | bool mFontChanged; | 128 | bool mFontChanged; |
127 | int mMonthSignalOffset; | 129 | int mMonthSignalOffset; |
128 | NavigatorBar *mNavigatorBar; | 130 | NavigatorBar *mNavigatorBar; |
129 | 131 | ||
130 | QFrame *headingSep; | 132 | QFrame *headingSep; |
131 | QFrame *weeknumSep; | 133 | QFrame *weeknumSep; |
132 | QLabel *headings[7]; | 134 | QLabel *headings[7]; |
133 | QLabel *weeknos[7]; | 135 | QLabel *weeknos[7]; |
134 | KODayMatrix *daymatrix; | 136 | KODayMatrix *daymatrix; |
135 | 137 | ||
136 | KCal::DateList mSelectedDates; | 138 | KCal::DateList mSelectedDates; |
137 | QDate m_MthYr; | 139 | QDate m_MthYr; |
138 | int m_fstDayOfWk; | 140 | int m_fstDayOfWk; |
139 | bool m_bShowWeekNums; | 141 | bool m_bShowWeekNums; |
140 | 142 | ||
141 | int dayNum(int row, int col); | 143 | int dayNum(int row, int col); |
142 | int dayToIndex(int dayNum); | 144 | int dayToIndex(int dayNum); |
143 | 145 | ||
144 | Calendar *mCalendar; | 146 | Calendar *mCalendar; |
145 | KCalendarSystem *mCalendarSystem; | 147 | KCalendarSystem *mCalendarSystem; |
146 | 148 | ||
147 | const QString *curHeaders; | 149 | const QString *curHeaders; |
148 | 150 | ||
149 | /** used to update the day view periodically, in particular every | 151 | /** used to update the day view periodically, in particular every |
150 | * midnight to move the "today" rectangle. | 152 | * midnight to move the "today" rectangle. |
151 | */ | 153 | */ |
152 | QTimer *updateTimer; | 154 | QTimer *updateTimer; |
153 | QDate lastDayChecked; | 155 | QDate lastDayChecked; |
154 | RolloverType updateRollover; | 156 | RolloverType updateRollover; |
155 | 157 | ||
156 | // Disabling copy constructor and assignment operator | 158 | // Disabling copy constructor and assignment operator |
157 | KDateNavigator(const KDateNavigator & ); | 159 | KDateNavigator(const KDateNavigator & ); |
158 | KDateNavigator &operator=(const KDateNavigator &); | 160 | KDateNavigator &operator=(const KDateNavigator &); |
159 | }; | 161 | }; |
160 | 162 | ||
161 | #endif | 163 | #endif |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 120bc89..a2e0ae0 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -225,385 +225,386 @@ QColor KODayMatrix::getShadedColor(QColor color) | |||
225 | { | 225 | { |
226 | QColor shaded; | 226 | QColor shaded; |
227 | int h=0; | 227 | int h=0; |
228 | int s=0; | 228 | int s=0; |
229 | int v=0; | 229 | int v=0; |
230 | color.hsv(&h,&s,&v); | 230 | color.hsv(&h,&s,&v); |
231 | s = s/4; | 231 | s = s/4; |
232 | v = 192+v/4; | 232 | v = 192+v/4; |
233 | shaded.setHsv(h,s,v); | 233 | shaded.setHsv(h,s,v); |
234 | 234 | ||
235 | return shaded; | 235 | return shaded; |
236 | } | 236 | } |
237 | 237 | ||
238 | KODayMatrix::~KODayMatrix() | 238 | KODayMatrix::~KODayMatrix() |
239 | { | 239 | { |
240 | // delete mKODaymatrixWhatsThis; | 240 | // delete mKODaymatrixWhatsThis; |
241 | delete [] days; | 241 | delete [] days; |
242 | delete [] daylbls; | 242 | delete [] daylbls; |
243 | delete [] events; | 243 | delete [] events; |
244 | delete mToolTip; | 244 | delete mToolTip; |
245 | } | 245 | } |
246 | 246 | ||
247 | /* | 247 | /* |
248 | void KODayMatrix::setStartDate(QDate start) | 248 | void KODayMatrix::setStartDate(QDate start) |
249 | { | 249 | { |
250 | updateView(start); | 250 | updateView(start); |
251 | } | 251 | } |
252 | */ | 252 | */ |
253 | 253 | ||
254 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 254 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
255 | { | 255 | { |
256 | 256 | ||
257 | if (mSelStart == NOSELECTION) { | 257 | if (mSelStart == NOSELECTION) { |
258 | return; | 258 | return; |
259 | } | 259 | } |
260 | 260 | ||
261 | //cope with selection being out of matrix limits at top (< 0) | 261 | //cope with selection being out of matrix limits at top (< 0) |
262 | int i0 = mSelStart; | 262 | int i0 = mSelStart; |
263 | if (i0 < 0) { | 263 | if (i0 < 0) { |
264 | for (int i = i0; i < 0; i++) { | 264 | for (int i = i0; i < 0; i++) { |
265 | selDays.append(days[0].addDays(i)); | 265 | selDays.append(days[0].addDays(i)); |
266 | } | 266 | } |
267 | i0 = 0; | 267 | i0 = 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 270 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
271 | if (mSelEnd > NUMDAYS-1) { | 271 | if (mSelEnd > NUMDAYS-1) { |
272 | for (int i = i0; i <= NUMDAYS-1; i++) { | 272 | for (int i = i0; i <= NUMDAYS-1; i++) { |
273 | selDays.append(days[i]); | 273 | selDays.append(days[i]); |
274 | } | 274 | } |
275 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 275 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
276 | selDays.append(days[0].addDays(i)); | 276 | selDays.append(days[0].addDays(i)); |
277 | } | 277 | } |
278 | 278 | ||
279 | // apply normal routine to selection being entirely within matrix limits | 279 | // apply normal routine to selection being entirely within matrix limits |
280 | } else { | 280 | } else { |
281 | for (int i = i0; i <= mSelEnd; i++) { | 281 | for (int i = i0; i <= mSelEnd; i++) { |
282 | selDays.append(days[i]); | 282 | selDays.append(days[i]); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 287 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
288 | { | 288 | { |
289 | mSelStart = startdate.daysTo(start); | 289 | mSelStart = startdate.daysTo(start); |
290 | if ( mSelStart < 0 ) | 290 | if ( mSelStart < 0 ) |
291 | mSelStart = 0; | 291 | mSelStart = 0; |
292 | mSelEnd = startdate.daysTo(end); | 292 | mSelEnd = startdate.daysTo(end); |
293 | //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd ); | 293 | //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd ); |
294 | if ( mSelEnd < 0 ) | 294 | if ( mSelEnd < 0 ) |
295 | clearSelection(); | 295 | clearSelection(); |
296 | } | 296 | } |
297 | void KODayMatrix::clearSelection() | 297 | void KODayMatrix::clearSelection() |
298 | { | 298 | { |
299 | mSelEnd = mSelStart = NOSELECTION; | 299 | mSelEnd = mSelStart = NOSELECTION; |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | void KODayMatrix::recalculateToday() | 303 | void KODayMatrix::recalculateToday() |
304 | { | 304 | { |
305 | today = -1; | 305 | today = -1; |
306 | for (int i=0; i<NUMDAYS; i++) { | 306 | for (int i=0; i<NUMDAYS; i++) { |
307 | events[i] = 0; | 307 | events[i] = 0; |
308 | days[i] = startdate.addDays(i); | 308 | days[i] = startdate.addDays(i); |
309 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 309 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
310 | 310 | ||
311 | // if today is in the currently displayed month, hilight today | 311 | // if today is in the currently displayed month, hilight today |
312 | if (days[i].year() == QDate::currentDate().year() && | 312 | if (days[i].year() == QDate::currentDate().year() && |
313 | days[i].month() == QDate::currentDate().month() && | 313 | days[i].month() == QDate::currentDate().month() && |
314 | days[i].day() == QDate::currentDate().day()) { | 314 | days[i].day() == QDate::currentDate().day()) { |
315 | today = i; | 315 | today = i; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | // qDebug(QString("Today is visible at %1.").arg(today)); | 318 | // qDebug(QString("Today is visible at %1.").arg(today)); |
319 | } | 319 | } |
320 | 320 | ||
321 | void KODayMatrix::updateView() | 321 | void KODayMatrix::updateView() |
322 | { | 322 | { |
323 | updateView(startdate); | 323 | updateView(startdate); |
324 | } | 324 | } |
325 | void KODayMatrix::repaintViewTimed() | 325 | void KODayMatrix::repaintViewTimed() |
326 | { | 326 | { |
327 | mRepaintTimer->stop(); | 327 | mRepaintTimer->stop(); |
328 | repaint(false); | 328 | repaint(false); |
329 | } | 329 | } |
330 | void KODayMatrix::updateViewTimed() | 330 | void KODayMatrix::updateViewTimed() |
331 | { | 331 | { |
332 | mUpdateTimer->stop(); | 332 | mUpdateTimer->stop(); |
333 | if ( !mCalendar ) { | 333 | if ( !mCalendar ) { |
334 | qDebug("NOT CAL "); | 334 | qDebug("NOT CAL "); |
335 | return; | 335 | return; |
336 | } | 336 | } |
337 | //qDebug("KODayMatrix::updateViewTimed "); | 337 | //qDebug("KODayMatrix::updateViewTimed "); |
338 | for(int i = 0; i < NUMDAYS; i++) { | 338 | for(int i = 0; i < NUMDAYS; i++) { |
339 | // if events are set for the day then remember to draw it bold | 339 | // if events are set for the day then remember to draw it bold |
340 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 340 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
341 | Event *event; | 341 | Event *event; |
342 | int numEvents = eventlist.count(); | 342 | int numEvents = eventlist.count(); |
343 | QString holiStr = ""; | 343 | QString holiStr = ""; |
344 | bDays.clearBit(i); | 344 | bDays.clearBit(i); |
345 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 345 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
346 | ushort recurType = event->recurrence()->doesRecur(); | 346 | ushort recurType = event->recurrence()->doesRecur(); |
347 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 347 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
348 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 348 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
349 | numEvents--; | 349 | numEvents--; |
350 | } | 350 | } |
351 | if ( event->isHoliday()) { | 351 | if ( event->isHoliday()) { |
352 | if ( !holiStr.isEmpty() ) | 352 | if ( !holiStr.isEmpty() ) |
353 | holiStr += "\n"; | 353 | holiStr += "\n"; |
354 | holiStr += event->summary(); | 354 | holiStr += event->summary(); |
355 | if ( !event->location().isEmpty() ) | 355 | if ( !event->location().isEmpty() ) |
356 | holiStr += " (" + event->location() + ")"; | 356 | holiStr += " (" + event->location() + ")"; |
357 | } | 357 | } |
358 | if ( event->isBirthday()) { | 358 | if ( event->isBirthday()) { |
359 | if ( !holiStr.isEmpty() ) | 359 | if ( !holiStr.isEmpty() ) |
360 | holiStr += "\n"; | 360 | holiStr += "\n"; |
361 | holiStr += i18n("Birthday") + ": "+event->summary(); | 361 | holiStr += i18n("Birthday") + ": "+event->summary(); |
362 | if ( !event->location().isEmpty() ) | 362 | if ( !event->location().isEmpty() ) |
363 | holiStr += " (" + event->location() + ")"; | 363 | holiStr += " (" + event->location() + ")"; |
364 | bDays.setBit(i); | 364 | bDays.setBit(i); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | events[i] = numEvents; | 367 | events[i] = numEvents; |
368 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 368 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
369 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 369 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
370 | !holiStr.isEmpty()) { | 370 | !holiStr.isEmpty()) { |
371 | mHolidays[i] = holiStr; | 371 | mHolidays[i] = holiStr; |
372 | } else { | 372 | } else { |
373 | mHolidays[i] = QString::null; | 373 | mHolidays[i] = QString::null; |
374 | } | 374 | } |
375 | } | 375 | } |
376 | if ( ! mPendingUpdateBeforeRepaint ) | 376 | if ( ! mPendingUpdateBeforeRepaint ) |
377 | repaint(false); | 377 | repaint(false); |
378 | } | 378 | } |
379 | void KODayMatrix::updateView(QDate actdate) | 379 | void KODayMatrix::updateView(QDate actdate) |
380 | { | 380 | { |
381 | 381 | ||
382 | if ( ! actdate.isValid() ) { | 382 | if ( ! actdate.isValid() ) { |
383 | //qDebug("date not valid "); | 383 | //qDebug("date not valid "); |
384 | return; | 384 | return; |
385 | } | 385 | } |
386 | mDayChanged = false; | 386 | mDayChanged = false; |
387 | //flag to indicate if the starting day of the matrix has changed by this call | 387 | //flag to indicate if the starting day of the matrix has changed by this call |
388 | //mDayChanged = false; | 388 | //mDayChanged = false; |
389 | // if a new startdate is to be set then apply Cornelius's calculation | 389 | // if a new startdate is to be set then apply Cornelius's calculation |
390 | // of the first day to be shown | 390 | // of the first day to be shown |
391 | if (actdate != startdate) { | 391 | if (actdate != startdate) { |
392 | // reset index of selection according to shift of starting date from startdate to actdate | 392 | // reset index of selection according to shift of starting date from startdate to actdate |
393 | if (mSelStart != NOSELECTION) { | 393 | if (mSelStart != NOSELECTION) { |
394 | int tmp = actdate.daysTo(startdate); | 394 | int tmp = actdate.daysTo(startdate); |
395 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 395 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
396 | // shift selection if new one would be visible at least partly ! | 396 | // shift selection if new one would be visible at least partly ! |
397 | 397 | ||
398 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 398 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
399 | // nested if is required for next X display pushed from a different month - correction required | 399 | // nested if is required for next X display pushed from a different month - correction required |
400 | // otherwise, for month forward and backward, it must be avoided | 400 | // otherwise, for month forward and backward, it must be avoided |
401 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 401 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
402 | mSelStart = mSelStart + tmp; | 402 | mSelStart = mSelStart + tmp; |
403 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 403 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
404 | mSelEnd = mSelEnd + tmp; | 404 | mSelEnd = mSelEnd + tmp; |
405 | } | 405 | } |
406 | } | 406 | } |
407 | startdate = actdate; | 407 | startdate = actdate; |
408 | mDayChanged = true; | 408 | mDayChanged = true; |
409 | recalculateToday(); | 409 | recalculateToday(); |
410 | } | 410 | } |
411 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 411 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
412 | if ( !isVisible() ) { | 412 | if ( !isVisible() ) { |
413 | mPendingUpdateBeforeRepaint = true; | 413 | mPendingUpdateBeforeRepaint = true; |
414 | } else { | 414 | } else { |
415 | #ifdef DESKTOP_VERSION | 415 | #ifdef DESKTOP_VERSION |
416 | //mRepaintTimer->start( 100 ); | 416 | //mRepaintTimer->start( 100 ); |
417 | mUpdateTimer->start( 100 ); | 417 | //updateViewTimed(); |
418 | mUpdateTimer->start( 20 ); | ||
418 | #else | 419 | #else |
419 | mRepaintTimer->start( 350 ); | 420 | mRepaintTimer->start( 350 ); |
420 | mUpdateTimer->start( 1200 ); | 421 | mUpdateTimer->start( 1200 ); |
421 | #endif | 422 | #endif |
422 | } | 423 | } |
423 | } | 424 | } |
424 | void KODayMatrix::updateEvents() | 425 | void KODayMatrix::updateEvents() |
425 | { | 426 | { |
426 | if ( !mCalendar ) return; | 427 | if ( !mCalendar ) return; |
427 | 428 | ||
428 | for( int i = 0; i < NUMDAYS; i++ ) { | 429 | for( int i = 0; i < NUMDAYS; i++ ) { |
429 | // if events are set for the day then remember to draw it bold | 430 | // if events are set for the day then remember to draw it bold |
430 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 431 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
431 | int numEvents = eventlist.count(); | 432 | int numEvents = eventlist.count(); |
432 | Event *event; | 433 | Event *event; |
433 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 434 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
434 | ushort recurType = event->doesRecur(); | 435 | ushort recurType = event->doesRecur(); |
435 | 436 | ||
436 | if ( ( recurType == Recurrence::rDaily && | 437 | if ( ( recurType == Recurrence::rDaily && |
437 | !KOPrefs::instance()->mDailyRecur ) || | 438 | !KOPrefs::instance()->mDailyRecur ) || |
438 | ( recurType == Recurrence::rWeekly && | 439 | ( recurType == Recurrence::rWeekly && |
439 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 440 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
440 | numEvents--; | 441 | numEvents--; |
441 | } | 442 | } |
442 | } | 443 | } |
443 | events[ i ] = numEvents; | 444 | events[ i ] = numEvents; |
444 | } | 445 | } |
445 | } | 446 | } |
446 | 447 | ||
447 | const QDate& KODayMatrix::getDate(int offset) | 448 | const QDate& KODayMatrix::getDate(int offset) |
448 | { | 449 | { |
449 | if (offset < 0 || offset > NUMDAYS-1) { | 450 | if (offset < 0 || offset > NUMDAYS-1) { |
450 | qDebug("Wrong offset2 %d", offset); | 451 | qDebug("Wrong offset2 %d", offset); |
451 | return days[0]; | 452 | return days[0]; |
452 | } | 453 | } |
453 | return days[offset]; | 454 | return days[offset]; |
454 | } | 455 | } |
455 | 456 | ||
456 | QString KODayMatrix::getHolidayLabel(int offset) | 457 | QString KODayMatrix::getHolidayLabel(int offset) |
457 | { | 458 | { |
458 | if (offset < 0 || offset > NUMDAYS-1) { | 459 | if (offset < 0 || offset > NUMDAYS-1) { |
459 | qDebug("Wrong offset1 %d", offset); | 460 | qDebug("Wrong offset1 %d", offset); |
460 | return QString(); | 461 | return QString(); |
461 | } | 462 | } |
462 | return mHolidays[offset]; | 463 | return mHolidays[offset]; |
463 | } | 464 | } |
464 | 465 | ||
465 | int KODayMatrix::getDayIndexFrom(int x, int y) | 466 | int KODayMatrix::getDayIndexFrom(int x, int y) |
466 | { | 467 | { |
467 | int colModulo = (width()-2) % 7; | 468 | int colModulo = (width()-2) % 7; |
468 | int rowModulo = (height()-2) % 6; | 469 | int rowModulo = (height()-2) % 6; |
469 | #if 0 | 470 | #if 0 |
470 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 471 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
471 | 6 - x/daysize.width() : x/daysize.width()); | 472 | 6 - x/daysize.width() : x/daysize.width()); |
472 | #endif | 473 | #endif |
473 | int xVal = (x-colModulo/2-2)/daysize.width(); | 474 | int xVal = (x-colModulo/2-2)/daysize.width(); |
474 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 475 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
475 | 476 | ||
476 | 477 | ||
477 | return 7*(yVal) + xVal; | 478 | return 7*(yVal) + xVal; |
478 | 479 | ||
479 | } | 480 | } |
480 | 481 | ||
481 | // ---------------------------------------------------------------------------- | 482 | // ---------------------------------------------------------------------------- |
482 | // M O U S E E V E N T H A N D L I N G | 483 | // M O U S E E V E N T H A N D L I N G |
483 | // ---------------------------------------------------------------------------- | 484 | // ---------------------------------------------------------------------------- |
484 | 485 | ||
485 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 486 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
486 | { | 487 | { |
487 | 488 | ||
488 | if ( e->button() == LeftButton ) | 489 | if ( e->button() == LeftButton ) |
489 | mouseDown = true; | 490 | mouseDown = true; |
490 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 491 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
491 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 492 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
492 | mSelInit = mSelStart; | 493 | mSelInit = mSelStart; |
493 | mSelEnd = mSelStart; | 494 | mSelEnd = mSelStart; |
494 | repaint(false); | 495 | repaint(false); |
495 | } | 496 | } |
496 | 497 | ||
497 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 498 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
498 | { | 499 | { |
499 | if ( e->button() == LeftButton ) | 500 | if ( e->button() == LeftButton ) |
500 | if ( ! mouseDown ) { | 501 | if ( ! mouseDown ) { |
501 | return; | 502 | return; |
502 | } | 503 | } |
503 | else | 504 | else |
504 | mouseDown = false; | 505 | mouseDown = false; |
505 | int tmp = getDayIndexFrom(e->x(), e->y()); | 506 | int tmp = getDayIndexFrom(e->x(), e->y()); |
506 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 507 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
507 | 508 | ||
508 | if (mSelInit > tmp) { | 509 | if (mSelInit > tmp) { |
509 | mSelEnd = mSelInit; | 510 | mSelEnd = mSelInit; |
510 | if (tmp != mSelStart) { | 511 | if (tmp != mSelStart) { |
511 | mSelStart = tmp; | 512 | mSelStart = tmp; |
512 | repaint(false); | 513 | repaint(false); |
513 | } | 514 | } |
514 | } else { | 515 | } else { |
515 | mSelStart = mSelInit; | 516 | mSelStart = mSelInit; |
516 | 517 | ||
517 | //repaint only if selection has changed | 518 | //repaint only if selection has changed |
518 | if (tmp != mSelEnd) { | 519 | if (tmp != mSelEnd) { |
519 | mSelEnd = tmp; | 520 | mSelEnd = tmp; |
520 | repaint(false); | 521 | repaint(false); |
521 | } | 522 | } |
522 | } | 523 | } |
523 | 524 | ||
524 | DateList daylist; | 525 | DateList daylist; |
525 | if ( mSelStart < 0 ) | 526 | if ( mSelStart < 0 ) |
526 | mSelStart = 0; | 527 | mSelStart = 0; |
527 | for (int i = mSelStart; i <= mSelEnd; i++) { | 528 | for (int i = mSelStart; i <= mSelEnd; i++) { |
528 | daylist.append(days[i]); | 529 | daylist.append(days[i]); |
529 | } | 530 | } |
530 | emit selected((const DateList)daylist); | 531 | emit selected((const DateList)daylist); |
531 | 532 | ||
532 | } | 533 | } |
533 | 534 | ||
534 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 535 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
535 | { | 536 | { |
536 | if ( ! mouseDown ) { | 537 | if ( ! mouseDown ) { |
537 | return; | 538 | return; |
538 | } | 539 | } |
539 | int tmp = getDayIndexFrom(e->x(), e->y()); | 540 | int tmp = getDayIndexFrom(e->x(), e->y()); |
540 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 541 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
541 | 542 | ||
542 | if (mSelInit > tmp) { | 543 | if (mSelInit > tmp) { |
543 | mSelEnd = mSelInit; | 544 | mSelEnd = mSelInit; |
544 | if (tmp != mSelStart) { | 545 | if (tmp != mSelStart) { |
545 | mSelStart = tmp; | 546 | mSelStart = tmp; |
546 | repaint(false); | 547 | repaint(false); |
547 | } | 548 | } |
548 | } else { | 549 | } else { |
549 | mSelStart = mSelInit; | 550 | mSelStart = mSelInit; |
550 | 551 | ||
551 | //repaint only if selection has changed | 552 | //repaint only if selection has changed |
552 | if (tmp != mSelEnd) { | 553 | if (tmp != mSelEnd) { |
553 | mSelEnd = tmp; | 554 | mSelEnd = tmp; |
554 | repaint(false); | 555 | repaint(false); |
555 | } | 556 | } |
556 | } | 557 | } |
557 | } | 558 | } |
558 | 559 | ||
559 | // ---------------------------------------------------------------------------- | 560 | // ---------------------------------------------------------------------------- |
560 | // D R A G ' N D R O P H A N D L I N G | 561 | // D R A G ' N D R O P H A N D L I N G |
561 | // ---------------------------------------------------------------------------- | 562 | // ---------------------------------------------------------------------------- |
562 | 563 | ||
563 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 564 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
564 | { | 565 | { |
565 | #ifndef KORG_NODND | 566 | #ifndef KORG_NODND |
566 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 567 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
567 | e->ignore(); | 568 | e->ignore(); |
568 | return; | 569 | return; |
569 | } | 570 | } |
570 | 571 | ||
571 | // some visual feedback | 572 | // some visual feedback |
572 | // oldPalette = palette(); | 573 | // oldPalette = palette(); |
573 | // setPalette(my_HilitePalette); | 574 | // setPalette(my_HilitePalette); |
574 | // update(); | 575 | // update(); |
575 | #endif | 576 | #endif |
576 | } | 577 | } |
577 | 578 | ||
578 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 579 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
579 | { | 580 | { |
580 | #ifndef KORG_NODND | 581 | #ifndef KORG_NODND |
581 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 582 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
582 | e->ignore(); | 583 | e->ignore(); |
583 | return; | 584 | return; |
584 | } | 585 | } |
585 | 586 | ||
586 | e->accept(); | 587 | e->accept(); |
587 | #endif | 588 | #endif |
588 | } | 589 | } |
589 | 590 | ||
590 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 591 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
591 | { | 592 | { |
592 | #ifndef KORG_NODND | 593 | #ifndef KORG_NODND |
593 | // setPalette(oldPalette); | 594 | // setPalette(oldPalette); |
594 | // update(); | 595 | // update(); |
595 | #endif | 596 | #endif |
596 | } | 597 | } |
597 | 598 | ||
598 | void KODayMatrix::dropEvent(QDropEvent *e) | 599 | void KODayMatrix::dropEvent(QDropEvent *e) |
599 | { | 600 | { |
600 | #ifndef KORG_NODND | 601 | #ifndef KORG_NODND |
601 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 602 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
602 | 603 | ||
603 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 604 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
604 | e->ignore(); | 605 | e->ignore(); |
605 | return; | 606 | return; |
606 | } | 607 | } |
607 | 608 | ||
608 | DndFactory factory( mCalendar ); | 609 | DndFactory factory( mCalendar ); |
609 | Event *event = factory.createDrop(e); | 610 | Event *event = factory.createDrop(e); |
@@ -654,278 +655,278 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
654 | { | 655 | { |
655 | QRect sz = frameRect(); | 656 | QRect sz = frameRect(); |
656 | if ( sz.width() <= 0 || sz.height() <= 0 ) | 657 | if ( sz.width() <= 0 || sz.height() <= 0 ) |
657 | return; | 658 | return; |
658 | if ( mPendingUpdateBeforeRepaint ) { | 659 | if ( mPendingUpdateBeforeRepaint ) { |
659 | updateViewTimed(); | 660 | updateViewTimed(); |
660 | mPendingUpdateBeforeRepaint = false; | 661 | mPendingUpdateBeforeRepaint = false; |
661 | } | 662 | } |
662 | if ( myPix.width() != sz.width() || myPix.height()!=sz.height() ) { | 663 | if ( myPix.width() != sz.width() || myPix.height()!=sz.height() ) { |
663 | myPix.resize(sz.size() ); | 664 | myPix.resize(sz.size() ); |
664 | } | 665 | } |
665 | QPainter p(&myPix); | 666 | QPainter p(&myPix); |
666 | p.setFont(font()); | 667 | p.setFont(font()); |
667 | 668 | ||
668 | 669 | ||
669 | int dheight = daysize.height(); | 670 | int dheight = daysize.height(); |
670 | int dwidth = daysize.width(); | 671 | int dwidth = daysize.width(); |
671 | int row,col; | 672 | int row,col; |
672 | int selw, selh; | 673 | int selw, selh; |
673 | int xyOff = frameWidth(); | 674 | int xyOff = frameWidth(); |
674 | int colModulo = sz.width() % 7; | 675 | int colModulo = sz.width() % 7; |
675 | int rowModulo = sz.height() % 6; | 676 | int rowModulo = sz.height() % 6; |
676 | //qDebug("col %d row %d ",colModulo,rowModulo ); | 677 | //qDebug("col %d row %d ",colModulo,rowModulo ); |
677 | 678 | ||
678 | bool isRTL = KOGlobals::self()->reverseLayout(); | 679 | bool isRTL = KOGlobals::self()->reverseLayout(); |
679 | 680 | ||
680 | // draw background and topleft frame | 681 | // draw background and topleft frame |
681 | p.fillRect(pevent->rect(), mDefaultBackColor); | 682 | p.fillRect(pevent->rect(), mDefaultBackColor); |
682 | p.setPen(mDefaultTextColor); | 683 | p.setPen(mDefaultTextColor); |
683 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 684 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
684 | int mSelStartT = mSelStart; | 685 | int mSelStartT = mSelStart; |
685 | int mSelEndT = mSelEnd; | 686 | int mSelEndT = mSelEnd; |
686 | if ( mSelEndT >= NUMDAYS ) | 687 | if ( mSelEndT >= NUMDAYS ) |
687 | mSelEndT = NUMDAYS-1; | 688 | mSelEndT = NUMDAYS-1; |
688 | // draw selected days with highlighted background color | 689 | // draw selected days with highlighted background color |
689 | if (mSelStart != NOSELECTION) { | 690 | if (mSelStart != NOSELECTION) { |
690 | bool skip = false; | 691 | bool skip = false; |
691 | if ( ! mouseDown ) { | 692 | if ( ! mouseDown ) { |
692 | int mo = days[20].month(); | 693 | int mo = days[20].month(); |
693 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | 694 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); |
694 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | 695 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); |
695 | int startMo = days[mSelStartT].month(); | 696 | int startMo = days[mSelStartT].month(); |
696 | int endMo = days[mSelEndT].month(); | 697 | int endMo = days[mSelEndT].month(); |
697 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) | 698 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) |
698 | startMo = 1; | 699 | startMo = 1; |
699 | if ( endMo == 1 && mo == 12 ) | 700 | if ( endMo == 1 && mo == 12 ) |
700 | endMo = 12; | 701 | endMo = 12; |
701 | if ( (startMo > mo || endMo < mo) ) { | 702 | if ( (startMo > mo || endMo < mo) ) { |
702 | skip = true; | 703 | skip = true; |
703 | } else { | 704 | } else { |
704 | if ( days[mSelStartT].month() != mo ) { | 705 | if ( days[mSelStartT].month() != mo ) { |
705 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | 706 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); |
706 | mSelStartT += add +1; | 707 | mSelStartT += add +1; |
707 | } | 708 | } |
708 | if ( days[mSelEndT].month() != mo ) { | 709 | if ( days[mSelEndT].month() != mo ) { |
709 | int sub = days[mSelEndT].day(); | 710 | int sub = days[mSelEndT].day(); |
710 | mSelEndT -= sub ; | 711 | mSelEndT -= sub ; |
711 | } | 712 | } |
712 | } | 713 | } |
713 | } | 714 | } |
714 | if ( ! skip ) { | 715 | if ( ! skip ) { |
715 | row = mSelStartT/7; | 716 | row = mSelStartT/7; |
716 | col = mSelStartT -row*7; | 717 | col = mSelStartT -row*7; |
717 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 718 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
718 | int addCol = 0; | 719 | int addCol = 0; |
719 | int addRow = 0; | 720 | int addRow = 0; |
720 | int addRow2 = 0; | 721 | int addRow2 = 0; |
721 | int addCol2 = 0; | 722 | int addCol2 = 0; |
722 | if (row == mSelEndT/7) { | 723 | if (row == mSelEndT/7) { |
723 | if ( rowModulo ) { | 724 | if ( rowModulo ) { |
724 | if ( row >= 6 - rowModulo ) | 725 | if ( row >= 6 - rowModulo ) |
725 | addRow = row - 5 + rowModulo; | 726 | addRow = row - 5 + rowModulo; |
726 | } | 727 | } |
727 | if ( colModulo ) { | 728 | if ( colModulo ) { |
728 | int colt1 = mSelEndT%7; | 729 | int colt1 = mSelEndT%7; |
729 | //qDebug("colt1 %d ", colt1 ); | 730 | //qDebug("colt1 %d ", colt1 ); |
730 | if ( colt1 >= 7 - colModulo ) | 731 | if ( colt1 >= 7 - colModulo ) |
731 | addCol = colt1 - 7 + colModulo+1; | 732 | addCol = colt1 - 7 + colModulo+1; |
732 | int colt = mSelStartT%7; | 733 | int colt = mSelStartT%7; |
733 | if ( colt >= 7 - colModulo ) | 734 | if ( colt >= 7 - colModulo ) |
734 | addCol2 = colt - 7 + colModulo; | 735 | addCol2 = colt - 7 + colModulo; |
735 | addCol -= addCol2; | 736 | addCol -= addCol2; |
736 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | 737 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); |
737 | } | 738 | } |
738 | // Single row selection | 739 | // Single row selection |
739 | if ( row == 0) | 740 | if ( row == 0) |
740 | addRow = 1; | 741 | addRow = 1; |
741 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, | 742 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
742 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 743 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
743 | } else { | 744 | } else { |
744 | // draw first row to the right | 745 | // draw first row to the right |
745 | if ( colModulo ) { | 746 | if ( colModulo ) { |
746 | if ( col >= 7 - colModulo ) | 747 | if ( col >= 7 - colModulo ) |
747 | addCol2 = col - 7 + colModulo; | 748 | addCol2 = col - 7 + colModulo; |
748 | } | 749 | } |
749 | if ( rowModulo ) { | 750 | if ( rowModulo ) { |
750 | if ( row >= 6 - rowModulo ) | 751 | if ( row >= 6 - rowModulo ) |
751 | addRow = row - 5 + rowModulo; | 752 | addRow = row - 5 + rowModulo; |
752 | } | 753 | } |
753 | if ( row == 0) | 754 | if ( row == 0) |
754 | addRow = 1; | 755 | addRow = 1; |
755 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, | 756 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, |
756 | dheight+1, selcol); | 757 | dheight+1, selcol); |
757 | // draw full block till last line | 758 | // draw full block till last line |
758 | selh = mSelEndT/7-row; | 759 | selh = mSelEndT/7-row; |
759 | addRow = 0; | 760 | addRow = 0; |
760 | if ( rowModulo ) { | 761 | if ( rowModulo ) { |
761 | if ( mSelEndT/7 >= 6 - rowModulo ) | 762 | if ( mSelEndT/7 >= 6 - rowModulo ) |
762 | addRow = mSelEndT/7 - 5 + rowModulo; | 763 | addRow = mSelEndT/7 - 5 + rowModulo; |
763 | } | 764 | } |
764 | if (selh > 1) { | 765 | if (selh > 1) { |
765 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); | 766 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); |
766 | } | 767 | } |
767 | // draw last block from left to mSelEndT | 768 | // draw last block from left to mSelEndT |
768 | selw = mSelEndT-7*(mSelEndT/7)+1; | 769 | selw = mSelEndT-7*(mSelEndT/7)+1; |
769 | //qDebug("esl %d ",selw ); | 770 | //qDebug("esl %d ",selw ); |
770 | int add = 0; | 771 | int add = 0; |
771 | if ( colModulo ) { | 772 | if ( colModulo ) { |
772 | add = 7 - colModulo; | 773 | add = 7 - colModulo; |
773 | if ( selw > add ) | 774 | if ( selw > add ) |
774 | add = selw - add; | 775 | add = selw - add; |
775 | else | 776 | else |
776 | add = 0; | 777 | add = 0; |
777 | } | 778 | } |
778 | //qDebug("add %d ", add); | 779 | //qDebug("add %d ", add); |
779 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, | 780 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, |
780 | selw*dwidth+add, dheight+1, selcol); | 781 | selw*dwidth+add, dheight+1, selcol); |
781 | } | 782 | } |
782 | } | 783 | } |
783 | } | 784 | } |
784 | 785 | ||
785 | // iterate over all days in the matrix and draw the day label in appropriate colors | 786 | // iterate over all days in the matrix and draw the day label in appropriate colors |
786 | QColor actcol = mDefaultTextColorShaded; | 787 | QColor actcol = mDefaultTextColorShaded; |
787 | p.setPen(actcol); | 788 | p.setPen(actcol); |
788 | QPen tmppen; | 789 | QPen tmppen; |
789 | for(int i = 0; i < NUMDAYS; i++) { | 790 | for(int i = 0; i < NUMDAYS; i++) { |
790 | row = i/7; | 791 | row = i/7; |
791 | col = isRTL ? 6-(i-row*7) : i-row*7; | 792 | col = isRTL ? 6-(i-row*7) : i-row*7; |
792 | 793 | ||
793 | // if it is the first day of a month switch color from normal to shaded and vice versa | 794 | // if it is the first day of a month switch color from normal to shaded and vice versa |
794 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 795 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
795 | if (actcol == mDefaultTextColorShaded) { | 796 | if (actcol == mDefaultTextColorShaded) { |
796 | actcol = mDefaultTextColor; | 797 | actcol = mDefaultTextColor; |
797 | } else { | 798 | } else { |
798 | actcol = mDefaultTextColorShaded; | 799 | actcol = mDefaultTextColorShaded; |
799 | } | 800 | } |
800 | p.setPen(actcol); | 801 | p.setPen(actcol); |
801 | } | 802 | } |
802 | if (actcol == mDefaultTextColorShaded) { | 803 | if (actcol == mDefaultTextColorShaded) { |
803 | if ( ! mouseDown ) { | 804 | if ( ! mouseDown ) { |
804 | continue; | 805 | continue; |
805 | } | 806 | } |
806 | } | 807 | } |
807 | //Reset pen color after selected days block | 808 | //Reset pen color after selected days block |
808 | if (i == mSelEndT+1) { | 809 | if (i == mSelEndT+1) { |
809 | p.setPen(actcol); | 810 | p.setPen(actcol); |
810 | } | 811 | } |
811 | 812 | ||
812 | // if today then draw rectangle around day | 813 | // if today then draw rectangle around day |
813 | if (today == i) { | 814 | if (today == i) { |
814 | tmppen = p.pen(); | 815 | tmppen = p.pen(); |
815 | QPen mTodayPen(p.pen()); | 816 | QPen mTodayPen(p.pen()); |
816 | if ( daysize.width() < 20 ) | 817 | if ( daysize.width() < 20 ) |
817 | mTodayPen.setWidth(1); | 818 | mTodayPen.setWidth(1); |
818 | else | 819 | else |
819 | mTodayPen.setWidth(mTodayMarginWidth); | 820 | mTodayPen.setWidth(mTodayMarginWidth); |
820 | //draw red rectangle for holidays | 821 | //draw red rectangle for holidays |
821 | if (!mHolidays[i].isNull()) { | 822 | if (!mHolidays[i].isNull()) { |
822 | if (actcol == mDefaultTextColor) { | 823 | if (actcol == mDefaultTextColor) { |
823 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 824 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
824 | } else { | 825 | } else { |
825 | mTodayPen.setColor(mHolidayColorShaded); | 826 | mTodayPen.setColor(mHolidayColorShaded); |
826 | } | 827 | } |
827 | } | 828 | } |
828 | //draw gray rectangle for today if in selection | 829 | //draw gray rectangle for today if in selection |
829 | if (i >= mSelStartT && i <= mSelEndT) { | 830 | if (i >= mSelStartT && i <= mSelEndT) { |
830 | QColor grey("grey"); | 831 | QColor grey("grey"); |
831 | mTodayPen.setColor(grey); | 832 | mTodayPen.setColor(grey); |
832 | } | 833 | } |
833 | p.setPen(mTodayPen); | 834 | p.setPen(mTodayPen); |
834 | 835 | ||
835 | 836 | ||
836 | int addCol = 0; | 837 | int addCol = 0; |
837 | int addRow = 0; | 838 | int addRow = 0; |
838 | if (rowModulo) { | 839 | if (rowModulo) { |
839 | if ( row >= 6 - rowModulo ) | 840 | if ( row >= 6 - rowModulo ) |
840 | addRow = row - 5 + rowModulo; | 841 | addRow = row - 5 + rowModulo; |
841 | } | 842 | } |
842 | if ( colModulo ) { | 843 | if ( colModulo ) { |
843 | if ( col >= 7 - colModulo ) | 844 | if ( col >= 7 - colModulo ) |
844 | addCol = col - 6 + colModulo-1; | 845 | addCol = col - 6 + colModulo-1; |
845 | } | 846 | } |
846 | if ( col == 0 ) | 847 | |
847 | addCol = 1; | 848 | addCol += 1; |
848 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); | 849 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); |
849 | p.setPen(tmppen); | 850 | p.setPen(tmppen); |
850 | } | 851 | } |
851 | 852 | ||
852 | // if any events are on that day then draw it using a bold font | 853 | // if any events are on that day then draw it using a bold font |
853 | if (events[i] > 0) { | 854 | if (events[i] > 0) { |
854 | QFont myFont = font(); | 855 | QFont myFont = font(); |
855 | myFont.setBold(true); | 856 | myFont.setBold(true); |
856 | p.setFont(myFont); | 857 | p.setFont(myFont); |
857 | } | 858 | } |
858 | 859 | ||
859 | // if it is a holiday then use the default holiday color | 860 | // if it is a holiday then use the default holiday color |
860 | if (!mHolidays[i].isNull()) { | 861 | if (!mHolidays[i].isNull()) { |
861 | if ( bDays.testBit(i) ) { | 862 | if ( bDays.testBit(i) ) { |
862 | p.setPen(Qt::green); | 863 | p.setPen(Qt::green); |
863 | } else { | 864 | } else { |
864 | if (actcol == mDefaultTextColor) { | 865 | if (actcol == mDefaultTextColor) { |
865 | p.setPen(KOPrefs::instance()->mHolidayColor); | 866 | p.setPen(KOPrefs::instance()->mHolidayColor); |
866 | } else { | 867 | } else { |
867 | p.setPen(mHolidayColorShaded); | 868 | p.setPen(mHolidayColorShaded); |
868 | } | 869 | } |
869 | } | 870 | } |
870 | } | 871 | } |
871 | 872 | ||
872 | // draw selected days with special color | 873 | // draw selected days with special color |
873 | // DO NOT specially highlight holidays in selection ! | 874 | // DO NOT specially highlight holidays in selection ! |
874 | if (i >= mSelStartT && i <= mSelEndT) { | 875 | if (i >= mSelStartT && i <= mSelEndT) { |
875 | ;//p.setPen(mSelectedDaysColor); | 876 | ;//p.setPen(mSelectedDaysColor); |
876 | } | 877 | } |
877 | 878 | ||
878 | int addCol = 0; | 879 | int addCol = 0; |
879 | int addRow = 0; | 880 | int addRow = 0; |
880 | if ( colModulo ) { | 881 | if ( colModulo ) { |
881 | if ( col >= 7 - colModulo ) | 882 | if ( col >= 7 - colModulo ) |
882 | addCol = col - 7 + colModulo; | 883 | addCol = col - 7 + colModulo; |
883 | } | 884 | } |
884 | if ( rowModulo ) { | 885 | if ( rowModulo ) { |
885 | if ( row >= 6 - rowModulo ) | 886 | if ( row >= 6 - rowModulo ) |
886 | addRow = row - 5 + rowModulo; | 887 | addRow = row - 5 + rowModulo; |
887 | } | 888 | } |
888 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 889 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
889 | ++addCol;//++addCol; | 890 | ++addCol;//++addCol; |
890 | if ( row == 0) | 891 | if ( row == 0) |
891 | addRow = 1; | 892 | addRow = 1; |
892 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 893 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
893 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 894 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
894 | 895 | ||
895 | // reset color to actual color | 896 | // reset color to actual color |
896 | if (!mHolidays[i].isNull()) { | 897 | if (!mHolidays[i].isNull()) { |
897 | p.setPen(actcol); | 898 | p.setPen(actcol); |
898 | } | 899 | } |
899 | // reset bold font to plain font | 900 | // reset bold font to plain font |
900 | if (events[i] > 0) { | 901 | if (events[i] > 0) { |
901 | QFont myFont = font(); | 902 | QFont myFont = font(); |
902 | myFont.setBold(false); | 903 | myFont.setBold(false); |
903 | p.setFont(myFont); | 904 | p.setFont(myFont); |
904 | } | 905 | } |
905 | } | 906 | } |
906 | int off = xyOff; | 907 | int off = xyOff; |
907 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); | 908 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); |
908 | //qDebug("ffffffffff %d ", off); | 909 | //qDebug("ffffffffff %d ", off); |
909 | } | 910 | } |
910 | 911 | ||
911 | // ---------------------------------------------------------------------------- | 912 | // ---------------------------------------------------------------------------- |
912 | // R E SI Z E E V E N T H A N D L I N G | 913 | // R E SI Z E E V E N T H A N D L I N G |
913 | // ---------------------------------------------------------------------------- | 914 | // ---------------------------------------------------------------------------- |
914 | 915 | ||
915 | void KODayMatrix::resizeEvent(QResizeEvent *) | 916 | void KODayMatrix::resizeEvent(QResizeEvent *) |
916 | { | 917 | { |
917 | QRect sz = frameRect(); | 918 | QRect sz = frameRect(); |
918 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 919 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
919 | daysize.setWidth(sz.width() / 7); | 920 | daysize.setWidth(sz.width() / 7); |
920 | } | 921 | } |
921 | 922 | ||
922 | QSize KODayMatrix::sizeHint() const | 923 | QSize KODayMatrix::sizeHint() const |
923 | { | 924 | { |
924 | 925 | ||
925 | QFontMetrics fm ( font() ); | 926 | QFontMetrics fm ( font() ); |
926 | int wid = fm.width( "30") *7+3; | 927 | int wid = fm.width( "30") *7+3; |
927 | int hei = fm.height() * 6+3; | 928 | int hei = fm.height() * 6+3; |
928 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | 929 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); |
929 | return QSize ( wid, hei ); | 930 | return QSize ( wid, hei ); |
930 | 931 | ||
931 | } | 932 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 76982b4..9fd1f68 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -116,385 +116,385 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
116 | { | 116 | { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
121 | break; | 121 | break; |
122 | case Key_Up: | 122 | case Key_Up: |
123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | setCurrentItem((currentItem()+count()-1)%count()); |
128 | if(!itemVisible(currentItem())) { | 128 | if(!itemVisible(currentItem())) { |
129 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if((unsigned int) currentItem() == (count()-1)) { |
130 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | setTopItem(currentItem()-numItemsVisible()+1); |
131 | } else { | 131 | } else { |
132 | setTopItem(topItem()-1); | 132 | setTopItem(topItem()-1); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | break; | 135 | break; |
136 | case Key_Down: | 136 | case Key_Down: |
137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
138 | e->ignore(); | 138 | e->ignore(); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | setCurrentItem((currentItem()+1)%count()); | 141 | setCurrentItem((currentItem()+1)%count()); |
142 | if(!itemVisible(currentItem())) { | 142 | if(!itemVisible(currentItem())) { |
143 | if(currentItem() == 0) { | 143 | if(currentItem() == 0) { |
144 | setTopItem(0); | 144 | setTopItem(0); |
145 | } else { | 145 | } else { |
146 | setTopItem(topItem()+1); | 146 | setTopItem(topItem()+1); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | break; | 149 | break; |
150 | case Key_I: | 150 | case Key_I: |
151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
152 | e->ignore(); | 152 | e->ignore(); |
153 | break; | 153 | break; |
154 | case Key_Shift: | 154 | case Key_Shift: |
155 | emit shiftDown(); | 155 | emit shiftDown(); |
156 | break; | 156 | break; |
157 | default: | 157 | default: |
158 | e->ignore(); | 158 | e->ignore(); |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void KNoScrollListBox::oneDown() | 163 | void KNoScrollListBox::oneDown() |
164 | { | 164 | { |
165 | setCurrentItem((currentItem()+1)%count()); | 165 | setCurrentItem((currentItem()+1)%count()); |
166 | if(!itemVisible(currentItem())) { | 166 | if(!itemVisible(currentItem())) { |
167 | if(currentItem() == 0) { | 167 | if(currentItem() == 0) { |
168 | setTopItem(0); | 168 | setTopItem(0); |
169 | } else { | 169 | } else { |
170 | setTopItem(topItem()+1); | 170 | setTopItem(topItem()+1); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
175 | { | 175 | { |
176 | switch(e->key()) { | 176 | switch(e->key()) { |
177 | case Key_Shift: | 177 | case Key_Shift: |
178 | emit shiftUp(); | 178 | emit shiftUp(); |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
186 | { | 186 | { |
187 | QListBox::mousePressEvent(e); | 187 | QListBox::mousePressEvent(e); |
188 | 188 | ||
189 | if(e->button() == RightButton) { | 189 | if(e->button() == RightButton) { |
190 | emit rightClick(); | 190 | emit rightClick(); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
195 | : QListBoxItem() | 195 | : QListBoxItem() |
196 | { | 196 | { |
197 | setText( s ); | 197 | setText( s ); |
198 | mMultiday = 0; | 198 | mMultiday = 0; |
199 | mIncidence = incidence; | 199 | mIncidence = incidence; |
200 | mDate = qd; | 200 | mDate = qd; |
201 | mRecur = false; | 201 | mRecur = false; |
202 | mAlarm = false; | 202 | mAlarm = false; |
203 | mReply = false; | 203 | mReply = false; |
204 | mInfo = false; | 204 | mInfo = false; |
205 | } | 205 | } |
206 | 206 | ||
207 | void MonthViewItem::paint(QPainter *p) | 207 | void MonthViewItem::paint(QPainter *p) |
208 | { | 208 | { |
209 | #if QT_VERSION >= 0x030000 | 209 | #if QT_VERSION >= 0x030000 |
210 | bool sel = isSelected(); | 210 | bool sel = isSelected(); |
211 | #else | 211 | #else |
212 | bool sel = selected(); | 212 | bool sel = selected(); |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | 215 | ||
216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
217 | { | 217 | { |
218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
221 | } | 221 | } |
222 | int x = 1; | 222 | int x = 1; |
223 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 223 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
224 | int size = PIXMAP_SIZE; | 224 | int size = PIXMAP_SIZE; |
225 | if ( QApplication::desktop()->width() < 300 ) | 225 | if ( QApplication::desktop()->width() < 300 ) |
226 | size = 3; | 226 | size = 3; |
227 | int heihei = height( listBox () ); | 227 | int heihei = height( listBox () ); |
228 | int y = (heihei - size -1 ) /2; | 228 | int y = (heihei - size -1 ) /2; |
229 | 229 | ||
230 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 230 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
231 | if ( mInfo ) { | 231 | if ( mInfo ) { |
232 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 232 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
233 | x += size + 1; | 233 | x += size + 1; |
234 | } | 234 | } |
235 | if ( mRecur ) { | 235 | if ( mRecur ) { |
236 | p->fillRect ( x, y,size,size, Qt::blue ); | 236 | p->fillRect ( x, y,size,size, Qt::blue ); |
237 | x += size + 1; | 237 | x += size + 1; |
238 | } | 238 | } |
239 | if ( mAlarm ) { | 239 | if ( mAlarm ) { |
240 | p->fillRect ( x, y,size,size, Qt::red ); | 240 | p->fillRect ( x, y,size,size, Qt::red ); |
241 | x += size + 1; | 241 | x += size + 1; |
242 | } | 242 | } |
243 | if ( mReply ) { | 243 | if ( mReply ) { |
244 | p->fillRect ( x, y,size,size, Qt::yellow ); | 244 | p->fillRect ( x, y,size,size, Qt::yellow ); |
245 | x += size + 1; | 245 | x += size + 1; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | if ( mMultiday ) { | 248 | if ( mMultiday ) { |
249 | int yyy = y+(size/2); | 249 | int yyy = y+(size/2); |
250 | int sizeM = size+2; | 250 | int sizeM = size+2; |
251 | p->setBrush( QBrush::SolidPattern ); | 251 | p->setBrush( QBrush::SolidPattern ); |
252 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 252 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
253 | if ( mMultiday == 2 || mMultiday == 3 ) { | 253 | if ( mMultiday == 2 || mMultiday == 3 ) { |
254 | QPointArray pa ( 3 ); | 254 | QPointArray pa ( 3 ); |
255 | pa.setPoint (0, x, yyy ); | 255 | pa.setPoint (0, x, yyy ); |
256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
258 | p->drawPolygon( pa ); | 258 | p->drawPolygon( pa ); |
259 | } | 259 | } |
260 | if ( mMultiday == 2 || mMultiday == 1 ) { | 260 | if ( mMultiday == 2 || mMultiday == 1 ) { |
261 | QPointArray pa ( 3 ); | 261 | QPointArray pa ( 3 ); |
262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
265 | p->drawPolygon( pa ); | 265 | p->drawPolygon( pa ); |
266 | } | 266 | } |
267 | if ( mMultiday == 1 ) { | 267 | if ( mMultiday == 1 ) { |
268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
269 | 269 | ||
270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
271 | } | 271 | } |
272 | if ( mMultiday == 3 ) { | 272 | if ( mMultiday == 3 ) { |
273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
275 | 275 | ||
276 | } | 276 | } |
277 | x += sizeM/2 + 1; | 277 | x += sizeM/2 + 1; |
278 | x += sizeM + 1; | 278 | x += sizeM + 1; |
279 | } | 279 | } |
280 | 280 | ||
281 | if ( mIncidence->type() == "Todo" ){ | 281 | if ( mIncidence->type() == "Todo" ){ |
282 | Todo* td = ( Todo* ) mIncidence; | 282 | Todo* td = ( Todo* ) mIncidence; |
283 | if ( td->isCompleted() ) { | 283 | if ( td->isCompleted() ) { |
284 | int half = size/2; | 284 | int half = size/2; |
285 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 285 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
286 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 286 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
287 | x += half+half + 4; | 287 | x += half+half + 4; |
288 | 288 | ||
289 | } else { | 289 | } else { |
290 | int val = td->percentComplete()/20; | 290 | int val = td->percentComplete()/20; |
291 | p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); | 291 | p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); |
292 | p->drawRect ( x, y-1,7,size+2); | 292 | p->drawRect ( x, y-1,7,size+2); |
293 | x += size + 3; | 293 | x += size + 3; |
294 | } | 294 | } |
295 | } | 295 | } |
296 | QFontMetrics fm = p->fontMetrics(); | 296 | QFontMetrics fm = p->fontMetrics(); |
297 | int yPos; | 297 | int yPos; |
298 | int pmheight = size; | 298 | int pmheight = size; |
299 | if( pmheight < fm.height() ) | 299 | if( pmheight < fm.height() ) |
300 | yPos = fm.ascent() + fm.leading()/2; | 300 | yPos = fm.ascent() + fm.leading()/2; |
301 | else | 301 | else |
302 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 302 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
303 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 303 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
304 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 304 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
305 | p->drawText( x, yPos, text() ); | 305 | p->drawText( x, yPos, text() ); |
306 | if ( mIncidence->cancelled() ) { | 306 | if ( mIncidence->cancelled() ) { |
307 | int wid = fm.width( text() ); | 307 | int wid = fm.width( text() ); |
308 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 308 | p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 ); |
309 | } | 309 | } |
310 | 310 | ||
311 | } | 311 | } |
312 | 312 | ||
313 | int MonthViewItem::height(const QListBox *lb) const | 313 | int MonthViewItem::height(const QListBox *lb) const |
314 | { | 314 | { |
315 | if ( lb ) | 315 | if ( lb ) |
316 | return lb->fontMetrics().lineSpacing()+1; | 316 | return lb->fontMetrics().lineSpacing()+1; |
317 | return 10; | 317 | return 10; |
318 | } | 318 | } |
319 | 319 | ||
320 | int MonthViewItem::width(const QListBox *lb) const | 320 | int MonthViewItem::width(const QListBox *lb) const |
321 | { | 321 | { |
322 | int size = PIXMAP_SIZE; | 322 | int size = PIXMAP_SIZE; |
323 | if ( QApplication::desktop()->width() < 300 ) | 323 | if ( QApplication::desktop()->width() < 300 ) |
324 | size = 3; | 324 | size = 3; |
325 | int x = 1; | 325 | int x = 1; |
326 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 326 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
327 | if ( mInfo ) { | 327 | if ( mInfo ) { |
328 | x += size + 1; | 328 | x += size + 1; |
329 | } | 329 | } |
330 | if( mRecur ) { | 330 | if( mRecur ) { |
331 | x += size+1; | 331 | x += size+1; |
332 | } | 332 | } |
333 | if( mAlarm ) { | 333 | if( mAlarm ) { |
334 | x += size+1; | 334 | x += size+1; |
335 | } | 335 | } |
336 | if( mReply ) { | 336 | if( mReply ) { |
337 | x += size+1; | 337 | x += size+1; |
338 | } | 338 | } |
339 | } | 339 | } |
340 | if( mMultiday ) { | 340 | if( mMultiday ) { |
341 | x += size+1+2+size/2; | 341 | x += size+1+2+size/2; |
342 | } | 342 | } |
343 | 343 | ||
344 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 344 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 348 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
349 | : QWidget( par ), | 349 | : QWidget( par ), |
350 | mMonthView( parent ) | 350 | mMonthView( parent ) |
351 | { | 351 | { |
352 | 352 | ||
353 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 353 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
354 | 354 | ||
355 | // mLabel = new QLabel( this );QPushButton | 355 | // mLabel = new QLabel( this );QPushButton |
356 | mLabel = new QPushButton( this ); | 356 | mLabel = new QPushButton( this ); |
357 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 357 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
358 | //mLabel->setLineWidth( 1 ); | 358 | //mLabel->setLineWidth( 1 ); |
359 | //mLabel->setAlignment( AlignCenter ); | 359 | //mLabel->setAlignment( AlignCenter ); |
360 | mLabel->setFlat( true ); | 360 | mLabel->setFlat( true ); |
361 | mLabel->setFocusPolicy(NoFocus); | 361 | mLabel->setFocusPolicy(NoFocus); |
362 | mItemList = new KNoScrollListBox( this ); | 362 | mItemList = new KNoScrollListBox( this ); |
363 | mItemList->setMinimumSize( 10, 10 ); | 363 | mItemList->setMinimumSize( 10, 10 ); |
364 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 364 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
365 | mItemList->setLineWidth( 1 ); | 365 | mItemList->setLineWidth( 1 ); |
366 | topLayout->addWidget( mItemList ); | 366 | topLayout->addWidget( mItemList ); |
367 | mLabel->raise(); | 367 | mLabel->raise(); |
368 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 368 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
369 | mStandardPalette = palette(); | 369 | mStandardPalette = palette(); |
370 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 370 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
371 | 371 | ||
372 | enableScrollBars( false ); | 372 | enableScrollBars( false ); |
373 | updateConfig(); | 373 | updateConfig(); |
374 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 374 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
375 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 375 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
376 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 376 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
377 | SLOT( defaultAction( QListBoxItem * ) ) ); | 377 | SLOT( defaultAction( QListBoxItem * ) ) ); |
378 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 378 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
379 | const QPoint &) ), | 379 | const QPoint &) ), |
380 | SLOT( contextMenu( QListBoxItem * ) ) ); | 380 | SLOT( contextMenu( QListBoxItem * ) ) ); |
381 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 381 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
382 | SLOT( selection( QListBoxItem * ) ) ); | 382 | SLOT( selection( QListBoxItem * ) ) ); |
383 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 383 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
384 | SLOT( cellClicked( QListBoxItem * ) ) ); | 384 | SLOT( cellClicked( QListBoxItem * ) ) ); |
385 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 385 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
386 | SLOT( selection( QListBoxItem * ) ) ); | 386 | SLOT( selection( QListBoxItem * ) ) ); |
387 | } | 387 | } |
388 | #ifdef DESKTOP_VERSION | 388 | #ifdef DESKTOP_VERSION |
389 | QToolTipGroup *MonthViewCell::toolTipGroup() | 389 | QToolTipGroup *MonthViewCell::toolTipGroup() |
390 | { | 390 | { |
391 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 391 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
392 | return mToolTipGroup; | 392 | return mToolTipGroup; |
393 | } | 393 | } |
394 | #endif | 394 | #endif |
395 | 395 | ||
396 | void MonthViewCell::setDate( const QDate &date ) | 396 | void MonthViewCell::setDate( const QDate &date ) |
397 | { | 397 | { |
398 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 398 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
399 | mDate = date; | 399 | mDate = date; |
400 | 400 | ||
401 | 401 | ||
402 | 402 | ||
403 | //resizeEvent( 0 ); | 403 | //resizeEvent( 0 ); |
404 | } | 404 | } |
405 | 405 | ||
406 | QDate MonthViewCell::date() const | 406 | QDate MonthViewCell::date() const |
407 | { | 407 | { |
408 | return mDate; | 408 | return mDate; |
409 | } | 409 | } |
410 | 410 | ||
411 | void MonthViewCell::setPrimary( bool primary ) | 411 | void MonthViewCell::setPrimary( bool primary ) |
412 | { | 412 | { |
413 | mPrimary = primary; | 413 | mPrimary = primary; |
414 | //setMyPalette(); | 414 | //setMyPalette(); |
415 | } | 415 | } |
416 | void MonthViewCell::setMyPalette() | 416 | void MonthViewCell::setMyPalette() |
417 | { | 417 | { |
418 | 418 | ||
419 | if ( mHoliday) { | 419 | if ( mHoliday) { |
420 | setPalette( mHolidayPalette ); | 420 | setPalette( mHolidayPalette ); |
421 | } else { | 421 | } else { |
422 | if ( mPrimary ) { | 422 | if ( mPrimary ) { |
423 | setPalette( mPrimaryPalette ); | 423 | setPalette( mPrimaryPalette ); |
424 | } else { | 424 | } else { |
425 | setPalette( mNonPrimaryPalette ); | 425 | setPalette( mNonPrimaryPalette ); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | QPalette pal = palette(); | 428 | QPalette pal = palette(); |
429 | 429 | ||
430 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 430 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
431 | } | 431 | } |
432 | QPalette MonthViewCell::getPalette () | 432 | QPalette MonthViewCell::getPalette () |
433 | { | 433 | { |
434 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 434 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
435 | return mStandardPalette; | 435 | return mStandardPalette; |
436 | if ( mHoliday) { | 436 | if ( mHoliday) { |
437 | return mHolidayPalette ; | 437 | return mHolidayPalette ; |
438 | } else { | 438 | } else { |
439 | if ( mPrimary ) { | 439 | if ( mPrimary ) { |
440 | return mPrimaryPalette ; | 440 | return mPrimaryPalette ; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | return mNonPrimaryPalette; | 443 | return mNonPrimaryPalette; |
444 | } | 444 | } |
445 | bool MonthViewCell::isPrimary() const | 445 | bool MonthViewCell::isPrimary() const |
446 | { | 446 | { |
447 | return mPrimary; | 447 | return mPrimary; |
448 | } | 448 | } |
449 | 449 | ||
450 | void MonthViewCell::setHoliday( bool holiday ) | 450 | void MonthViewCell::setHoliday( bool holiday ) |
451 | { | 451 | { |
452 | mHoliday = holiday; | 452 | mHoliday = holiday; |
453 | //setMyPalette(); | 453 | //setMyPalette(); |
454 | } | 454 | } |
455 | 455 | ||
456 | void MonthViewCell::setHoliday( const QString &holiday ) | 456 | void MonthViewCell::setHoliday( const QString &holiday ) |
457 | { | 457 | { |
458 | mHolidayString = holiday; | 458 | mHolidayString = holiday; |
459 | 459 | ||
460 | if ( !holiday.isEmpty() ) { | 460 | if ( !holiday.isEmpty() ) { |
461 | setHoliday( true ); | 461 | setHoliday( true ); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 464 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
465 | { | 465 | { |
466 | 466 | ||
467 | e->ignore(); | 467 | e->ignore(); |
468 | 468 | ||
469 | } | 469 | } |
470 | 470 | ||
471 | void MonthViewCell::startUpdateCell() | 471 | void MonthViewCell::startUpdateCell() |
472 | { | 472 | { |
473 | 473 | ||
474 | mItemList->setFocusPolicy(NoFocus); | 474 | mItemList->setFocusPolicy(NoFocus); |
475 | if ( !mMonthView->isUpdatePossible() ) | 475 | if ( !mMonthView->isUpdatePossible() ) |
476 | return; | 476 | return; |
477 | 477 | ||
478 | /* | 478 | /* |
479 | if ( !isVisible() ){ | 479 | if ( !isVisible() ){ |
480 | return; | 480 | return; |
481 | } | 481 | } |
482 | */ | 482 | */ |
483 | // qDebug("MonthViewCell::updateCell() "); | 483 | // qDebug("MonthViewCell::updateCell() "); |
484 | setPrimary( mDate.month()%2 ); | 484 | setPrimary( mDate.month()%2 ); |
485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
486 | if ( mDate == QDate::currentDate() ) { | 486 | if ( mDate == QDate::currentDate() ) { |
487 | mItemList->setLineWidth( 3 ); | 487 | mItemList->setLineWidth( 3 ); |
488 | } else { | 488 | } else { |
489 | mItemList->setLineWidth( 1 ); | 489 | mItemList->setLineWidth( 1 ); |
490 | } | 490 | } |
491 | mItemList->clear(); | 491 | mItemList->clear(); |
492 | 492 | ||
493 | #ifdef DESKTOP_VERSION | 493 | #ifdef DESKTOP_VERSION |
494 | QToolTip::remove(this); | 494 | QToolTip::remove(this); |
495 | #endif | 495 | #endif |
496 | mToolTip.clear(); | 496 | mToolTip.clear(); |
497 | //qApp->processEvents(); | 497 | //qApp->processEvents(); |
498 | if ( !mHolidayString.isEmpty() ) { | 498 | if ( !mHolidayString.isEmpty() ) { |
499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
500 | item->setPalette( mHolidayPalette ); | 500 | item->setPalette( mHolidayPalette ); |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 1b4ee52..06f5ef8 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,272 +1,272 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | bool isRTL = KOGlobals::self()->reverseLayout(); | 67 | bool isRTL = KOGlobals::self()->reverseLayout(); |
68 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
69 | bool isDesktop = false; | 69 | bool isDesktop = false; |
70 | #else | 70 | #else |
71 | bool isDesktop = true; | 71 | bool isDesktop = true; |
72 | #endif | 72 | #endif |
73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
74 | isDesktop = true; | 74 | isDesktop = true; |
75 | // Create backward navigation buttons | 75 | // Create backward navigation buttons |
76 | mPrevYear = new QPushButton( mCtrlFrame ); | 76 | mPrevYear = new QPushButton( mCtrlFrame ); |
77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
79 | 79 | ||
80 | mPrevMonth = new QPushButton( mCtrlFrame ); | 80 | mPrevMonth = new QPushButton( mCtrlFrame ); |
81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
83 | 83 | ||
84 | // Create forward navigation buttons | 84 | // Create forward navigation buttons |
85 | mNextMonth = new QPushButton( mCtrlFrame ); | 85 | mNextMonth = new QPushButton( mCtrlFrame ); |
86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
87 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 87 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
88 | 88 | ||
89 | mPrevWeek = new QPushButton( mCtrlFrame ); | 89 | mPrevWeek = new QPushButton( mCtrlFrame ); |
90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); | 91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); |
92 | 92 | ||
93 | // Create forward navigation buttons | 93 | // Create forward navigation buttons |
94 | mNextWeek = new QPushButton( mCtrlFrame ); | 94 | mNextWeek = new QPushButton( mCtrlFrame ); |
95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
96 | QToolTip::add( mNextWeek, i18n("Next Week") ); | 96 | QToolTip::add( mNextWeek, i18n("Next Week") ); |
97 | 97 | ||
98 | mNextYear = new QPushButton( mCtrlFrame ); | 98 | mNextYear = new QPushButton( mCtrlFrame ); |
99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
100 | QToolTip::add( mNextYear, i18n("Next Year") ); | 100 | QToolTip::add( mNextYear, i18n("Next Year") ); |
101 | mSelectMonth = new QPushButton( mCtrlFrame ); | 101 | mSelectMonth = new QPushButton( mCtrlFrame ); |
102 | // Create month name label | 102 | // Create month name label |
103 | //selectMonth->setFont( tfont ); | 103 | //selectMonth->setFont( tfont ); |
104 | // selectMonth->setAlignment( AlignCenter ); | 104 | // selectMonth->setAlignment( AlignCenter ); |
105 | //mDateLabel = new QLabel( selectMonth ); | 105 | //mDateLabel = new QLabel( selectMonth ); |
106 | //mDateLabel->setFont( tfont ); | 106 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 107 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 108 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 109 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 110 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
116 | } else { | 116 | } else { |
117 | mPrevWeek->hide(); | 117 | mPrevWeek->hide(); |
118 | mNextWeek->hide(); | 118 | mNextWeek->hide(); |
119 | } | 119 | } |
120 | 120 | ||
121 | resetFont( font() ); | 121 | resetFont( font() ); |
122 | 122 | ||
123 | 123 | ||
124 | // set up control frame layout | 124 | // set up control frame layout |
125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
126 | ctrlLayout->addWidget( mPrevYear, 3 ); | 126 | ctrlLayout->addWidget( mPrevYear, 3 ); |
127 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 127 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
128 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 128 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
129 | //ctrlLayout->addStretch( 1 ); | 129 | //ctrlLayout->addStretch( 1 ); |
130 | // ctrlLayout->addSpacing( 1 ); | 130 | // ctrlLayout->addSpacing( 1 ); |
131 | // ctrlLayout->addWidget( mDateLabel ); | 131 | // ctrlLayout->addWidget( mDateLabel ); |
132 | ctrlLayout->addWidget( mSelectMonth ); | 132 | ctrlLayout->addWidget( mSelectMonth ); |
133 | // ctrlLayout->addSpacing( 1 ); | 133 | // ctrlLayout->addSpacing( 1 ); |
134 | // ctrlLayout->addStretch( 1 ); | 134 | // ctrlLayout->addStretch( 1 ); |
135 | ctrlLayout->addWidget( mNextWeek, 3 ); | 135 | ctrlLayout->addWidget( mNextWeek, 3 ); |
136 | ctrlLayout->addWidget( mNextMonth, 3 ); | 136 | ctrlLayout->addWidget( mNextMonth, 3 ); |
137 | ctrlLayout->addWidget( mNextYear, 3 ); | 137 | ctrlLayout->addWidget( mNextYear, 3 ); |
138 | 138 | ||
139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
146 | mPrevYear->setFocusPolicy(NoFocus); | 146 | mPrevYear->setFocusPolicy(NoFocus); |
147 | mPrevMonth->setFocusPolicy(NoFocus); | 147 | mPrevMonth->setFocusPolicy(NoFocus); |
148 | mNextMonth->setFocusPolicy(NoFocus); | 148 | mNextMonth->setFocusPolicy(NoFocus); |
149 | mPrevWeek->setFocusPolicy(NoFocus); | 149 | mPrevWeek->setFocusPolicy(NoFocus); |
150 | mNextWeek->setFocusPolicy(NoFocus); | 150 | mNextWeek->setFocusPolicy(NoFocus); |
151 | mNextYear->setFocusPolicy(NoFocus); | 151 | mNextYear->setFocusPolicy(NoFocus); |
152 | mSelectMonth->setFocusPolicy(NoFocus); | 152 | mSelectMonth->setFocusPolicy(NoFocus); |
153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | NavigatorBar::~NavigatorBar() | 157 | NavigatorBar::~NavigatorBar() |
158 | { | 158 | { |
159 | } | 159 | } |
160 | QSize NavigatorBar::sizeHint() const | 160 | QSize NavigatorBar::sizeHint() const |
161 | { | 161 | { |
162 | int wid = mCurrentMinWid ; | 162 | int wid = mCurrentMinWid ; |
163 | if ( mPrevYear->isVisible() ) | 163 | if ( mPrevYear->isVisible() ) |
164 | wid += mCurrentButtonMinWid; | 164 | wid += mCurrentButtonMinWid; |
165 | if ( mPrevMonth->isVisible() ) | 165 | if ( mPrevMonth->isVisible() ) |
166 | wid += mCurrentButtonMinWid; | 166 | wid += mCurrentButtonMinWid; |
167 | if ( mPrevWeek->isVisible() ) | 167 | if ( mPrevWeek->isVisible() ) |
168 | wid += mCurrentButtonMinWid; | 168 | wid += mCurrentButtonMinWid; |
169 | if ( mNextMonth->isVisible() ) | 169 | if ( mNextMonth->isVisible() ) |
170 | wid += mCurrentButtonMinWid; | 170 | wid += mCurrentButtonMinWid; |
171 | if ( mNextWeek->isVisible() ) | 171 | if ( mNextWeek->isVisible() ) |
172 | wid += mCurrentButtonMinWid; | 172 | wid += mCurrentButtonMinWid; |
173 | if ( mNextYear->isVisible() ) | 173 | if ( mNextYear->isVisible() ) |
174 | wid += mCurrentButtonMinWid; | 174 | wid += mCurrentButtonMinWid; |
175 | //qDebug("ret %d %d ", wid, mCurrentHei); | 175 | //qDebug("ret %d %d ", wid, mCurrentHei); |
176 | return QSize ( wid, mCurrentHei ); | 176 | return QSize ( wid, mCurrentHei ); |
177 | } | 177 | } |
178 | QSize NavigatorBar::sizeHintTwoButtons() const | 178 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const |
179 | { | 179 | { |
180 | return QSize ( mCurrentMinWid + 2 * mCurrentButtonMinWid , mCurrentHei ); | 180 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); |
181 | } | 181 | } |
182 | void NavigatorBar::resetFont ( QFont fo ) | 182 | void NavigatorBar::resetFont ( QFont fo ) |
183 | { | 183 | { |
184 | 184 | ||
185 | QFont tfont = fo; | 185 | QFont tfont = fo; |
186 | if ( QApplication::desktop()->width() >= 480 ) | 186 | if ( QApplication::desktop()->width() >= 480 ) |
187 | tfont.setPointSize(tfont.pointSize()+2); | 187 | tfont.setPointSize(tfont.pointSize()+2); |
188 | tfont.setBold(true); | 188 | tfont.setBold(true); |
189 | 189 | ||
190 | mSelectMonth->setFont( tfont ); | 190 | mSelectMonth->setFont( tfont ); |
191 | // Set minimum width to width of widest month name label | 191 | // Set minimum width to width of widest month name label |
192 | int i; | 192 | int i; |
193 | int maxwidth = 0; | 193 | int maxwidth = 0; |
194 | QFontMetrics fm ( mSelectMonth->font() ); | 194 | QFontMetrics fm ( mSelectMonth->font() ); |
195 | int width = fm.width("September '00" ); | 195 | int width = fm.width("September '00" ); |
196 | maxwidth = width+2; | 196 | maxwidth = width+2; |
197 | int size = fm.height()+2; | 197 | int size = fm.height()+2; |
198 | if ( QApplication::desktop()->width() >= 480 ) { | 198 | if ( QApplication::desktop()->width() >= 480 ) { |
199 | size += 6; | 199 | size += 6; |
200 | maxwidth+= 6; | 200 | maxwidth+= 6; |
201 | } | 201 | } |
202 | mSelectMonth->setMinimumWidth( maxwidth ); | 202 | mSelectMonth->setMinimumWidth( maxwidth ); |
203 | mSelectMonth->setFixedHeight( size ); | 203 | mSelectMonth->setFixedHeight( size ); |
204 | mPrevYear->setFixedHeight( size ); | 204 | mPrevYear->setFixedHeight( size ); |
205 | mPrevMonth->setFixedHeight( size ); | 205 | mPrevMonth->setFixedHeight( size ); |
206 | mPrevWeek->setFixedHeight( size ); | 206 | mPrevWeek->setFixedHeight( size ); |
207 | mNextMonth->setFixedHeight( size ); | 207 | mNextMonth->setFixedHeight( size ); |
208 | mNextWeek->setFixedHeight( size ); | 208 | mNextWeek->setFixedHeight( size ); |
209 | mNextYear->setFixedHeight ( size ); | 209 | mNextYear->setFixedHeight ( size ); |
210 | mCurrentHei = size +2; | 210 | mCurrentHei = size +2; |
211 | mCurrentMinWid = maxwidth+2; | 211 | mCurrentMinWid = maxwidth+2; |
212 | mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; | 212 | mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; |
213 | } | 213 | } |
214 | 214 | ||
215 | void NavigatorBar::showButtons( bool left, bool right ) | 215 | void NavigatorBar::showButtons( bool left, bool right ) |
216 | { | 216 | { |
217 | if ( left ) { | 217 | if ( left ) { |
218 | mPrevYear->show(); | 218 | mPrevYear->show(); |
219 | mPrevMonth->show(); | 219 | mPrevMonth->show(); |
220 | } else { | 220 | } else { |
221 | mPrevYear->hide(); | 221 | mPrevYear->hide(); |
222 | mPrevMonth->hide(); | 222 | mPrevMonth->hide(); |
223 | } | 223 | } |
224 | 224 | ||
225 | if ( right ) { | 225 | if ( right ) { |
226 | mNextYear->show(); | 226 | mNextYear->show(); |
227 | mNextMonth->show(); | 227 | mNextMonth->show(); |
228 | } else { | 228 | } else { |
229 | mNextYear->hide(); | 229 | mNextYear->hide(); |
230 | mNextMonth->hide(); | 230 | mNextMonth->hide(); |
231 | } | 231 | } |
232 | if ( !left && !right ) { | 232 | if ( !left && !right ) { |
233 | //mSelectMonth->setMaximumWidth( 1024 ); | 233 | //mSelectMonth->setMaximumWidth( 1024 ); |
234 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 234 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | void NavigatorBar::selectMonth() | 238 | void NavigatorBar::selectMonth() |
239 | { | 239 | { |
240 | 240 | ||
241 | int month; | 241 | int month; |
242 | KPopupFrame* popup = new KPopupFrame(this); | 242 | KPopupFrame* popup = new KPopupFrame(this); |
243 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); | 243 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); |
244 | // ----- | 244 | // ----- |
245 | picker->resize(picker->sizeHint()); | 245 | picker->resize(picker->sizeHint()); |
246 | popup->setMainWidget(picker); | 246 | popup->setMainWidget(picker); |
247 | picker->setFocus(); | 247 | picker->setFocus(); |
248 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 248 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
249 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 249 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
250 | { | 250 | { |
251 | month = picker->getResult(); | 251 | month = picker->getResult(); |
252 | emit monthSelected ( month ); | 252 | emit monthSelected ( month ); |
253 | } else { | 253 | } else { |
254 | KNotifyClient::beep(); | 254 | KNotifyClient::beep(); |
255 | } | 255 | } |
256 | delete popup; | 256 | delete popup; |
257 | } | 257 | } |
258 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 258 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
259 | { | 259 | { |
260 | if (dateList.count() > 0) { | 260 | if (dateList.count() > 0) { |
261 | QDate date = dateList.first(); | 261 | QDate date = dateList.first(); |
262 | 262 | ||
263 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 263 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
264 | 264 | ||
265 | // compute the label at the top of the navigator | 265 | // compute the label at the top of the navigator |
266 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 266 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
267 | QString::number( calSys->year( date ) ).right(2); | 267 | QString::number( calSys->year( date ) ).right(2); |
268 | 268 | ||
269 | mSelectMonth->setText( dtstr ); | 269 | mSelectMonth->setText( dtstr ); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index bf6d173..9ccef14 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h | |||
@@ -1,76 +1,76 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef NAVIGATORBAR_H | 24 | #ifndef NAVIGATORBAR_H |
25 | #define NAVIGATORBAR_H | 25 | #define NAVIGATORBAR_H |
26 | 26 | ||
27 | #include <libkcal/incidencebase.h> | 27 | #include <libkcal/incidencebase.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | 30 | ||
31 | class QPushButton; | 31 | class QPushButton; |
32 | class QFrame; | 32 | class QFrame; |
33 | class QLabel; | 33 | class QLabel; |
34 | 34 | ||
35 | class NavigatorBar: public QWidget | 35 | class NavigatorBar: public QWidget |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); | 39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); |
40 | ~NavigatorBar(); | 40 | ~NavigatorBar(); |
41 | void showButtons( bool left, bool right ); | 41 | void showButtons( bool left, bool right ); |
42 | void resetFont ( QFont fo ); | 42 | void resetFont ( QFont fo ); |
43 | QSize sizeHint() const; | 43 | QSize sizeHint() const; |
44 | QSize sizeHintTwoButtons() const; | 44 | QSize sizeHintTwoButtons( int butNum = 2 ) const; |
45 | 45 | ||
46 | public slots: | 46 | public slots: |
47 | void selectDates( const KCal::DateList & ); | 47 | void selectDates( const KCal::DateList & ); |
48 | void selectMonth(); | 48 | void selectMonth(); |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | void goNextMonth(); | 51 | void goNextMonth(); |
52 | void goPrevMonth(); | 52 | void goPrevMonth(); |
53 | void goNextWeek(); | 53 | void goNextWeek(); |
54 | void goPrevWeek(); | 54 | void goPrevWeek(); |
55 | void goNextYear(); | 55 | void goNextYear(); |
56 | void goPrevYear(); | 56 | void goPrevYear(); |
57 | void monthSelected( int ); | 57 | void monthSelected( int ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | int mCurrentHei; | 60 | int mCurrentHei; |
61 | int mCurrentMinWid; | 61 | int mCurrentMinWid; |
62 | int mCurrentButtonMinWid; | 62 | int mCurrentButtonMinWid; |
63 | QFrame *mCtrlFrame; | 63 | QFrame *mCtrlFrame; |
64 | 64 | ||
65 | QPushButton *mPrevYear; | 65 | QPushButton *mPrevYear; |
66 | QPushButton *mPrevMonth; | 66 | QPushButton *mPrevMonth; |
67 | QPushButton *mNextMonth; | 67 | QPushButton *mNextMonth; |
68 | QPushButton *mPrevWeek; | 68 | QPushButton *mPrevWeek; |
69 | QPushButton *mNextWeek; | 69 | QPushButton *mNextWeek; |
70 | QPushButton *mNextYear; | 70 | QPushButton *mNextYear; |
71 | QPushButton *mSelectMonth; | 71 | QPushButton *mSelectMonth; |
72 | 72 | ||
73 | //QLabel *mDateLabel; | 73 | //QLabel *mDateLabel; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |