summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8c1953d..14e8b5c 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -313,48 +313,49 @@ void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
313KOQuickTodo::KOQuickTodo(QWidget *parent) : 313KOQuickTodo::KOQuickTodo(QWidget *parent) :
314 QLineEdit(parent) 314 QLineEdit(parent)
315{ 315{
316 setText(i18n("Click to add a new Todo")); 316 setText(i18n("Click to add a new Todo"));
317} 317}
318 318
319void KOQuickTodo::focusInEvent(QFocusEvent *ev) 319void KOQuickTodo::focusInEvent(QFocusEvent *ev)
320{ 320{
321 if ( text()==i18n("Click to add a new Todo") ) 321 if ( text()==i18n("Click to add a new Todo") )
322 setText(""); 322 setText("");
323 QLineEdit::focusInEvent(ev); 323 QLineEdit::focusInEvent(ev);
324} 324}
325 325
326void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 326void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
327{ 327{
328 setText(i18n("Click to add a new Todo")); 328 setText(i18n("Click to add a new Todo"));
329 QLineEdit::focusOutEvent(ev); 329 QLineEdit::focusOutEvent(ev);
330} 330}
331 331
332///////////////////////////////////////////////////////////////////////////// 332/////////////////////////////////////////////////////////////////////////////
333 333
334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
335 KOrg::BaseView(calendar,parent,name) 335 KOrg::BaseView(calendar,parent,name)
336{ 336{
337 isFlatDisplay = false;
337 mNavigator = 0; 338 mNavigator = 0;
338 QBoxLayout *topLayout = new QVBoxLayout(this); 339 QBoxLayout *topLayout = new QVBoxLayout(this);
339 mName = QString ( name ); 340 mName = QString ( name );
340 mBlockUpdate = false; 341 mBlockUpdate = false;
341 mQuickAdd = new KOQuickTodo(this); 342 mQuickAdd = new KOQuickTodo(this);
342 topLayout->addWidget(mQuickAdd); 343 topLayout->addWidget(mQuickAdd);
343 344
344 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 345 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
345 346
346 mTodoListView = new KOTodoListView(calendar,this, name ); 347 mTodoListView = new KOTodoListView(calendar,this, name );
347 topLayout->addWidget(mTodoListView); 348 topLayout->addWidget(mTodoListView);
348 //mTodoListView->header()->setMaximumHeight(30); 349 //mTodoListView->header()->setMaximumHeight(30);
349 mTodoListView->setRootIsDecorated(true); 350 mTodoListView->setRootIsDecorated(true);
350 mTodoListView->setAllColumnsShowFocus(true); 351 mTodoListView->setAllColumnsShowFocus(true);
351 352
352 mTodoListView->setShowSortIndicator(true); 353 mTodoListView->setShowSortIndicator(true);
353 354
354 mTodoListView->addColumn(i18n("Todo")); 355 mTodoListView->addColumn(i18n("Todo"));
355 mTodoListView->addColumn(i18n("Prio")); 356 mTodoListView->addColumn(i18n("Prio"));
356 mTodoListView->setColumnAlignment(1,AlignHCenter); 357 mTodoListView->setColumnAlignment(1,AlignHCenter);
357 mTodoListView->addColumn(i18n("Complete")); 358 mTodoListView->addColumn(i18n("Complete"));
358 mTodoListView->setColumnAlignment(2,AlignCenter); 359 mTodoListView->setColumnAlignment(2,AlignCenter);
359 360
360 mTodoListView->addColumn(i18n("Due Date")); 361 mTodoListView->addColumn(i18n("Due Date"));
@@ -931,59 +932,67 @@ void KOTodoView::itemClicked(QListViewItem *item)
931 } 932 }
932 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 933 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
933 if ( pendingSubtodo != 0 ) { 934 if ( pendingSubtodo != 0 ) {
934 bool allowReparent = true; 935 bool allowReparent = true;
935 QListViewItem *par = item; 936 QListViewItem *par = item;
936 while ( par ) { 937 while ( par ) {
937 if ( par == pendingSubtodo ) { 938 if ( par == pendingSubtodo ) {
938 allowReparent = false; 939 allowReparent = false;
939 break; 940 break;
940 } 941 }
941 par = par->parent(); 942 par = par->parent();
942 } 943 }
943 if ( !allowReparent ) { 944 if ( !allowReparent ) {
944 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 945 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
945 qDebug("Recursive reparenting not possible "); 946 qDebug("Recursive reparenting not possible ");
946 pendingSubtodo = 0; 947 pendingSubtodo = 0;
947 } else { 948 } else {
948 Todo* newParent = todoItem->todo(); 949 Todo* newParent = todoItem->todo();
949 Todo* newSub = pendingSubtodo->todo(); 950 Todo* newSub = pendingSubtodo->todo();
950 pendingSubtodo = 0; 951 pendingSubtodo = 0;
951 emit reparentTodoSignal( newParent,newSub ); 952 emit reparentTodoSignal( newParent,newSub );
952 return; 953 return;
953 } 954 }
954 } 955 }
955 int completed = todoItem->todo()->isCompleted(); // Completed or not? 956#if 0
956 957 // handled by the item itself
958 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
959 qDebug("com %d ",completed );
960 qDebug("itemclicked ");
957 if (todoItem->isOn()) { 961 if (todoItem->isOn()) {
962 qDebug("on ");
958 if (!completed) { 963 if (!completed) {
964 qDebug("set true ");
959 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 965 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
960 } 966 }
961 } else { 967 } else {
968 qDebug("not on ");
962 if (completed) { 969 if (completed) {
970 qDebug("set false ");
963 todoItem->todo()->setCompleted(false); 971 todoItem->todo()->setCompleted(false);
964 } 972 }
965 } 973 }
974#endif
966} 975}
967 976
968void KOTodoView::setDocumentId( const QString &id ) 977void KOTodoView::setDocumentId( const QString &id )
969{ 978{
970 kdDebug() << "KOTodoView::setDocumentId()" << endl; 979 kdDebug() << "KOTodoView::setDocumentId()" << endl;
971 980
972 mDocPrefs->setDoc( id ); 981 mDocPrefs->setDoc( id );
973} 982}
974 983
975void KOTodoView::itemStateChanged( QListViewItem *item ) 984void KOTodoView::itemStateChanged( QListViewItem *item )
976{ 985{
977 if (!item) return; 986 if (!item) return;
978 987
979 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 988 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
980 989
981// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 990// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
982 991
983 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 992 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
984} 993}
985 994
986void KOTodoView::saveLayout(KConfig *config, const QString &group) const 995void KOTodoView::saveLayout(KConfig *config, const QString &group) const
987{ 996{
988 mTodoListView->saveLayout(config,group); 997 mTodoListView->saveLayout(config,group);
989} 998}