summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp22
-rw-r--r--korganizer/navigatorbar.h4
2 files changed, 26 insertions, 0 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 4a51bba..e4abbf7 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -154,12 +154,31 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
154 154
155} 155}
156 156
157NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
158{ 158{
159} 159}
160QSize NavigatorBar::sizeHint() const
161{
162 int wid = mCurrentMinWid ;
163 if ( mPrevYear->isVisible() )
164 wid += mCurrentButtonMinWid;
165 if ( mPrevMonth->isVisible() )
166 wid += mCurrentButtonMinWid;
167 if ( mPrevWeek->isVisible() )
168 wid += mCurrentButtonMinWid;
169 if ( mNextMonth->isVisible() )
170 wid += mCurrentButtonMinWid;
171 if ( mNextWeek->isVisible() )
172 wid += mCurrentButtonMinWid;
173 if ( mNextYear->isVisible() )
174 wid += mCurrentButtonMinWid;
175 //qDebug("ret %d %d ", wid, mCurrentHei);
176 int add = 2;
177 return QSize ( wid+add, mCurrentHei+add );
178}
160void NavigatorBar::resetFont ( QFont fo ) 179void NavigatorBar::resetFont ( QFont fo )
161{ 180{
162 181
163 QFont tfont = fo; 182 QFont tfont = fo;
164 if ( QApplication::desktop()->width() >= 480 ) 183 if ( QApplication::desktop()->width() >= 480 )
165 tfont.setPointSize(tfont.pointSize()+2); 184 tfont.setPointSize(tfont.pointSize()+2);
@@ -182,12 +201,15 @@ void NavigatorBar::resetFont ( QFont fo )
182 mPrevYear->setFixedHeight( size ); 201 mPrevYear->setFixedHeight( size );
183 mPrevMonth->setFixedHeight( size ); 202 mPrevMonth->setFixedHeight( size );
184 mPrevWeek->setFixedHeight( size ); 203 mPrevWeek->setFixedHeight( size );
185 mNextMonth->setFixedHeight( size ); 204 mNextMonth->setFixedHeight( size );
186 mNextWeek->setFixedHeight( size ); 205 mNextWeek->setFixedHeight( size );
187 mNextYear->setFixedHeight ( size ); 206 mNextYear->setFixedHeight ( size );
207 mCurrentHei = size;
208 mCurrentMinWid = maxwidth;
209 mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2;
188} 210}
189 211
190void NavigatorBar::showButtons( bool left, bool right ) 212void NavigatorBar::showButtons( bool left, bool right )
191{ 213{
192 if ( left ) { 214 if ( left ) {
193 mPrevYear->show(); 215 mPrevYear->show();
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 0b2f60b..5d5aff4 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -37,12 +37,13 @@ class NavigatorBar: public QWidget
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 44
44 public slots: 45 public slots:
45 void selectDates( const KCal::DateList & ); 46 void selectDates( const KCal::DateList & );
46 void selectMonth(); 47 void selectMonth();
47 48
48 signals: 49 signals:
@@ -52,12 +53,15 @@ class NavigatorBar: public QWidget
52 void goPrevWeek(); 53 void goPrevWeek();
53 void goNextYear(); 54 void goNextYear();
54 void goPrevYear(); 55 void goPrevYear();
55 void monthSelected( int ); 56 void monthSelected( int );
56 57
57 private: 58 private:
59 int mCurrentHei;
60 int mCurrentMinWid;
61 int mCurrentButtonMinWid;
58 QFrame *mCtrlFrame; 62 QFrame *mCtrlFrame;
59 63
60 QPushButton *mPrevYear; 64 QPushButton *mPrevYear;
61 QPushButton *mPrevMonth; 65 QPushButton *mPrevMonth;
62 QPushButton *mNextMonth; 66 QPushButton *mNextMonth;
63 QPushButton *mPrevWeek; 67 QPushButton *mPrevWeek;