-rw-r--r-- | korganizer/navigatorbar.cpp | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 27d4d17..4a51bba 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -64,6 +64,3 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
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 | ||
@@ -122,30 +119,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
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 |
@@ -186,2 +159,32 @@ NavigatorBar::~NavigatorBar() | |||
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 ) |
@@ -204,3 +207,3 @@ void NavigatorBar::showButtons( bool left, bool right ) | |||
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 ) ); |