summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp86
-rw-r--r--korganizer/kodaymatrix.cpp8
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp10
-rw-r--r--microkde/kdialogbase.cpp8
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
@@ -107,20 +107,83 @@ void TimeLabels::setCellHeight(int height)
Optimization so that only the "dirty" portion of the scroll view
is redrawn. Unfortunately, this is not called by default paintEvent() method.
*/
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;
cw = contentsWidth() ;
// end of workaround
@@ -189,12 +252,13 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
} else {
//qDebug("NO redraw ");
}
// double buffer not yet implemented
//bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
//mRedrawNeeded = false;
+#endif
}
/**
Calculates the minimum width.
*/
int TimeLabels::minimumWidth() const
@@ -215,13 +279,13 @@ void TimeLabels::updateConfig()
test = "12";
mMiniWidth = fontMetrics().width(test);
if (KGlobal::locale()->use12Clock())
test = "pm";
else {
if ( QApplication::desktop()->width() <= 320 )
- test = "";
+ test = "00";
else
test = "00";
}
QFont sFont = font();
sFont.setPointSize( sFont.pointSize()/2 );
QFontMetrics fmS( sFont );
@@ -671,12 +735,14 @@ void KOAgendaView::createDayLabels()
// ### Before deleting and recreating we could check if mSelectedDates changed...
// It would remove some flickering and gain speed (since this is called by
// 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;
QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
QFontMetrics fm ( dlf );
@@ -729,15 +795,17 @@ void KOAgendaView::createDayLabels()
dayLabel = getNewDaylabel();
}
dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() );
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;
bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
int counter = -1;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index b8a0f09..8affe50 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -764,28 +764,28 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
if ( colt >= 7 - colModulo )
addCol2 = colt - 7 + colModulo;
addCol -= addCol2;
//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 {
// draw first row to the right
if ( colModulo ) {
if ( col >= 7 - colModulo )
addCol2 = col - 7 + colModulo;
}
if ( rowModulo ) {
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);
// draw full block till last line
selh = mSelEndT/7-row;
addRow = 0;
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 253175e..2a30346 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -270,13 +270,13 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
// Draw the splitter rectangle
p.setBrush( colorGroup().background() );
p.setPen( colorGroup().foreground() );
//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() );
//buffer.fill( backgroundColor() );
// parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup());
@@ -285,17 +285,13 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
// arrow color
QColor col;
if ( _activeButton )
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 );
}
//QColor col = backgroundColor().dark( 130 );
p.setBrush( col );
p.setPen( col );
@@ -685,13 +681,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
opaqueOldPos = p;
#else
if ( !mRubberBand ) {
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????
if ( !rBord ) {
if (QApplication::desktop()->width() <= 320 )
rBord = 3;
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index e6144de..11635e1 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -133,14 +133,14 @@ void KDialogBase::hideButtons()
}
void KDialogBase::initLayout()
{
delete mTopLayout;
mTopLayout = new QVBoxLayout( this );
- mTopLayout->setMargin( marginHint() );
- mTopLayout->setSpacing( spacingHint() );
+ mTopLayout->setMargin( marginHintSmall() );
+ mTopLayout->setSpacing( spacingHintSmall() );
mTopLayout->addWidget( mMainWidget );
QBoxLayout *buttonLayout = new QHBoxLayout;
mTopLayout->addLayout( buttonLayout );
@@ -148,14 +148,14 @@ void KDialogBase::initLayout()
if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
if ( mOkButton ) buttonLayout->addWidget( mOkButton );
if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
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 )
{
// kdDebug() << "KDialogBase::addPage(): " << name << endl;
QFrame *frame = new QFrame( tabWidget() );