Commit 10c7cfb2 authored by Zoltan Gyarmati's avatar Zoltan Gyarmati

ktimetracker: sort progress percentage numerically and

 tasks case-insensitively
REVIEW: 121369
BUG: 225139
BUG: 285160
parent fe324888
......@@ -656,6 +656,21 @@ void Task::startNewSession()
mSessionStartTiMe=KDateTime::currentLocalDateTime();
}
/* Overriding the < operator in order to sort the names case insensitive and
* the progress percentage [coloumn 6] numerically.
*/
bool Task::operator<(const QTreeWidgetItem &other)const {
const int column = treeWidget()->sortColumn();
if (column == 6){ //progress percent
return text(column).toInt() < other.text(column).toInt();
} else if (column == 0) { //task name
return text(column).toLower() < other.text(column).toLower();
}
else {
return text(column) < other.text(column);
}
}
//BEGIN Properties
QString Task::uid() const
{
......
......@@ -367,6 +367,8 @@ public:
void init( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime, QString sessionStartTiMe,
DesktopList desktops, int percent_complete, int priority, bool konsolemode=false );
bool operator<(const QTreeWidgetItem &other)const;
static QVector<QPixmap*> *icons;
/** The iCal unique ID of the Todo for this task. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment