summaryrefslogtreecommitdiffstats
path: root/korganizer/kotodoviewitem.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /korganizer/kotodoviewitem.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/kotodoviewitem.cpp')
-rw-r--r--korganizer/kotodoviewitem.cpp95
1 files changed, 58 insertions, 37 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 7e5541fa3..f5b0adced 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -24,17 +24,19 @@
without including the source code for Qt in the source distribution.
*/
-#include <tqpainter.h>
+#include "kotodoviewitem.h"
+#include "kotodoview.h"
+#include "koprefs.h"
+#include "koglobals.h"
+
+#include <libkcal/incidenceformatter.h>
#include <klocale.h>
#include <kdebug.h>
#include <tqpainter.h>
#include <tqpixmap.h>
-#include "kotodoviewitem.h"
-#include "kotodoview.h"
-#include "koprefs.h"
-#include "koglobals.h"
+#include <tqpainter.h>
KOTodoViewItem::KOTodoViewItem( TQListView *parent, Todo *todo, KOTodoView *kotodo)
: TQCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
@@ -50,7 +52,7 @@ KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *
inline int KOTodoViewItem::compareDueDates( const KOTodoViewItem *b ) const
{
- if ( mEffectiveDueDate.isValid() &&
+ if ( mEffectiveDueDate.isValid() &&
!b->mEffectiveDueDate.isValid() )
return -1;
else if ( !mEffectiveDueDate.isValid() &&
@@ -63,41 +65,57 @@ inline int KOTodoViewItem::compareDueDates( const KOTodoViewItem *b ) const
int KOTodoViewItem::compare( TQListViewItem *it, int col, bool ascending ) const
{
KOTodoViewItem *i = dynamic_cast<KOTodoViewItem *>( it );
- if ( !i )
+ if ( !i ) {
return TQListViewItem::compare( it, col, ascending );
-
+ }
+
// throw completed todos to the bottom
- if ( mTodo->isCompleted() && !i->todo()->isCompleted() )
+ if ( mTodo->isCompleted() && !i->todo()->isCompleted() ) {
return ascending ? 1 : -1;
- else if ( !mTodo->isCompleted() && i->todo()->isCompleted() )
+ } else if ( !mTodo->isCompleted() && i->todo()->isCompleted() ) {
return ascending ? -1 : 1;
-
+ }
+
int c;
switch ( col ) {
- case ( KOTodoView::eSummaryColumn ):
- return mTodo->summary().localeAwareCompare( i->todo()->summary() );
- case ( KOTodoView::eRecurColumn ):
- return ( mTodo->doesRecur() ? 1 : 0 ) - (i->todo()->doesRecur() ? 1 : 0 );
- case ( KOTodoView::ePriorityColumn ):
- c = mTodo->priority() - i->todo()->priority();
- if ( c )
- return c;
+ case KOTodoView::eSummaryColumn:
+ return mTodo->summary().localeAwareCompare( i->todo()->summary() );
+
+ case KOTodoView::eRecurColumn:
+ return ( mTodo->doesRecur() ? 1 : 0 ) - ( i->todo()->doesRecur() ? 1 : 0 );
+
+ case KOTodoView::ePriorityColumn:
+ c = mTodo->priority() - i->todo()->priority();
+ if ( c ) {
+ return c;
+ } else {
return compareDueDates( i );
- case ( KOTodoView::ePercentColumn ):
- return mTodo->percentComplete() - i->todo()->percentComplete();
- case ( KOTodoView::eDueDateColumn ):
- c = compareDueDates( i );
- if ( c )
- return c;
+ }
+
+ case KOTodoView::ePercentColumn:
+ return mTodo->percentComplete() - i->todo()->percentComplete();
+
+ case KOTodoView::eDueDateColumn:
+ c = compareDueDates( i );
+ if ( c ) {
+ return c;
+ } else {
return mTodo->priority() - i->todo()->priority();
- case ( KOTodoView::eCategoriesColumn ):
- return mTodo->categoriesStr().localeAwareCompare(
- i->todo()->categoriesStr() );
- case ( KOTodoView::eDescriptionColumn ):
- return mTodo->description().localeAwareCompare( i->todo()->description() );
- default:
- Q_ASSERT( false && "unknown column to compare" );
- return TQListViewItem::compare( it, col, ascending );
+ }
+ case KOTodoView::eCategoriesColumn:
+ return mTodo->categoriesStr().localeAwareCompare( i->todo()->categoriesStr() );
+
+ case KOTodoView::eFolderColumn:
+ return TQListViewItem::compare( it, col, ascending );
+
+#if 0
+ case KOTodoView::eDescriptionColumn:
+ return mTodo->description().localeAwareCompare( i->todo()->description() );
+#endif
+
+ default:
+ Q_ASSERT( false && "unknown column to compare" );
+ return TQListViewItem::compare( it, col, ascending );
}
}
@@ -120,14 +138,14 @@ void KOTodoViewItem::construct()
static const TQPixmap recurPxmp = KOGlobals::self()->smallIcon("recur");
if ( mTodo->doesRecur() )
setPixmap( KOTodoView::eRecurColumn, recurPxmp );
-
+
if ( mTodo->priority()==0 ) {
setText( KOTodoView::ePriorityColumn, i18n("--") );
} else {
setText( KOTodoView::ePriorityColumn, TQString::number(mTodo->priority()) );
}
setText( KOTodoView::ePercentColumn, TQString::number(mTodo->percentComplete()) );
-
+
if (mTodo->hasDueDate()) {
TQString dtStr = mTodo->dtDueDateStr();
if (!mTodo->doesFloat()) {
@@ -143,9 +161,12 @@ void KOTodoViewItem::construct()
}
} else
setText( KOTodoView::eDueDateColumn, "" );
-
+
setText( KOTodoView::eCategoriesColumn, mTodo->categoriesStr() );
+ setText( KOTodoView::eFolderColumn,
+ IncidenceFormatter::resourceString( mTodoView->calendar(), mTodo ) );
+
#if 0
// Find sort id in description. It's the text behind the last '#' character
// found in the description. White spaces are removed from beginning and end
@@ -173,7 +194,7 @@ void KOTodoViewItem::stateChange( bool state )
setOn( mTodo->isCompleted() );
return;
}
-
+
kdDebug(5850) << "State changed, modified " << state << endl;
mTodoView->setNewPercentageDelayed( this, state ? 100 : 0 );
}