summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-25 02:15:46 (UTC)
committer zautrix <zautrix>2005-03-25 02:15:46 (UTC)
commit658354b7112aff72f0fadd924c82b977d803bc27 (patch) (side-by-side diff)
treeda728354015340c16466fbfb3c851d96d6d95196 /korganizer
parent7c2e130ddd194f1c4b5365af6999a27c08232f4b (diff)
downloadkdepimpi-658354b7112aff72f0fadd924c82b977d803bc27.zip
kdepimpi-658354b7112aff72f0fadd924c82b977d803bc27.tar.gz
kdepimpi-658354b7112aff72f0fadd924c82b977d803bc27.tar.bz2
fixes
Diffstat (limited to 'korganizer') (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
@@ -312,13 +312,16 @@ void MonthViewItem::paint(QPainter *p)
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;
}
int MonthViewItem::width(const QListBox *lb) const
{
+
+ if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
int size = PIXMAP_SIZE;
if ( QApplication::desktop()->width() < 300 )
size = 3;
@@ -340,9 +343,13 @@ int MonthViewItem::width(const QListBox *lb) const
if( mMultiday ) {
x += size+1+2+size/2;
}
-
return( x + lb->fontMetrics().width( text() ) + 1 );
}
+ if ( ! lb )
+ return 10;
+ //qDebug("ret wid %d ", lb->width());
+ return lb->width();
+}
MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
@@ -350,7 +357,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mMonthView( parent )
{
- QVBoxLayout *topLayout = new QVBoxLayout( this );
+ //QVBoxLayout *topLayout = new QVBoxLayout( this );
// mLabel = new QLabel( this );QPushButton
mLabel = new QPushButton( this );
@@ -363,7 +370,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mItemList->setMinimumSize( 10, 10 );
mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
mItemList->setLineWidth( 1 );
- topLayout->addWidget( mItemList );
+ //topLayout->addWidget( mItemList );
mLabel->raise();
// QColor( 0,0,255 ) QColor( 160,1600,255 )
mStandardPalette = palette();
@@ -417,17 +424,20 @@ 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 ) ));
}
QPalette MonthViewCell::getPalette ()
{
@@ -675,6 +685,7 @@ void MonthViewCell::finishUpdateCell()
mLabel->setText( text );
resizeEvent( 0 );
+
}
void MonthViewCell::updateCell()
{
@@ -735,8 +746,16 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
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 {
mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
@@ -781,11 +800,12 @@ void MonthViewCell::select()
;// updateCell();
}
-void MonthViewCell::resizeEvent ( QResizeEvent * )
+void MonthViewCell::resizeEvent ( QResizeEvent * e )
{
if ( !mMonthView->isUpdatePossible() )
return;
-
+ //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
+ deselect();
int size = height() - mLabel->height() - 2;
if ( size > 0 )
mItemList->verticalScrollBar()->setMaximumHeight( size );
@@ -794,6 +814,8 @@ void MonthViewCell::resizeEvent ( QResizeEvent * )
mItemList->horizontalScrollBar()->setMaximumWidth( size );
mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
+ mItemList->resize ( width(), height () );
+
}
void MonthViewCell::defaultAction( QListBoxItem *item )