summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp46
-rw-r--r--korganizer/kotodoview.h2
2 files changed, 31 insertions, 17 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 00c2d97..27d755e 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -503,5 +503,6 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
KOrg::BaseView(calendar,parent,name)
-{
+{
+ mActiveItem = 0;
mCategoryPopupMenu = 0;
mPendingUpdateBeforeRepaint = false;
@@ -808,6 +809,16 @@ void KOTodoView::paintEvent(QPaintEvent * pevent)
}
+void KOTodoView::clearList( bool saveCurrentItem ) // default true
+{
+ if ( mTodoListView->childCount() ) {
+ if ( saveCurrentItem )
+ storeCurrentItem();
+ mTodoListView->clear();
+ mTodoMap.clear();
+ }
+}
void KOTodoView::updateView()
{
+ mActiveItem = 0;
pendingSubtodo = 0;
if ( mBlockUpdate ) {
@@ -815,6 +826,7 @@ void KOTodoView::updateView()
}
if ( !isVisible() ) {
- mPendingUpdateBeforeRepaint = true;
- return;
+ clearList ();
+ mPendingUpdateBeforeRepaint = true;
+ return;
}
//qDebug("KOTodoView::updateView() %x", this);
@@ -823,11 +835,10 @@ void KOTodoView::updateView()
return;
}
- storeCurrentItem();
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
-
- mTodoListView->clear();
+ clearList ();
+
if ( mName == "todolistsmall" ) {
if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
@@ -865,5 +876,4 @@ void KOTodoView::updateView()
// specific order of events. That means that we have to generate parent items
// recursively for proper hierarchical display of Todos.
- mTodoMap.clear();
Todo *todo;
todo = todoList.first();// todo; todo = todoList.next()) {
@@ -975,5 +985,6 @@ void KOTodoView::resetCurrentItem()
}
processSelectionChange();
- QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
+ if ( mName != "todolistsmall" )
+ QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
}
void KOTodoView::resetFocusToList()
@@ -1101,10 +1112,12 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
void KOTodoView::editItem(QListViewItem *item )
{
- emit editTodoSignal(((KOTodoViewItem *)item)->todo());
+ if ( item )
+ emit editTodoSignal(((KOTodoViewItem *)item)->todo());
}
void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
{
- emit showTodoSignal(((KOTodoViewItem *)item)->todo());
+ if ( item )
+ emit showTodoSignal(((KOTodoViewItem *)item)->todo());
}
@@ -1358,5 +1371,5 @@ void KOTodoView::toggleRunningItem()
}
tp.exec();
- updateTodo ( t, 0 );
+ updateTodo ( t, KOGlobals::EVENTEDITED );
} else {
KOStartTodoPrefs tp ( t->summary(), this );
@@ -1375,5 +1388,5 @@ void KOTodoView::toggleRunningItem()
} else {
t->setRunning( true );
- updateTodo ( t, 0 );
+ updateTodo ( t, KOGlobals::EVENTEDITED );
}
}
@@ -1506,14 +1519,14 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
void KOTodoView::displayAllFlat()
{
- storeCurrentItem();
+
+ mActiveItem = 0;
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
+ clearList ();
mPopupMenu->setItemChecked( 8,true );
isFlatDisplay = true;
QPtrList<Todo> todoList = calendar()->todos();
- mTodoMap.clear();
- mTodoListView->clear();
Todo *todo;
for(todo = todoList.first(); todo; todo = todoList.next()) {
@@ -1697,7 +1710,8 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e )
}
}
+
void KOTodoView::updateTodo( Todo * t, int type )
{
- if ( mBlockUpdate)
+ if ( mBlockUpdate )
return;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index a8e90e2..9180015 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -175,5 +175,5 @@ class KOTodoView : public KOrg::BaseView
void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
QString getWhatsThisText(QPoint p);
- void clearList() {mTodoListView->clear(); }
+ void clearList( bool saveCurrentItem = true );
public slots: