summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-04-04 20:24:30 (UTC)
committer zautrix <zautrix>2005-04-04 20:24:30 (UTC)
commitc408fcb55de18d1e3e1d20803c3885e3074cfaa4 (patch) (side-by-side diff)
tree092f6e385210a9fa7bd625c2e0cae3ceba68f513 /korganizer/komonthview.cpp
parent8e7f4812c4ad239b6a17cce8aa84c00274ced4df (diff)
downloadkdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.zip
kdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.tar.gz
kdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.tar.bz2
month view fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp92
1 files changed, 52 insertions, 40 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9f7db69..1ed288b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -85,4 +85,6 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
mWT = new KNOWhatsThis(this);
resetOnFocusIn = true;
+ setVScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(QScrollView::AlwaysOff);
}
KNoScrollListBox::~KNoScrollListBox()
@@ -101,4 +103,26 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
}
resetOnFocusIn = true;
+
+ if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
+ QListBoxItem *fi = firstItem ();
+ if (fi ) {
+ int ihei = fi->height( this );
+ int hei = numRows () * ihei;
+ if ( hei < height() - horizontalScrollBar()->height () ) {
+ setVScrollBarMode(QScrollView::AlwaysOff);
+ }
+ else
+ setVScrollBarMode(QScrollView::Auto);
+ if ( ihei *3 > height() ) {
+ setHScrollBarMode(QScrollView::AlwaysOff);
+ }
+ else {
+ setHScrollBarMode(QScrollView::Auto);
+ }
+ } else {
+ setVScrollBarMode(QScrollView::Auto);
+ setHScrollBarMode(QScrollView::Auto);
+ }
+ }
}
void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
@@ -109,4 +133,6 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
}
QListBox::focusOutEvent ( e );
+ setVScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(QScrollView::AlwaysOff);
}
@@ -244,4 +270,5 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
mReply = false;
mInfo = false;
+ isWeekItem = KOPrefs::instance()->mMonthViewWeek;
//qDebug("NEWWWWWWWWWWWWW ");
}
@@ -381,5 +408,5 @@ int MonthViewItem::width(const QListBox *lb) const
{
- if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
+ if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
int size = PIXMAP_SIZE;
if ( QApplication::desktop()->width() < 300 )
@@ -416,6 +443,4 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mMonthView( parent )
{
-
- mCurrentAvailItem = 0;
//QVBoxLayout *topLayout = new QVBoxLayout( this );
currentPalette = 0;
@@ -573,6 +598,12 @@ void MonthViewCell::startUpdateCell()
setLineWidth( 1 );
}
- mCurrentAvailItem = (MonthViewItem*) firstItem ();
+ MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
//clear();
+ while ( CurrentAvailItem ) {
+ MonthViewItem *item = CurrentAvailItem;
+ CurrentAvailItem = (MonthViewItem *)item->next();
+ mAvailItemList.append( item );
+ takeItem ( item );
+ }
#ifdef DESKTOP_VERSION
@@ -594,5 +625,4 @@ void MonthViewCell::insertEvent(Event *event)
{
QString mToolTipText;
- bool insertNewItem = false;
setFocusPolicy(WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
@@ -653,19 +683,13 @@ void MonthViewCell::insertEvent(Event *event)
}
MonthViewItem *item ;
- if ( mCurrentAvailItem ) {
- item = mCurrentAvailItem;
- mCurrentAvailItem = (MonthViewItem*) item->next();
- item->recycle( event, mDate, text );
- } else {
+
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
item->recycle( event, mDate, text );
- insertNewItem = true;
} else {
- insertNewItem = true;
item = new MonthViewItem( event, mDate, text );
}
- }
+
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
@@ -707,5 +731,4 @@ void MonthViewCell::insertEvent(Event *event)
#endif
item->setMultiDay( multiday );
- if ( insertNewItem)
insertItem( item );
mToolTip.append( mToolTipText );
@@ -713,5 +736,4 @@ void MonthViewCell::insertEvent(Event *event)
void MonthViewCell::insertTodo(Todo *todo)
{
- bool insertNewItem = false;
setFocusPolicy(WheelFocus);
QString text;
@@ -724,19 +746,11 @@ void MonthViewCell::insertTodo(Todo *todo)
text += todo->summary();
MonthViewItem *item ;
- if ( mCurrentAvailItem ) {
- item = mCurrentAvailItem;
- mCurrentAvailItem = (MonthViewItem*) item->next();
- item->recycle( todo, mDate, text );
- } else {
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
item->recycle( todo, mDate, text );
- insertNewItem = true;
} else {
- insertNewItem = true;
item = new MonthViewItem( todo, mDate, text );
}
- }
//MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
@@ -768,5 +782,4 @@ void MonthViewCell::insertTodo(Todo *todo)
item->setAlarm( todo->isAlarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
- if ( insertNewItem)
insertItem( item );
mToolTip.append( text );
@@ -783,10 +796,5 @@ void MonthViewCell::repaintfinishUpdateCell()
void MonthViewCell::finishUpdateCell()
{
- while ( mCurrentAvailItem ) {
- MonthViewItem *item = mCurrentAvailItem;
- mCurrentAvailItem = (MonthViewItem *)item->next();
- mAvailItemList.append( item );
- takeItem ( item );
- }
+
@@ -862,4 +870,6 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
void MonthViewCell::enableScrollBars( bool enabled )
{
+
+ return;
if ( enabled ) {
QListBoxItem *fi = firstItem ();
@@ -872,8 +882,10 @@ void MonthViewCell::enableScrollBars( bool enabled )
else
setVScrollBarMode(QScrollView::Auto);
- if ( ihei *3 > height() )
+ if ( ihei *3 > height() ) {
setHScrollBarMode(QScrollView::AlwaysOff);
- else
+ }
+ else {
setHScrollBarMode(QScrollView::Auto);
+ }
} else {
setVScrollBarMode(QScrollView::Auto);
@@ -982,5 +994,4 @@ void MonthViewCell::newEvent()
void MonthViewCell::cellClicked( QListBoxItem *item )
{
- static QListBoxItem * lastClicked = 0;
if ( item == 0 ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
@@ -1092,5 +1103,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
}
mWeekLabels[mNumWeeks]->setText( i18n("W"));
- mWeekLabels[0]->setFocusPolicy(WheelFocus);
+ mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
@@ -1108,5 +1119,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
}
mWeekLabelsW[1]->setText( i18n("W"));
- mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
+ mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
@@ -1399,5 +1410,5 @@ void KOMonthView::changeEventDisplay(Event *, int)
// this should be re-written to be much more efficient, but this
// quick-and-dirty-hack gets the job done for right now.
- qDebug("KOMonthView::changeEventDisplay ");
+ //qDebug("KOMonthView::changeEventDisplay ");
updateView();
}
@@ -1529,12 +1540,13 @@ void KOMonthView::updateView()
void KOMonthView::setKeyBoardFocus()
{
+ //qDebug("KOMonthView::setKeyBoardFocus() ");
bool shootAgain = false;
if ( mShowWeekView ) {
- shootAgain = !mWeekLabelsW[0]->hasFocus();
- mWeekLabelsW[0]->setFocus();
+ shootAgain = !mWeekLabelsW[1]->hasFocus();
+ mWeekLabelsW[1]->setFocus();
}
else {
- shootAgain = !mWeekLabels[0]->hasFocus();
- mWeekLabels[0]->setFocus();
+ shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
+ mWeekLabels[mNumWeeks]->setFocus();
}
if ( shootAgain ) {