summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
authorzautrix <zautrix>2005-07-03 15:58:48 (UTC)
committer zautrix <zautrix>2005-07-03 15:58:48 (UTC)
commit9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e (patch) (unidiff)
tree4e5e6a4e6eac36df79891d61ed1d1cd76ed6105d /korganizer/kotodoview.cpp
parent0c632bafd2d058504118dc8957fc4808a784f548 (diff)
downloadkdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.zip
kdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.tar.gz
kdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.tar.bz2
fixes
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp53
1 files changed, 41 insertions, 12 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index e2966f8..4f42c83 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -567,9 +567,21 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
567 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 567 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
568 568
569 569
570 mCategoryPopupMenu = new QPopupMenu (this);
571 mCategoryPopupMenu->setCheckable (true);
572 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
573 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
574
575 mCalPopupMenu = new QPopupMenu (this);
576 mCalPopupMenu->setCheckable (true);
577 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
578 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
579
580
581
570 582
571 mItemPopupMenu = new QPopupMenu(this); 583 mItemPopupMenu = new QPopupMenu(this);
572 mItemPopupMenu->insertItem(i18n("Show..."), this, 584 mItemPopupMenu->insertItem(i18n("Show"), this,
573 SLOT (showTodo())); 585 SLOT (showTodo()));
574 mItemPopupMenu->insertItem(i18n("Edit..."), this, 586 mItemPopupMenu->insertItem(i18n("Edit..."), this,
575 SLOT (editTodo())); 587 SLOT (editTodo()));
@@ -585,6 +597,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
585#endif 597#endif
586 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 598 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
587 SLOT (cancelTodo())); 599 SLOT (cancelTodo()));
600 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu);
601 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu);
588 mItemPopupMenu->insertSeparator(); 602 mItemPopupMenu->insertSeparator();
589 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 603 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
590 SLOT (toggleRunningItem())); 604 SLOT (toggleRunningItem()));
@@ -1053,7 +1067,9 @@ void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
1053 moveTodo(); 1067 moveTodo();
1054 break; 1068 break;
1055 case 8: 1069 case 8:
1056 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 1070 mCategoryPopupMenu->popup(QCursor::pos ()); break;
1071 case 9:
1072 mCalPopupMenu->popup(QCursor::pos ()); break;
1057 default: 1073 default:
1058 mItemPopupMenu->popup(QCursor::pos()); 1074 mItemPopupMenu->popup(QCursor::pos());
1059 } 1075 }
@@ -1164,17 +1180,11 @@ void KOTodoView::setNewPercentage(int index)
1164 } 1180 }
1165} 1181}
1166 1182
1167 1183void KOTodoView::fillCategories ()
1168QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1169{ 1184{
1170 if ( !mCategoryPopupMenu ) {
1171 mCategoryPopupMenu = new QPopupMenu (this);
1172 mCategoryPopupMenu->setCheckable (true);
1173 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1174 }
1175 mCategoryPopupMenu->clear(); 1185 mCategoryPopupMenu->clear();
1176 QStringList checkedCategories = todoItem->todo()->categories (); 1186 if ( ! mActiveItem ) return;
1177 1187 QStringList checkedCategories = mActiveItem->todo()->categories ();
1178 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1188 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1179 it != KOPrefs::instance()->mCustomCategories.end (); 1189 it != KOPrefs::instance()->mCustomCategories.end ();
1180 ++it) { 1190 ++it) {
@@ -1182,7 +1192,26 @@ QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1182 mCategory[index] = *it; 1192 mCategory[index] = *it;
1183 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); 1193 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true);
1184 } 1194 }
1185 return mCategoryPopupMenu; 1195}
1196void KOTodoView::fillCal ()
1197{
1198 mCalPopupMenu->clear();
1199 if (!mActiveItem) return;
1200 bool readO = mActiveItem->todo()->isReadOnly();
1201 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
1202 while ( kkf ) {
1203 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber);
1204 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
1205 mCalPopupMenu->setItemEnabled( index, false );
1206 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID());
1207 kkf = KOPrefs::instance()->mCalendars.next();
1208 }
1209}
1210void KOTodoView::changedCal (int index )
1211{
1212 if (!mActiveItem) return;
1213 mActiveItem->todo()->setCalID( index );
1214 mActiveItem->construct();
1186} 1215}
1187void KOTodoView::changedCategories(int index) 1216void KOTodoView::changedCategories(int index)
1188{ 1217{