Changeset View
Changeset View
Standalone View
Standalone View
src/presentation/workdaypagemodel.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | { | 51 | { | ||
52 | const auto parentData = parentIndex.data(QueryTreeModel<Domain::Task::Ptr>::ObjectRole); | 52 | const auto parentData = parentIndex.data(QueryTreeModel<Domain::Task::Ptr>::ObjectRole); | ||
53 | const auto parentArtifact = parentData.value<Domain::Artifact::Ptr>(); | 53 | const auto parentArtifact = parentData.value<Domain::Artifact::Ptr>(); | ||
54 | const auto parentTask = parentArtifact.objectCast<Domain::Task>(); | 54 | const auto parentTask = parentArtifact.objectCast<Domain::Task>(); | ||
55 | 55 | | |||
56 | auto task = Domain::Task::Ptr::create(); | 56 | auto task = Domain::Task::Ptr::create(); | ||
57 | task->setTitle(title); | 57 | task->setTitle(title); | ||
58 | if (!parentTask) | 58 | if (!parentTask) | ||
59 | task->setStartDate(Utils::DateTime::currentDateTime()); | 59 | task->setStartDate(Utils::DateTime::currentDate()); | ||
60 | const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) | 60 | const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) | ||
61 | : m_taskRepository->create(task); | 61 | : m_taskRepository->create(task); | ||
62 | installHandler(job, i18n("Cannot add task %1 in Workday", title)); | 62 | installHandler(job, i18n("Cannot add task %1 in Workday", title)); | ||
63 | 63 | | |||
64 | return task; | 64 | return task; | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | void WorkdayPageModel::removeItem(const QModelIndex &index) | 67 | void WorkdayPageModel::removeItem(const QModelIndex &index) | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 144 | auto drop = [this](const QMimeData *mimeData, Qt::DropAction, const Domain::Artifact::Ptr &artifact) { | |||
160 | 160 | | |||
161 | foreach(const auto &droppedArtifact, droppedArtifacts) { | 161 | foreach(const auto &droppedArtifact, droppedArtifacts) { | ||
162 | auto childTask = droppedArtifact.objectCast<Domain::Task>(); | 162 | auto childTask = droppedArtifact.objectCast<Domain::Task>(); | ||
163 | 163 | | |||
164 | if (parentTask) { | 164 | if (parentTask) { | ||
165 | const auto job = m_taskRepository->associate(parentTask, childTask); | 165 | const auto job = m_taskRepository->associate(parentTask, childTask); | ||
166 | installHandler(job, i18n("Cannot move task %1 as sub-task of %2", childTask->title(), parentTask->title())); | 166 | installHandler(job, i18n("Cannot move task %1 as sub-task of %2", childTask->title(), parentTask->title())); | ||
167 | } else { | 167 | } else { | ||
168 | childTask->setStartDate(Utils::DateTime::currentDateTime()); | 168 | childTask->setStartDate(Utils::DateTime::currentDate()); | ||
169 | 169 | | |||
170 | auto job = m_taskRepository->dissociate(childTask); | 170 | auto job = m_taskRepository->dissociate(childTask); | ||
171 | installHandler(job, i18n("Cannot deparent task %1 from its parent", childTask->title())); | 171 | installHandler(job, i18n("Cannot deparent task %1 from its parent", childTask->title())); | ||
172 | } | 172 | } | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | return true; | 175 | return true; | ||
176 | }; | 176 | }; | ||
Show All 13 Lines |