summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 957ac52..b9c7dec 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -124,17 +124,17 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
124 int y = cell * mCellHeight; 124 int y = cell * mCellHeight;
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 = 5; 132 int borderWidth = 2;
133 QFont nFont = p->font(); 133 QFont nFont = p->font();
134 QFont sFont = nFont; 134 QFont sFont = nFont;
135 sFont.setPointSize( sFont.pointSize()/2+2 ); 135 sFont.setPointSize( sFont.pointSize()/2+2 );
136 if (!KGlobal::locale()->use12Clock()) 136 if (!KGlobal::locale()->use12Clock())
137 suffix = "00"; 137 suffix = "00";
138 QFontMetrics fmS( sFont ); 138 QFontMetrics fmS( sFont );
139 int sHei = fmS.height(); 139 int sHei = fmS.height();
140 if ( timeHeight > mCellHeight ) { 140 if ( timeHeight > mCellHeight ) {
@@ -174,35 +174,27 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
174 } 174 }
175} 175}
176 176
177/** 177/**
178 Calculates the minimum width. 178 Calculates the minimum width.
179*/ 179*/
180int TimeLabels::minimumWidth() const 180int TimeLabels::minimumWidth() const
181{ 181{
182 QFontMetrics fm = fontMetrics(); 182 return mMiniWidth;
183
184 //TODO: calculate this value
185 int borderWidth = 4;
186
187 // the maximum width possible
188 int width = fm.width("88:88x") + borderWidth;
189
190 return width;
191} 183}
192 184
193/** updates widget's internal state */ 185/** updates widget's internal state */
194void TimeLabels::updateConfig() 186void TimeLabels::updateConfig()
195{ 187{
196 // set the font 188 // set the font
197 // config->setGroup("Fonts"); 189 // config->setGroup("Fonts");
198 // QFont font = config->readFontEntry("TimeBar Font"); 190 // QFont font = config->readFontEntry("TimeBar Font");
199 setFont(KOPrefs::instance()->mTimeBarFont); 191 setFont(KOPrefs::instance()->mTimeBarFont);
200 192 mMiniWidth = fontMetrics().width("88:88") + 2 ;
201 // update geometry restrictions based on new settings 193 // update geometry restrictions based on new settings
202 setFixedWidth(minimumWidth()); 194 setFixedWidth(minimumWidth());
203 195
204 // update HourSize 196 // update HourSize
205 mCellHeight = KOPrefs::instance()->mHourSize*4; 197 mCellHeight = KOPrefs::instance()->mHourSize*4;
206 resizeContents(50,mRows * mCellHeight); 198 resizeContents(50,mRows * mCellHeight);
207} 199}
208 200