-rw-r--r-- | korganizer/koagendaview.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index fa6b951..18f242c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -125,27 +125,39 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
125 | QFontMetrics fm = fontMetrics(); | 125 | QFontMetrics fm = fontMetrics(); |
126 | QString hour; | 126 | QString hour; |
127 | QString suffix; | 127 | QString suffix; |
128 | QString fullTime; | 128 | QString fullTime; |
129 | int tW = fm.width("24:00i"); | 129 | int tW = fm.width("24:00i"); |
130 | int timeHeight = fm.height(); | 130 | int timeHeight = fm.height(); |
131 | timeHeight -= (timeHeight/4-2); | 131 | //timeHeight -= (timeHeight/4-2); |
132 | int borderWidth = 0; | 132 | int borderWidth = 0; |
133 | QFont nFont = p->font(); | 133 | QFont nFont = p->font(); |
134 | QFont sFont = nFont; | 134 | |
135 | sFont.setPointSize( sFont.pointSize()/2+2 ); | ||
136 | if (!KGlobal::locale()->use12Clock()) | 135 | if (!KGlobal::locale()->use12Clock()) |
137 | suffix = "00"; | 136 | suffix = "00"; |
138 | else | 137 | else |
139 | borderWidth = 0; | 138 | borderWidth = 0; |
140 | QFontMetrics fmS( sFont ); | ||
141 | int sHei = fmS.height(); | ||
142 | if ( timeHeight > mCellHeight ) { | 139 | if ( timeHeight > mCellHeight ) { |
143 | timeHeight = mCellHeight-1; | 140 | timeHeight = mCellHeight-1; |
144 | sHei -= 2; | 141 | int pointS = nFont.pointSize(); |
142 | while ( pointS > 4 ) { | ||
143 | nFont.setPointSize( pointS ); | ||
144 | fm = QFontMetrics( nFont ); | ||
145 | if ( fm.height() < mCellHeight ) | ||
146 | break; | ||
147 | -- pointS; | ||
148 | } | ||
149 | fm = QFontMetrics( nFont ); | ||
150 | borderWidth = 4; | ||
151 | timeHeight = fm.height(); | ||
145 | } | 152 | } |
153 | timeHeight -= (timeHeight/4-2); | ||
154 | QFont sFont = nFont; | ||
155 | sFont.setPointSize( sFont.pointSize()/2+2 ); | ||
156 | QFontMetrics fmS( sFont ); | ||
157 | int sHei = fmS.height(); | ||
146 | 158 | ||
147 | while (y < cy + ch) { | 159 | while (y < cy + ch) { |
148 | p->drawLine(cx,y,cx+tW,y); | 160 | p->drawLine(cx,y,cx+tW,y); |
149 | hour.setNum(cell); | 161 | hour.setNum(cell); |
150 | 162 | ||
151 | // handle 24h and am/pm time formats | 163 | // handle 24h and am/pm time formats |
@@ -886,12 +898,18 @@ void KOAgendaView::updateView() | |||
886 | complete. | 898 | complete. |
887 | */ | 899 | */ |
888 | void KOAgendaView::updateConfig() | 900 | void KOAgendaView::updateConfig() |
889 | { | 901 | { |
890 | if ( mBlockUpdating ) | 902 | if ( mBlockUpdating ) |
891 | return; | 903 | return; |
904 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { | ||
905 | int old = KOPrefs::instance()->mHourSize; | ||
906 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; | ||
907 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); | ||
908 | } | ||
909 | |||
892 | 910 | ||
893 | // update config for children | 911 | // update config for children |
894 | mTimeLabels->updateConfig(); | 912 | mTimeLabels->updateConfig(); |
895 | mAgenda->storePosition(); | 913 | mAgenda->storePosition(); |
896 | mAgenda->updateConfig(); | 914 | mAgenda->updateConfig(); |
897 | mAllDayAgenda->updateConfig(); | 915 | mAllDayAgenda->updateConfig(); |