summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-04-01 18:10:09 (UTC)
committer zautrix <zautrix>2005-04-01 18:10:09 (UTC)
commitedc032c21ae3788d02a632ea8066e4ac5a4feedb (patch) (unidiff)
tree8e59c8dcf1cc3021694025627d36e152f7adc389 /korganizer/koagendaview.cpp
parent5d88f92b76a760f100384ea5fa6ed143088d19bb (diff)
downloadkdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.zip
kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.gz
kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.bz2
fixes
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 218396d..072d464 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -115,15 +115,16 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
115 // bug: the parameters cx, cy, cw, ch are the areas that need to be 115 // bug: the parameters cx, cy, cw, ch are the areas that need to be
116 // redrawn, not the area of the widget. unfortunately, this 116 // redrawn, not the area of the widget. unfortunately, this
117 // code assumes the latter... 117 // code assumes the latter...
118 118
119 // now, for a workaround... 119 // now, for a workaround...
120 // these two assignments fix the weird redraw bug 120 // these two assignments fix the weird redraw bug
121 mRedrawNeeded = true;
121 if ( mRedrawNeeded ) { 122 if ( mRedrawNeeded ) {
122 cx = contentsX() + 2; 123 cx = contentsX() + frameWidth()*2;
123 cw = contentsWidth() - 2; 124 cw = contentsWidth() ;
124 // end of workaround 125 // end of workaround
125 126
126 int cell = ((int)(cy/mCellHeight)); 127 int cell = ((int)(cy/mCellHeight));
127 int y = cell * mCellHeight; 128 int y = cell * mCellHeight;
128 QFontMetrics fm = fontMetrics(); 129 QFontMetrics fm = fontMetrics();
129 QString hour; 130 QString hour;
@@ -149,19 +150,19 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
149 -- pointS; 150 -- pointS;
150 } 151 }
151 fm = QFontMetrics( nFont ); 152 fm = QFontMetrics( nFont );
152 borderWidth = 4; 153 borderWidth = 4;
153 timeHeight = fm.height(); 154 timeHeight = fm.height();
154 } 155 }
155 timeHeight -= (timeHeight/4-2); 156 //timeHeight -= (timeHeight/4-2);
156 QFont sFont = nFont; 157 QFont sFont = nFont;
157 sFont.setPointSize( sFont.pointSize()/2+2 ); 158 sFont.setPointSize( sFont.pointSize()/2+2 );
158 QFontMetrics fmS( sFont ); 159 QFontMetrics fmS( sFont );
159 int sHei = fmS.height(); 160 int sHei = fmS.height();
160 sHei -= (sHei/4-2); 161 //sHei -= (sHei/4-2);
161 int startW = this->width() - frameWidth(); 162 int startW = this->width() - frameWidth()-1;
162 while (y < cy + ch) { 163 while (y < cy + ch) {
163 p->drawLine(cx,y,cx+tW,y); 164 p->drawLine(cx,y,cx+tW,y);
164 hour.setNum(cell); 165 hour.setNum(cell);
165 166
166 // handle 24h and am/pm time formats 167 // handle 24h and am/pm time formats
167 if (KGlobal::locale()->use12Clock()) { 168 if (KGlobal::locale()->use12Clock()) {
@@ -170,20 +171,20 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
170 suffix = "am"; 171 suffix = "am";
171 if (cell == 0) hour.setNum(12); 172 if (cell == 0) hour.setNum(12);
172 if (cell > 12) hour.setNum(cell - 12); 173 if (cell > 12) hour.setNum(cell - 12);
173 } 174 }
174 175
175 // center and draw the time label 176 // center and draw the time label
176 int timeWidth = fm.width(hour+"i"); 177 int timeWidth = fm.width(hour);
177 int tw2 = fm.width(suffix); 178 int tw2 = fm.width(suffix);
178 int offset = startW - timeWidth - tw2 ; 179 int offset = startW - timeWidth - tw2 ;
179 p->setFont( nFont ); 180 p->setFont( nFont );
180 p->drawText(cx - borderWidth + offset, y+ timeHeight, hour); 181 p->drawText( offset, y+ timeHeight, hour);
181 p->setFont( sFont ); 182 p->setFont( sFont );
182 offset = startW - tw2-1; 183 offset = startW - tw2+1;
183 p->drawText(cx - borderWidth + offset, y+ sHei, suffix); 184 p->drawText( offset, y+ sHei, suffix);
184 185
185 // increment indices 186 // increment indices
186 y += mCellHeight; 187 y += mCellHeight;
187 cell++; 188 cell++;
188 } 189 }
189 } else { 190 } else {
@@ -415,14 +416,13 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
415 mExpandButton = new QPushButton(mDummyAllDayLeft); 416 mExpandButton = new QPushButton(mDummyAllDayLeft);
416 mExpandButton->setPixmap( expandPix ); 417 mExpandButton->setPixmap( expandPix );
417 int widebut = mExpandButton->sizeHint().width()+4; 418 int widebut = mExpandButton->sizeHint().width()+4;
418 int heibut = mExpandButton->sizeHint().height()+4; 419 int heibut = mExpandButton->sizeHint().height()+4;
419 if ( heibut > widebut ) 420 if ( heibut > widebut )
420 widebut = heibut ; 421 widebut = heibut ;
421 if ( QApplication::desktop()->width() < 480 ) 422
422 widebut = widebut*3/2;
423 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 423 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
424 // QSizePolicy::Fixed ) ); 424 // QSizePolicy::Fixed ) );
425 mExpandButton->setFixedSize( widebut, widebut); 425 mExpandButton->setFixedSize( widebut, widebut);
426 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 426 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
427 mExpandButton->setFocusPolicy(NoFocus); 427 mExpandButton->setFocusPolicy(NoFocus);
428 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 428 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
@@ -714,13 +714,13 @@ void KOAgendaView::createDayLabels()
714 KOAgendaButton *dayLabel; 714 KOAgendaButton *dayLabel;
715 dayLabel = mDayLabelsList.first(); 715 dayLabel = mDayLabelsList.first();
716 if ( !dayLabel ) { 716 if ( !dayLabel ) {
717 appendLabels = true; 717 appendLabels = true;
718 dayLabel = getNewDaylabel(); 718 dayLabel = getNewDaylabel();
719 } 719 }
720 dayLabel->setFixedWidth( mTimeLabels->width()+2 ); 720 dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() );
721 dayLabel->setFont( dlf ); 721 dayLabel->setFont( dlf );
722 dayLabel->setNum( -1 ); 722 dayLabel->setNum( -1 );
723 //dayLabel->setAlignment(QLabel::AlignHCenter); 723 //dayLabel->setAlignment(QLabel::AlignHCenter);
724 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 724 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
725 dayLabel->show(); 725 dayLabel->show();
726 DateList::ConstIterator dit; 726 DateList::ConstIterator dit;
@@ -825,14 +825,14 @@ void KOAgendaView::createDayLabels()
825 appendLabels = true; 825 appendLabels = true;
826 } 826 }
827 if ( appendLabels ) { 827 if ( appendLabels ) {
828 dayLabel = getNewDaylabel(); 828 dayLabel = getNewDaylabel();
829 } 829 }
830 //dayLabel->hide();//test only 830 //dayLabel->hide();//test only
831 831 qDebug("fremwidd %d ", mAgenda->frameWidth());
832 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 832 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()- (mAgenda->frameWidth()*2) ) % mSelectedDates.count() ;
833 if ( offset < 0 ) offset = 0; 833 if ( offset < 0 ) offset = 0;
834 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 834 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
835 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); 835 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
836 dayLabel->setFont( dlf ); 836 dayLabel->setFont( dlf );
837 dayLabel->setAutoRepeat( true ); 837 dayLabel->setAutoRepeat( true );
838 dayLabel->show(); 838 dayLabel->show();