From b03b54ce54c1391db8979db0df1369e1c68656fa Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 30 Jun 2005 11:05:14 +0000 Subject: fixxx --- (limited to 'korganizer/kotodoview.cpp') diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1bfdef9..873a776 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -497,6 +497,7 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev) KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { + mCategoryPopupMenu = 0; mPendingUpdateBeforeRepaint = false; isFlatDisplay = false; mNavigator = 0; @@ -1158,22 +1159,22 @@ void KOTodoView::setNewPercentage(int index) QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) { - QPopupMenu* tempMenu = new QPopupMenu (this); - QStringList checkedCategories = todoItem->todo()->categories (); - - tempMenu->setCheckable (true); - for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); - it != KOPrefs::instance()->mCustomCategories.end (); - ++it) { - int index = tempMenu->insertItem (*it); - mCategory[index] = *it; - if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); - } - - connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); - return tempMenu; - - + if ( !mCategoryPopupMenu ) { + mCategoryPopupMenu = new QPopupMenu (this); + mCategoryPopupMenu->setCheckable (true); + connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); + } + mCategoryPopupMenu->clear(); + QStringList checkedCategories = todoItem->todo()->categories (); + + for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); + it != KOPrefs::instance()->mCustomCategories.end (); + ++it) { + int index = mCategoryPopupMenu->insertItem (*it); + mCategory[index] = *it; + if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); + } + return mCategoryPopupMenu; } void KOTodoView::changedCategories(int index) { -- cgit v0.9.0.2