27 #include <QStyledItemDelegate>
32 #include <QMouseEvent>
36 #include <KApplication>
38 #include <KFileDialog>
40 #include <KMessageBox>
41 #include <KProgressDialog>
42 #include <KUrlRequester>
56 #include "storageadaptor.h"
58 #define T_LINESIZE 1023
63 class TaskViewDelegate :
public QStyledItemDelegate {
65 TaskViewDelegate(
QObject *parent = 0 ) : QStyledItemDelegate( parent ) {}
67 void paint( QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const
69 if (index.column () == 6)
71 QApplication::style()->drawControl( QStyle::CE_ItemViewItem, &option, painter );
72 int rX = option.rect.x() + 2;
73 int rY = option.rect.y() + 2;
74 int rWidth = option.rect.width() - 4;
75 int rHeight = option.rect.height() - 4;
76 int value = index.model()->data( index ).toInt();
77 int newWidth = (int)(rWidth * (value / 100.));
79 if(QApplication::isLeftToRight())
81 int mid = rY + rHeight / 2;
82 int width = rWidth / 2;
83 QLinearGradient gradient1( rX, mid, rX + width, mid);
84 gradient1.setColorAt( 0, Qt::red );
85 gradient1.setColorAt( 1, Qt::yellow );
86 painter->fillRect( rX, rY, (newWidth < width) ? newWidth : width, rHeight, gradient1 );
90 QLinearGradient gradient2( rX + width, mid, rX + 2 * width, mid);
91 gradient2.setColorAt( 0, Qt::yellow );
92 gradient2.setColorAt( 1, Qt::green );
93 painter->fillRect( rX + width, rY, newWidth - width, rHeight, gradient2 );
96 painter->setPen( option.state & QStyle::State_Selected ? option.palette.highlight().color() : option.palette.background().color() );
97 for (
int x = rHeight; x < newWidth; x += rHeight)
99 painter->drawLine( rX + x, rY, rX + x, rY + rHeight - 1 );
104 int mid = option.rect.height() - rHeight / 2;
105 int width = rWidth / 2;
106 QLinearGradient gradient1( rX, mid, rX + width, mid);
107 gradient1.setColorAt( 0, Qt::red );
108 gradient1.setColorAt( 1, Qt::yellow );
109 painter->fillRect( option.rect.height(), rY, (newWidth < width) ? newWidth : width, rHeight, gradient1 );
111 if (newWidth > width)
113 QLinearGradient gradient2( rX + width, mid, rX + 2 * width, mid);
114 gradient2.setColorAt( 0, Qt::yellow );
115 gradient2.setColorAt( 1, Qt::green );
116 painter->fillRect( rX + width, rY, newWidth - width, rHeight, gradient2 );
119 painter->setPen( option.state & QStyle::State_Selected ? option.palette.highlight().color() : option.palette.background().color() );
120 for (
int x = rWidth- rHeight; x > newWidth; x -= rHeight)
122 painter->drawLine( rWidth - x, rY, rWidth - x, rY + rHeight - 1 );
126 painter->setPen( Qt::black );
127 painter->drawText( option.rect, Qt::AlignCenter | Qt::AlignVCenter, QString::number(value) +
" %" );
131 QStyledItemDelegate::paint( painter, option, index );
139 class TaskView::Private
144 mFocusTrackingActive( false ) {}
151 bool mFocusTrackingActive;
152 Task* mLastTaskWithFocus;
153 QList<Task*> mActiveTasks;
155 QMenu *mPopupPercentageMenu;
156 QMap<QAction*, int> mPercentage;
157 QMenu *mPopupPriorityMenu;
158 QMap<QAction*, int> mPriority;
166 new StorageAdaptor(
this );
167 QDBusConnection::sessionBus().registerObject(
"/ktimetrackerstorage",
this );
176 SIGNAL(newFocus(QString)),
180 setWindowFlags( windowFlags() | Qt::WindowContextHelpButtonHint );
181 labels << i18n(
"Task Name" ) << i18n(
"Session Time" ) << i18n(
"Time" )
182 << i18n(
"Total Session Time" ) << i18n(
"Total Time" )
183 << i18n(
"Priority" ) << i18n(
"Percent Complete" );
184 setHeaderLabels( labels );
185 headerItem()->setWhatsThis(0,i18n(
"The task name is what you call the task, it can be chosen freely."));
186 headerItem()->setWhatsThis(1,i18n(
"The session time is the time since you last chose \"start new session.\""));
187 headerItem()->setWhatsThis(3,i18n(
"The total session time is the session time of this task and all its subtasks."));
188 headerItem()->setWhatsThis(4,i18n(
"The total time is the time of this task and all its subtasks."));
189 setAllColumnsShowFocus(
true );
190 setSortingEnabled(
true );
191 setAlternatingRowColors(
true );
192 setDragDropMode( QAbstractItemView::InternalMove );
193 setItemDelegateForColumn( 6,
new TaskViewDelegate(
this) );
196 _minuteTimer =
new QTimer(
this);
197 connect( _minuteTimer, SIGNAL(timeout()),
this, SLOT(
minuteUpdate()));
204 connect( _idleTimeDetector, SIGNAL(
stopAllTimers(QDateTime)),
210 _autoSaveTimer =
new QTimer(
this);
211 connect( _autoSaveTimer, SIGNAL(timeout()),
this, SLOT(
save()));
214 _manualSaveTimer =
new QTimer(
this);
215 _manualSaveTimer->setSingleShot(
true );
216 connect( _manualSaveTimer, SIGNAL(timeout()),
this, SLOT(
save()));
220 connect( _desktopTracker, SIGNAL(reachedActiveDesktop(
Task*)),
222 connect( _desktopTracker, SIGNAL(leftActiveDesktop(
Task*)),
227 connect( headerContextMenu, SIGNAL(columnToggled(
int)),
this, SLOT(
slotColumnToggled(
int)) );
230 d->mPopupPercentageMenu =
new QMenu(
this );
231 for (
int i = 0; i <= 100; i += 10 )
233 QString label = i18n(
"%1 %" , i );
234 d->mPercentage[ d->mPopupPercentageMenu->addAction( label ) ] = i;
236 connect( d->mPopupPercentageMenu, SIGNAL(triggered(QAction*)),
239 d->mPopupPriorityMenu =
new QMenu(
this );
240 for (
int i = 0; i <= 9; ++i )
246 label = i18n(
"unspecified" );
249 label = i18nc(
"combox entry for highest priority",
"1 (highest)" );
252 label = i18nc(
"combox entry for medium priority",
"5 (medium)" );
255 label = i18nc(
"combox entry for lowest priority",
"9 (lowest)" );
258 label = QString(
"%1" ).arg( i );
261 d->mPriority[ d->mPopupPriorityMenu->addAction( label ) ] = i;
263 connect( d->mPopupPriorityMenu, SIGNAL(triggered(QAction*)),
266 setContextMenuPolicy( Qt::CustomContextMenu );
267 connect(
this, SIGNAL(customContextMenuRequested(QPoint)),
271 sortByColumn( 0, Qt::AscendingOrder );
272 for (
int i=0; i<=columnCount(); ++i) resizeColumnToContents(i);
277 QString newTaskName = taskName;
278 newTaskName.remove(
'\n' );
280 if ( d->mFocusTrackingActive )
291 d->mLastTaskWithFocus =
task;
296 QString taskuid =
addTask( newTaskName );
297 if ( taskuid.isNull() )
299 KMessageBox::error( 0, i18n(
300 "Error storing new task. Your changes were not saved. Make sure you can edit your iCalendar file. Also quit all applications using this file and remove any lock file related to its name from ~/.kde/share/apps/kabc/lock/ " ) );
308 d->mLastTaskWithFocus =
task;
318 QModelIndex index = indexAt( event->pos() );
320 if (index.isValid() && index.column() == 6)
322 int newValue = (int)((event->pos().x() - visualRect(index).x()) / (
double)(visualRect(index).width()) * 100);
323 if ( event->modifiers() & Qt::ShiftModifier )
325 int delta = newValue % 10;
328 newValue += (10 - delta);
335 if (item && item->isSelected())
347 QTreeWidget::mouseMoveEvent( event );
353 kDebug(5970) <<
"Entering function, event->button()=" <<
event->button();
354 QModelIndex index = indexAt( event->pos() );
357 if ( index.isValid() && index.column() == 0 && visualRect( index ).x() <=
event->pos().x()
358 &&
event->pos().x() < visualRect( index ).x() + 19)
380 QPoint newPos = viewport()->mapToGlobal( event->pos() );
383 QTreeWidget::mousePressEvent( event );
401 kDebug(5970) <<
"Entering function";
402 return static_cast< Task*
>( QTreeWidget::currentItem() );
410 if ( topLevelItemCount() == 0 )
return 0;
412 QTreeWidgetItemIterator item(
this );
413 while( *item && i-- ) ++item;
415 kDebug( 5970 ) <<
"Leaving TaskView::itemAt" <<
"returning " << (*item==0);
424 assert( !( fileName.isEmpty() ) );
428 kDebug(5970) <<
"Entering function";
430 QString err = d->mStorage->load(
this, fileName);
434 KMessageBox::error(
this, err);
436 kDebug(5970) <<
"Leaving TaskView::load";
449 if ( !d->mStorage->allEventsHaveEndTiMe( t ) )
452 d->mActiveTasks.append(t);
454 if ( d->mActiveTasks.count() == 1 )
461 if ( topLevelItemCount() > 0 )
464 setCurrentItem(topLevelItem( 0 ));
466 KMessageBox::error( 0, i18n(
"Your virtual desktop number is too high, desktop tracking will not work" ) );
470 for (
int i=0; i<=columnCount(); ++i) resizeColumnToContents(i);
471 kDebug(5970) <<
"Leaving function";
474 void TaskView::restoreItemState()
479 kDebug(5970) <<
"Entering function";
481 if ( topLevelItemCount() > 0 )
483 QTreeWidgetItemIterator item(
this );
491 kDebug(5970) <<
"Leaving function";
496 kDebug() <<
"Entering function";
497 if ( !item || _isloading )
return;
499 kDebug(5970) <<
"TaskView::itemStateChanged()" <<
" uid=" << t->
uid() <<
" state=" << t->isExpanded();
500 if( _preferences ) _preferences->
writeEntry( t->
uid(), t->isExpanded() );
505 d->mStorage->closeStorage();
510 return d->mStorage->allEventsHaveEndTiMe();
517 kWarning() <<
"TaskView::iCalFileModified(): calendar or weakPointer is null: " << calendar;
519 kDebug(5970) <<
"entering function";
521 d->mStorage->buildTaskView( calendar->
weakPointer().toStrongRef(), this );
522 kDebug(5970) <<
"exiting iCalFileModified";
528 kDebug(5970) <<
"entering function";
532 t->setPixmapProgress();
538 while (
itemAt( ++i ) && (
itemAt( i )->depth() == 0 ) ){};
542 setRootIsDecorated(
true );
545 kDebug(5970) <<
"exiting TaskView::refresh()";
551 kDebug(5970) <<
"Entering function";
560 for( KCalCore::Event::List::iterator i = eventList.begin(); i != eventList.end(); ++i )
562 if ( (*i)->relatedTo() ==
itemAt(n)->
uid() )
564 KDateTime kdatetimestart = (*i)->dtStart();
565 KDateTime kdatetimeend = (*i)->dtEnd();
566 KDateTime eventstart = KDateTime::fromString(kdatetimestart.toString().remove(
"Z"));
567 KDateTime eventend = KDateTime::fromString(kdatetimeend.toString().remove(
"Z"));
568 int duration=eventstart.secsTo( eventend )/60;
571 kDebug(5970) <<
"duration is " << duration;
573 if (
itemAt(n)->sessionStartTiMe().isValid() )
576 if ((
itemAt(n)->sessionStartTiMe().secsTo( eventstart )>0) &&
577 (
itemAt(n)->sessionStartTiMe().secsTo( eventend )>0))
580 int sessionTime=eventstart.secsTo( eventend )/60;
598 kDebug(5970) <<
"Leaving TaskView::reFreshTimes()";
604 kDebug( 5970 ) <<
"entering importPlanner";
606 QString lFileName = fileName;
607 if ( lFileName.isEmpty() )
608 lFileName = KFileDialog::getOpenFileName( QString(), QString(), 0 );
609 QFile xmlFile( lFileName );
610 QXmlInputSource source( &xmlFile );
611 QXmlSimpleReader reader;
612 reader.setContentHandler( handler );
613 reader.parse( source );
619 return d->mStorage->report(
this, rc );
624 kDebug(5970) <<
"TaskView::exportcsvFile()";
629 dialog.urlExportTo->KUrlRequester::setMode(KFile::File);
632 QString err = d->mStorage->report(
this, dialog.
reportCriteria() );
633 if ( !err.isEmpty() ) KMessageBox::error(
this, i18n(err.toLatin1()) );
639 kDebug(5970) <<
"TaskView::exportcsvHistory()";
645 dialog.urlExportTo->KUrlRequester::setMode(KFile::File);
656 QTreeWidgetItemIterator item(
this );
689 QTreeWidget::dropEvent(event);
695 _manualSaveTimer->start( 10 );
700 kDebug(5970) <<
"Entering TaskView::save()";
701 QString err=d->mStorage->save(
this);
705 QString errMsg = d->mStorage->icalfile() +
":\n";
707 if (err==QString(
"Could not save. Could not lock file."))
708 errMsg += i18n(
"Could not save. Disk full?");
710 errMsg += i18n(
"Could not save.");
712 KMessageBox::error(
this, errMsg);
723 kDebug(5970) <<
"Entering function";
724 if (task != 0 && d->mActiveTasks.indexOf(task) == -1)
730 task->
setRunning(
true, d->mStorage, startTime);
731 d->mActiveTasks.append(task);
733 if ( d->mActiveTasks.count() == 1 )
742 d->mActiveTasks.clear();
747 kDebug(5970) <<
"Entering function";
748 KProgressDialog dialog(
this, 0, QString(
"Progress") );
749 dialog.progressBar()->setMaximum( d->mActiveTasks.count() );
750 if ( d->mActiveTasks.count() > 1 ) dialog.show();
752 foreach (
Task *
task, d->mActiveTasks )
754 kapp->processEvents();
756 dialog.progressBar()->setValue( dialog.progressBar()->value() + 1 );
760 d->mActiveTasks.clear();
768 d->mFocusTrackingActive = !d->mFocusTrackingActive;
770 if ( d->mFocusTrackingActive )
788 kDebug(5970) <<
"Entering TaskView::startNewSession";
789 QTreeWidgetItemIterator item(
this );
796 kDebug(5970) <<
"Leaving TaskView::startNewSession";
802 kDebug(5970) <<
"Entering function";
803 QTreeWidgetItemIterator item(
this );
811 kDebug(5970) <<
"Leaving function";
817 kDebug(5970) <<
"Entering function";
818 QTreeWidgetItemIterator item(
this );
825 kDebug(5970) <<
"Leaving function";
830 kDebug(5970) <<
"Entering function";
831 if ( task != 0 && d->mActiveTasks.indexOf(task) != -1 )
833 d->mActiveTasks.removeAll(task);
835 if ( d->mActiveTasks.count() == 0 )
848 if ( d->mFocusTrackingActive && d->mLastTaskWithFocus ==
currentItem() )
856 addTimeToActiveTasks(1,
false);
859 void TaskView::addTimeToActiveTasks(
int minutes,
bool save_data)
861 foreach (
Task *
task, d->mActiveTasks )
862 task->
changeTime( minutes, ( save_data ? d->mStorage : 0 ) );
873 long total, totalDiff, session, sessionDiff;
876 int result = dialog->exec();
877 if ( result == QDialog::Accepted )
879 QString taskName = i18n(
"Unnamed Task" );
883 total = totalDiff = session = sessionDiff = 0;
884 dialog->
status( &desktopList );
888 if ( desktopList.size() == _desktopTracker->
desktopCount() )
891 QString uid =
addTask( taskName, taskDescription, total, session, desktopList, parent );
894 KMessageBox::error( 0, i18n(
895 "Error storing new task. Your changes were not saved. Make sure you can edit your iCalendar file. Also quit all applications using this file and remove any lock file related to its name from ~/.kde/share/apps/kabc/lock/ " ) );
902 (
const QString& taskname,
const QString& taskdescription,
long total,
long session,
905 kDebug(5970) <<
"Entering function; taskname =" << taskname;
906 setSortingEnabled(
false);
908 if ( parent ) task =
new Task( taskname, taskdescription, total, session, desktops, parent );
909 else task =
new Task( taskname, taskdescription, total, session, desktops,
this );
911 task->
setUid( d->mStorage->addTask( task, parent ) );
912 QString taskuid=task->
uid();
913 if ( ! taskuid.isNull() )
915 _desktopTracker->registerForDesktops( task, desktops );
916 setCurrentItem( task );
917 task->setSelected(
true );
925 setSortingEnabled(
true);
934 newTask(i18n(
"New Sub Task"), task);
935 task->setExpanded(
true);
941 kDebug(5970) <<
"Entering editTask";
950 int result = dialog->exec();
951 if (result == QDialog::Accepted)
953 QString taskName = i18n(
"Unnamed Task");
959 task->
setName(taskName, d->mStorage);
966 dialog->
status( &desktopList );
969 if (desktopList.size() == _desktopTracker->
desktopCount())
972 if ( oldDeskTopList != desktopList )
986 KMessageBox::information(0,i18n(
"No task selected."));
990 if (completion<0) completion=0;
1002 QString uid=task->
uid();
1003 task->
remove(d->mStorage);
1008 if (d->mActiveTasks.count() == 0)
1023 kDebug(5970) <<
"Entering function";
1027 KMessageBox::information(0,i18n(
"No task selected."));
1031 int response = KMessageBox::Continue;
1034 response = KMessageBox::warningContinueCancel( 0,
1035 i18n(
"Are you sure you want to delete the selected"
1036 " task and its entire history?\n"
1037 "NOTE: all subtasks and their history will also "
1039 i18n(
"Deleting Task"), KStandardGuiItem::del());
1049 KMessageBox::information(0,i18n(
"No task selected."));
1060 addTimeToActiveTasks(-minutes,
false);
1065 kDebug(5970) <<
"Entering function";
1069 d->mActiveTasks.removeAll( deletedTask );
1083 kDebug(5970) <<
"Entering function";
1086 KApplication::clipboard()->setText(t.
totalsAsText(
this, rc));
1093 KApplication::clipboard()->setText(s);
1101 Task *task =
static_cast<Task*
>( item );
1145 QPoint newPos = viewport()->mapToGlobal( pos );
1146 int column = columnAt( pos.x() );
1151 d->mPopupPercentageMenu->popup( newPos );
1155 d->mPopupPriorityMenu->popup( newPos );
1183 return d->mFocusTrackingActive;
1188 return d->mActiveTasks;
1193 kDebug(5970) <<
"Entering function";
1209 _autoSaveTimer->start(
1213 else if ( _autoSaveTimer->isActive() )
1215 _autoSaveTimer->stop();
1221 #include "taskview.moc"
void setPercentComplete(const int percent, timetrackerstorage *storage)
Update percent complete for this task.
static Preferences * instance()
static uint period()
Get period.
void dropEvent(QDropEvent *event)
void stopIdleDetection()
Stops detecting idle time.
bool isIdleDetectionPossible()
Returns true if it is possible to do idle detection.
void slotSetPriority(QAction *)
void startIdleDetection()
Starts detecting idle time.
void toggleFocusTracking()
Toggles the automatic tracking of focused windows.
QString deleteAllEvents()
static FocusDetectorNotifier * instance()
void detach(TaskView *view)
bool readBoolEntry(const QString &uid)
QString name() const
returns the name of this task.
void editTask()
Calls editTask dialog for the current task.
void importPlanner(const QString &fileName="")
used to import tasks from imendio planner
void startNewSession()
sets session time to zero.
QString totalsAsText(TaskView *taskview, ReportCriteria rc)
Generates ascii text of task totals, for current task on down.
void newFocusWindowDetected(const QString &)
React on the focus having changed to Window QString.
Task * itemAt(int i)
Return the i'th item (zero-based), cast to a Task pointer.
long count()
Return the total number of items in the view.
void setRunning(bool on, timetrackerstorage *storage, const QDateTime &when=QDateTime::currentDateTime())
starts or stops a task
static bool displayPriority()
Get displayPriority.
void startTimerFor(Task *task, const QDateTime &startTime=QDateTime::currentDateTime())
starts timer for task.
QString setClipBoardText(const QString &s)
Set the text of the application's clipboard.
QString reFreshTimes()
Refresh the times of the tasks, e.g.
void setDescription(const QString &description)
Keep track of how long the computer has been idle.
void setTask(const QString &name)
void scheduleSave()
Schedule that we should save very soon.
static void setEnabled(bool v)
Set enabled.
TaskView(QWidget *parent=0)
QString clipTotals(const ReportCriteria &rc)
Copy totals for current and all sub tasks to clipboard.
Task * task(const QString &uid)
return the task with the given UID
void stopCurrentTimer()
Stop the timer for the current item in the view.
Routines to output timecard data.
void subtractTime(int minutes)
Subtracts time from all active tasks, and does not log event.
void iCalFileModified()
React on another process having modified the iCal file we rely on.
static bool displaySessionTime()
Get displaySessionTime.
bool remove(timetrackerstorage *storage)
remove Task with all it's children
static bool autoSave()
Get autoSave.
void status(DesktopList *desktopList) const
bool isComplete()
Return true if task is complete (percent complete equals 100).
QString setSessionTime(long minutes)
Sets the session time.
static bool enabled()
Get enabled.
void markTaskAsIncomplete()
void slotCustomContextMenuRequested(const QPoint &)
void markTaskAsComplete()
QList< Task * > activeTasks() const
Returns a list of the current active tasks.
QString taskDescription()
void setName(const QString &name, timetrackerstorage *storage)
sets the name of the task
void clearActiveTasks()
clears all active tasks.
void slotColumnToggled(int)
void tasksChanged(QList< Task * > activeTasks)
ReportCriteria reportCriteria()
Return an object that encapsulates the choices the user has made.
void resetTimes()
Reset all times to 0 and adjust parent task's totalTiMes.
void newTask()
Calls newTask dialog with caption "New Task".
static void setDisplayPercentComplete(bool v)
Set displayPercentComplete.
void startNewSession()
Reset session time to zero for all tasks.
void slotItemDoubleClicked(QTreeWidgetItem *item, int)
static uint autoSavePeriod()
Get autoSavePeriod.
void refresh()
Used to refresh (e.g.
void setMaxIdle(int maxIdle)
Sets the maximum allowed idle.
void startCurrentTimer()
Start the timer on the current item (task) in view.
bool allEventsHaveEndTiMe()
Deliver if all events from the storage have and end time.
QString uid() const
Return unique iCalendar Todo ID for this task.
void mousePressEvent(QMouseEvent *)
void setPerCentComplete(int completion)
Sets % completed for the current task.
void exportcsvFile()
Export comma separated values format for task time totals.
void closeStorage()
Close the storage and release lock.
Stores entries from export dialog.
Class to show a dialog in ktimetracker to enter data about a task.
void toggleOverAllIdleDetection(bool on)
Sets whether idle detection should be done at all.
timetrackerstorage * storage()
Returns a pointer to storage object.
bool isRunning() const
return the state of a task - if it's running or not
KCalCore::Event::List rawevents()
list of all events
void deleteTask(Task *task=0)
Deletes the given or the current task (and children) from the view.
void stopTimerFor(Task *task)
void slotSetPercentage(QAction *)
void deleteEntry(const QString &key)
bool isFocusTrackingActive() const
Returns whether the focus tracking is currently active.
static void setDisplayTime(bool v)
Set displayTime.
QString addTime(long minutes)
Adds minutes to the time of the task and the total time of its supertasks.
QString addSessionTime(long minutes)
Adds minutes to the task's session time and its supertasks' total session time.
static bool promptDelete()
Get promptDelete.
QStringList tasks()
return all task names, e.g.
static bool displayTotalTime()
Get displayTotalTime.
void deleteTaskBatch(Task *task=0)
Deletes the given or the current task (and children) from the view.
void writeEntry(const QString &key, bool value)
QString description() const
returns the description of this task.
void resetDisplayTimeForAllTasks()
Reset session and total time for all tasks - do not touch the storage.
void setDesktopList(DesktopList dl)
void changeTime(long minutes, timetrackerstorage *storage)
Change task time.
static KTimeTrackerSettings * self()
QVector< int > DesktopList
static void setDisplayTotalTime(bool v)
Set displayTotalTime.
void setUid(const QString &uid)
Set unique id for the task.
void totalTimesChanged(long session, long total)
QString startTracking()
Start time tracking of tasks by virtual desktop.
static bool displayTime()
Get displayTime.
void registerForDesktops(Task *task, DesktopList dl)
void reconfigure()
Reconfigures taskView depending on current configuration.
void load(const QString &filename)
Load the view from storage.
QWeakPointer< KTimeTracker::KTTCalendar > weakPointer() const
static void setDisplaySessionTime(bool v)
Set displaySessionTime.
DesktopList desktops() const
QString recalculatetotalsessiontime()
A recursive function to calculate the total session time of a task.
void enableTasksToExportQuestion()
Enable the "Tasks to export" question in the dialog.
void mouseMoveEvent(QMouseEvent *)
static bool uniTasking()
Get uniTasking.
QString report(const ReportCriteria &rc)
call export function for csv totals or history
A utility to associate tasks with desktops As soon as a desktop is activated/left - an signal is emit...
void save()
Save to persistent storage.
static void setDisplayTotalSessionTime(bool v)
Set displayTotalSessionTime.
void stopAllTimers(const QDateTime &when=QDateTime::currentDateTime())
Stop all running timers.
static bool displayTotalSessionTime()
Get displayTotalSessionTime.
void newSubTask()
Calls newTask dialog with caption "New Sub Task".
void setPriority(int priority)
Update priority for this task.
void deletingTask(Task *deletedTask)
receiving signal that a task is being deleted
static bool configPDA()
Get configPDA.
void contextMenuRequested(const QPoint &)
void itemStateChanged(QTreeWidgetItem *item)
item state stores if a task is expanded so you can see the subtasks
void setPixmapProgress()
Sets an appropriate icon for this task based on its level of completion.
static void setDisplayPriority(bool v)
Set displayPriority.
A class representing a task.
void attach(TaskView *view)
QString exportcsvHistory()
Export comma-separated values format for task history.
QString recalculatetotaltime()
A recursive function to calculate the total time of a task.
Task * currentItem() const
Return the current item in the view, cast to a Task pointer.
Class to store/retrieve KTimeTracker data to/from persistent storage.
static bool displayPercentComplete()
Get displayPercentComplete.
void resetTimeForAllTasks()
Reset session and total time to zero for all tasks.
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)
Add a task to view and storage.
void setDescription(const QString &description)
sets the description of the task