File ktimetracker_bnc651155.diff of Package kdepim4
--- ktimetracker/edittaskdialog.cpp 2010/03/07 12:25:36 1100379
+++ ktimetracker/edittaskdialog.cpp 2010/03/07 12:32:15 1100380
@@ -66,6 +66,11 @@
return m_ui->tasknamelineedit->text();
}
+QString EditTaskDialog::timeChange()
+{
+ return m_ui->letimechange->text();
+}
+
void EditTaskDialog::setTask( const QString &name )
{
m_ui->tasknamelineedit->setText( name );
--- ktimetracker/edittaskdialog.h 2010/03/07 12:25:36 1100379
+++ ktimetracker/edittaskdialog.h 2010/03/07 12:32:15 1100380
@@ -10,6 +10,19 @@
class EditTaskDialog;
}
+/**
+ * Class to show a dialog in ktimetracker to enter data about a task.
+ *
+ * Holds task name and auto-tracking virtual desktops.
+ *
+ * Typically this class will be called by a taskview object to enter a new task
+ * or to edit an existing task. After quitting, you can read out task name and all
+ * properties till you delete the object.
+ *
+ * @short Class to show a dialog to enter data about a task
+ * @author Thorsten Staerk
+ */
+
class EditTaskDialog : public QDialog
{
Q_OBJECT
@@ -17,6 +30,7 @@
EditTaskDialog( TaskView *parent, const QString &caption, DesktopList* desktopList = 0 );
~EditTaskDialog();
QString taskName();
+ QString timeChange();
void setTask( const QString &name );
void status( DesktopList *desktopList) const;
--- ktimetracker/edittaskdialog.ui 2010/03/07 12:25:36 1100379
+++ ktimetracker/edittaskdialog.ui 2010/03/07 12:32:15 1100380
@@ -16,13 +16,25 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="tasknamelabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
<string>Task Name:</string>
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="tasknamelineedit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="whatsThis">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
@@ -33,7 +45,46 @@
</property>
</widget>
</item>
+ <item row="1" column="0" colspan="3">
+ <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>
<item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Change time (in minutes, e.g. -60)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="letimechange">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="autotrackinggroupbox">
<property name="title">
<string>Auto Tracking</string>
@@ -47,7 +98,7 @@
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</item>
- <item row="3" column="0" colspan="2">
+ <item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -57,16 +108,6 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QPushButton" name="edittimespushbutton">
- <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/>
--- ktimetracker/task.cpp 2010/03/07 12:25:36 1100379
+++ ktimetracker/task.cpp 2010/03/07 12:32:15 1100380
@@ -292,11 +292,6 @@
mDesktops = desktopList;
}
-void Task::changeTime( long minutes, timetrackerstorage* storage )
-{
- changeTimes( minutes, minutes, storage);
-}
-
QString Task::addTime( long minutes )
{
kDebug(5970) << "Entering function";
@@ -393,6 +388,11 @@
kDebug(5970) << "Leaving function";
}
+void Task::changeTime( long minutes, timetrackerstorage* storage )
+{
+ changeTimes( minutes, minutes, storage);
+}
+
void Task::changeTotalTimes( long minutesSession, long minutes )
{
kDebug(5970)
--- ktimetracker/taskview.cpp 2010/03/07 12:25:36 1100379
+++ ktimetracker/taskview.cpp 2010/03/07 12:32:15 1100380
@@ -945,13 +945,10 @@
task->setName(taskName, d->mStorage);
// update session time as well if the time was changed
- long total, session, totalDiff, sessionDiff;
- total = totalDiff = session = sessionDiff = 0;
- DesktopList desktopList;
- dialog->status(&desktopList);
-
- if ( totalDiff != 0 || sessionDiff != 0)
- task->changeTimes( sessionDiff, totalDiff, d->mStorage );
+ if (!dialog->timeChange().isEmpty())
+ {
+ task->changeTime(dialog->timeChange().toInt(),d->mStorage);
+ }
// If all available desktops are checked, disable auto tracking,
// since it makes no sense to track for every desktop.