summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-05 19:42:46 (UTC)
committer zautrix <zautrix>2005-04-05 19:42:46 (UTC)
commit6add774cf9841377f32613c7aa23161a823aa1da (patch) (side-by-side diff)
tree43631d25bdfff4eb9d9934bc604609c38717b000 /korganizer
parent8734ae4789ed411cb546edd304816a77c431a2bf (diff)
downloadkdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.zip
kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.gz
kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp146
-rw-r--r--korganizer/komonthview.h5
2 files changed, 90 insertions, 61 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index e66ddce..4dfb9df 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -96,34 +96,38 @@ KNoScrollListBox::~KNoScrollListBox()
void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
{
QListBox::focusInEvent ( e );
- QListBoxItem * i = item ( 0 );
- if ( i && resetOnFocusIn ) {
- setCurrentItem( i );
- setSelected ( 0, true );
- }
- 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
+ if ( count() ){
+ int ci = currentItem();
+ if ( ci < 0 ) ci = 0;
+
+ setCurrentItem( ci );
+ setSelected ( ci, true );
+ emit highlighted( item ( ci ) );
+
+ 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);
- if ( ihei *3 > height() ) {
- setHScrollBarMode(QScrollView::AlwaysOff);
- }
- else {
setHScrollBarMode(QScrollView::Auto);
}
- } else {
- setVScrollBarMode(QScrollView::Auto);
- setHScrollBarMode(QScrollView::Auto);
- }
- }
+ }
+ }
}
void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
{
@@ -172,13 +176,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
e->ignore();
break;
}
- if ( count() ) {
- setCurrentItem((currentItem()+count()-1)%count());
- if(!itemVisible(currentItem())) {
- if((unsigned int) currentItem() == (count()-1)) {
- setTopItem(currentItem()-numItemsVisible()+1);
- } else {
- setTopItem(topItem()-1);
+ if ( count() ) {
+ if ( currentItem() == 0 ) {
+ emit prevCell();
+ } else {
+ setCurrentItem((currentItem()+count()-1)%count());
+ if(!itemVisible(currentItem())) {
+ if((unsigned int) currentItem() == (count()-1)) {
+ setTopItem(currentItem()-numItemsVisible()+1);
+ } else {
+ setTopItem(topItem()-1);
+ }
}
}
}
@@ -188,13 +196,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
e->ignore();
break;
}
- if ( count () ) {
- setCurrentItem((currentItem()+1)%count());
- if(!itemVisible(currentItem())) {
- if(currentItem() == 0) {
- setTopItem(0);
- } else {
- setTopItem(topItem()+1);
+ if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
+ setCurrentItem((currentItem()+1)%count());
+ if(!itemVisible(currentItem())) {
+ if(currentItem() == 0) {
+ setTopItem(0);
+ } else {
+ setTopItem(topItem()+1);
+ }
}
}
}
@@ -225,14 +237,18 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
void KNoScrollListBox::oneDown()
{
- if ( count () ) {
- resetOnFocusIn = false;
- setCurrentItem((currentItem()+1)%count());
- if(!itemVisible(currentItem())) {
- if(currentItem() == 0) {
- setTopItem(0);
- } else {
- setTopItem(topItem()+1);
+ if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
+ resetOnFocusIn = false;
+ setCurrentItem((currentItem()+1)%count());
+ if(!itemVisible(currentItem())) {
+ if(currentItem() == 0) {
+ setTopItem(0);
+ } else {
+ setTopItem(topItem()+1);
+ }
}
}
}
@@ -473,10 +489,11 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
SLOT( contextMenu( QListBoxItem * ) ) );
connect( this, SIGNAL( highlighted( QListBoxItem *) ),
SLOT( selection( QListBoxItem * ) ) );
- connect( this, SIGNAL( clicked( QListBoxItem * ) ),
- SLOT( cellClicked( QListBoxItem * ) ) );
+
+ /*
connect( this, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( selection( QListBoxItem * ) ) );
+ */
}
#ifdef DESKTOP_VERSION
QToolTipGroup *MonthViewCell::toolTipGroup()
@@ -989,6 +1006,7 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
void MonthViewCell::defaultAction( QListBoxItem *item )
{
+
if ( !item ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
@@ -1010,22 +1028,13 @@ void MonthViewCell::newEvent()
}
void MonthViewCell::cellClicked( QListBoxItem *item )
{
+ qDebug("CELL ");
if ( item == 0 ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
return;
}
- /*
- if ( lastClicked )
- if ( ! item ) {
- if ( lastClicked->listBox() != item->listBox() )
- lastClicked->listBox()->clearSelection();
- }
- */
-
- mMonthView->setSelectedCell( this );
- if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
- select();
+
}
void MonthViewCell::contextMenu( QListBoxItem *item )
@@ -1151,6 +1160,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
SIGNAL( newEventSignal( QDateTime ) ) );
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
+ connect( cell, SIGNAL( nextCell() ),
+ SLOT( nextCell() ) );
+ connect( cell, SIGNAL( prevCell() ),
+ SLOT( prevCell() ) );
}
}
mCellsW.resize( mDaysPerWeek );
@@ -1164,6 +1177,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
SIGNAL( newEventSignal( QDateTime ) ) );
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
+ connect( cell, SIGNAL( nextCell() ),
+ SLOT( nextCell() ) );
+ connect( cell, SIGNAL( prevCell() ),
+ SLOT( prevCell() ) );
cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
}
@@ -1974,3 +1991,12 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
break;
}
}
+
+void KOMonthView::nextCell()
+{
+ bool res = focusNextPrevChild ( true );
+}
+void KOMonthView::prevCell()
+{
+ focusNextPrevChild ( false );
+}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index e39eeb0..c6b6b5e 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -83,6 +83,8 @@ class KNoScrollListBox: public QListBox
void shiftDown();
void shiftUp();
void rightClick();
+ void nextCell();
+ void prevCell();
protected slots:
void oneDown();
@@ -188,7 +190,6 @@ class MonthViewCell : public KNoScrollListBox
QStringList mToolTip;
void resizeEvent( QResizeEvent * );
-
public slots:
void showDay();
@@ -256,6 +257,8 @@ class KOMonthView: public KOEventView
bool skipResize;
NavigatorBar* navigatorBar() { return mNavigatorBar ;}
public slots:
+ void nextCell();
+ void prevCell();
virtual void updateView();
virtual void updateConfig();
virtual void showDates(const QDate &start, const QDate &end);