mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 10:13:42 +00:00
Show tasks with deadline first, in order
This commit is contained in:
parent
3030e15d5e
commit
d1a4858504
4 changed files with 19 additions and 1 deletions
|
@ -75,6 +75,11 @@ bool TaskItem::hasDate() const
|
|||
return isDate(data.date);
|
||||
}
|
||||
|
||||
bool TaskItem::hasTime() const
|
||||
{
|
||||
return getStartTime() != "" && getEndTime() != "";
|
||||
}
|
||||
|
||||
bool TaskItem::hasTag(const std::string &tag) const
|
||||
{
|
||||
return vectorUtils::contains(data.tags, tag);
|
||||
|
|
|
@ -57,6 +57,7 @@ class TaskItem
|
|||
const Tags &getTags() const;
|
||||
bool hasTag(const std::string &tag) const;
|
||||
bool hasDate() const;
|
||||
bool hasTime() const;
|
||||
|
||||
private:
|
||||
void onChange();
|
||||
|
|
|
@ -52,7 +52,17 @@ void TasksView::update()
|
|||
} else if (!t1->hasDate() && t2->hasDate()) {
|
||||
return false;
|
||||
}
|
||||
return t1->getDate() < t2->getDate();
|
||||
if (t1->getDate() < t2->getDate()) {
|
||||
return true;
|
||||
} else if (t1->getDate() > t2->getDate()) {
|
||||
return false;
|
||||
}
|
||||
if (t1->hasTime() && !t2->hasTime()) {
|
||||
return true;
|
||||
} else if (!t1->hasTime() && t2->hasTime()) {
|
||||
return false;
|
||||
}
|
||||
return t1->getStartTime() < t2->getStartTime();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue