summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
authorzautrix <zautrix>2005-04-02 14:07:31 (UTC)
committer zautrix <zautrix>2005-04-02 14:07:31 (UTC)
commitb0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd (patch) (side-by-side diff)
tree942bcf89b35cf165e9147c1e4a5efa817c48007f /korganizer/kotodoview.cpp
parent997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (diff)
downloadkdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.zip
kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.gz
kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.bz2
fixes
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -209,28 +209,30 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
QPoint p(contentsToViewport(e->pos()));
QListViewItem *i = itemAt(p);
bool rootClicked = true;
if (i) {
// if the user clicked into the root decoration of the item, don't
// try to start a drag!
int X = p.x();
//qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
if (X > header()->sectionPos(0) +
treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
- itemMargin() ||
+ itemMargin() +i->height()||
X < header()->sectionPos(0)) {
rootClicked = false;
}
+ } else {
+ rootClicked = false;
}
#ifndef KORG_NODND
mMousePressed = false;
if (! rootClicked ) {
mPressPos = e->pos();
mMousePressed = true;
}
#endif
//qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
#ifndef DESKTOP_VERSION
if (!( e->button() == RightButton && rootClicked) )
QListView::contentsMousePressEvent(e);
@@ -721,27 +723,27 @@ void KOTodoView::updateView()
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();
+ mCurItemRootParent = mCurItem;
+ while ( mCurItemRootParent->relatedTo() != 0 )
+ mCurItemRootParent = mCurItemRootParent->relatedTo();
}
mActiveItem = 0;
}
void KOTodoView::resetCurrentItem()
{
mTodoListView->setFocus();
KOTodoViewItem* foundItem = 0;
KOTodoViewItem* foundItemRoot = 0;
KOTodoViewItem* foundItemAbove = 0;
if ( mTodoListView->firstChild () ) {
if ( mCurItem ) {
@@ -750,28 +752,28 @@ void KOTodoView::resetCurrentItem()
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 ( ! foundItem ) {
- if ( foundItemAbove )
- foundItem = foundItemAbove;
- else
+ if ( foundItemRoot )
foundItem = foundItemRoot;
+ else
+ foundItem = foundItemAbove;
}
}
if ( foundItem ) {
mTodoListView->setCurrentItem( foundItem );
mTodoListView->ensureItemVisible( foundItem );
} else {
mTodoListView->setCurrentItem( mTodoListView->firstChild () );
}
}
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
@@ -1196,35 +1198,41 @@ void KOTodoView::setTodoModified( Todo* todo )
todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
}
void KOTodoView::clearSelection()
{
mTodoListView->selectAll( false );
}
void KOTodoView::setAllOpen()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), true);
+ resetCurrentItem();
}
void KOTodoView::setAllClose()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), false);
+ resetCurrentItem();
}
void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
{
while ( item ) {
setOpen( item->firstChild(), setOpenI );
item->setOpen( setOpenI );
item = item->nextSibling();
}
}
void KOTodoView::displayAllFlat()
@@ -1245,26 +1253,28 @@ void KOTodoView::displayAllFlat()
}
mTodoListView->setFocus();
processSelectionChange();
}
void KOTodoView::setAllFlat()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
return;
- }
+ }
+ storeCurrentItem();
displayAllFlat();
+ resetCurrentItem();
}
void KOTodoView::purgeCompleted()
{
emit purgeCompletedSignal();
}
void KOTodoView::toggleQuickTodo()
{
if ( mQuickAdd->isVisible() ) {
mQuickAdd->hide();
KOPrefs::instance()->mEnableQuickTodo = false;
}