-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 42 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.h | 2 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 3 |
4 files changed, 33 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9a4e719..6ed6a1c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1897,56 +1897,56 @@ void CalendarView::readSettings() | |||
1897 | mLeftFrame->setSizes(sizes); | 1897 | mLeftFrame->setSizes(sizes); |
1898 | sizes = config->readIntListEntry("Main Splitter Frame"); | 1898 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1899 | resetval = 0; | 1899 | resetval = 0; |
1900 | maxVal = 0; | 1900 | maxVal = 0; |
1901 | if (sizes.count() != 2) { | 1901 | if (sizes.count() != 2) { |
1902 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1902 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1903 | resetval = mDateNavigator->sizeHint().width()+2; | 1903 | resetval = mDateNavigator->sizeHint().width()+2; |
1904 | } else { | 1904 | } else { |
1905 | resetval = mDateNavigator->sizeHint().height()+2; | 1905 | resetval = mDateNavigator->sizeHint().height()+2; |
1906 | } | 1906 | } |
1907 | } | 1907 | } |
1908 | if ( resetval ) { | 1908 | if ( resetval ) { |
1909 | sizes.clear(); | 1909 | sizes.clear(); |
1910 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1910 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1911 | maxVal = QApplication::desktop()->width() -10; | 1911 | maxVal = QApplication::desktop()->width() -10; |
1912 | } else { | 1912 | } else { |
1913 | maxVal = QApplication::desktop()->height()-10; | 1913 | maxVal = QApplication::desktop()->height()-10; |
1914 | } | 1914 | } |
1915 | sizes << resetval; | 1915 | sizes << resetval; |
1916 | if ( maxVal < resetval + resetval) | 1916 | if ( maxVal < resetval + resetval) |
1917 | resetval = maxVal - resetval; | 1917 | resetval = maxVal - resetval; |
1918 | sizes << resetval; | 1918 | sizes << resetval; |
1919 | } | 1919 | } |
1920 | mMainFrame->setSizes(sizes); | 1920 | mMainFrame->setSizes(sizes); |
1921 | |||
1922 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1921 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1923 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1922 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1924 | else mNavigator->selectDates( dateCount ); | 1923 | else mNavigator->selectDates( dateCount ); |
1925 | // mViewManager->readSettings( config ); | 1924 | // mViewManager->readSettings( config ); |
1926 | updateConfig(); | 1925 | updateConfig(); |
1927 | globalFlagBlockAgenda = 2; | 1926 | globalFlagBlockAgenda = 2; |
1928 | mViewManager->readSettings( config ); | 1927 | mViewManager->readSettings( config ); |
1928 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | ||
1929 | } | 1929 | } |
1930 | 1930 | ||
1931 | 1931 | ||
1932 | void CalendarView::writeSettings() | 1932 | void CalendarView::writeSettings() |
1933 | { | 1933 | { |
1934 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1934 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1935 | 1935 | ||
1936 | KConfig *config = KOGlobals::config(); | 1936 | KConfig *config = KOGlobals::config(); |
1937 | 1937 | ||
1938 | mViewManager->writeSettings( config ); | 1938 | mViewManager->writeSettings( config ); |
1939 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1939 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1940 | mDialogManager->writeSettings( config ); | 1940 | mDialogManager->writeSettings( config ); |
1941 | //KOPrefs::instance()->usrWriteConfig(); | 1941 | //KOPrefs::instance()->usrWriteConfig(); |
1942 | KOPrefs::instance()->writeConfig(); | 1942 | KOPrefs::instance()->writeConfig(); |
1943 | 1943 | ||
1944 | writeFilterSettings(config); | 1944 | writeFilterSettings(config); |
1945 | 1945 | ||
1946 | config->setGroup( "Views" ); | 1946 | config->setGroup( "Views" ); |
1947 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1947 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1948 | 1948 | ||
1949 | QValueList<int> listINT = mLeftFrame->sizes(); | 1949 | QValueList<int> listINT = mLeftFrame->sizes(); |
1950 | config->writeEntry("Left Splitter Frame",listINT); | 1950 | config->writeEntry("Left Splitter Frame",listINT); |
1951 | QValueList<int> listINT2 = mMainFrame->sizes(); | 1951 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1952 | config->writeEntry("Main Splitter Frame",listINT2); | 1952 | config->writeEntry("Main Splitter Frame",listINT2); |
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 2290c53..11dc592 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -19,52 +19,53 @@ | |||
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 | mResizeEnabled = false; | ||
43 | mExtraViews.setAutoDelete( true ); | 44 | mExtraViews.setAutoDelete( true ); |
44 | 45 | ||
45 | mNavigatorView = new KDateNavigator( this, name ); | 46 | mNavigatorView = new KDateNavigator( this, name ); |
46 | 47 | mNavigatorView->hide(); | |
47 | connectNavigatorView( mNavigatorView ); | 48 | connectNavigatorView( mNavigatorView ); |
48 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 49 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
49 | mLastDisplayedDN = 0; | 50 | mLastDisplayedDN = 0; |
50 | mUpdateTimer; | 51 | mUpdateTimer; |
51 | mUpdateTimer = new QTimer( this ); | 52 | mUpdateTimer = new QTimer( this ); |
52 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); | 53 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); |
53 | mFirstSelectedDate = QDate::currentDate(); | 54 | mFirstSelectedDate = QDate::currentDate(); |
54 | mSelectedDateCount = 1; | 55 | mSelectedDateCount = 1; |
55 | } | 56 | } |
56 | 57 | ||
57 | DateNavigatorContainer::~DateNavigatorContainer() | 58 | DateNavigatorContainer::~DateNavigatorContainer() |
58 | { | 59 | { |
59 | } | 60 | } |
60 | 61 | ||
61 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) | 62 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) |
62 | { | 63 | { |
63 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), | 64 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), |
64 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 65 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
65 | #if 0 | 66 | #if 0 |
66 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), | 67 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), |
67 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); | 68 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); |
68 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), | 69 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), |
69 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); | 70 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); |
70 | #endif | 71 | #endif |
@@ -197,96 +198,99 @@ void DateNavigatorContainer::checkUpdateDayMatrixDates() | |||
197 | verticalCount = size().height() / minSize.height(); | 198 | verticalCount = size().height() / minSize.height(); |
198 | horizontalCount = size().width() / minSize.width(); | 199 | horizontalCount = size().width() / minSize.width(); |
199 | if ( horizontalCount == 0 ) | 200 | if ( horizontalCount == 0 ) |
200 | horizontalCount = 1; | 201 | horizontalCount = 1; |
201 | if ( verticalCount == 0 ) | 202 | if ( verticalCount == 0 ) |
202 | verticalCount = 1; | 203 | verticalCount = 1; |
203 | fontchange = true; | 204 | fontchange = true; |
204 | count = horizontalCount * verticalCount; | 205 | count = horizontalCount * verticalCount; |
205 | } else { | 206 | } else { |
206 | if ( mNavigatorView->fontChanged() ) { | 207 | if ( mNavigatorView->fontChanged() ) { |
207 | fontchange = true; | 208 | fontchange = true; |
208 | fo = KOPrefs::instance()->mDateNavigatorFont; | 209 | fo = KOPrefs::instance()->mDateNavigatorFont; |
209 | mNavigatorView->changeFont( fo ); | 210 | mNavigatorView->changeFont( fo ); |
210 | mNavigatorView->unsetFontChanged(); | 211 | mNavigatorView->unsetFontChanged(); |
211 | } | 212 | } |
212 | } | 213 | } |
213 | 214 | ||
214 | mLastDisplayedDN = horizontalCount*verticalCount-1; | 215 | mLastDisplayedDN = horizontalCount*verticalCount-1; |
215 | while ( count > ( mExtraViews.count() + 1 ) ) { | 216 | while ( count > ( mExtraViews.count() + 1 ) ) { |
216 | KDateNavigator *n = new KDateNavigator( this ); | 217 | KDateNavigator *n = new KDateNavigator( this ); |
217 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 218 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
218 | mExtraViews.append( n ); | 219 | mExtraViews.append( n ); |
219 | n->setCalendar( mCalendar ); | 220 | n->setCalendar( mCalendar ); |
220 | connectNavigatorView( n ); | 221 | connectNavigatorView( n ); |
221 | n->show(); | 222 | // n->show(); |
222 | } | ||
223 | int iii = 0; | ||
224 | while ( iii < ( mExtraViews.count() ) ) { | ||
225 | if ( iii < count-1 ) | ||
226 | mExtraViews.at( iii )->show(); | ||
227 | else | ||
228 | mExtraViews.at( iii )->hide(); | ||
229 | ++iii; | ||
230 | } | 223 | } |
224 | |||
231 | 225 | ||
232 | setBaseDates(); | 226 | setBaseDates(); |
233 | if ( fontchange ) { | 227 | if ( fontchange ) { |
234 | //mNavigatorView->changeFont( fo ); | 228 | //mNavigatorView->changeFont( fo ); |
235 | uint i; | 229 | uint i; |
236 | for( i = 0; i < mExtraViews.count(); ++i ) { | 230 | for( i = 0; i < mExtraViews.count(); ++i ) { |
237 | KDateNavigator *view = mExtraViews.at( i ); | 231 | KDateNavigator *view = mExtraViews.at( i ); |
238 | view->changeFont( fo ); | 232 | view->changeFont( fo ); |
239 | } | 233 | } |
240 | } | 234 | } |
241 | mHorizontalCount = horizontalCount; | 235 | mHorizontalCount = horizontalCount; |
242 | mVerticalCount = verticalCount; | 236 | mVerticalCount = verticalCount; |
243 | 237 | ||
244 | } | 238 | } |
245 | 239 | ||
246 | int theight = height() / mVerticalCount; | 240 | int theight = height() / mVerticalCount; |
247 | int twidth = width() / mHorizontalCount; | 241 | int twidth = width() / mHorizontalCount; |
248 | 242 | ||
249 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 243 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
250 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); | 244 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); |
251 | else bar->showButtons( true, true ); | 245 | else bar->showButtons( true, true ); |
252 | 246 | ||
253 | mNavigatorView->setGeometry(0, | 247 | mNavigatorView->setGeometry(0, |
254 | 0, twidth, theight ); | 248 | 0, twidth, theight ); |
255 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 249 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
256 | int x = ( i + 1 ) % mHorizontalCount; | 250 | int x = ( i + 1 ) % mHorizontalCount; |
257 | int y = ( i + 1 ) / mHorizontalCount; | 251 | int y = ( i + 1 ) / mHorizontalCount; |
258 | 252 | ||
259 | KDateNavigator *view = mExtraViews.at( i ); | 253 | KDateNavigator *view = mExtraViews.at( i ); |
260 | bar = view->navigatorBar(); | 254 | bar = view->navigatorBar(); |
261 | if ( y > 0 ) bar->showButtons( false, false ); | 255 | if ( y > 0 ) bar->showButtons( false, false ); |
262 | else { | 256 | else { |
263 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); | 257 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); |
264 | else bar->showButtons( false, false ); | 258 | else bar->showButtons( false, false ); |
265 | } | 259 | } |
266 | view->setGeometry( x * twidth, | 260 | view->setGeometry( x * twidth, |
267 | y * theight, twidth, theight ); | 261 | y * theight, twidth, theight ); |
268 | } | 262 | } |
263 | int iii = 0; | ||
264 | int ccc = mHorizontalCount * mVerticalCount; | ||
265 | mNavigatorView->show(); | ||
266 | while ( iii < ( mExtraViews.count() ) ) { | ||
267 | if ( iii < ccc-1 ) | ||
268 | mExtraViews.at( iii )->show(); | ||
269 | else | ||
270 | mExtraViews.at( iii )->hide(); | ||
271 | ++iii; | ||
272 | } | ||
269 | } | 273 | } |
270 | 274 | ||
271 | QDate last = lastAvailableDate(); | 275 | QDate last = lastAvailableDate(); |
272 | QDate first = firstAvailableDate(); | 276 | QDate first = firstAvailableDate(); |
273 | 277 | ||
274 | QDate selFirst = mFirstSelectedDate; | 278 | QDate selFirst = mFirstSelectedDate; |
275 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); | 279 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); |
276 | if ( selFirst >= first && selLast <= last ) { | 280 | if ( selFirst >= first && selLast <= last ) { |
277 | updateDayMatrixDates(); | 281 | updateDayMatrixDates(); |
278 | } | 282 | } |
279 | else { | 283 | else { |
280 | updateDayMatrixDates(); | 284 | updateDayMatrixDates(); |
281 | emit monthSelected( mFirstSelectedDate.month() ); | 285 | emit monthSelected( mFirstSelectedDate.month() ); |
282 | } | 286 | } |
283 | } | 287 | } |
284 | void DateNavigatorContainer::updateDayMatrixDates() | 288 | void DateNavigatorContainer::updateDayMatrixDates() |
285 | { | 289 | { |
286 | QDate fDate = mFirstSelectedDate; | 290 | QDate fDate = mFirstSelectedDate; |
287 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); | 291 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); |
288 | mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); | 292 | mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); |
289 | mNavigatorView->dayMatrix()->repaint( false ); | 293 | mNavigatorView->dayMatrix()->repaint( false ); |
290 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 294 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
291 | KDateNavigator *n = mExtraViews.at( i ); | 295 | KDateNavigator *n = mExtraViews.at( i ); |
292 | if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { | 296 | if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { |
@@ -372,44 +376,54 @@ void DateNavigatorContainer::selectDates( const DateList &dateList ) | |||
372 | mNavigatorView->selectDates( dateList ); | 376 | mNavigatorView->selectDates( dateList ); |
373 | setBaseDates(); | 377 | setBaseDates(); |
374 | if ( mLastDisplayedDN ) { | 378 | if ( mLastDisplayedDN ) { |
375 | KDateNavigator *view = mExtraViews.at( 0 ); | 379 | KDateNavigator *view = mExtraViews.at( 0 ); |
376 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 380 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
377 | view->dayMatrix()->repaint( false ); | 381 | view->dayMatrix()->repaint( false ); |
378 | if ( mLastDisplayedDN > 1 ) { | 382 | if ( mLastDisplayedDN > 1 ) { |
379 | KDateNavigator *view = mExtraViews.at( 1 ); | 383 | KDateNavigator *view = mExtraViews.at( 1 ); |
380 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 384 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
381 | view->dayMatrix()->repaint( false ); | 385 | view->dayMatrix()->repaint( false ); |
382 | } | 386 | } |
383 | } | 387 | } |
384 | } | 388 | } |
385 | 389 | ||
386 | void DateNavigatorContainer::setBaseDates() | 390 | void DateNavigatorContainer::setBaseDates() |
387 | { | 391 | { |
388 | QDate baseDate = mNavigatorView->baseDate(); | 392 | QDate baseDate = mNavigatorView->baseDate(); |
389 | bool doRepaint = true; | 393 | bool doRepaint = true; |
390 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 394 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
391 | KDateNavigator *n = mExtraViews.at( i ); | 395 | KDateNavigator *n = mExtraViews.at( i ); |
392 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); | 396 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
393 | n->setBaseDate( baseDate, doRepaint ); | 397 | n->setBaseDate( baseDate, doRepaint ); |
394 | } | 398 | } |
395 | } | 399 | } |
396 | 400 | void DateNavigatorContainer::setResizeEnabled() | |
401 | { | ||
402 | mResizeEnabled = true; | ||
403 | //qDebug("DateNavigatorContainer::setResizeEnabled "); | ||
404 | checkUpdateDayMatrixDates(); | ||
405 | } | ||
397 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | 406 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
398 | { | 407 | { |
399 | 408 | ||
400 | 409 | //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); | |
401 | //qDebug("COUNT %d ", mExtraViews.count()); | 410 | //qDebug("COUNT %d ", mExtraViews.count()); |
402 | 411 | if ( ! mResizeEnabled ) { | |
403 | mUpdateTimer->start( 250 ); | 412 | //qDebug("NOT ResizeEnabled"); |
413 | return; | ||
414 | } | ||
415 | else | ||
416 | mUpdateTimer->start( 250 ); | ||
417 | |||
404 | //updateDayMatrixDates(); | 418 | //updateDayMatrixDates(); |
405 | } | 419 | } |
406 | 420 | ||
407 | QSize DateNavigatorContainer::minimumSizeHint() const | 421 | QSize DateNavigatorContainer::minimumSizeHint() const |
408 | { | 422 | { |
409 | return mNavigatorView->minimumSizeHint(); | 423 | return mNavigatorView->minimumSizeHint(); |
410 | } | 424 | } |
411 | 425 | ||
412 | QSize DateNavigatorContainer::sizeHint() const | 426 | QSize DateNavigatorContainer::sizeHint() const |
413 | { | 427 | { |
414 | return mNavigatorView->yourSizeHint(); | 428 | return mNavigatorView->yourSizeHint(); |
415 | } | 429 | } |
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h index d2f397d..ac9745d 100644 --- a/korganizer/datenavigatorcontainer.h +++ b/korganizer/datenavigatorcontainer.h | |||
@@ -42,65 +42,67 @@ class DateNavigatorContainer: public QWidget | |||
42 | /** | 42 | /** |
43 | Associate date navigator with a calendar. It is used by KODayMatrix. | 43 | Associate date navigator with a calendar. It is used by KODayMatrix. |
44 | */ | 44 | */ |
45 | void setCalendar( Calendar * ); | 45 | void setCalendar( Calendar * ); |
46 | 46 | ||
47 | QSize minimumSizeHint() const; | 47 | QSize minimumSizeHint() const; |
48 | QSize sizeHint() const; | 48 | QSize sizeHint() const; |
49 | KDateNavigator * navigatorView() { return mNavigatorView;} | 49 | KDateNavigator * navigatorView() { return mNavigatorView;} |
50 | QDate lastAvailableDate() const ; | 50 | QDate lastAvailableDate() const ; |
51 | QDate firstAvailableDate() const ; | 51 | QDate firstAvailableDate() const ; |
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | void selectDates( const KCal::DateList & ); | 54 | void selectDates( const KCal::DateList & ); |
55 | void updateView(); | 55 | void updateView(); |
56 | void updateConfig(); | 56 | void updateConfig(); |
57 | void updateDayMatrix(); | 57 | void updateDayMatrix(); |
58 | void updateDayMatrixDates(); | 58 | void updateDayMatrixDates(); |
59 | void checkUpdateDayMatrixDates(); | 59 | void checkUpdateDayMatrixDates(); |
60 | void updateToday(); | 60 | void updateToday(); |
61 | void slotMonthSelected( int month ); | 61 | void slotMonthSelected( int month ); |
62 | void slotgoNextMonth(); | 62 | void slotgoNextMonth(); |
63 | void slotgoPrevMonth(); | 63 | void slotgoPrevMonth(); |
64 | void slotgoNextYear(); | 64 | void slotgoNextYear(); |
65 | void slotgoPrevYear(); | 65 | void slotgoPrevYear(); |
66 | void setResizeEnabled(); | ||
66 | 67 | ||
67 | signals: | 68 | signals: |
68 | void datesSelected( const KCal::DateList & ); | 69 | void datesSelected( const KCal::DateList & ); |
69 | void incidenceDropped( Incidence *, const QDate & ); | 70 | void incidenceDropped( Incidence *, const QDate & ); |
70 | void incidenceDroppedMove( Incidence *, const QDate & ); | 71 | void incidenceDroppedMove( Incidence *, const QDate & ); |
71 | void weekClicked( const QDate &); | 72 | void weekClicked( const QDate &); |
72 | 73 | ||
73 | void goPrevious(); | 74 | void goPrevious(); |
74 | void goNext(); | 75 | void goNext(); |
75 | 76 | ||
76 | void goNextMonth(); | 77 | void goNextMonth(); |
77 | void goPrevMonth(); | 78 | void goPrevMonth(); |
78 | void goNextYear(); | 79 | void goNextYear(); |
79 | void goPrevYear(); | 80 | void goPrevYear(); |
80 | 81 | ||
81 | void monthSelected( int month ); | 82 | void monthSelected( int month ); |
82 | 83 | ||
83 | protected: | 84 | protected: |
84 | void computeMonthSelected( int month , bool forceEmit ); | 85 | void computeMonthSelected( int month , bool forceEmit ); |
85 | void jumpMonth( int month ); | 86 | void jumpMonth( int month ); |
86 | void resizeEvent( QResizeEvent * ); | 87 | void resizeEvent( QResizeEvent * ); |
87 | 88 | ||
88 | void setBaseDates(); | 89 | void setBaseDates(); |
89 | void connectNavigatorView( KDateNavigator *v ); | 90 | void connectNavigatorView( KDateNavigator *v ); |
90 | 91 | ||
91 | private: | 92 | private: |
93 | bool mResizeEnabled; | ||
92 | QTimer* mUpdateTimer; | 94 | QTimer* mUpdateTimer; |
93 | int mLastDisplayedDN; | 95 | int mLastDisplayedDN; |
94 | QDate mFirstSelectedDate; | 96 | QDate mFirstSelectedDate; |
95 | int mSelectedDateCount; | 97 | int mSelectedDateCount; |
96 | KDateNavigator *mNavigatorView; | 98 | KDateNavigator *mNavigatorView; |
97 | 99 | ||
98 | KCal::Calendar *mCalendar; | 100 | KCal::Calendar *mCalendar; |
99 | 101 | ||
100 | QPtrList<KDateNavigator> mExtraViews; | 102 | QPtrList<KDateNavigator> mExtraViews; |
101 | 103 | ||
102 | int mHorizontalCount; | 104 | int mHorizontalCount; |
103 | int mVerticalCount; | 105 | int mVerticalCount; |
104 | }; | 106 | }; |
105 | 107 | ||
106 | #endif | 108 | #endif |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 0cb767f..5eccfd6 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -98,49 +98,49 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
98 | } | 98 | } |
99 | weeknos[i]->installEventFilter(this); | 99 | weeknos[i]->installEventFilter(this); |
100 | 100 | ||
101 | topLayout->addWidget(weeknos[i],i+2,0); | 101 | topLayout->addWidget(weeknos[i],i+2,0); |
102 | } | 102 | } |
103 | 103 | ||
104 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 104 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
105 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 105 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
106 | daymatrix->setLineWidth(1); | 106 | daymatrix->setLineWidth(1); |
107 | 107 | ||
108 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 108 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
109 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 109 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
110 | 110 | ||
111 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 111 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
112 | SIGNAL( eventDropped( Event * ) ) ); | 112 | SIGNAL( eventDropped( Event * ) ) ); |
113 | 113 | ||
114 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 114 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
115 | 115 | ||
116 | // read settings from configuration file. | 116 | // read settings from configuration file. |
117 | updateConfig(); | 117 | updateConfig(); |
118 | enableRollover(FollowMonth); | 118 | enableRollover(FollowMonth); |
119 | mySizeHint = sizeHintTwoButtons(); | 119 | mySizeHint = sizeHintTwoButtons(); |
120 | myFullSizeHint = sizeHintTwoButtons( 4 ); | 120 | myFullSizeHint = sizeHintTwoButtons( 4 ); |
121 | mFontChanged = false; | 121 | mFontChanged = false; |
122 | resize ( 3,3 ); | 122 | //resize ( 3,3 ); |
123 | 123 | ||
124 | } | 124 | } |
125 | void KDateNavigator::changeFont ( QFont fo ) | 125 | void KDateNavigator::changeFont ( QFont fo ) |
126 | { | 126 | { |
127 | setFont( fo ); | 127 | setFont( fo ); |
128 | mNavigatorBar->resetFont( fo ); | 128 | mNavigatorBar->resetFont( fo ); |
129 | } | 129 | } |
130 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 130 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
131 | { | 131 | { |
132 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 132 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
133 | *b = false; | 133 | *b = false; |
134 | int fontPoint = fo.pointSize(); | 134 | int fontPoint = fo.pointSize(); |
135 | while ( fontPoint > 5 ) { | 135 | while ( fontPoint > 5 ) { |
136 | --fontPoint; | 136 | --fontPoint; |
137 | fo.setPointSize( fontPoint ); | 137 | fo.setPointSize( fontPoint ); |
138 | setFont( fo ); | 138 | setFont( fo ); |
139 | mFontChanged = true; | 139 | mFontChanged = true; |
140 | mNavigatorBar->resetFont( fo ); | 140 | mNavigatorBar->resetFont( fo ); |
141 | QSize sh = sizeHintTwoButtons( 2 ); | 141 | QSize sh = sizeHintTwoButtons( 2 ); |
142 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 142 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); |
143 | if ( si.width() > sh.width() && si.height() > sh.height()) { | 143 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
144 | if ( si.width() / sh.width() == 1 ) { | 144 | if ( si.width() / sh.width() == 1 ) { |
145 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) | 145 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) |
146 | continue; | 146 | continue; |
@@ -350,48 +350,49 @@ void KDateNavigator::updateView() | |||
350 | } | 350 | } |
351 | 351 | ||
352 | void KDateNavigator::updateConfig() | 352 | void KDateNavigator::updateConfig() |
353 | { | 353 | { |
354 | int day; | 354 | int day; |
355 | for(int i=0; i<7; i++) { | 355 | for(int i=0; i<7; i++) { |
356 | // take the first letter of the day name to be the abbreviation | 356 | // take the first letter of the day name to be the abbreviation |
357 | if (KGlobal::locale()->weekStartsMonday()) { | 357 | if (KGlobal::locale()->weekStartsMonday()) { |
358 | day = i+1; | 358 | day = i+1; |
359 | } else { | 359 | } else { |
360 | if (i==0) day = 7; | 360 | if (i==0) day = 7; |
361 | else day = i; | 361 | else day = i; |
362 | } | 362 | } |
363 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, | 363 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, |
364 | true ); | 364 | true ); |
365 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); | 365 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); |
366 | headings[i]->setText( dayName ); | 366 | headings[i]->setText( dayName ); |
367 | } | 367 | } |
368 | updateDates(); | 368 | updateDates(); |
369 | updateView(); | 369 | updateView(); |
370 | } | 370 | } |
371 | 371 | ||
372 | void KDateNavigator::setShowWeekNums(bool enabled) | 372 | void KDateNavigator::setShowWeekNums(bool enabled) |
373 | { | 373 | { |
374 | qDebug("KDateNavigator::setShowWeekNums***************************** "); | ||
374 | m_bShowWeekNums = enabled; | 375 | m_bShowWeekNums = enabled; |
375 | for(int i=0; i<6; i++) { | 376 | for(int i=0; i<6; i++) { |
376 | if(enabled) | 377 | if(enabled) |
377 | weeknos[i]->show(); | 378 | weeknos[i]->show(); |
378 | else | 379 | else |
379 | weeknos[i]->hide(); | 380 | weeknos[i]->hide(); |
380 | } | 381 | } |
381 | resize(size()); | 382 | resize(size()); |
382 | } | 383 | } |
383 | 384 | ||
384 | void KDateNavigator::selectDates(const DateList& dateList) | 385 | void KDateNavigator::selectDates(const DateList& dateList) |
385 | { | 386 | { |
386 | 387 | ||
387 | if (dateList.count() > 0) { | 388 | if (dateList.count() > 0) { |
388 | mNavigatorBar->selectDates( dateList ); | 389 | mNavigatorBar->selectDates( dateList ); |
389 | mSelectedDates = dateList; | 390 | mSelectedDates = dateList; |
390 | 391 | ||
391 | // set our record of the month and year that this datetbl is | 392 | // set our record of the month and year that this datetbl is |
392 | // displaying. | 393 | // displaying. |
393 | m_MthYr = mSelectedDates.first(); | 394 | m_MthYr = mSelectedDates.first(); |
394 | 395 | ||
395 | 396 | ||
396 | // set our record of the first day of the week of the current | 397 | // set our record of the first day of the week of the current |
397 | // month. This needs to be done before calling dayToIndex, since it | 398 | // month. This needs to be done before calling dayToIndex, since it |