~ubuntu-branches/ubuntu/raring/kdepim/raring-proposed

« back to all changes in this revision

Viewing changes to ktimetracker/task.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-07 07:56:38 UTC
  • mfrom: (0.2.27)
  • Revision ID: package-import@ubuntu.com-20120607075638-0luhdq11z7sgvs4m
Tags: 4:4.8.80-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include <KDebug>
31
31
#include <KIconLoader>
 
32
#include <KComponentData>
32
33
 
33
 
#include <kcal/event.h>
 
34
#include <KCalCore/Event>
34
35
 
35
36
#include "ktimetrackerutility.h"
36
37
#include "ktimetracker.h"
41
42
Task::Task( const QString& taskName, const QString& taskDescription, long minutes, long sessionTime,
42
43
            DesktopList desktops, TaskView *parent, bool konsolemode )
43
44
  : QObject(), QTreeWidgetItem(parent)
44
 
 
45
{
45
46
    init( taskName, taskDescription, minutes, sessionTime, 0, desktops, 0, 0, konsolemode );
46
47
}
47
48
 
48
49
Task::Task( const QString& taskName, const QString& taskDescription, long minutes, long sessionTime,
49
50
            DesktopList desktops, Task *parent)
50
 
  : QObject(), QTreeWidgetItem(parent) 
 
51
  : QObject(), QTreeWidgetItem(parent)
51
52
{
52
53
    init( taskName, taskDescription, minutes, sessionTime, 0, desktops, 0, 0 );
53
54
}
54
55
 
55
 
Task::Task( KCal::Todo* todo, TaskView* parent, bool konsolemode )
 
56
Task::Task( const KCalCore::Todo::Ptr &todo, TaskView* parent, bool konsolemode )
56
57
  : QObject(), QTreeWidgetItem( parent )
57
58
{
58
59
    long minutes = 0;
70
71
}
71
72
 
72
73
int Task::depth()
73
 
// Deliver the depth of a task, i.e. how many tasks are supertasks to it. 
 
74
// Deliver the depth of a task, i.e. how many tasks are supertasks to it.
74
75
// A toplevel task has the depth 0.
75
76
{
76
77
    kDebug(5970) << "Entering function";
128
129
 
129
130
    update();
130
131
    changeParentTotalTimes( mSessionTime, mTime);
131
 
  
 
132
 
132
133
    // alignment of the number items
133
134
    for (int i = 1; i < columnCount(); ++i)
134
135
    {
139
140
    setTextAlignment( 5, Qt::AlignCenter );
140
141
}
141
142
 
142
 
Task::~Task() 
 
143
Task::~Task()
143
144
{
144
145
    emit deletingTask(this);
145
146
    delete mTimer;
187
188
 
188
189
void Task::resumeRunning()
189
190
// setRunning is the back-end, the front-end is StartTimerFor().
190
 
// resumeRunning does the same as setRunning, but not add a new 
 
191
// resumeRunning does the same as setRunning, but not add a new
191
192
// start date to the storage.
192
193
{
193
194
    kDebug(5970) << "Entering function";
199
200
    }
200
201
}
201
202
 
202
 
void Task::setUid( const QString &uid ) 
 
203
void Task::setUid( const QString &uid )
203
204
{
204
205
    mUid = uid;
205
206
}
476
477
        return parent()->fullName() + QString::fromLatin1("/") + name();
477
478
}
478
479
 
479
 
KCal::Todo* Task::asTodo(KCal::Todo* todo) const
 
480
KCalCore::Todo::Ptr Task::asTodo(const KCalCore::Todo::Ptr &todo) const
480
481
{
481
482
    Q_ASSERT( todo != NULL );
482
483
 
509
510
    return todo;
510
511
}
511
512
 
512
 
bool Task::parseIncidence( KCal::Incidence* incident, long& minutes,
 
513
bool Task::parseIncidence( const KCalCore::Incidence::Ptr &incident, long& minutes,
513
514
    long& sessionMinutes, QString& sessionStartTiMe, QString& name, QString& description, DesktopList& desktops,
514
515
    int& percent_complete, int& priority )
515
516
{
577
578
            desktops.push_back( desktopInt );
578
579
        }
579
580
    }
580
 
    percent_complete = static_cast<KCal::Todo*>(incident)->percentComplete();
 
581
    percent_complete = incident.staticCast<KCalCore::Todo>()->percentComplete();
581
582
    priority = incident->priority();
582
583
    return true;
583
584
}