summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp48
1 files changed, 35 insertions, 13 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 8ee5bc3..050bfb9 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -314,5 +314,6 @@ int MonthViewItem::height(const QListBox *lb) const
{
+ int ret = 10;
if ( lb )
- return lb->fontMetrics().lineSpacing()+1;
- return 10;
+ ret = lb->fontMetrics().lineSpacing()+1;
+ return ret;
}
@@ -321,2 +322,4 @@ int MonthViewItem::width(const QListBox *lb) const
{
+
+ if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
int size = PIXMAP_SIZE;
@@ -342,5 +345,9 @@ int MonthViewItem::width(const QListBox *lb) const
}
-
return( x + lb->fontMetrics().width( text() ) + 1 );
}
+ if ( ! lb )
+ return 10;
+ //qDebug("ret wid %d ", lb->width());
+ return lb->width();
+}
@@ -352,3 +359,3 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
- QVBoxLayout *topLayout = new QVBoxLayout( this );
+ //QVBoxLayout *topLayout = new QVBoxLayout( this );
@@ -365,3 +372,3 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mItemList->setLineWidth( 1 );
- topLayout->addWidget( mItemList );
+ //topLayout->addWidget( mItemList );
mLabel->raise();
@@ -419,13 +426,16 @@ void MonthViewCell::setMyPalette()
if ( mHoliday) {
- setPalette( mHolidayPalette );
+ mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
+ mItemList->setPalette( mHolidayPalette );
} else {
if ( mPrimary ) {
- setPalette( mPrimaryPalette );
+ mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
+ mItemList->setPalette( mPrimaryPalette );
} else {
- setPalette( mNonPrimaryPalette );
+ mItemList->setPalette( mNonPrimaryPalette );
+ mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
}
}
- QPalette pal = palette();
+ //QPalette pal = palette();
- mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
+ //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
}
@@ -677,2 +687,3 @@ void MonthViewCell::finishUpdateCell()
resizeEvent( 0 );
+
}
@@ -737,4 +748,12 @@ void MonthViewCell::enableScrollBars( bool enabled )
if ( enabled ) {
- mItemList->setVScrollBarMode(QScrollView::Auto);
+ //mItemList->setVScrollBarMode(QScrollView::Auto);
mItemList->setHScrollBarMode(QScrollView::Auto);
+ QListBoxItem *fi = mItemList->firstItem ();
+ if (fi ) {
+ int hei = mItemList->numRows () * fi->height(mItemList);
+ if ( hei < height() - mItemList->horizontalScrollBar()->height () )
+ mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
+ else
+ mItemList->setVScrollBarMode(QScrollView::Auto);
+ }
} else {
@@ -783,3 +802,3 @@ void MonthViewCell::select()
-void MonthViewCell::resizeEvent ( QResizeEvent * )
+void MonthViewCell::resizeEvent ( QResizeEvent * e )
{
@@ -787,3 +806,4 @@ void MonthViewCell::resizeEvent ( QResizeEvent * )
return;
-
+ //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
+ deselect();
int size = height() - mLabel->height() - 2;
@@ -796,2 +816,4 @@ void MonthViewCell::resizeEvent ( QResizeEvent * )
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
+ mItemList->resize ( width(), height () );
+
}