author | zautrix <zautrix> | 2005-06-30 11:05:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 11:05:14 (UTC) |
commit | b03b54ce54c1391db8979db0df1369e1c68656fa (patch) (unidiff) | |
tree | adf1bb74f5f56cb54a18a2bbfa3bc327e2e32217 /korganizer/kotodoview.cpp | |
parent | 00e631189f1dca0d596b6ce5816f2fcde9124bd7 (diff) | |
download | kdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.zip kdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.tar.gz kdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/kotodoview.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1bfdef9..873a776 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -484,32 +484,33 @@ void KOQuickTodo::focusInEvent(QFocusEvent *ev) | |||
484 | if ( text()==i18n("Click to add a new Todo") ) | 484 | if ( text()==i18n("Click to add a new Todo") ) |
485 | setText(""); | 485 | setText(""); |
486 | QLineEdit::focusInEvent(ev); | 486 | QLineEdit::focusInEvent(ev); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | setText(i18n("Click to add a new Todo")); | 491 | setText(i18n("Click to add a new Todo")); |
492 | QLineEdit::focusOutEvent(ev); | 492 | QLineEdit::focusOutEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | ///////////////////////////////////////////////////////////////////////////// | 495 | ///////////////////////////////////////////////////////////////////////////// |
496 | 496 | ||
497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
498 | KOrg::BaseView(calendar,parent,name) | 498 | KOrg::BaseView(calendar,parent,name) |
499 | { | 499 | { |
500 | mCategoryPopupMenu = 0; | ||
500 | mPendingUpdateBeforeRepaint = false; | 501 | mPendingUpdateBeforeRepaint = false; |
501 | isFlatDisplay = false; | 502 | isFlatDisplay = false; |
502 | mNavigator = 0; | 503 | mNavigator = 0; |
503 | QBoxLayout *topLayout = new QVBoxLayout(this); | 504 | QBoxLayout *topLayout = new QVBoxLayout(this); |
504 | mName = QString ( name ); | 505 | mName = QString ( name ); |
505 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
506 | mQuickAdd = new KOQuickTodo(this); | 507 | mQuickAdd = new KOQuickTodo(this); |
507 | topLayout->addWidget(mQuickAdd); | 508 | topLayout->addWidget(mQuickAdd); |
508 | 509 | ||
509 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 510 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
510 | 511 | ||
511 | mTodoListView = new KOTodoListView(calendar,this, name ); | 512 | mTodoListView = new KOTodoListView(calendar,this, name ); |
512 | topLayout->addWidget(mTodoListView); | 513 | topLayout->addWidget(mTodoListView); |
513 | //mTodoListView->header()->setMaximumHeight(30); | 514 | //mTodoListView->header()->setMaximumHeight(30); |
514 | mTodoListView->setRootIsDecorated(true); | 515 | mTodoListView->setRootIsDecorated(true); |
515 | mTodoListView->setAllColumnsShowFocus(true); | 516 | mTodoListView->setAllColumnsShowFocus(true); |
@@ -1145,48 +1146,48 @@ void KOTodoView::setNewPercentage(int index) | |||
1145 | } | 1146 | } |
1146 | if (mPercentage[index] == 100) { | 1147 | if (mPercentage[index] == 100) { |
1147 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1148 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1148 | } else { | 1149 | } else { |
1149 | mActiveItem->todo()->setCompleted(false); | 1150 | mActiveItem->todo()->setCompleted(false); |
1150 | } | 1151 | } |
1151 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1152 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1152 | mActiveItem->construct(); | 1153 | mActiveItem->construct(); |
1153 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1154 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1154 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1155 | } | 1156 | } |
1156 | } | 1157 | } |
1157 | 1158 | ||
1158 | 1159 | ||
1159 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1160 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1160 | { | 1161 | { |
1161 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1162 | if ( !mCategoryPopupMenu ) { |
1162 | QStringList checkedCategories = todoItem->todo()->categories (); | 1163 | mCategoryPopupMenu = new QPopupMenu (this); |
1163 | 1164 | mCategoryPopupMenu->setCheckable (true); | |
1164 | tempMenu->setCheckable (true); | 1165 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1165 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1166 | } |
1166 | it != KOPrefs::instance()->mCustomCategories.end (); | 1167 | mCategoryPopupMenu->clear(); |
1167 | ++it) { | 1168 | QStringList checkedCategories = todoItem->todo()->categories (); |
1168 | int index = tempMenu->insertItem (*it); | 1169 | |
1169 | mCategory[index] = *it; | 1170 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1170 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1171 | it != KOPrefs::instance()->mCustomCategories.end (); |
1171 | } | 1172 | ++it) { |
1172 | 1173 | int index = mCategoryPopupMenu->insertItem (*it); | |
1173 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1174 | mCategory[index] = *it; |
1174 | return tempMenu; | 1175 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1175 | 1176 | } | |
1176 | 1177 | return mCategoryPopupMenu; | |
1177 | } | 1178 | } |
1178 | void KOTodoView::changedCategories(int index) | 1179 | void KOTodoView::changedCategories(int index) |
1179 | { | 1180 | { |
1180 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1181 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1181 | QStringList categories = mActiveItem->todo()->categories (); | 1182 | QStringList categories = mActiveItem->todo()->categories (); |
1182 | QString colcat = categories.first(); | 1183 | QString colcat = categories.first(); |
1183 | if (categories.find (mCategory[index]) != categories.end ()) | 1184 | if (categories.find (mCategory[index]) != categories.end ()) |
1184 | categories.remove (mCategory[index]); | 1185 | categories.remove (mCategory[index]); |
1185 | else | 1186 | else |
1186 | categories.insert (categories.end(), mCategory[index]); | 1187 | categories.insert (categories.end(), mCategory[index]); |
1187 | categories.sort (); | 1188 | categories.sort (); |
1188 | if ( !colcat.isEmpty() ) { | 1189 | if ( !colcat.isEmpty() ) { |
1189 | if ( categories.find ( colcat ) != categories.end () ) { | 1190 | if ( categories.find ( colcat ) != categories.end () ) { |
1190 | categories.remove( colcat ); | 1191 | categories.remove( colcat ); |
1191 | categories.prepend( colcat ); | 1192 | categories.prepend( colcat ); |
1192 | } | 1193 | } |