summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
authorzautrix <zautrix>2005-02-06 18:00:15 (UTC)
committer zautrix <zautrix>2005-02-06 18:00:15 (UTC)
commit282c7fc5b72f8a6ff78a408e10a6018c290ed9f0 (patch) (side-by-side diff)
tree95291ead32969e45a6e4e405f15532c9f29543f7 /korganizer/kotodoview.cpp
parent002a447671cdec6a2ee7940bc183c630c61121fa (diff)
downloadkdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.zip
kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.gz
kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.bz2
cat color better
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -916,101 +916,108 @@ void KOTodoView::setNewPriority(int index)
void KOTodoView::setNewPercentage(int index)
{
if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
mActiveItem->setOn( true );
return;
} else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
if ( par && par->isOn() )
par->setOn( false );
}
if (mPercentage[index] == 100) {
mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
} else {
mActiveItem->todo()->setCompleted(false);
}
mActiveItem->todo()->setPercentComplete(mPercentage[index]);
mActiveItem->construct();
todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
}
}
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;
}
void KOTodoView::changedCategories(int index)
{
if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
QStringList categories = mActiveItem->todo()->categories ();
+ QString colcat = categories.first();
if (categories.find (mCategory[index]) != categories.end ())
categories.remove (mCategory[index]);
else
categories.insert (categories.end(), mCategory[index]);
categories.sort ();
+ if ( !colcat.isEmpty() ) {
+ if ( categories.find ( colcat ) != categories.end () ) {
+ categories.remove( colcat );
+ categories.prepend( colcat );
+ }
+ }
mActiveItem->todo()->setCategories (categories);
mActiveItem->construct();
mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
}
}
void KOTodoView::itemDoubleClicked(QListViewItem *item)
{
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
if (!item) {
newTodo();
return;
}
if ( KOPrefs::instance()->mEditOnDoubleClick )
editItem( item );
else
showItem( item , QPoint(), 0 );
}
void KOTodoView::itemClicked(QListViewItem *item)
{
if (!item) {
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
return;
}
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
if ( pendingSubtodo != 0 ) {
bool allowReparent = true;
QListViewItem *par = item;
while ( par ) {
if ( par == pendingSubtodo ) {
allowReparent = false;
break;
}
par = par->parent();
}
if ( !allowReparent ) {
topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
qDebug("Recursive reparenting not possible ");
pendingSubtodo = 0;
} else {
Todo* newParent = todoItem->todo();