summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
authorzautrix <zautrix>2005-03-20 14:04:37 (UTC)
committer zautrix <zautrix>2005-03-20 14:04:37 (UTC)
commit69d75020eea5f95b9f5d77d97ed85ec8869d32db (patch) (unidiff)
tree378b920b9392e7ed4472597e586154d7b99b0645 /korganizer/navigatorbar.cpp
parent289dd44f4f23d92c45d8f28c867a14a980fd5dde (diff)
downloadkdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.zip
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.gz
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.bz2
layout fixes
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp67
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
@@ -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
184NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
185{ 158{
186} 159}
160void 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
187void NavigatorBar::showButtons( bool left, bool right ) 190void 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
210void NavigatorBar::selectMonth() 213void NavigatorBar::selectMonth()
211{ 214{