summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-21 09:58:16 (UTC)
committer zautrix <zautrix>2005-03-21 09:58:16 (UTC)
commit5b9e0451514d65ab576b51e0f9d3515fa6b9e4e6 (patch) (unidiff)
treec3e1f114768876675b6ab6463083d03dff321b4e
parentfd372d97084c401aacb999e89f8bdd94056a3b59 (diff)
downloadkdepimpi-5b9e0451514d65ab576b51e0f9d3515fa6b9e4e6.zip
kdepimpi-5b9e0451514d65ab576b51e0f9d3515fa6b9e4e6.tar.gz
kdepimpi-5b9e0451514d65ab576b51e0f9d3515fa6b9e4e6.tar.bz2
nf
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp4
-rw-r--r--korganizer/kdatenavigator.cpp14
-rw-r--r--korganizer/kdatenavigator.h1
-rw-r--r--korganizer/navigatorbar.cpp11
-rw-r--r--korganizer/navigatorbar.h1
5 files changed, 24 insertions, 7 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 3358ecf..5cdaa83 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -151,44 +151,44 @@ void DateNavigatorContainer::setBaseDates()
151 } 151 }
152} 152}
153 153
154void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 154void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
155{ 155{
156#if 0 156#if 0
157 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 157 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
158 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 158 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
159 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 159 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
160 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 160 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
161 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 161 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
162#endif 162#endif
163 QSize minSize = mNavigatorView->yourSizeHint(); 163 QSize minSize = mNavigatorView->sizeHintTwoButtons();
164 164
165// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 165// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
166 166
167 int verticalCount = size().height() / minSize.height(); 167 int verticalCount = size().height() / minSize.height();
168 int horizontalCount = size().width() / minSize.width(); 168 int horizontalCount = size().width() / minSize.width();
169 //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() );
170 //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; 171 bool fontchange = false;
172 QFont fo; 172 QFont fo;
173 if ( horizontalCount != mHorizontalCount || 173 if ( horizontalCount != mHorizontalCount ||
174 verticalCount != mVerticalCount ) { 174 verticalCount != mVerticalCount ) {
175 uint count = horizontalCount * verticalCount; 175 uint count = horizontalCount * verticalCount;
176 if ( count == 0 ) { 176 if ( count == 0 ) {
177 bool ok; 177 bool ok;
178 fo = mNavigatorView->yourFontHint( size() , &ok); 178 fo = mNavigatorView->yourFontHint( size() , &ok);
179 //mNavigatorView->resize( size() ); 179 //mNavigatorView->resize( size() );
180 //if ( ! ok ) 180 //if ( ! ok )
181 // return; 181 // return;
182 minSize = mNavigatorView->sizeHint(); 182 minSize = mNavigatorView->sizeHintTwoButtons();
183 verticalCount = size().height() / minSize.height(); 183 verticalCount = size().height() / minSize.height();
184 horizontalCount = size().width() / minSize.width(); 184 horizontalCount = size().width() / minSize.width();
185 if ( horizontalCount == 0 ) 185 if ( horizontalCount == 0 )
186 horizontalCount = 1; 186 horizontalCount = 1;
187 if ( verticalCount == 0 ) 187 if ( verticalCount == 0 )
188 verticalCount = 1; 188 verticalCount = 1;
189 fontchange = true; 189 fontchange = true;
190 count = horizontalCount * verticalCount; 190 count = horizontalCount * verticalCount;
191 } else { 191 } else {
192 if ( mNavigatorView->fontChanged() ) { 192 if ( mNavigatorView->fontChanged() ) {
193 fontchange = true; 193 fontchange = true;
194 fo = KOPrefs::instance()->mDateNavigatorFont; 194 fo = KOPrefs::instance()->mDateNavigatorFont;
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 92a0ac2..a5dbc5d 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -125,47 +125,59 @@ void KDateNavigator::changeFont ( QFont fo )
125} 125}
126QFont KDateNavigator::yourFontHint( QSize si , bool *b) 126QFont KDateNavigator::yourFontHint( QSize si , bool *b)
127{ 127{
128 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 128 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
129 *b = false; 129 *b = false;
130 int fontPoint = fo.pointSize(); 130 int fontPoint = fo.pointSize();
131 while ( fontPoint > 5 ) { 131 while ( fontPoint > 5 ) {
132 --fontPoint; 132 --fontPoint;
133 fo.setPointSize( fontPoint ); 133 fo.setPointSize( fontPoint );
134 setFont( fo ); 134 setFont( fo );
135 mFontChanged = true; 135 mFontChanged = true;
136 mNavigatorBar->resetFont( fo ); 136 mNavigatorBar->resetFont( fo );
137 QSize sh = sizeHint(); 137 QSize sh = sizeHintTwoButtons();
138 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 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()) { 139 if ( si.width() > sh.width() && si.height() > sh.height()) {
140 *b = true; 140 *b = true;
141 //qDebug("fooooooooooooooooooooooouuuuund "); 141 //qDebug("fooooooooooooooooooooooouuuuund ");
142 break; 142 break;
143 } 143 }
144 } 144 }
145 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 145 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
146 return fo; 146 return fo;
147} 147}
148QSize KDateNavigator::sizeHint() const 148QSize KDateNavigator::sizeHint() const
149{ 149{
150 QFontMetrics fm ( font() ); 150 QFontMetrics fm ( font() );
151 QSize day = daymatrix->sizeHint(); 151 QSize day = daymatrix->sizeHint();
152 QSize nav = mNavigatorBar->sizeHint(); 152 QSize nav = mNavigatorBar->sizeHint();
153 int wid = fm.width( "30") + day.width()+3; 153 int wid = fm.width( "30") + day.width()+3;
154 int hei = fm.height() +day.height()+nav.height()+2; 154 int hei = fm.height() +day.height()+nav.height()+2;
155 if ( wid < nav.width() ) 155 if ( wid < nav.width() )
156 wid = nav.width() ; 156 wid = nav.width() ;
157 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 157 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
158 return QSize ( wid, hei ); 158 return QSize ( wid, hei );
159} 159}
160QSize KDateNavigator::sizeHintTwoButtons() const
161{
162 QFontMetrics fm ( font() );
163 QSize day = daymatrix->sizeHint();
164 QSize nav = mNavigatorBar->sizeHintTwoButtons();
165 int wid = fm.width( "30") + day.width()+3;
166 int hei = fm.height() +day.height()+nav.height()+2;
167 if ( wid < nav.width() )
168 wid = nav.width() ;
169 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
170 return QSize ( wid, hei );
171}
160void KDateNavigator::slotMonthSelected( int m ) 172void KDateNavigator::slotMonthSelected( int m )
161{ 173{
162 if ( m_MthYr.month() <= mMonthSignalOffset) 174 if ( m_MthYr.month() <= mMonthSignalOffset)
163 m += 12; 175 m += 12;
164 int mo = m - mMonthSignalOffset; 176 int mo = m - mMonthSignalOffset;
165 emit monthSelected( m - mMonthSignalOffset ); 177 emit monthSelected( m - mMonthSignalOffset );
166 178
167} 179}
168void KDateNavigator::setCalendar( Calendar *cal ) 180void KDateNavigator::setCalendar( Calendar *cal )
169{ 181{
170 daymatrix->setCalendar( cal ); 182 daymatrix->setCalendar( cal );
171} 183}
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 3177687..d1f32b6 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -61,24 +61,25 @@ class KDateNavigator: public QFrame
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
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 QFont yourFontHint( QSize , bool * b); 68 QFont yourFontHint( QSize , bool * b);
69 bool fontChanged() {return mFontChanged; } 69 bool fontChanged() {return mFontChanged; }
70 void unsetFontChanged() { mFontChanged = false; } 70 void unsetFontChanged() { mFontChanged = false; }
71 KODayMatrix *dayMatrix() { return daymatrix ;} 71 KODayMatrix *dayMatrix() { return daymatrix ;}
72 QSize sizeHint() const; 72 QSize sizeHint() const;
73 QSize sizeHintTwoButtons() const;
73 void changeFont ( QFont fo ); 74 void changeFont ( QFont fo );
74 public slots: 75 public slots:
75 void selectDates( const KCal::DateList & ); 76 void selectDates( const KCal::DateList & );
76 void updateView(); 77 void updateView();
77 void updateConfig(); 78 void updateConfig();
78 void updateDayMatrix(); 79 void updateDayMatrix();
79 80
80 signals: 81 signals:
81 void datesSelected( const KCal::DateList & ); 82 void datesSelected( const KCal::DateList & );
82 void eventDropped( Event * ); 83 void eventDropped( Event * );
83 void weekClicked( const QDate &); 84 void weekClicked( const QDate &);
84 85
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index e4abbf7..1b4ee52 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -164,26 +164,29 @@ QSize NavigatorBar::sizeHint() const
164 wid += mCurrentButtonMinWid; 164 wid += mCurrentButtonMinWid;
165 if ( mPrevMonth->isVisible() ) 165 if ( mPrevMonth->isVisible() )
166 wid += mCurrentButtonMinWid; 166 wid += mCurrentButtonMinWid;
167 if ( mPrevWeek->isVisible() ) 167 if ( mPrevWeek->isVisible() )
168 wid += mCurrentButtonMinWid; 168 wid += mCurrentButtonMinWid;
169 if ( mNextMonth->isVisible() ) 169 if ( mNextMonth->isVisible() )
170 wid += mCurrentButtonMinWid; 170 wid += mCurrentButtonMinWid;
171 if ( mNextWeek->isVisible() ) 171 if ( mNextWeek->isVisible() )
172 wid += mCurrentButtonMinWid; 172 wid += mCurrentButtonMinWid;
173 if ( mNextYear->isVisible() ) 173 if ( mNextYear->isVisible() )
174 wid += mCurrentButtonMinWid; 174 wid += mCurrentButtonMinWid;
175 //qDebug("ret %d %d ", wid, mCurrentHei); 175 //qDebug("ret %d %d ", wid, mCurrentHei);
176 int add = 2; 176 return QSize ( wid, mCurrentHei );
177 return QSize ( wid+add, mCurrentHei+add ); 177}
178QSize NavigatorBar::sizeHintTwoButtons() const
179{
180 return QSize ( mCurrentMinWid + 2 * mCurrentButtonMinWid , mCurrentHei );
178} 181}
179void NavigatorBar::resetFont ( QFont fo ) 182void NavigatorBar::resetFont ( QFont fo )
180{ 183{
181 184
182 QFont tfont = fo; 185 QFont tfont = fo;
183 if ( QApplication::desktop()->width() >= 480 ) 186 if ( QApplication::desktop()->width() >= 480 )
184 tfont.setPointSize(tfont.pointSize()+2); 187 tfont.setPointSize(tfont.pointSize()+2);
185 tfont.setBold(true); 188 tfont.setBold(true);
186 189
187 mSelectMonth->setFont( tfont ); 190 mSelectMonth->setFont( tfont );
188 // Set minimum width to width of widest month name label 191 // Set minimum width to width of widest month name label
189 int i; 192 int i;
@@ -195,26 +198,26 @@ void NavigatorBar::resetFont ( QFont fo )
195 if ( QApplication::desktop()->width() >= 480 ) { 198 if ( QApplication::desktop()->width() >= 480 ) {
196 size += 6; 199 size += 6;
197 maxwidth+= 6; 200 maxwidth+= 6;
198 } 201 }
199 mSelectMonth->setMinimumWidth( maxwidth ); 202 mSelectMonth->setMinimumWidth( maxwidth );
200 mSelectMonth->setFixedHeight( size ); 203 mSelectMonth->setFixedHeight( size );
201 mPrevYear->setFixedHeight( size ); 204 mPrevYear->setFixedHeight( size );
202 mPrevMonth->setFixedHeight( size ); 205 mPrevMonth->setFixedHeight( size );
203 mPrevWeek->setFixedHeight( size ); 206 mPrevWeek->setFixedHeight( size );
204 mNextMonth->setFixedHeight( size ); 207 mNextMonth->setFixedHeight( size );
205 mNextWeek->setFixedHeight( size ); 208 mNextWeek->setFixedHeight( size );
206 mNextYear->setFixedHeight ( size ); 209 mNextYear->setFixedHeight ( size );
207 mCurrentHei = size; 210 mCurrentHei = size +2;
208 mCurrentMinWid = maxwidth; 211 mCurrentMinWid = maxwidth+2;
209 mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; 212 mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2;
210} 213}
211 214
212void NavigatorBar::showButtons( bool left, bool right ) 215void NavigatorBar::showButtons( bool left, bool right )
213{ 216{
214 if ( left ) { 217 if ( left ) {
215 mPrevYear->show(); 218 mPrevYear->show();
216 mPrevMonth->show(); 219 mPrevMonth->show();
217 } else { 220 } else {
218 mPrevYear->hide(); 221 mPrevYear->hide();
219 mPrevMonth->hide(); 222 mPrevMonth->hide();
220 } 223 }
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 5d5aff4..bf6d173 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -32,24 +32,25 @@ class QPushButton;
32class QFrame; 32class QFrame;
33class QLabel; 33class QLabel;
34 34
35class NavigatorBar: public QWidget 35class 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 void resetFont ( QFont fo );
43 QSize sizeHint() const; 43 QSize sizeHint() const;
44 QSize sizeHintTwoButtons() const;
44 45
45 public slots: 46 public slots:
46 void selectDates( const KCal::DateList & ); 47 void selectDates( const KCal::DateList & );
47 void selectMonth(); 48 void selectMonth();
48 49
49 signals: 50 signals:
50 void goNextMonth(); 51 void goNextMonth();
51 void goPrevMonth(); 52 void goPrevMonth();
52 void goNextWeek(); 53 void goNextWeek();
53 void goPrevWeek(); 54 void goPrevWeek();
54 void goNextYear(); 55 void goNextYear();
55 void goPrevYear(); 56 void goPrevYear();