-rw-r--r-- | korganizer/calendarview.cpp | 76 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 36 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 40 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 8 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 11 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 1 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 67 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 1 |
9 files changed, 184 insertions, 58 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3ce123c..ab59d00 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -293,29 +293,33 @@ void CalendarView::init() | |||
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 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; | 305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
306 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); | 306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | ||
308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
307 | } else { | 309 | } else { |
308 | mainBoxLayout = new QHBoxLayout(mainBox); | 310 | //mainBoxLayout = new QHBoxLayout(mainBox); |
309 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
310 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; | 312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | ||
314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | ||
311 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
312 | } | 316 | } |
313 | //QBoxLayout * leftFrameLayout; | 317 | //QBoxLayout * leftFrameLayout; |
314 | topLayout->addWidget( mainBox ); | 318 | topLayout->addWidget( mMainFrame ); |
315 | mainBoxLayout->addWidget (mLeftFrame); | 319 | //mainBoxLayout->addWidget (mLeftFrame); |
316 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 320 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
317 | "CalendarView::DateNavigator" ); | 321 | "CalendarView::DateNavigator" ); |
318 | #if 0 | 322 | #if 0 |
319 | // FIXME | 323 | // FIXME |
320 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 324 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
321 | "CalendarView::DateNavigator", QDate::currentDate()); | 325 | "CalendarView::DateNavigator", QDate::currentDate()); |
@@ -333,27 +337,27 @@ void CalendarView::init() | |||
333 | } else { | 337 | } else { |
334 | leftFrameLayout->addWidget(mTodoList,2 ); | 338 | leftFrameLayout->addWidget(mTodoList,2 ); |
335 | leftFrameLayout->addWidget(mFilterView ); | 339 | leftFrameLayout->addWidget(mFilterView ); |
336 | } | 340 | } |
337 | #endif | 341 | #endif |
338 | mFilterView->hide(); | 342 | mFilterView->hide(); |
339 | QWidget *rightBox = new QWidget( mainBox ); | 343 | QWidget *rightBox = new QWidget( mMainFrame ); |
340 | mainBoxLayout->addWidget ( rightBox, 10 ); | 344 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 345 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
342 | mRightFrame = new QWidgetStack( rightBox ); | 346 | mRightFrame = new QWidgetStack( rightBox ); |
343 | rightLayout->addWidget( mRightFrame, 10 ); | 347 | rightLayout->addWidget( mRightFrame, 10 ); |
344 | 348 | ||
345 | //mLeftFrame = (QWidget *)leftFrame; | 349 | //mLeftFrame = (QWidget *)leftFrame; |
346 | if ( KOPrefs::instance()->mVerticalScreen ) { | 350 | if ( KOPrefs::instance()->mVerticalScreen ) { |
347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 351 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 352 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
349 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 353 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 354 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
351 | } else { | 355 | } else { |
352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 356 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
353 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 357 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 358 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
355 | } | 359 | } |
356 | if ( !KOPrefs::instance()->mShowDateNavigator) | 360 | if ( !KOPrefs::instance()->mShowDateNavigator) |
357 | mDateNavigator->hide(); | 361 | mDateNavigator->hide(); |
358 | //qDebug("Calendarview Size %d %d ", width(), height()); | 362 | //qDebug("Calendarview Size %d %d ", width(), height()); |
359 | #endif | 363 | #endif |
@@ -1832,17 +1836,17 @@ void CalendarView::readSettings() | |||
1832 | } else { | 1836 | } else { |
1833 | resetval = mDateNavigator->sizeHint().height()+2; | 1837 | resetval = mDateNavigator->sizeHint().height()+2; |
1834 | } | 1838 | } |
1835 | } | 1839 | } |
1836 | if ( !resetval ){// i.e. sizes.count() == 3 | 1840 | if ( !resetval ){// i.e. sizes.count() == 3 |
1837 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1841 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | 1842 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) |
1839 | resetval = mDateNavigator->sizeHint().width()+2; | 1843 | resetval = mDateNavigator->sizeHint().width()+2; |
1840 | } else { | 1844 | } else { |
1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | 1845 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) |
1842 | resetval = mDateNavigator->sizeHint().height()+2; | 1846 | resetval = mDateNavigator->sizeHint().height()+2; |
1843 | } | 1847 | } |
1844 | } | 1848 | } |
1845 | if ( resetval ) { | 1849 | if ( resetval ) { |
1846 | sizes.clear(); | 1850 | sizes.clear(); |
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1851 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1848 | maxVal = QApplication::desktop()->width() -10; | 1852 | maxVal = QApplication::desktop()->width() -10; |
@@ -1853,12 +1857,43 @@ void CalendarView::readSettings() | |||
1853 | if ( maxVal < resetval + resetval) | 1857 | if ( maxVal < resetval + resetval) |
1854 | resetval = maxVal - resetval; | 1858 | resetval = maxVal - resetval; |
1855 | sizes << resetval; | 1859 | sizes << resetval; |
1856 | sizes << 100; | 1860 | sizes << 100; |
1857 | } | 1861 | } |
1858 | mLeftFrame->setSizes(sizes); | 1862 | mLeftFrame->setSizes(sizes); |
1863 | sizes = config->readIntListEntry("Main Splitter Frame"); | ||
1864 | if (sizes.count() != 3) { | ||
1865 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1866 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1867 | } else { | ||
1868 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1869 | } | ||
1870 | } | ||
1871 | if ( !resetval ){// i.e. sizes.count() == 3 | ||
1872 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1873 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | ||
1874 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1875 | } else { | ||
1876 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | ||
1877 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1878 | } | ||
1879 | } | ||
1880 | if ( resetval ) { | ||
1881 | sizes.clear(); | ||
1882 | if ( !KOPrefs::instance()->mVerticalScreen ) { | ||
1883 | maxVal = QApplication::desktop()->width() -10; | ||
1884 | } else { | ||
1885 | maxVal = QApplication::desktop()->height()-10; | ||
1886 | } | ||
1887 | sizes << resetval; | ||
1888 | if ( maxVal < resetval + resetval) | ||
1889 | resetval = maxVal - resetval; | ||
1890 | sizes << resetval; | ||
1891 | } | ||
1892 | mMainFrame->setSizes(sizes); | ||
1893 | |||
1859 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1894 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1860 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1895 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1861 | else mNavigator->selectDates( dateCount ); | 1896 | else mNavigator->selectDates( dateCount ); |
1862 | // mViewManager->readSettings( config ); | 1897 | // mViewManager->readSettings( config ); |
1863 | updateConfig(); | 1898 | updateConfig(); |
1864 | globalFlagBlockAgenda = 2; | 1899 | globalFlagBlockAgenda = 2; |
@@ -1925,13 +1960,14 @@ void CalendarView::writeSettings() | |||
1925 | 1960 | ||
1926 | config->setGroup( "Views" ); | 1961 | config->setGroup( "Views" ); |
1927 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1962 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1928 | 1963 | ||
1929 | QValueList<int> listINT = mLeftFrame->sizes(); | 1964 | QValueList<int> listINT = mLeftFrame->sizes(); |
1930 | config->writeEntry("Left Splitter Frame",listINT); | 1965 | config->writeEntry("Left Splitter Frame",listINT); |
1931 | 1966 | listINT = mMainFrame->sizes(); | |
1967 | config->writeEntry("Main Splitter Frame",listINT); | ||
1932 | #ifdef DESKTOP_VERSION | 1968 | #ifdef DESKTOP_VERSION |
1933 | config->setGroup("WidgetLayout"); | 1969 | config->setGroup("WidgetLayout"); |
1934 | QStringList list ;//= config->readListEntry("MainLayout"); | 1970 | QStringList list ;//= config->readListEntry("MainLayout"); |
1935 | int x,y,w,h; | 1971 | int x,y,w,h; |
1936 | QWidget* wid; | 1972 | QWidget* wid; |
1937 | wid = topLevelWidget(); | 1973 | wid = topLevelWidget(); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index fac9a9e..16e671f 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -528,13 +528,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
528 | void calendarModified( bool, Calendar * ); | 528 | void calendarModified( bool, Calendar * ); |
529 | 529 | ||
530 | CalPrinter *mCalPrinter; | 530 | CalPrinter *mCalPrinter; |
531 | 531 | ||
532 | QSplitter *mPanner; | 532 | QSplitter *mPanner; |
533 | QSplitter *mLeftSplitter; | 533 | QSplitter *mLeftSplitter; |
534 | KDGanttMinimizeSplitter *mLeftFrame; | 534 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
535 | QWidgetStack *mRightFrame; | 535 | QWidgetStack *mRightFrame; |
536 | 536 | ||
537 | KDatePicker* mDatePicker; | 537 | KDatePicker* mDatePicker; |
538 | QVBox* mDateFrame; | 538 | QVBox* mDateFrame; |
539 | 539 | ||
540 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 540 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index b9bd1b9..3358ecf 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -30,12 +30,13 @@ | |||
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 | 37 | ||
37 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, | 38 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, |
38 | const char *name ) | 39 | const char *name ) |
39 | : QWidget( parent, name ), mCalendar( 0 ), | 40 | : QWidget( parent, name ), mCalendar( 0 ), |
40 | mHorizontalCount( 1 ), mVerticalCount( 1 ) | 41 | mHorizontalCount( 1 ), mVerticalCount( 1 ) |
41 | { | 42 | { |
@@ -164,18 +165,39 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | |||
164 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; | 165 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; |
165 | 166 | ||
166 | int verticalCount = size().height() / minSize.height(); | 167 | int verticalCount = size().height() / minSize.height(); |
167 | int horizontalCount = size().width() / minSize.width(); | 168 | int horizontalCount = size().width() / minSize.width(); |
168 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | 169 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); |
169 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 170 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
171 | bool fontchange = false; | ||
172 | QFont fo; | ||
170 | if ( horizontalCount != mHorizontalCount || | 173 | if ( horizontalCount != mHorizontalCount || |
171 | verticalCount != mVerticalCount ) { | 174 | verticalCount != mVerticalCount ) { |
172 | uint count = horizontalCount * verticalCount; | 175 | uint count = horizontalCount * verticalCount; |
173 | if ( count == 0 ) { | 176 | if ( count == 0 ) { |
174 | mNavigatorView->resize( minSize ); | 177 | bool ok; |
175 | return; | 178 | fo = mNavigatorView->yourFontHint( size() , &ok); |
179 | //mNavigatorView->resize( size() ); | ||
180 | //if ( ! ok ) | ||
181 | // return; | ||
182 | minSize = mNavigatorView->sizeHint(); | ||
183 | verticalCount = size().height() / minSize.height(); | ||
184 | horizontalCount = size().width() / minSize.width(); | ||
185 | if ( horizontalCount == 0 ) | ||
186 | horizontalCount = 1; | ||
187 | if ( verticalCount == 0 ) | ||
188 | verticalCount = 1; | ||
189 | fontchange = true; | ||
190 | count = horizontalCount * verticalCount; | ||
191 | } else { | ||
192 | if ( mNavigatorView->fontChanged() ) { | ||
193 | fontchange = true; | ||
194 | fo = KOPrefs::instance()->mDateNavigatorFont; | ||
195 | mNavigatorView->changeFont( fo ); | ||
196 | mNavigatorView->unsetFontChanged(); | ||
197 | } | ||
176 | } | 198 | } |
177 | 199 | ||
178 | while ( count > ( mExtraViews.count() + 1 ) ) { | 200 | while ( count > ( mExtraViews.count() + 1 ) ) { |
179 | KDateNavigator *n = new KDateNavigator( this ); | 201 | KDateNavigator *n = new KDateNavigator( this ); |
180 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 202 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
181 | mExtraViews.append( n ); | 203 | mExtraViews.append( n ); |
@@ -185,17 +207,23 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | |||
185 | n->show(); | 207 | n->show(); |
186 | } | 208 | } |
187 | 209 | ||
188 | while ( count < ( mExtraViews.count() + 1 ) ) { | 210 | while ( count < ( mExtraViews.count() + 1 ) ) { |
189 | mExtraViews.removeLast(); | 211 | mExtraViews.removeLast(); |
190 | } | 212 | } |
191 | 213 | if ( fontchange ) { | |
214 | //mNavigatorView->changeFont( fo ); | ||
215 | uint i; | ||
216 | for( i = 0; i < mExtraViews.count(); ++i ) { | ||
217 | KDateNavigator *view = mExtraViews.at( i ); | ||
218 | view->changeFont( fo ); | ||
219 | } | ||
220 | } | ||
192 | mHorizontalCount = horizontalCount; | 221 | mHorizontalCount = horizontalCount; |
193 | mVerticalCount = verticalCount; | 222 | mVerticalCount = verticalCount; |
194 | } | 223 | } |
195 | |||
196 | int height = size().height() / verticalCount; | 224 | int height = size().height() / verticalCount; |
197 | int width = size().width() / horizontalCount; | 225 | int width = size().width() / horizontalCount; |
198 | 226 | ||
199 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 227 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
200 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); | 228 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); |
201 | else bar->showButtons( true, true ); | 229 | else bar->showButtons( true, true ); |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index b097dc1..92a0ac2 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -113,12 +113,52 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
114 | 114 | ||
115 | // read settings from configuration file. | 115 | // read settings from configuration file. |
116 | updateConfig(); | 116 | updateConfig(); |
117 | enableRollover(FollowMonth); | 117 | enableRollover(FollowMonth); |
118 | mySizeHint = sizeHint(); | 118 | mySizeHint = sizeHint(); |
119 | mFontChanged = false; | ||
120 | } | ||
121 | void KDateNavigator::changeFont ( QFont fo ) | ||
122 | { | ||
123 | setFont( fo ); | ||
124 | mNavigatorBar->resetFont( fo ); | ||
125 | } | ||
126 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | ||
127 | { | ||
128 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | ||
129 | *b = false; | ||
130 | int fontPoint = fo.pointSize(); | ||
131 | while ( fontPoint > 5 ) { | ||
132 | --fontPoint; | ||
133 | fo.setPointSize( fontPoint ); | ||
134 | setFont( fo ); | ||
135 | mFontChanged = true; | ||
136 | mNavigatorBar->resetFont( fo ); | ||
137 | QSize sh = sizeHint(); | ||
138 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | ||
139 | if ( si.width() > sh.width() && si.height() > sh.height()) { | ||
140 | *b = true; | ||
141 | //qDebug("fooooooooooooooooooooooouuuuund "); | ||
142 | break; | ||
143 | } | ||
144 | } | ||
145 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); | ||
146 | return fo; | ||
147 | } | ||
148 | QSize KDateNavigator::sizeHint() const | ||
149 | { | ||
150 | QFontMetrics fm ( font() ); | ||
151 | QSize day = daymatrix->sizeHint(); | ||
152 | QSize nav = mNavigatorBar->sizeHint(); | ||
153 | int wid = fm.width( "30") + day.width()+3; | ||
154 | int hei = fm.height() +day.height()+nav.height()+2; | ||
155 | if ( wid < nav.width() ) | ||
156 | wid = nav.width() ; | ||
157 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | ||
158 | return QSize ( wid, hei ); | ||
119 | } | 159 | } |
120 | void KDateNavigator::slotMonthSelected( int m ) | 160 | void KDateNavigator::slotMonthSelected( int m ) |
121 | { | 161 | { |
122 | if ( m_MthYr.month() <= mMonthSignalOffset) | 162 | if ( m_MthYr.month() <= mMonthSignalOffset) |
123 | m += 12; | 163 | m += 12; |
124 | int mo = m - mMonthSignalOffset; | 164 | int mo = m - mMonthSignalOffset; |
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 292e71c..3177687 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -62,13 +62,18 @@ class KDateNavigator: public QFrame | |||
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;} | 66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} |
67 | QSize yourSizeHint() { return mySizeHint; } | 67 | QSize yourSizeHint() { return mySizeHint; } |
68 | KODayMatrix *dayMatrix() { return daymatrix ;} | 68 | QFont yourFontHint( QSize , bool * b); |
69 | bool fontChanged() {return mFontChanged; } | ||
70 | void unsetFontChanged() { mFontChanged = false; } | ||
71 | KODayMatrix *dayMatrix() { return daymatrix ;} | ||
72 | QSize sizeHint() const; | ||
73 | void changeFont ( QFont fo ); | ||
69 | public slots: | 74 | public slots: |
70 | void selectDates( const KCal::DateList & ); | 75 | void selectDates( const KCal::DateList & ); |
71 | void updateView(); | 76 | void updateView(); |
72 | void updateConfig(); | 77 | void updateConfig(); |
73 | void updateDayMatrix(); | 78 | void updateDayMatrix(); |
74 | 79 | ||
@@ -114,12 +119,13 @@ class KDateNavigator: public QFrame | |||
114 | void wheelEvent (QWheelEvent *); | 119 | void wheelEvent (QWheelEvent *); |
115 | 120 | ||
116 | bool eventFilter (QObject *,QEvent *); | 121 | bool eventFilter (QObject *,QEvent *); |
117 | 122 | ||
118 | private: | 123 | private: |
119 | QSize mySizeHint; | 124 | QSize mySizeHint; |
125 | bool mFontChanged; | ||
120 | int mMonthSignalOffset; | 126 | int mMonthSignalOffset; |
121 | NavigatorBar *mNavigatorBar; | 127 | NavigatorBar *mNavigatorBar; |
122 | 128 | ||
123 | QFrame *headingSep; | 129 | QFrame *headingSep; |
124 | QFrame *weeknumSep; | 130 | QFrame *weeknumSep; |
125 | QLabel *headings[7]; | 131 | QLabel *headings[7]; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 619ae39..9181936 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -793,6 +793,17 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
793 | void KODayMatrix::resizeEvent(QResizeEvent *) | 793 | void KODayMatrix::resizeEvent(QResizeEvent *) |
794 | { | 794 | { |
795 | QRect sz = frameRect(); | 795 | QRect sz = frameRect(); |
796 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 796 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
797 | daysize.setWidth(sz.width() / 7); | 797 | daysize.setWidth(sz.width() / 7); |
798 | } | 798 | } |
799 | |||
800 | QSize KODayMatrix::sizeHint() const | ||
801 | { | ||
802 | |||
803 | QFontMetrics fm ( font() ); | ||
804 | int wid = fm.width( "30") *7+7; | ||
805 | int hei = fm.height() * 6+4; | ||
806 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | ||
807 | return QSize ( wid, hei ); | ||
808 | |||
809 | } | ||
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index c049942..39946de 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -167,12 +167,13 @@ public: | |||
167 | * in the array of visible dates and going from | 167 | * in the array of visible dates and going from |
168 | * top left (0) to bottom right (41). | 168 | * top left (0) to bottom right (41). |
169 | */ | 169 | */ |
170 | bool isBeginningOfMonth() const { return today<=8; } ; | 170 | bool isBeginningOfMonth() const { return today<=8; } ; |
171 | bool isEndOfMonth() const { return today>=27; } ; | 171 | bool isEndOfMonth() const { return today>=27; } ; |
172 | QString getWhatsThisText( QPoint ) ; | 172 | QString getWhatsThisText( QPoint ) ; |
173 | QSize sizeHint() const; | ||
173 | 174 | ||
174 | public slots: | 175 | public slots: |
175 | /** Recalculates all the flags of the days in the matrix like holidays or events | 176 | /** Recalculates all the flags of the days in the matrix like holidays or events |
176 | * on a day (Actually calls above method with the actual startdate). | 177 | * on a day (Actually calls above method with the actual startdate). |
177 | */ | 178 | */ |
178 | void updateView(); | 179 | void updateView(); |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 27d4d17..4a51bba 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -59,16 +59,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
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 | QFont tfont = font(); | 65 | |
66 | if ( QApplication::desktop()->width() >= 480 ) | ||
67 | tfont.setPointSize(tfont.pointSize()+2); | ||
68 | tfont.setBold(true); | ||
69 | 66 | ||
70 | bool isRTL = KOGlobals::self()->reverseLayout(); | 67 | bool isRTL = KOGlobals::self()->reverseLayout(); |
71 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
72 | bool isDesktop = false; | 69 | bool isDesktop = false; |
73 | #else | 70 | #else |
74 | bool isDesktop = true; | 71 | bool isDesktop = true; |
@@ -117,40 +114,16 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
117 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
118 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
119 | } else { | 116 | } else { |
120 | mPrevWeek->hide(); | 117 | mPrevWeek->hide(); |
121 | mNextWeek->hide(); | 118 | mNextWeek->hide(); |
122 | } | 119 | } |
123 | mSelectMonth->setFont( tfont ); | ||
124 | // Set minimum width to width of widest month name label | ||
125 | int i; | ||
126 | int maxwidth = 0; | ||
127 | QFontMetrics fm ( mSelectMonth->font() ); | ||
128 | int width = fm.width("September '00" ); | ||
129 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | ||
130 | // ++i ) { | ||
131 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | ||
132 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | ||
133 | // int width = fm.width("September 2000" ); | ||
134 | // if ( width > maxwidth ) maxwidth = width; | ||
135 | // } | ||
136 | maxwidth = width+2; | ||
137 | int size = fm.height()+2; | ||
138 | if ( QApplication::desktop()->width() >= 480 ) { | ||
139 | size += 6; | ||
140 | maxwidth+= 6; | ||
141 | } | ||
142 | 120 | ||
143 | mSelectMonth->setFixedWidth( maxwidth ); | 121 | resetFont( font() ); |
144 | mSelectMonth->setFixedHeight( size ); | 122 | |
145 | mPrevYear->setFixedHeight( size ); | 123 | |
146 | mPrevMonth->setFixedHeight( size ); | ||
147 | mPrevWeek->setFixedHeight( size ); | ||
148 | mNextMonth->setFixedHeight( size ); | ||
149 | mNextWeek->setFixedHeight( size ); | ||
150 | mNextYear->setFixedHeight ( size ); | ||
151 | // set up control frame layout | 124 | // set up control frame layout |
152 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
153 | ctrlLayout->addWidget( mPrevYear, 3 ); | 126 | ctrlLayout->addWidget( mPrevYear, 3 ); |
154 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 127 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
155 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 128 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
156 | //ctrlLayout->addStretch( 1 ); | 129 | //ctrlLayout->addStretch( 1 ); |
@@ -181,12 +154,42 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
181 | 154 | ||
182 | } | 155 | } |
183 | 156 | ||
184 | NavigatorBar::~NavigatorBar() | 157 | NavigatorBar::~NavigatorBar() |
185 | { | 158 | { |
186 | } | 159 | } |
160 | void NavigatorBar::resetFont ( QFont fo ) | ||
161 | { | ||
162 | |||
163 | QFont tfont = fo; | ||
164 | if ( QApplication::desktop()->width() >= 480 ) | ||
165 | tfont.setPointSize(tfont.pointSize()+2); | ||
166 | tfont.setBold(true); | ||
167 | |||
168 | mSelectMonth->setFont( tfont ); | ||
169 | // Set minimum width to width of widest month name label | ||
170 | int i; | ||
171 | int maxwidth = 0; | ||
172 | QFontMetrics fm ( mSelectMonth->font() ); | ||
173 | int width = fm.width("September '00" ); | ||
174 | maxwidth = width+2; | ||
175 | int size = fm.height()+2; | ||
176 | if ( QApplication::desktop()->width() >= 480 ) { | ||
177 | size += 6; | ||
178 | maxwidth+= 6; | ||
179 | } | ||
180 | mSelectMonth->setMinimumWidth( maxwidth ); | ||
181 | mSelectMonth->setFixedHeight( size ); | ||
182 | mPrevYear->setFixedHeight( size ); | ||
183 | mPrevMonth->setFixedHeight( size ); | ||
184 | mPrevWeek->setFixedHeight( size ); | ||
185 | mNextMonth->setFixedHeight( size ); | ||
186 | mNextWeek->setFixedHeight( size ); | ||
187 | mNextYear->setFixedHeight ( size ); | ||
188 | } | ||
189 | |||
187 | void NavigatorBar::showButtons( bool left, bool right ) | 190 | void NavigatorBar::showButtons( bool left, bool right ) |
188 | { | 191 | { |
189 | if ( left ) { | 192 | if ( left ) { |
190 | mPrevYear->show(); | 193 | mPrevYear->show(); |
191 | mPrevMonth->show(); | 194 | mPrevMonth->show(); |
192 | } else { | 195 | } else { |
@@ -199,13 +202,13 @@ void NavigatorBar::showButtons( bool left, bool right ) | |||
199 | mNextMonth->show(); | 202 | mNextMonth->show(); |
200 | } else { | 203 | } else { |
201 | mNextYear->hide(); | 204 | mNextYear->hide(); |
202 | mNextMonth->hide(); | 205 | mNextMonth->hide(); |
203 | } | 206 | } |
204 | if ( !left && !right ) { | 207 | if ( !left && !right ) { |
205 | mSelectMonth->setMaximumWidth( 1024 ); | 208 | //mSelectMonth->setMaximumWidth( 1024 ); |
206 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 209 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
207 | } | 210 | } |
208 | } | 211 | } |
209 | 212 | ||
210 | void NavigatorBar::selectMonth() | 213 | void NavigatorBar::selectMonth() |
211 | { | 214 | { |
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 4442caa..0b2f60b 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h | |||
@@ -36,12 +36,13 @@ 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 | 43 | ||
43 | public slots: | 44 | public slots: |
44 | void selectDates( const KCal::DateList & ); | 45 | void selectDates( const KCal::DateList & ); |
45 | void selectMonth(); | 46 | void selectMonth(); |
46 | 47 | ||
47 | signals: | 48 | signals: |