summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-31 23:55:51 (UTC)
committer zautrix <zautrix>2005-03-31 23:55:51 (UTC)
commitb76ad1e7e329051a47e28c9d132ce3fcd0b25c5c (patch) (side-by-side diff)
treeb0b3d0eb7a3d29981c183275aadeed0cbbef0007 /korganizer
parentc0fa26aa3b33c293853bdd7d028ddb0545e33c85 (diff)
downloadkdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.zip
kdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.tar.gz
kdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp5
-rw-r--r--korganizer/koagenda.h2
-rw-r--r--korganizer/koagendaview.cpp15
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/komonthview.cpp7
-rw-r--r--korganizer/kotodoview.cpp81
-rw-r--r--korganizer/kotodoview.h5
-rw-r--r--korganizer/koviewmanager.cpp4
8 files changed, 98 insertions, 22 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1a24887..9720f43 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -240,7 +240,7 @@ void KOAgenda::init()
mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 );
+ mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
#ifndef _WIN32_
int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
@@ -754,8 +754,7 @@ void KOAgenda::newItem( int item )
newTodoSignal(mStartCellX ,mStartCellY );
} else
{
- QDate day = mSelectedDates[mStartCellX];
- emit showDateView( item, day );
+ emit showDateView( item, mStartCellX );
// 3Day view
// 4Week view
// 5Month view
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 3d33ae5..35c08b6 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -145,7 +145,7 @@ class KOAgenda : public QScrollView
void finishResize();
signals:
- void showDateView( int, QDate );
+ void showDateView( int, int);
void newEventSignal();
void newEventSignal(int gx,int gy);
void newTodoSignal(int gx,int gy);
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b9909d6..2996acb 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -488,8 +488,8 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
SLOT(setContentsPos(int)));
- connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
- connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
+ connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int )));
+ connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) ));
// Create/Show/Edit/Delete Event
connect(mAgenda,SIGNAL(newEventSignal(int,int)),
@@ -1310,6 +1310,17 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
// // emit updateTodoViews();
// }
+void KOAgendaView::slotShowDateView( int mode , int d )
+{
+ if ( d >= mSelectedDates.count() ) {
+ qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
+
+ } else {
+ QDate day = mSelectedDates[d];
+ emit showDateView(mode , day );
+ }
+
+}
void KOAgendaView::newEvent(int gx, int gy)
{
if (!mSelectedDates.count()) return;
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 57b4e46..6dc81c6 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -206,6 +206,7 @@ class KOAgendaView : public KOEventView {
void scrollOneHourUp();
void scrollOneHourDown();
void addToCalSlot(Incidence *, Incidence *);
+ void slotShowDateView( int, int );
signals:
void showDateView( int, QDate );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b9ce4f4..ab9a4b6 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -937,7 +937,11 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
void MonthViewCell::defaultAction( QListBoxItem *item )
{
- if ( !item ) return;
+ if ( !item ) {
+ QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
+ emit newEventSignal( dt );
+ return;
+ }
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
Incidence *incidence = eventItem->incidence();
@@ -1371,6 +1375,7 @@ 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 ");
updateView();
}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index e008625..ccc4b01 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -264,9 +264,24 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
}
#endif
}
-void KOTodoListView::keyPressEvent ( QKeyEvent * e )
+void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
{
+ if ( !e->isAutoRepeat() ) {
+ mFlagKeyPressed = false;
+ }
+}
+
+void KOTodoListView::keyPressEvent ( QKeyEvent * e )
+{
+ qApp->processEvents();
+ if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
+ e->ignore();
+ // qDebug(" ignore %d",e->isAutoRepeat() );
+ return;
+ }
+ if (! e->isAutoRepeat() )
+ mFlagKeyPressed = true;
QListViewItem* cn;
if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
cn = currentItem();
@@ -289,7 +304,6 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
return;
}
- // qDebug("KOTodoListView::keyPressEvent ");
if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
switch ( e->key() ) {
case Qt::Key_Down:
@@ -598,18 +612,17 @@ void KOTodoView::updateView()
mPendingUpdateBeforeRepaint = true;
return;
}
+ storeCurrentItem();
//qDebug("KOTodoView::updateView() %x", this);
if ( isFlatDisplay ) {
displayAllFlat();
+ resetCurrentItem();
return;
}
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
- Incidence* oldInc = 0;
- mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
- if (mActiveItem)
- oldInc = mActiveItem->todo();
+
mTodoListView->clear();
if ( mName == "todolistsmall" ) {
@@ -691,27 +704,66 @@ void KOTodoView::updateView()
mTodoListView->blockSignals( true );
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
mTodoListView->blockSignals( false );
+ resetCurrentItem();
+ processSelectionChange();
+}
+
+void KOTodoView::storeCurrentItem()
+{
+ mCurItem = 0;
+ mCurItemRootParent = 0;
+ mCurItemAbove = 0;
+ mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
+ if (mActiveItem) {
+ mCurItem = mActiveItem->todo();
+ KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
+ if ( activeItemAbove )
+ mCurItemAbove = activeItemAbove->todo();
+ while ( mActiveItem->parent() != 0 )
+ mActiveItem = (KOTodoViewItem*)mActiveItem->parent();
+ mCurItemRootParent = mActiveItem->todo();
+ }
+ mActiveItem = 0;
+}
+
+void KOTodoView::resetCurrentItem()
+{
mTodoListView->setFocus();
+ KOTodoViewItem* foundItem = 0;
+ KOTodoViewItem* foundItemRoot = 0;
+ KOTodoViewItem* foundItemAbove = 0;
if ( mTodoListView->firstChild () ) {
- if ( oldInc ) {
+ if ( mCurItem ) {
KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
while ( item ) {
- if ( item->todo() == oldInc ) {
- mTodoListView->setCurrentItem( item );
- mTodoListView->ensureItemVisible( item );
+ if ( item->todo() == mCurItem ) {
+ foundItem = item;
break;
+ } else if ( item->todo() == mCurItemAbove ) {
+ foundItemAbove = item;
+
+ } else if ( item->todo() == mCurItemRootParent ) {
+ foundItemRoot = item;
}
item = (KOTodoViewItem*)item->itemBelow();
}
- if ( ! item )
- mTodoListView->setCurrentItem( mTodoListView->firstChild () );
+ if ( ! foundItem ) {
+ if ( foundItemAbove )
+ foundItem = foundItemAbove;
+ else
+ foundItem = foundItemRoot;
+ }
+ }
+ if ( foundItem ) {
+ mTodoListView->setCurrentItem( foundItem );
+ mTodoListView->ensureItemVisible( foundItem );
} else {
mTodoListView->setCurrentItem( mTodoListView->firstChild () );
}
}
- processSelectionChange();
+ mTodoListView->setFocus();
}
-
+//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
{
@@ -1239,6 +1291,7 @@ void KOTodoView::addQuickTodo()
todoModified (todo, KOGlobals::EVENTADDED );
updateView();
}
+
void KOTodoView::keyPressEvent ( QKeyEvent * e )
{
// e->ignore();
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index eab0754..e553d0e 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -86,7 +86,9 @@ class KOTodoListView : public KListView
QPoint mPressPos;
bool mMousePressed;
QListViewItem *mOldCurrent;
+ bool mFlagKeyPressed;
void keyPressEvent ( QKeyEvent * ) ;
+ void keyReleaseEvent ( QKeyEvent * ) ;
};
@@ -252,6 +254,9 @@ class KOTodoView : public KOrg::BaseView
void keyPressEvent ( QKeyEvent * ) ;
KOTodoViewItem * pendingSubtodo;
DateNavigator* mNavigator;
+ void storeCurrentItem();
+ void resetCurrentItem();
+ Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
};
#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f97aa98..c442d0b 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -138,7 +138,7 @@ void KOViewManager::showDateView( int view, QDate date)
mCurrentAgendaView = 14 ;
mMainView->dateNavigator()->selectDates( date, 14);
} else if (view == 6 ) {
- //mMainView->dateNavigator()->selectDates( date, 7 );
+ resetDateSilent( date,1);
showMonthView();
} else if (view == 7 ) {
mMainView->dateNavigator()->selectDate( date );
@@ -389,6 +389,8 @@ void KOViewManager::updateWNview()
{
if ( mCurrentView == mWhatsNextView && mWhatsNextView )
mWhatsNextView->updateView();
+ if ( mCurrentView == mMonthView && mMonthView )
+ mMonthView->updateView();
}
void KOViewManager::showWhatsNextView()