author | zautrix <zautrix> | 2005-04-02 08:36:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-02 08:36:37 (UTC) |
commit | e7cb4c20af8b07bf923c864026481ce316c40e1d (patch) (side-by-side diff) | |
tree | c88b2d0c01ce683e73ea9f4657f4d5c6fbe6f922 | |
parent | 7aefe488d1fe0c34cf29460f48a9a97d632f615e (diff) | |
download | kdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.zip kdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.tar.gz kdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 86 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 10 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 8 |
4 files changed, 88 insertions, 24 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 2b05d37..8d32152 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -110,14 +110,77 @@ void TimeLabels::setCellHeight(int height) void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) { - // if ( globalFlagBlockAgenda ) - // return; - // bug: the parameters cx, cy, cw, ch are the areas that need to be - // redrawn, not the area of the widget. unfortunately, this - // code assumes the latter... - - // now, for a workaround... - // these two assignments fix the weird redraw bug + cx = contentsX() + frameWidth()*2; + cw = contentsWidth() ; + // end of workaround + + int cell = ((int)(cy/mCellHeight)); + int y = cell * mCellHeight; + QFontMetrics fm = fontMetrics(); + QString hour; + QString suffix = "am"; + int timeHeight = fm.ascent(); + QFont nFont = p->font(); + + if (!KGlobal::locale()->use12Clock()) { + if ( QApplication::desktop()->width() <= 320 ) + suffix = "00"; + else + suffix = "00"; + } + + if ( timeHeight > mCellHeight ) { + timeHeight = mCellHeight-1; + int pointS = nFont.pointSize(); + while ( pointS > 4 ) { + nFont.setPointSize( pointS ); + fm = QFontMetrics( nFont ); + if ( fm.ascent() < mCellHeight ) + break; + -- pointS; + } + fm = QFontMetrics( nFont ); + timeHeight = fm.ascent(); + } + //timeHeight -= (timeHeight/4-2); + QFont sFont = nFont; + sFont.setPointSize( sFont.pointSize()/2 ); + QFontMetrics fmS( sFont ); + int sHei = fmS.ascent() ; + //sHei -= (sHei/4-2); + int startW = this->width() - frameWidth()-2; + int tw2 = fmS.width(suffix); + timeHeight = (timeHeight-1) /2 -1; + while (y < cy + ch+mCellHeight) { + p->drawLine(startW-tw2+1 ,y,cw,y); + hour.setNum(cell); + // handle 24h and am/pm time formats + if (KGlobal::locale()->use12Clock()) { + if (cell > 11) suffix = "pm"; + else + suffix = "am"; + if (cell == 0) hour.setNum(12); + if (cell > 12) hour.setNum(cell - 12); + } + + // center and draw the time label + int timeWidth = fm.width(hour); + int offset = startW - timeWidth - tw2 ; + p->setFont( nFont ); + p->drawText( offset, y+ timeHeight, hour); + p->setFont( sFont ); + offset = startW - tw2+1; + p->drawText( offset, y -1, suffix); + + // increment indices + y += mCellHeight; + cell++; + } + + + + +#if 0 mRedrawNeeded = true; if ( mRedrawNeeded ) { cx = contentsX() + frameWidth()*2; @@ -192,6 +255,7 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) // double buffer not yet implemented //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); //mRedrawNeeded = false; +#endif } /** @@ -218,7 +282,7 @@ void TimeLabels::updateConfig() test = "pm"; else { if ( QApplication::desktop()->width() <= 320 ) - test = ""; + test = "00"; else test = "00"; } @@ -674,6 +738,8 @@ void KOAgendaView::createDayLabels() // each updateView() call) int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; + if ( QApplication::desktop()->width() <= 320 ) + maxWid -= 10; mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); if ( maxWid < 0 ) maxWid = 20; @@ -732,9 +798,11 @@ void KOAgendaView::createDayLabels() dayLabel->setFont( dlf ); dayLabel->setNum( -1 ); //dayLabel->setAlignment(QLabel::AlignHCenter); +#if 0 if ( QApplication::desktop()->width() <= 320 ) dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) ); else +#endif dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); dayLabel->show(); DateList::ConstIterator dit; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index b8a0f09..8affe50 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -767,8 +767,8 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); } // Single row selection - if ( row == 0) - addRow = 1; + //if ( row == 0) + // addRow = 1; p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); } else { @@ -781,8 +781,8 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) if ( row >= 6 - rowModulo ) addRow = row - 5 + rowModulo; } - if ( row == 0) - addRow = 1; + //if ( row == 0) + // addRow = 1; int drawWid = width()-(col*dwidth+1+addCol2)-1; p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, dheight+1, selcol); diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 253175e..2a30346 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp @@ -273,7 +273,7 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) //p.drawRect( rect() ); #ifndef DESKTOP_VERSION if ( mMouseDown ) - buffer.fill( QColor( 242,27,255 ) ); + buffer.fill( colorGroup().background().dark() ); else #endif buffer.fill( colorGroup().background() ); @@ -288,11 +288,7 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) col = colorGroup().background().dark( 250 ); else { if ( mMouseDown ) -#ifndef DESKTOP_VERSION - col = QColor( 178,18,188);//QColor( 242,27,255 );//Qt::white; -#else - col = Qt::white; -#endif + col = Qt::white; else col = colorGroup().background().dark( 150 ); } @@ -688,7 +684,7 @@ void KDGanttMinimizeSplitter::setRubberband( int p ) mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); mRubberBand->setFrameStyle( Box | Raised ); //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); - mRubberBand->setPalette( QPalette ( QColor( 178,18,188), QColor( 242,27,255 ) )); + mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); } QRect r = contentsRect(); static int rBord = 0; //Themable???? diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index e6144de..11635e1 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -136,8 +136,8 @@ void KDialogBase::initLayout() delete mTopLayout; mTopLayout = new QVBoxLayout( this ); - mTopLayout->setMargin( marginHint() ); - mTopLayout->setSpacing( spacingHint() ); + mTopLayout->setMargin( marginHintSmall() ); + mTopLayout->setSpacing( spacingHintSmall() ); mTopLayout->addWidget( mMainWidget ); @@ -151,8 +151,8 @@ void KDialogBase::initLayout() if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); - buttonLayout->setMargin( 0 ); - buttonLayout->setSpacing( spacingHint() ); + buttonLayout->setMargin( marginHintSmall() ); + buttonLayout->setSpacing( spacingHintSmall() ); } QFrame *KDialogBase::addPage( const QString &name ) |