| Summary: | multiline textfield for task-description | ||
|---|---|---|---|
| Product: | [Applications] ktimetracker | Reporter: | Samuel Suther <s.suther> |
| Component: | general | Assignee: | Thorsten Staerk <dev> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | mangoo |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Samuel Suther
2011-01-25 08:21:46 UTC
*** Bug 223768 has been marked as a duplicate of this bug. *** *** Bug 184468 has been marked as a duplicate of this bug. *** Here is a patch for this, still needs to be refined:
diff --git a/ktimetracker/edittaskdialog.cpp b/ktimetracker/edittaskdialog.cpp
index a53f049..8e9de97 100644
--- a/ktimetracker/edittaskdialog.cpp
+++ b/ktimetracker/edittaskdialog.cpp
@@ -66,14 +66,26 @@ QString EditTaskDialog::taskName()
return m_ui->tasknamelineedit->text();
}
+QString EditTaskDialog::taskDescription()
+{
+ return m_ui->tasknametextedit->toPlainText();
+}
+
QString EditTaskDialog::timeChange()
{
return m_ui->letimechange->text();
}
-void EditTaskDialog::setTask( const QString &name )
+void EditTaskDialog::setTask(const QString &name)
{
- m_ui->tasknamelineedit->setText( name );
+ kDebug() << name;
+ m_ui->tasknamelineedit->setText(name);
+}
+
+void EditTaskDialog::setDescription(const QString &description)
+{
+ kDebug() << description;
+ m_ui->tasknametextedit->setText(description);
}
void EditTaskDialog::status(DesktopList *desktopList) const
diff --git a/ktimetracker/edittaskdialog.h b/ktimetracker/edittaskdialog.h
index 53c75cc..0008c02 100644
--- a/ktimetracker/edittaskdialog.h
+++ b/ktimetracker/edittaskdialog.h
@@ -30,8 +30,10 @@ public:
EditTaskDialog( TaskView *parent, const QString &caption, DesktopList* desktopList = 0 );
~EditTaskDialog();
QString taskName();
+ QString taskDescription();
QString timeChange();
void setTask( const QString &name );
+ void setDescription( const QString &description );
void status( DesktopList *desktopList) const;
protected:
diff --git a/ktimetracker/edittaskdialog.ui b/ktimetracker/edittaskdialog.ui
index 2549ea3..e15a800 100644
--- a/ktimetracker/edittaskdialog.ui
+++ b/ktimetracker/edittaskdialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
- <height>300</height>
+ <height>375</height>
</rect>
</property>
<property name="windowTitle">
@@ -27,7 +27,7 @@
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
+ <item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="tasknamelineedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -45,23 +45,24 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="1" column="0" colspan="3">
- <widget class="QPushButton" name="edittimespushbutton">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Description:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="4">
+ <widget class="QTextEdit" name="tasknametextedit">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="whatsThis">
- <string>To change this task's time, you have to edit its event history.</string>
- </property>
- <property name="text">
- <string>Edit Times</string>
- </property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
+ <item row="4" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -74,7 +75,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="2" column="2">
+ <item row="4" column="3">
<widget class="QLineEdit" name="letimechange">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -84,8 +85,20 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="3" column="0" colspan="3">
+ <item row="5" column="0" colspan="4">
<widget class="QGroupBox" name="autotrackinggroupbox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>111</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>392</width>
+ <height>111</height>
+ </size>
+ </property>
<property name="title">
<string>Auto Tracking</string>
</property>
@@ -98,7 +111,7 @@ p, li { white-space: pre-wrap; }
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</item>
- <item row="4" column="0" colspan="2">
+ <item row="6" column="2" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -108,6 +121,22 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QPushButton" name="edittimespushbutton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis">
+ <string>To change this task's time, you have to edit its event history.</string>
+ </property>
+ <property name="text">
+ <string>Edit Times</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/ktimetracker/ktimetracker.kcfg b/ktimetracker/ktimetracker.kcfg
index 8dad2f9..3cce046 100644
--- a/ktimetracker/ktimetracker.kcfg
+++ b/ktimetracker/ktimetracker.kcfg
@@ -59,6 +59,9 @@
<entry name="displayPercentComplete" type="Bool">
<default>false</default>
</entry>
+ <entry name="displayBilled" type="Bool">
+ <default>false</default>
+ </entry>
<entry name="decimalFormat" type="Bool">
<default>false</default>
</entry>
diff --git a/ktimetracker/main.cpp b/ktimetracker/main.cpp
index 66c96ac..d01619b 100644
--- a/ktimetracker/main.cpp
+++ b/ktimetracker/main.cpp
@@ -166,7 +166,7 @@ int main( int argc, char *argv[] )
const QString& s=args->getOption("addtask");
QVector<int> vec;
DesktopList dl=vec;
- Task* task=new Task( s,(long int) 0,(long int) 0, dl, 0, true );
+ Task* task=new Task( s, QString(), (long int) 0,(long int) 0, dl, 0, true );
sto->addTask( task );
sto->save( 0 );
delete sto;
diff --git a/ktimetracker/mainwindow.cpp b/ktimetracker/mainwindow.cpp
index abb3747..f365c9d 100644
--- a/ktimetracker/mainwindow.cpp
+++ b/ktimetracker/mainwindow.cpp
@@ -55,7 +55,6 @@ MainWindow::MainWindow( const QString &icsfile )
kDebug(5970) << "Entering function, icsfile is " << icsfile;
// Setup our actions
setupActions();
-
// this routine will find and load our Part.
KPluginLoader loader( "ktimetrackerpart" );
KPluginFactory *factory = loader.factory();
diff --git a/ktimetracker/plannerparser.cpp b/ktimetracker/plannerparser.cpp
index f4d5b7a..8013f94 100644
--- a/ktimetracker/plannerparser.cpp
+++ b/ktimetracker/plannerparser.cpp
@@ -83,12 +83,12 @@ bool PlannerParser::startElement( const QString&, const QString&, const QString&
if (level++>0)
{
parentTask=task;
- task = new Task(taskName, 0, 0, dl, parentTask);
+ task = new Task(taskName, QString(), 0, 0, dl, parentTask);
task->setUid(_taskView->storage()->addTask(task, parentTask));
}
else
{
- task = new Task(taskName, 0, 0, dl, _taskView);
+ task = new Task(taskName, QString(), 0, 0, dl, _taskView);
kDebug() <<"added" << taskName;
task->setUid(_taskView->storage()->addTask(task, 0));
}
diff --git a/ktimetracker/task.cpp b/ktimetracker/task.cpp
index d45e8e7..5c1421e 100644
--- a/ktimetracker/task.cpp
+++ b/ktimetracker/task.cpp
@@ -38,18 +38,18 @@
QVector<QPixmap*> *Task::icons = 0;
-Task::Task( const QString& taskName, long minutes, long sessionTime,
+Task::Task( const QString& taskName, const QString& taskDescription, long minutes, long sessionTime,
DesktopList desktops, TaskView *parent, bool konsolemode )
: QObject(), QTreeWidgetItem(parent)
{
- init( taskName, minutes, sessionTime, 0, desktops, 0, 0, konsolemode );
+ init( taskName, taskDescription, minutes, sessionTime, 0, desktops, 0, 0, konsolemode );
}
-Task::Task( const QString& taskName, long minutes, long sessionTime,
+Task::Task( const QString& taskName, const QString& taskDescription, long minutes, long sessionTime,
DesktopList desktops, Task *parent)
: QObject(), QTreeWidgetItem(parent)
{
- init( taskName, minutes, sessionTime, 0, desktops, 0, 0 );
+ init( taskName, taskDescription, minutes, sessionTime, 0, desktops, 0, 0 );
}
Task::Task( KCal::Todo* todo, TaskView* parent, bool konsolemode )
@@ -57,15 +57,16 @@ Task::Task( KCal::Todo* todo, TaskView* parent, bool konsolemode )
{
long minutes = 0;
QString name;
+ QString description;
long sessionTime = 0;
QString sessionStartTiMe;
int percent_complete = 0;
int priority = 0;
DesktopList desktops;
- parseIncidence( todo, minutes, sessionTime, sessionStartTiMe, name, desktops, percent_complete,
+ parseIncidence( todo, minutes, sessionTime, sessionStartTiMe, name, description, desktops, percent_complete,
priority );
- init( name, minutes, sessionTime, sessionStartTiMe, desktops, percent_complete, priority, konsolemode );
+ init( name, description, minutes, sessionTime, sessionStartTiMe, desktops, percent_complete, priority, konsolemode );
}
int Task::depth()
@@ -80,7 +81,7 @@ int Task::depth()
return res;
}
-void Task::init( const QString& taskName, long minutes, long sessionTime, QString sessionStartTiMe,
+void Task::init( const QString& taskName, const QString& taskDescription, long minutes, long sessionTime, QString sessionStartTiMe,
DesktopList desktops, int percent_complete, int priority, bool konsolemode )
{
const TaskView *taskView = qobject_cast<TaskView*>( treeWidget() );
@@ -112,6 +113,7 @@ void Task::init( const QString& taskName, long minutes, long sessionTime, QStrin
mRemoving = false;
mName = taskName.trimmed();
+ mDescription = taskDescription.trimmed();
mLastStart = QDateTime::currentDateTime();
mTotalTime = mTime = minutes;
mTotalSessionTime = mSessionTime = sessionTime;
@@ -220,6 +222,18 @@ void Task::setName( const QString& name, timetrackerstorage* storage )
}
}
+void Task::setDescription( const QString& description )
+{
+ kDebug(5970) << "Entering function, description=" << description;
+
+ QString olddescription = mDescription;
+ if ( olddescription != description )
+ {
+ mDescription = description;
+ update();
+ }
+}
+
void Task::setPercentComplete(const int percent, timetrackerstorage *storage)
{
kDebug(5970) << "Entering function(" << percent <<", storage):" << mUid;
@@ -468,6 +482,7 @@ KCal::Todo* Task::asTodo(KCal::Todo* todo) const
kDebug(5970) <<"Task::asTodo: name() = '" << name() <<"'";
todo->setSummary( name() );
+ todo->setDescription( description() );
// Note: if the date start is empty, the KOrganizer GUI will have the
// checkbox blank, but will prefill the todo's starting datetime to the
@@ -495,12 +510,13 @@ KCal::Todo* Task::asTodo(KCal::Todo* todo) const
}
bool Task::parseIncidence( KCal::Incidence* incident, long& minutes,
- long& sessionMinutes, QString& sessionStartTiMe, QString& name, DesktopList& desktops,
+ long& sessionMinutes, QString& sessionStartTiMe, QString& name, QString& description, DesktopList& desktops,
int& percent_complete, int& priority )
{
kDebug(5970) << "Entering function";
bool ok;
name = incident->summary();
+ description = incident->description();
mUid = incident->uid();
mComment = incident->description();
ok = false;
@@ -665,6 +681,11 @@ QString Task::name() const
return mName;
}
+QString Task::description() const
+{
+ return mDescription;
+}
+
QDateTime Task::startTime() const
{
return mLastStart;
diff --git a/ktimetracker/task.h b/ktimetracker/task.h
index 93ce79f..84d54ef 100644
--- a/ktimetracker/task.h
+++ b/ktimetracker/task.h
@@ -58,9 +58,9 @@ class Task : public QObject, public QTreeWidgetItem
Q_OBJECT
public:
- Task( const QString& taskame, long minutes, long sessionTime,
+ Task( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime,
DesktopList desktops, TaskView* parent = 0, bool konsolemode=false );
- Task( const QString& taskame, long minutes, long sessionTime,
+ Task( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime,
DesktopList desktops, Task* parent = 0);
Task( KCal::Todo* incident, TaskView* parent, bool konsolemode=false );
@@ -235,11 +235,20 @@ public:
*/
void setName( const QString& name, timetrackerstorage* storage );
+ /** sets the description of the task
+ */
+ void setDescription( const QString& description);
+
/** returns the name of this task.
* @return a pointer to the name.
*/
QString name() const;
+ /** returns the description of this task.
+ * @return a pointer to the description.
+ */
+ QString description() const;
+
/**
* Returns that task name, prefixed by parent tree up to root.
*
@@ -281,7 +290,7 @@ public:
* and use these data to initialize the task.
*/
bool parseIncidence( KCal::Incidence*, long& minutes,
- long& sessionMinutes, QString& sessionStartTiMe, QString& name, DesktopList& desktops,
+ long& sessionMinutes, QString& sessionStartTiMe, QString& name, QString& description, DesktopList& desktops,
int& percent_complete, int& priority );
/**
@@ -357,7 +366,7 @@ public:
void noNegativeTimes();
/** initialize a task */
- void init( const QString& taskame, long minutes, long sessionTime, QString sessionStartTiMe,
+ void init( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime, QString sessionStartTiMe,
DesktopList desktops, int percent_complete, int priority, bool konsolemode=false );
static QVector<QPixmap*> *icons;
@@ -373,6 +382,9 @@ public:
/** task name */
QString mName;
+ /** task description */
+ QString mDescription;
+
/** Last time this task was started. */
QDateTime mLastStart;
diff --git a/ktimetracker/taskview.cpp b/ktimetracker/taskview.cpp
index 1710a95..4f8ec16 100644
--- a/ktimetracker/taskview.cpp
+++ b/ktimetracker/taskview.cpp
@@ -871,6 +871,7 @@ void TaskView::newTask( const QString &caption, Task *parent )
{
QString taskName = i18n( "Unnamed Task" );
if ( !dialog->taskName().isEmpty()) taskName = dialog->taskName();
+ QString taskDescription = dialog->taskDescription();
total = totalDiff = session = sessionDiff = 0;
dialog->status( &desktopList );
@@ -880,7 +881,7 @@ void TaskView::newTask( const QString &caption, Task *parent )
if ( desktopList.size() == _desktopTracker->desktopCount() )
desktopList.clear();
- QString uid = addTask( taskName, total, session, desktopList, parent );
+ QString uid = addTask( taskName, taskDescription, total, session, desktopList, parent );
if ( uid.isNull() )
{
KMessageBox::error( 0, i18n(
@@ -891,14 +892,14 @@ void TaskView::newTask( const QString &caption, Task *parent )
}
QString TaskView::addTask
-( const QString& taskname, long total, long session,
+( const QString& taskname, const QString& taskdescription, long total, long session,
const DesktopList& desktops, Task* parent )
{
kDebug(5970) << "Entering function; taskname =" << taskname;
setSortingEnabled(false);
Task *task;
- if ( parent ) task = new Task( taskname, total, session, desktops, parent );
- else task = new Task( taskname, total, session, desktops, this );
+ if ( parent ) task = new Task( taskname, taskdescription, total, session, desktops, parent );
+ else task = new Task( taskname, taskdescription, total, session, desktops, this );
task->setUid( d->mStorage->addTask( task, parent ) );
QString taskuid=task->uid();
@@ -938,6 +939,7 @@ void TaskView::editTask()
DesktopList oldDeskTopList = desktopList;
EditTaskDialog *dialog = new EditTaskDialog( this, i18n("Edit Task"), &desktopList );
dialog->setTask( task->name() );
+ dialog->setDescription( task->description() );
int result = dialog->exec();
if (result == QDialog::Accepted)
{
@@ -948,7 +950,7 @@ void TaskView::editTask()
}
// setName only does something if the new name is different
task->setName(taskName, d->mStorage);
-
+ task->setDescription(dialog->taskDescription());
// update session time as well if the time was changed
if (!dialog->timeChange().isEmpty())
{
diff --git a/ktimetracker/taskview.h b/ktimetracker/taskview.h
index 3e73aa8..aba8c92 100644
--- a/ktimetracker/taskview.h
+++ b/ktimetracker/taskview.h
@@ -101,7 +101,7 @@ class TaskView : public QTreeWidget
Task* task( const QString& uid );
/** Add a task to view and storage. */
- QString addTask( const QString& taskame, long total = 0, long session = 0, const DesktopList& desktops = QVector<int>(0,0),
+ QString addTask( const QString& taskame, const QString& taskdescription = QString(), long total = 0, long session = 0, const DesktopList& desktops = QVector<int>(0,0),
Task* parent = 0 );
/** Returns a list of the current active tasks. */
diff --git a/ktimetracker/timetrackerstorage.h b/ktimetracker/timetrackerstorage.h
index 247b2b6..3cb4c38 100644
--- a/ktimetracker/timetrackerstorage.h
+++ b/ktimetracker/timetrackerstorage.h
@@ -200,7 +200,6 @@ class timetrackerstorage : public QObject
*/
void setName(const Task* task, const QString& oldname) { Q_UNUSED(task); Q_UNUSED(oldname); }
-
/**
* Log the event that a timer has started for a task.
*
diff --git a/ktimetracker/timetrackerwidget.cpp b/ktimetracker/timetrackerwidget.cpp
index ba9b65d..e2ac5d0 100644
--- a/ktimetracker/timetrackerwidget.cpp
+++ b/ktimetracker/timetrackerwidget.cpp
@@ -457,7 +457,7 @@ bool TimetrackerWidget::eventFilter( QObject *obj, QEvent *event )
void TimetrackerWidget::slotAddTask( const QString &taskName )
{
TaskView *taskView = currentTaskView();
- taskView->addTask( taskName, 0, 0, DesktopList(), 0 );
+ taskView->addTask( taskName, QString(), 0, 0, DesktopList(), 0 );
d->mSearchWidget->clear();
}
@@ -643,7 +643,7 @@ void TimetrackerWidget::addTask( const QString &taskName )
if ( taskView )
{
- taskView->addTask( taskName, 0, 0, DesktopList(), 0 );
+ taskView->addTask( taskName, QString(), 0, 0, DesktopList(), 0 );
}
}
@@ -653,7 +653,7 @@ void TimetrackerWidget::addSubTask( const QString& taskName, const QString &task
if ( taskView )
{
- taskView->addTask( taskName, 0, 0, DesktopList(), taskView->task( taskId) );
+ taskView->addTask( taskName, QString(), 0, 0, DesktopList(), taskView->task( taskId) );
taskView->refresh();
}
}
Sorry cannot commit and I think this is because of using anongit, but I cannot find out due to the switch from SVN to GIT. For re-creating my commit manually here is a list of changed files: - edittaskdialog.ui - edittaskdialog.cpp - edittaskdialog.h - main.cpp - plannerparser.cpp - mainwindow.cpp - taskview.cpp - taskview.h - task.cpp - task.h - timetrackerstorage.cpp - timetrackerstorage.h - timetrackerwidget.cpp Git commit 47594819cd14d0b937bb40f4cf467c5bb5613daa by Thorsten Staerk. Committed on 29/09/2011 at 09:18. Pushed by tstaerk into branch 'master'. Allow adding a description to a task. BUGS:264226 M +12 -2 ktimetracker/edittaskdialog.cpp M +2 -0 ktimetracker/edittaskdialog.h M +44 -15 ktimetracker/edittaskdialog.ui M +1 -1 ktimetracker/main.cpp M +2 -2 ktimetracker/plannerparser.cpp M +29 -8 ktimetracker/task.cpp M +16 -4 ktimetracker/task.h M +7 -5 ktimetracker/taskview.cpp M +1 -1 ktimetracker/taskview.h M +1 -1 ktimetracker/timetrackerstorage.cpp M +3 -3 ktimetracker/timetrackerwidget.cpp http://commits.kde.org/kdepim/47594819cd14d0b937bb40f4cf467c5bb5613daa |