-rw-r--r-- | korganizer/kotodoview.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
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); + if ( !mCategoryPopupMenu ) { + mCategoryPopupMenu = new QPopupMenu (this); + mCategoryPopupMenu->setCheckable (true); + connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); + } + mCategoryPopupMenu->clear(); 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); + int index = mCategoryPopupMenu->insertItem (*it); mCategory[index] = *it; - if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); + if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); } - - connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); - return tempMenu; - - + return mCategoryPopupMenu; } void KOTodoView::changedCategories(int index) { |