Diffstat (limited to 'korganizer/kdatenavigator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kdatenavigator.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index fe83e09..231095f 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -103,78 +103,83 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
105 | daymatrix->setLineWidth(1); | 105 | daymatrix->setLineWidth(1); |
106 | 106 | ||
107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
109 | 109 | ||
110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
111 | SIGNAL( eventDropped( Event * ) ) ); | 111 | SIGNAL( eventDropped( Event * ) ) ); |
112 | 112 | ||
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 = sizeHintTwoButtons(); | 118 | mySizeHint = sizeHintTwoButtons(); |
119 | myFullSizeHint = sizeHintTwoButtons( 4 ); | ||
119 | mFontChanged = false; | 120 | mFontChanged = false; |
120 | } | 121 | } |
121 | void KDateNavigator::changeFont ( QFont fo ) | 122 | void KDateNavigator::changeFont ( QFont fo ) |
122 | { | 123 | { |
123 | setFont( fo ); | 124 | setFont( fo ); |
124 | mNavigatorBar->resetFont( fo ); | 125 | mNavigatorBar->resetFont( fo ); |
125 | } | 126 | } |
126 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 127 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
127 | { | 128 | { |
128 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 129 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
129 | *b = false; | 130 | *b = false; |
130 | int fontPoint = fo.pointSize(); | 131 | int fontPoint = fo.pointSize(); |
131 | while ( fontPoint > 5 ) { | 132 | while ( fontPoint > 5 ) { |
132 | --fontPoint; | 133 | --fontPoint; |
133 | fo.setPointSize( fontPoint ); | 134 | fo.setPointSize( fontPoint ); |
134 | setFont( fo ); | 135 | setFont( fo ); |
135 | mFontChanged = true; | 136 | mFontChanged = true; |
136 | mNavigatorBar->resetFont( fo ); | 137 | mNavigatorBar->resetFont( fo ); |
137 | QSize sh = sizeHintTwoButtons(); | 138 | QSize sh = sizeHintTwoButtons( 2 ); |
138 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 139 | //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 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
141 | if ( si.width() / sh.width() == 1 ) { | ||
142 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) | ||
143 | continue; | ||
144 | } | ||
140 | *b = true; | 145 | *b = true; |
141 | //qDebug("fooooooooooooooooooooooouuuuund "); | 146 | //qDebug("fooooooooooooooooooooooouuuuund "); |
142 | break; | 147 | break; |
143 | } | 148 | } |
144 | } | 149 | } |
145 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); | 150 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); |
146 | return fo; | 151 | return fo; |
147 | } | 152 | } |
148 | QSize KDateNavigator::sizeHint() const | 153 | QSize KDateNavigator::sizeHint() const |
149 | { | 154 | { |
150 | QFontMetrics fm ( font() ); | 155 | QFontMetrics fm ( font() ); |
151 | QSize day = daymatrix->sizeHint(); | 156 | QSize day = daymatrix->sizeHint(); |
152 | QSize nav = mNavigatorBar->sizeHint(); | 157 | QSize nav = mNavigatorBar->sizeHint(); |
153 | int wid = fm.width( "30") + day.width()+3; | 158 | int wid = fm.width( "30") + day.width()+3; |
154 | int hei = fm.height() +day.height()+nav.height()+2; | 159 | int hei = fm.height() +day.height()+nav.height()+2; |
155 | if ( wid < nav.width() ) | 160 | if ( wid < nav.width() ) |
156 | wid = nav.width() ; | 161 | wid = nav.width() ; |
157 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 162 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
158 | return QSize ( wid, hei ); | 163 | return QSize ( wid, hei ); |
159 | } | 164 | } |
160 | QSize KDateNavigator::sizeHintTwoButtons() const | 165 | QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const |
161 | { | 166 | { |
162 | QFontMetrics fm ( font() ); | 167 | QFontMetrics fm ( font() ); |
163 | QSize day = daymatrix->sizeHint(); | 168 | QSize day = daymatrix->sizeHint(); |
164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); | 169 | QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); |
165 | int wid = fm.width( "30") + day.width()+3; | 170 | int wid = fm.width( "30") + day.width()+3; |
166 | int hei = fm.height() +day.height()+nav.height()+2; | 171 | int hei = fm.height() +day.height()+nav.height()+2; |
167 | if ( wid < nav.width() ) | 172 | if ( wid < nav.width() ) |
168 | wid = nav.width() ; | 173 | wid = nav.width() ; |
169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 174 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
170 | return QSize ( wid, hei ); | 175 | return QSize ( wid, hei ); |
171 | } | 176 | } |
172 | void KDateNavigator::slotMonthSelected( int m ) | 177 | void KDateNavigator::slotMonthSelected( int m ) |
173 | { | 178 | { |
174 | if ( m_MthYr.month() <= mMonthSignalOffset) | 179 | if ( m_MthYr.month() <= mMonthSignalOffset) |
175 | m += 12; | 180 | m += 12; |
176 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); | 181 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); |
177 | emit monthSelected( m - mMonthSignalOffset ); | 182 | emit monthSelected( m - mMonthSignalOffset ); |
178 | 183 | ||
179 | } | 184 | } |
180 | void KDateNavigator::setCalendar( Calendar *cal ) | 185 | void KDateNavigator::setCalendar( Calendar *cal ) |