<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>karm: taskview.cpp Source File (karm)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> <style type="text/css"> <!-- hr { display: none; } #content h2 { margin-left: 0px; } table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; } td.mdRow { padding: 8px 20px; } td.md { font-weight: bold; } td.mdname1 { font-weight: bold; color: #602020; } td.mdname { font-weight: bold; color: #602020; } --> </style> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" /> <div id="nav_header_title" align="left">KDE PIM API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_left" style="text-align: left;"> / <a href="../../">API Reference</a> / <a href=".">karm</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <h2><a name="content"></a>karm</h2> <!-- Generated by Doxygen 1.5.5 --> <h1>taskview.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include <qclipboard.h></span> <a name="l00002"></a>00002 <span class="preprocessor">#include <qfile.h></span> <a name="l00003"></a>00003 <span class="preprocessor">#include <qlayout.h></span> <a name="l00004"></a>00004 <span class="preprocessor">#include <qlistbox.h></span> <a name="l00005"></a>00005 <span class="preprocessor">#include <qlistview.h></span> <a name="l00006"></a>00006 <span class="preprocessor">#include <qptrlist.h></span> <a name="l00007"></a>00007 <span class="preprocessor">#include <qptrstack.h></span> <a name="l00008"></a>00008 <span class="preprocessor">#include <qstring.h></span> <a name="l00009"></a>00009 <span class="preprocessor">#include <qtextstream.h></span> <a name="l00010"></a>00010 <span class="preprocessor">#include <qtimer.h></span> <a name="l00011"></a>00011 <span class="preprocessor">#include <qxml.h></span> <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="preprocessor">#include "kapplication.h"</span> <span class="comment">// kapp</span> <a name="l00014"></a>00014 <span class="preprocessor">#include <kconfig.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <kdebug.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <kfiledialog.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <klocale.h></span> <span class="comment">// i18n</span> <a name="l00018"></a>00018 <span class="preprocessor">#include <kmessagebox.h></span> <a name="l00019"></a>00019 <span class="preprocessor">#include <kurlrequester.h></span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include "csvexportdialog.h"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "desktoptracker.h"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "edittaskdialog.h"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "idletimedetector.h"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "karmstorage.h"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "plannerparser.h"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "preferences.h"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "printdialog.h"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "reportcriteria.h"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "task.h"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "taskview.h"</span> <a name="l00032"></a>00032 <span class="preprocessor">#include "timekard.h"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "taskviewwhatsthis.h"</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#define T_LINESIZE 1023</span> <a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define HIDDEN_COLUMN -10</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="keyword">class </span><a class="code" href="classDesktopTracker.html" title="A utility to associate tasks with desktops As soon as a desktop is activated/left...">DesktopTracker</a>; <a name="l00039"></a>00039 <a name="l00040"></a>00040 TaskView::TaskView(QWidget *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> QString &icsfile ):KListView(parent,name) <a name="l00041"></a>00041 { <a name="l00042"></a>00042 _preferences = Preferences::instance( icsfile ); <a name="l00043"></a>00043 _storage = KarmStorage::instance(); <a name="l00044"></a>00044 <a name="l00045"></a>00045 connect( <span class="keyword">this</span>, SIGNAL( expanded( QListViewItem * ) ), <a name="l00046"></a>00046 <span class="keyword">this</span>, SLOT( itemStateChanged( QListViewItem * ) ) ); <a name="l00047"></a>00047 connect( <span class="keyword">this</span>, SIGNAL( collapsed( QListViewItem * ) ), <a name="l00048"></a>00048 <span class="keyword">this</span>, SLOT( itemStateChanged( QListViewItem * ) ) ); <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="comment">// setup default values</span> <a name="l00051"></a>00051 previousColumnWidths[0] = previousColumnWidths[1] <a name="l00052"></a>00052 = previousColumnWidths[2] = previousColumnWidths[3] = HIDDEN_COLUMN; <a name="l00053"></a>00053 <a name="l00054"></a>00054 addColumn( i18n(<span class="stringliteral">"Task Name"</span>) ); <a name="l00055"></a>00055 addColumn( i18n(<span class="stringliteral">"Session Time"</span>) ); <a name="l00056"></a>00056 addColumn( i18n(<span class="stringliteral">"Time"</span>) ); <a name="l00057"></a>00057 addColumn( i18n(<span class="stringliteral">"Total Session Time"</span>) ); <a name="l00058"></a>00058 addColumn( i18n(<span class="stringliteral">"Total Time"</span>) ); <a name="l00059"></a>00059 setColumnAlignment( 1, Qt::AlignRight ); <a name="l00060"></a>00060 setColumnAlignment( 2, Qt::AlignRight ); <a name="l00061"></a>00061 setColumnAlignment( 3, Qt::AlignRight ); <a name="l00062"></a>00062 setColumnAlignment( 4, Qt::AlignRight ); <a name="l00063"></a>00063 adaptColumns(); <a name="l00064"></a>00064 setAllColumnsShowFocus( <span class="keyword">true</span> ); <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="comment">// set up the minuteTimer</span> <a name="l00067"></a>00067 _minuteTimer = <span class="keyword">new</span> QTimer(<span class="keyword">this</span>); <a name="l00068"></a>00068 connect( _minuteTimer, SIGNAL( timeout() ), <span class="keyword">this</span>, SLOT( minuteUpdate() )); <a name="l00069"></a>00069 _minuteTimer->start(1000 * secsPerMinute); <a name="l00070"></a>00070 <a name="l00071"></a>00071 <span class="comment">// React when user changes iCalFile</span> <a name="l00072"></a>00072 connect(_preferences, SIGNAL(iCalFile(QString)), <a name="l00073"></a>00073 <span class="keyword">this</span>, SLOT(iCalFileChanged(QString))); <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="comment">// resize columns when config is changed</span> <a name="l00076"></a>00076 connect(_preferences, SIGNAL( setupChanged() ), <span class="keyword">this</span>,SLOT( adaptColumns() )); <a name="l00077"></a>00077 <a name="l00078"></a>00078 _minuteTimer->start(1000 * secsPerMinute); <a name="l00079"></a>00079 <a name="l00080"></a>00080 <span class="comment">// Set up the idle detection.</span> <a name="l00081"></a>00081 _idleTimeDetector = <span class="keyword">new</span> <a class="code" href="classIdleTimeDetector.html" title="Keep track of how long the computer has been idle.">IdleTimeDetector</a>( _preferences->idlenessTimeout() ); <a name="l00082"></a>00082 connect( _idleTimeDetector, SIGNAL( extractTime(<span class="keywordtype">int</span>) ), <a name="l00083"></a>00083 <span class="keyword">this</span>, SLOT( extractTime(<span class="keywordtype">int</span>) )); <a name="l00084"></a>00084 connect( _idleTimeDetector, SIGNAL( stopAllTimersAt(QDateTime) ), <a name="l00085"></a>00085 <span class="keyword">this</span>, SLOT( stopAllTimersAt(QDateTime) )); <a name="l00086"></a>00086 connect( _preferences, SIGNAL( idlenessTimeout(<span class="keywordtype">int</span>) ), <a name="l00087"></a>00087 _idleTimeDetector, SLOT( setMaxIdle(<span class="keywordtype">int</span>) )); <a name="l00088"></a>00088 connect( _preferences, SIGNAL( detectIdleness(<span class="keywordtype">bool</span>) ), <a name="l00089"></a>00089 _idleTimeDetector, SLOT( toggleOverAllIdleDetection(<span class="keywordtype">bool</span>) )); <a name="l00090"></a>00090 <span class="keywordflow">if</span> (!_idleTimeDetector->isIdleDetectionPossible()) <a name="l00091"></a>00091 _preferences->disableIdleDetection(); <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">// Setup auto save timer</span> <a name="l00094"></a>00094 _autoSaveTimer = <span class="keyword">new</span> QTimer(<span class="keyword">this</span>); <a name="l00095"></a>00095 connect( _preferences, SIGNAL( autoSave(<span class="keywordtype">bool</span>) ), <a name="l00096"></a>00096 <span class="keyword">this</span>, SLOT( autoSaveChanged(<span class="keywordtype">bool</span>) )); <a name="l00097"></a>00097 connect( _preferences, SIGNAL( autoSavePeriod(<span class="keywordtype">int</span>) ), <a name="l00098"></a>00098 <span class="keyword">this</span>, SLOT( autoSavePeriodChanged(<span class="keywordtype">int</span>) )); <a name="l00099"></a>00099 connect( _autoSaveTimer, SIGNAL( timeout() ), <span class="keyword">this</span>, SLOT( save() )); <a name="l00100"></a>00100 <a name="l00101"></a>00101 <span class="comment">// Setup manual save timer (to save changes a little while after they happen)</span> <a name="l00102"></a>00102 _manualSaveTimer = <span class="keyword">new</span> QTimer(<span class="keyword">this</span>); <a name="l00103"></a>00103 connect( _manualSaveTimer, SIGNAL( timeout() ), <span class="keyword">this</span>, SLOT( save() )); <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="comment">// Connect desktop tracker events to task starting/stopping</span> <a name="l00106"></a>00106 _desktopTracker = <span class="keyword">new</span> <a class="code" href="classDesktopTracker.html" title="A utility to associate tasks with desktops As soon as a desktop is activated/left...">DesktopTracker</a>(); <a name="l00107"></a>00107 connect( _desktopTracker, SIGNAL( reachedtActiveDesktop( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* ) ), <a name="l00108"></a>00108 <span class="keyword">this</span>, SLOT( startTimerFor(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>*) )); <a name="l00109"></a>00109 connect( _desktopTracker, SIGNAL( leftActiveDesktop( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* ) ), <a name="l00110"></a>00110 <span class="keyword">this</span>, SLOT( stopTimerFor(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>*) )); <a name="l00111"></a>00111 <span class="keyword">new</span> <a class="code" href="classTaskViewWhatsThis.html" title="this is the karm-taskview-specific implementation of qwhatsthis">TaskViewWhatsThis</a>( <span class="keyword">this</span> ); <a name="l00112"></a>00112 } <a name="l00113"></a>00113 <a name="l00114"></a><a class="code" href="classTaskView.html#03d27e96a50dcffa947644f49641f300">00114</a> <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* <a class="code" href="classTaskView.html#03d27e96a50dcffa947644f49641f300" title="Returns a pointer to storage object.">TaskView::storage</a>() <a name="l00115"></a>00115 { <a name="l00116"></a>00116 <span class="keywordflow">return</span> _storage; <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="keywordtype">void</span> TaskView::contentsMousePressEvent ( QMouseEvent * e ) <a name="l00120"></a>00120 { <a name="l00121"></a>00121 kdDebug(5970) << <span class="stringliteral">"entering contentsMousePressEvent"</span> << endl; <a name="l00122"></a>00122 KListView::contentsMousePressEvent(e); <a name="l00123"></a>00123 <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00124"></a>00124 <span class="comment">// This checks that there has been a click onto an item, </span> <a name="l00125"></a>00125 <span class="comment">// not into an empty part of the KListView.</span> <a name="l00126"></a>00126 <span class="keywordflow">if</span> ( task != 0 && <span class="comment">// zero can happen if there is no task</span> <a name="l00127"></a>00127 e->pos().y() >= <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->itemPos() && <a name="l00128"></a>00128 e->pos().y() < <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->itemPos()+<a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->height() ) <a name="l00129"></a>00129 { <a name="l00130"></a>00130 <span class="comment">// see if the click was on the completed icon</span> <a name="l00131"></a>00131 <span class="keywordtype">int</span> leftborder = treeStepSize() * ( task->depth() + ( rootIsDecorated() ? 1 : 0)) + itemMargin(); <a name="l00132"></a>00132 <span class="keywordflow">if</span> ((leftborder < e->x()) && (e->x() < 19 + leftborder )) <a name="l00133"></a>00133 { <a name="l00134"></a>00134 <span class="keywordflow">if</span> ( e->button() == LeftButton ) <a name="l00135"></a>00135 <span class="keywordflow">if</span> ( task-><a class="code" href="classTask.html#465cfd298427ead3becc3911098f776c" title="Return true if task is complete (percent complete equals 100).">isComplete</a>() ) task-><a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3" title="Update percent complete for this task.">setPercentComplete</a>( 0, _storage ); <a name="l00136"></a>00136 <span class="keywordflow">else</span> task-><a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3" title="Update percent complete for this task.">setPercentComplete</a>( 100, _storage ); <a name="l00137"></a>00137 } <a name="l00138"></a>00138 emit updateButtons(); <a name="l00139"></a>00139 } <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="keywordtype">void</span> TaskView::contentsMouseDoubleClickEvent ( QMouseEvent * e ) <a name="l00143"></a>00143 <span class="comment">// if the user double-clicks onto a tasks, he says "I am now working exclusively</span> <a name="l00144"></a>00144 <span class="comment">// on that task". That means, on a doubleclick, we check if it occurs on an item</span> <a name="l00145"></a>00145 <span class="comment">// not in the blank space, if yes, stop all other tasks and start the new timer.</span> <a name="l00146"></a>00146 { <a name="l00147"></a>00147 kdDebug(5970) << <span class="stringliteral">"entering contentsMouseDoubleClickEvent"</span> << endl; <a name="l00148"></a>00148 KListView::contentsMouseDoubleClickEvent(e); <a name="l00149"></a>00149 <a name="l00150"></a>00150 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00151"></a>00151 <a name="l00152"></a>00152 <span class="keywordflow">if</span> ( task != 0 ) <span class="comment">// current_item() exists</span> <a name="l00153"></a>00153 { <a name="l00154"></a>00154 <span class="keywordflow">if</span> ( e->pos().y() >= task->itemPos() && <span class="comment">// doubleclick was onto current_item()</span> <a name="l00155"></a>00155 e->pos().y() < task->itemPos()+task->height() ) <a name="l00156"></a>00156 { <a name="l00157"></a>00157 <span class="keywordflow">if</span> ( activeTasks.findRef(task) == -1 ) <span class="comment">// task is active</span> <a name="l00158"></a>00158 { <a name="l00159"></a>00159 <a class="code" href="classTaskView.html#e3bb12fde718e07f246307aad386e3ba" title="Stop all running timers.">stopAllTimers</a>(); <a name="l00160"></a>00160 <a class="code" href="classTaskView.html#639574ae0a0502e165b5ce3bab6dbd13" title="Start the timer on the current item (task) in view.">startCurrentTimer</a>(); <a name="l00161"></a>00161 } <a name="l00162"></a>00162 <span class="keywordflow">else</span> <a class="code" href="classTaskView.html#31ddc7a863e428bf3edf5e2eb1a50de7" title="Stop the timer for the current item in the view.">stopCurrentTimer</a>(); <a name="l00163"></a>00163 } <a name="l00164"></a>00164 } <a name="l00165"></a>00165 } <a name="l00166"></a>00166 <a name="l00167"></a>00167 TaskView::~TaskView() <a name="l00168"></a>00168 { <a name="l00169"></a>00169 _preferences-><a class="code" href="classPreferences.html#abb274345e18b258dd54f3c58f88eea1">save</a>(); <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a><a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49">00172</a> <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* <a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">TaskView::first_child</a>()<span class="keyword"> const</span> <a name="l00173"></a>00173 <span class="keyword"></span>{ <a name="l00174"></a>00174 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classTask.html" title="A class representing a task.">Task</a>*<span class="keyword">></span>(firstChild()); <a name="l00175"></a>00175 } <a name="l00176"></a>00176 <a name="l00177"></a><a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3">00177</a> <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">TaskView::current_item</a>()<span class="keyword"> const</span> <a name="l00178"></a>00178 <span class="keyword"></span>{ <a name="l00179"></a>00179 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classTask.html" title="A class representing a task.">Task</a>*<span class="keyword">></span>(currentItem()); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a name="l00182"></a><a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d">00182</a> <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">TaskView::item_at_index</a>(<span class="keywordtype">int</span> i) <a name="l00183"></a>00183 { <a name="l00184"></a>00184 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classTask.html" title="A class representing a task.">Task</a>*<span class="keyword">></span>(itemAtIndex(i)); <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <a name="l00187"></a><a class="code" href="classTaskView.html#347e02bcfcf2936ead89a6ddd0169058">00187</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#347e02bcfcf2936ead89a6ddd0169058" title="Load the view from storage.">TaskView::load</a>( QString fileName ) <a name="l00188"></a>00188 { <a name="l00189"></a>00189 <span class="comment">// if the program is used as an embedded plugin for konqueror, there may be a need</span> <a name="l00190"></a>00190 <span class="comment">// to load from a file without touching the preferences.</span> <a name="l00191"></a>00191 _isloading = <span class="keyword">true</span>; <a name="l00192"></a>00192 QString err = _storage-><a class="code" href="classKarmStorage.html#8c707128d3f14637807145138821e20d">load</a>(<span class="keyword">this</span>, _preferences, fileName); <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="keywordflow">if</span> (!err.isEmpty()) <a name="l00195"></a>00195 { <a name="l00196"></a>00196 KMessageBox::error(<span class="keyword">this</span>, err); <a name="l00197"></a>00197 _isloading = <span class="keyword">false</span>; <a name="l00198"></a>00198 <span class="keywordflow">return</span>; <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a name="l00201"></a>00201 <span class="comment">// Register tasks with desktop tracker</span> <a name="l00202"></a>00202 <span class="keywordtype">int</span> i = 0; <a name="l00203"></a>00203 <span class="keywordflow">for</span> ( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* t = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(i); t; t = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(++i) ) <a name="l00204"></a>00204 _desktopTracker-><a class="code" href="classDesktopTracker.html#01cde654bee0dc60f303d510ea5b90f4">registerForDesktops</a>( t, t->getDesktops() ); <a name="l00205"></a>00205 <a name="l00206"></a>00206 restoreItemState( <a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>() ); <a name="l00207"></a>00207 <a name="l00208"></a>00208 setSelected(<a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>(), <span class="keyword">true</span>); <a name="l00209"></a>00209 setCurrentItem(<a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>()); <a name="l00210"></a>00210 _desktopTracker-><a class="code" href="classDesktopTracker.html#a2948817186332c4dd11037a92c97141">startTracking</a>(); <a name="l00211"></a>00211 _isloading = <span class="keyword">false</span>; <a name="l00212"></a>00212 <a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664" title="Used to refresh (e.g.">refresh</a>(); <a name="l00213"></a>00213 } <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="keywordtype">void</span> TaskView::restoreItemState( QListViewItem *item ) <a name="l00216"></a>00216 { <a name="l00217"></a>00217 <span class="keywordflow">while</span>( item ) <a name="l00218"></a>00218 { <a name="l00219"></a>00219 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *t = (<a class="code" href="classTask.html" title="A class representing a task.">Task</a> *)item; <a name="l00220"></a>00220 t->setOpen( _preferences-><a class="code" href="classPreferences.html#29ed448f863d3624f15294b9f4f06a07">readBoolEntry</a>( t-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>() ) ); <a name="l00221"></a>00221 <span class="keywordflow">if</span>( item->childCount() > 0 ) restoreItemState( item->firstChild() ); <a name="l00222"></a>00222 item = item->nextSibling(); <a name="l00223"></a>00223 } <a name="l00224"></a>00224 } <a name="l00225"></a>00225 <a name="l00226"></a><a class="code" href="classTaskView.html#43dc6e7573e4f8a46c45b0b1200e916c">00226</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#43dc6e7573e4f8a46c45b0b1200e916c" title="item state stores if a task is expanded so you can see the subtasks">TaskView::itemStateChanged</a>( QListViewItem *item ) <a name="l00227"></a>00227 { <a name="l00228"></a>00228 <span class="keywordflow">if</span> ( !item || _isloading ) <span class="keywordflow">return</span>; <a name="l00229"></a>00229 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *t = (<a class="code" href="classTask.html" title="A class representing a task.">Task</a> *)item; <a name="l00230"></a>00230 kdDebug(5970) << <span class="stringliteral">"TaskView::itemStateChanged()"</span> <a name="l00231"></a>00231 << <span class="stringliteral">" uid="</span> << t-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>() << <span class="stringliteral">" state="</span> << t->isOpen() <a name="l00232"></a>00232 << endl; <a name="l00233"></a>00233 <span class="keywordflow">if</span>( _preferences ) _preferences-><a class="code" href="classPreferences.html#8a7bd1dc3db4dcdebad026f0b71a8360">writeEntry</a>( t-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>(), t->isOpen() ); <a name="l00234"></a>00234 } <a name="l00235"></a>00235 <a name="l00236"></a><a class="code" href="classTaskView.html#74fe4fed0700550fcfda0f5abb88d211">00236</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#74fe4fed0700550fcfda0f5abb88d211" title="Close the storage and release lock.">TaskView::closeStorage</a>() { _storage-><a class="code" href="classKarmStorage.html#26e3745ddfa39d688efeb14d30e91a7f">closeStorage</a>( <span class="keyword">this</span> ); } <a name="l00237"></a>00237 <a name="l00238"></a><a class="code" href="classTaskView.html#2e887f2a1308134994ca9da82841ebcd">00238</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#2e887f2a1308134994ca9da82841ebcd" title="React on another process having modified the iCal file we rely on.">TaskView::iCalFileModified</a>(ResourceCalendar *rc) <a name="l00239"></a>00239 { <a name="l00240"></a>00240 kdDebug(5970) << <span class="stringliteral">"entering iCalFileModified"</span> << endl; <a name="l00241"></a>00241 kdDebug(5970) << rc->infoText() << endl; <a name="l00242"></a>00242 rc->dump(); <a name="l00243"></a>00243 _storage-><a class="code" href="classKarmStorage.html#d1f34396d616c0227153e4caec7136d2">buildTaskView</a>(rc,<span class="keyword">this</span>); <a name="l00244"></a>00244 kdDebug(5970) << <span class="stringliteral">"exiting iCalFileModified"</span> << endl; <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <a name="l00247"></a><a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664">00247</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664" title="Used to refresh (e.g.">TaskView::refresh</a>() <a name="l00248"></a>00248 { <a name="l00249"></a>00249 kdDebug(5970) << <span class="stringliteral">"entering TaskView::refresh()"</span> << endl; <a name="l00250"></a>00250 this->setRootIsDecorated(<span class="keyword">true</span>); <a name="l00251"></a>00251 <span class="keywordtype">int</span> i = 0; <a name="l00252"></a>00252 <span class="keywordflow">for</span> ( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* t = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(i); t; t = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(++i) ) <a name="l00253"></a>00253 { <a name="l00254"></a>00254 t-><a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee" title="Sets an appropriate icon for this task based on its level of completion.">setPixmapProgress</a>(); <a name="l00255"></a>00255 } <a name="l00256"></a>00256 <a name="l00257"></a>00257 <span class="comment">// remove root decoration if there is no more children.</span> <a name="l00258"></a>00258 <span class="keywordtype">bool</span> anyChilds = <span class="keyword">false</span>; <a name="l00259"></a>00259 <span class="keywordflow">for</span>(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* child = <a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>(); <a name="l00260"></a>00260 child; <a name="l00261"></a>00261 child = child-><a class="code" href="classTask.html#a7c59fd2c4318c9eac3bf10fb0201422">nextSibling</a>()) { <a name="l00262"></a>00262 <span class="keywordflow">if</span> (child->childCount() != 0) { <a name="l00263"></a>00263 anyChilds = <span class="keyword">true</span>; <a name="l00264"></a>00264 <span class="keywordflow">break</span>; <a name="l00265"></a>00265 } <a name="l00266"></a>00266 } <a name="l00267"></a>00267 <span class="keywordflow">if</span> (!anyChilds) { <a name="l00268"></a>00268 setRootIsDecorated(<span class="keyword">false</span>); <a name="l00269"></a>00269 } <a name="l00270"></a>00270 emit updateButtons(); <a name="l00271"></a>00271 kdDebug(5970) << <span class="stringliteral">"exiting TaskView::refresh()"</span> << endl; <a name="l00272"></a>00272 } <a name="l00273"></a>00273 <a name="l00274"></a><a class="code" href="classTaskView.html#1729aefe766187c1efe34a8017cdca70">00274</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#1729aefe766187c1efe34a8017cdca70" title="Used to import a legacy file format.">TaskView::loadFromFlatFile</a>() <a name="l00275"></a>00275 { <a name="l00276"></a>00276 kdDebug(5970) << <span class="stringliteral">"TaskView::loadFromFlatFile()"</span> << endl; <a name="l00277"></a>00277 <a name="l00278"></a>00278 <span class="comment">//KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);</span> <a name="l00279"></a>00279 <a name="l00280"></a>00280 QString fileName(KFileDialog::getOpenFileName(QString::null, QString::null, <a name="l00281"></a>00281 0)); <a name="l00282"></a>00282 <span class="keywordflow">if</span> (!fileName.isEmpty()) { <a name="l00283"></a>00283 QString err = _storage-><a class="code" href="classKarmStorage.html#31314be2d906119dfba7111b18b7b17b" title="Read tasks and their total times from a text file (legacy storage).">loadFromFlatFile</a>(<span class="keyword">this</span>, fileName); <a name="l00284"></a>00284 <span class="keywordflow">if</span> (!err.isEmpty()) <a name="l00285"></a>00285 { <a name="l00286"></a>00286 KMessageBox::error(<span class="keyword">this</span>, err); <a name="l00287"></a>00287 <span class="keywordflow">return</span>; <a name="l00288"></a>00288 } <a name="l00289"></a>00289 <span class="comment">// Register tasks with desktop tracker</span> <a name="l00290"></a>00290 <span class="keywordtype">int</span> task_idx = 0; <a name="l00291"></a>00291 <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(task_idx++); <a name="l00292"></a>00292 <span class="keywordflow">while</span> (task) <a name="l00293"></a>00293 { <a name="l00294"></a>00294 <span class="comment">// item_at_index returns 0 where no more items.</span> <a name="l00295"></a>00295 _desktopTracker-><a class="code" href="classDesktopTracker.html#01cde654bee0dc60f303d510ea5b90f4">registerForDesktops</a>( task, task-><a class="code" href="classTask.html#e181eeb5a4794309abf132b5b6392fd4">getDesktops</a>() ); <a name="l00296"></a>00296 task = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(task_idx++); <a name="l00297"></a>00297 } <a name="l00298"></a>00298 <a name="l00299"></a>00299 setSelected(<a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>(), <span class="keyword">true</span>); <a name="l00300"></a>00300 setCurrentItem(<a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>()); <a name="l00301"></a>00301 <a name="l00302"></a>00302 _desktopTracker-><a class="code" href="classDesktopTracker.html#a2948817186332c4dd11037a92c97141">startTracking</a>(); <a name="l00303"></a>00303 } <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <a name="l00306"></a><a class="code" href="classTaskView.html#bf9961221707538335b1fe5b939e2fff">00306</a> QString <a class="code" href="classTaskView.html#bf9961221707538335b1fe5b939e2fff" title="used to import tasks from imendio planner">TaskView::importPlanner</a>(QString fileName) <a name="l00307"></a>00307 { <a name="l00308"></a>00308 kdDebug(5970) << <span class="stringliteral">"entering importPlanner"</span> << endl; <a name="l00309"></a>00309 <a class="code" href="classPlannerParser.html" title="this class is here to import tasks from a planner project file to karm.">PlannerParser</a>* handler=<span class="keyword">new</span> <a class="code" href="classPlannerParser.html" title="this class is here to import tasks from a planner project file to karm.">PlannerParser</a>(<span class="keyword">this</span>); <a name="l00310"></a>00310 <span class="keywordflow">if</span> (fileName.isEmpty()) fileName=KFileDialog::getOpenFileName(QString::null, QString::null, 0); <a name="l00311"></a>00311 QFile xmlFile( fileName ); <a name="l00312"></a>00312 QXmlInputSource source( xmlFile ); <a name="l00313"></a>00313 QXmlSimpleReader reader; <a name="l00314"></a>00314 reader.setContentHandler( handler ); <a name="l00315"></a>00315 reader.parse( source ); <a name="l00316"></a>00316 <a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664" title="Used to refresh (e.g.">refresh</a>(); <a name="l00317"></a>00317 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; <a name="l00318"></a>00318 } <a name="l00319"></a>00319 <a name="l00320"></a><a class="code" href="classTaskView.html#6ae8ad51a6e563e5f7c1cad9b2ef4ec3">00320</a> QString <a class="code" href="classTaskView.html#6ae8ad51a6e563e5f7c1cad9b2ef4ec3" title="call export function for csv totals or history">TaskView::report</a>( <span class="keyword">const</span> <a class="code" href="classReportCriteria.html" title="Stores entries from export dialog.">ReportCriteria</a>& rc ) <a name="l00321"></a>00321 { <a name="l00322"></a>00322 <span class="keywordflow">return</span> _storage-><a class="code" href="classKarmStorage.html#4d36c935a652dabc297ea571b5f7cfbd" title="Output a report based on contents of ReportCriteria.">report</a>( <span class="keyword">this</span>, rc ); <a name="l00323"></a>00323 } <a name="l00324"></a>00324 <a name="l00325"></a><a class="code" href="classTaskView.html#8f8d52286b85e4c04b38247e9b6110bc">00325</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#8f8d52286b85e4c04b38247e9b6110bc" title="Export comma separated values format for task time totals.">TaskView::exportcsvFile</a>() <a name="l00326"></a>00326 { <a name="l00327"></a>00327 kdDebug(5970) << <span class="stringliteral">"TaskView::exportcsvFile()"</span> << endl; <a name="l00328"></a>00328 <a name="l00329"></a>00329 CSVExportDialog dialog( ReportCriteria::CSVTotalsExport, <span class="keyword">this</span> ); <a name="l00330"></a>00330 <span class="keywordflow">if</span> ( <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>() && <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->isRoot() ) <a name="l00331"></a>00331 dialog.enableTasksToExportQuestion(); <a name="l00332"></a>00332 dialog.urlExportTo->KURLRequester::setMode(KFile::File); <a name="l00333"></a>00333 <span class="keywordflow">if</span> ( dialog.exec() ) { <a name="l00334"></a>00334 QString err = _storage-><a class="code" href="classKarmStorage.html#4d36c935a652dabc297ea571b5f7cfbd" title="Output a report based on contents of ReportCriteria.">report</a>( <span class="keyword">this</span>, dialog.reportCriteria() ); <a name="l00335"></a>00335 <span class="keywordflow">if</span> ( !err.isEmpty() ) KMessageBox::error( <span class="keyword">this</span>, i18n(err.ascii()) ); <a name="l00336"></a>00336 } <a name="l00337"></a>00337 } <a name="l00338"></a>00338 <a name="l00339"></a><a class="code" href="classTaskView.html#cc29cbfd8320d66b658559cca4e71d5a">00339</a> QString <a class="code" href="classTaskView.html#cc29cbfd8320d66b658559cca4e71d5a" title="Export comma-separated values format for task history.">TaskView::exportcsvHistory</a>() <a name="l00340"></a>00340 { <a name="l00341"></a>00341 kdDebug(5970) << <span class="stringliteral">"TaskView::exportcsvHistory()"</span> << endl; <a name="l00342"></a>00342 QString err; <a name="l00343"></a>00343 <a name="l00344"></a>00344 CSVExportDialog dialog( ReportCriteria::CSVHistoryExport, <span class="keyword">this</span> ); <a name="l00345"></a>00345 <span class="keywordflow">if</span> ( <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>() && <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->isRoot() ) <a name="l00346"></a>00346 dialog.enableTasksToExportQuestion(); <a name="l00347"></a>00347 dialog.urlExportTo->KURLRequester::setMode(KFile::File); <a name="l00348"></a>00348 <span class="keywordflow">if</span> ( dialog.exec() ) { <a name="l00349"></a>00349 err = _storage-><a class="code" href="classKarmStorage.html#4d36c935a652dabc297ea571b5f7cfbd" title="Output a report based on contents of ReportCriteria.">report</a>( <span class="keyword">this</span>, dialog.reportCriteria() ); <a name="l00350"></a>00350 } <a name="l00351"></a>00351 <span class="keywordflow">return</span> err; <a name="l00352"></a>00352 } <a name="l00353"></a>00353 <a name="l00354"></a><a class="code" href="classTaskView.html#cdacd37c9f4309ee0b2ff52e052792e1">00354</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#cdacd37c9f4309ee0b2ff52e052792e1" title="Schedule that we should save very soon.">TaskView::scheduleSave</a>() <a name="l00355"></a>00355 { <a name="l00356"></a>00356 kdDebug(5970) << <span class="stringliteral">"Entering TaskView::scheduleSave"</span> << endl; <a name="l00357"></a>00357 <span class="comment">// save changes a little while after they happen</span> <a name="l00358"></a>00358 _manualSaveTimer->start( 10, <span class="keyword">true</span> <span class="comment">/*single-shot*/</span> ); <a name="l00359"></a>00359 } <a name="l00360"></a>00360 <a name="l00361"></a><a class="code" href="classTaskView.html#03abf669a3d3a5a669cd2f8e0dcbcee0">00361</a> <a class="code" href="classPreferences.html" title="Provide an interface to the configuration options for the program.">Preferences</a>* <a class="code" href="classTaskView.html#03abf669a3d3a5a669cd2f8e0dcbcee0" title="Return preferences user selected on settings dialog.">TaskView::preferences</a>() { <span class="keywordflow">return</span> _preferences; } <a name="l00362"></a>00362 <a name="l00363"></a><a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e">00363</a> QString <a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">TaskView::save</a>() <a name="l00364"></a>00364 <span class="comment">// This saves the tasks. If they do not yet have an endDate, their startDate is also not saved.</span> <a name="l00365"></a>00365 { <a name="l00366"></a>00366 kdDebug(5970) << <span class="stringliteral">"Entering TaskView::save"</span> << endl; <a name="l00367"></a>00367 QString err = _storage-><a class="code" href="classKarmStorage.html#dd79932f855e7aa5fda180f177fc625e">save</a>(<span class="keyword">this</span>); <a name="l00368"></a>00368 emit(setStatusBar(err)); <a name="l00369"></a>00369 <span class="keywordflow">return</span> err; <a name="l00370"></a>00370 } <a name="l00371"></a>00371 <a name="l00372"></a><a class="code" href="classTaskView.html#639574ae0a0502e165b5ce3bab6dbd13">00372</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#639574ae0a0502e165b5ce3bab6dbd13" title="Start the timer on the current item (task) in view.">TaskView::startCurrentTimer</a>() <a name="l00373"></a>00373 { <a name="l00374"></a>00374 <a class="code" href="classTaskView.html#1f0a2039eca771ee28f457f6a8d098d5" title="starts timer for task.">startTimerFor</a>( <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>() ); <a name="l00375"></a>00375 } <a name="l00376"></a>00376 <a name="l00377"></a><a class="code" href="classTaskView.html#1baadc861bc75b2aa06ce7351a03cefd">00377</a> <span class="keywordtype">long</span> <a class="code" href="classTaskView.html#1baadc861bc75b2aa06ce7351a03cefd" title="Return the total number if items in the view.">TaskView::count</a>() <a name="l00378"></a>00378 { <a name="l00379"></a>00379 <span class="keywordtype">long</span> n = 0; <a name="l00380"></a>00380 <span class="keywordflow">for</span> (<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* t = <a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(n); t; t=<a class="code" href="classTaskView.html#9050454887e14a5c62725e23f242639d" title="Return the i&#39;th item (zero-based), cast to a Task pointer.">item_at_index</a>(++n)); <a name="l00381"></a>00381 <span class="keywordflow">return</span> n; <a name="l00382"></a>00382 } <a name="l00383"></a>00383 <a name="l00384"></a><a class="code" href="classTaskView.html#1f0a2039eca771ee28f457f6a8d098d5">00384</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#1f0a2039eca771ee28f457f6a8d098d5" title="starts timer for task.">TaskView::startTimerFor</a>(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task, QDateTime startTime ) <a name="l00385"></a>00385 { <a name="l00386"></a>00386 kdDebug(5970) << <span class="stringliteral">"Entering TaskView::startTimerFor"</span> << endl; <a name="l00387"></a>00387 <span class="keywordflow">if</span> (<a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">save</a>()==QString()) <a name="l00388"></a>00388 { <a name="l00389"></a>00389 <span class="keywordflow">if</span> (task != 0 && activeTasks.findRef(task) == -1) <a name="l00390"></a>00390 { <a name="l00391"></a>00391 _idleTimeDetector-><a class="code" href="classIdleTimeDetector.html#1ee14e6756fd95ca2b1ea00f89b4e97d" title="Starts detecting idle time.">startIdleDetection</a>(); <a name="l00392"></a>00392 <span class="keywordflow">if</span> (!task-><a class="code" href="classTask.html#465cfd298427ead3becc3911098f776c" title="Return true if task is complete (percent complete equals 100).">isComplete</a>()) <a name="l00393"></a>00393 { <a name="l00394"></a>00394 task-><a class="code" href="classTask.html#6b36fb9311e31d5708ba0755721e8292" title="starts or stops a task">setRunning</a>(<span class="keyword">true</span>, _storage, startTime); <a name="l00395"></a>00395 activeTasks.append(task); <a name="l00396"></a>00396 emit updateButtons(); <a name="l00397"></a>00397 <span class="keywordflow">if</span> ( activeTasks.count() == 1 ) <a name="l00398"></a>00398 emit timersActive(); <a name="l00399"></a>00399 emit tasksChanged( activeTasks); <a name="l00400"></a>00400 } <a name="l00401"></a>00401 } <a name="l00402"></a>00402 } <a name="l00403"></a>00403 <span class="keywordflow">else</span> KMessageBox::error(0,i18n(<span class="stringliteral">"Saving is impossible, so timing is useless. \nSaving problems may result from a full harddisk, a directory name instead of a file name, or stale locks. Check that your harddisk has enough space, that your calendar file exists and is a file and remove stale locks, typically from ~/.kde/share/apps/kabc/lock."</span>)); <a name="l00404"></a>00404 } <a name="l00405"></a>00405 <a name="l00406"></a><a class="code" href="classTaskView.html#918b4d6f5147a80b9d60d57fc2ae0a8c">00406</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#918b4d6f5147a80b9d60d57fc2ae0a8c" title="clears all active tasks.">TaskView::clearActiveTasks</a>() <a name="l00407"></a>00407 { <a name="l00408"></a>00408 activeTasks.clear(); <a name="l00409"></a>00409 } <a name="l00410"></a>00410 <a name="l00411"></a><a class="code" href="classTaskView.html#e3bb12fde718e07f246307aad386e3ba">00411</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#e3bb12fde718e07f246307aad386e3ba" title="Stop all running timers.">TaskView::stopAllTimers</a>() <a name="l00412"></a>00412 { <a name="l00413"></a>00413 kdDebug(5970) << <span class="stringliteral">"Entering TaskView::stopAllTimers()"</span> << endl; <a name="l00414"></a>00414 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < activeTasks.count(); i++ ) <a name="l00415"></a>00415 activeTasks.at(i)->setRunning(<span class="keyword">false</span>, _storage); <a name="l00416"></a>00416 <a name="l00417"></a>00417 _idleTimeDetector-><a class="code" href="classIdleTimeDetector.html#d5e53c7ecaa371791e484473efd8953f" title="Stops detecting idle time.">stopIdleDetection</a>(); <a name="l00418"></a>00418 activeTasks.clear(); <a name="l00419"></a>00419 emit updateButtons(); <a name="l00420"></a>00420 emit timersInactive(); <a name="l00421"></a>00421 emit tasksChanged( activeTasks ); <a name="l00422"></a>00422 } <a name="l00423"></a>00423 <a name="l00424"></a><a class="code" href="classTaskView.html#fb2a62582fc7f4385373bc464bde9054">00424</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#fb2a62582fc7f4385373bc464bde9054" title="Stop all running timers as if it was qdt.">TaskView::stopAllTimersAt</a>(QDateTime qdt) <a name="l00425"></a>00425 <span class="comment">// stops all timers for the time qdt. This makes sense, if the idletimedetector detected</span> <a name="l00426"></a>00426 <span class="comment">// the last work has been done 50 minutes ago.</span> <a name="l00427"></a>00427 { <a name="l00428"></a>00428 kdDebug(5970) << <span class="stringliteral">"Entering TaskView::stopAllTimersAt "</span> << qdt << endl; <a name="l00429"></a>00429 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < activeTasks.count(); i++ ) <a name="l00430"></a>00430 { <a name="l00431"></a>00431 activeTasks.at(i)->setRunning(<span class="keyword">false</span>, _storage, qdt, qdt); <a name="l00432"></a>00432 kdDebug() << activeTasks.at(i)->name() << endl; <a name="l00433"></a>00433 } <a name="l00434"></a>00434 <a name="l00435"></a>00435 _idleTimeDetector-><a class="code" href="classIdleTimeDetector.html#d5e53c7ecaa371791e484473efd8953f" title="Stops detecting idle time.">stopIdleDetection</a>(); <a name="l00436"></a>00436 activeTasks.clear(); <a name="l00437"></a>00437 emit updateButtons(); <a name="l00438"></a>00438 emit timersInactive(); <a name="l00439"></a>00439 emit tasksChanged( activeTasks ); <a name="l00440"></a>00440 } <a name="l00441"></a>00441 <a name="l00442"></a><a class="code" href="classTaskView.html#f6127fd23064e1237a0589ca70978ae6">00442</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#f6127fd23064e1237a0589ca70978ae6" title="Reset session time to zero for all tasks.">TaskView::startNewSession</a>() <a name="l00443"></a>00443 { <a name="l00444"></a>00444 QListViewItemIterator item( <a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>()); <a name="l00445"></a>00445 <span class="keywordflow">for</span> ( ; item.current(); ++item ) { <a name="l00446"></a>00446 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> * task = (<a class="code" href="classTask.html" title="A class representing a task.">Task</a> *) item.current(); <a name="l00447"></a>00447 task-><a class="code" href="classTask.html#f322e5b6ad97ee507f49a5096e202d46" title="sets session time to zero.">startNewSession</a>(); <a name="l00448"></a>00448 } <a name="l00449"></a>00449 } <a name="l00450"></a>00450 <a name="l00451"></a><a class="code" href="classTaskView.html#46bf86d293a62ae07f78b3d62ffc608e">00451</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#46bf86d293a62ae07f78b3d62ffc608e" title="Reset session and total time to zero for all tasks.">TaskView::resetTimeForAllTasks</a>() <a name="l00452"></a>00452 { <a name="l00453"></a>00453 QListViewItemIterator item( <a class="code" href="classTaskView.html#19f03096ab651f975fec50e4be6aef49" title="Return the first item in the view, cast to a Task pointer.">first_child</a>()); <a name="l00454"></a>00454 <span class="keywordflow">for</span> ( ; item.current(); ++item ) { <a name="l00455"></a>00455 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> * task = (<a class="code" href="classTask.html" title="A class representing a task.">Task</a> *) item.current(); <a name="l00456"></a>00456 task-><a class="code" href="classTask.html#3a6b331837192d762fcf06b45fd4b609" title="Reset all times to 0.">resetTimes</a>(); <a name="l00457"></a>00457 } <a name="l00458"></a>00458 } <a name="l00459"></a>00459 <a name="l00460"></a>00460 <span class="keywordtype">void</span> TaskView::stopTimerFor(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task) <a name="l00461"></a>00461 { <a name="l00462"></a>00462 kdDebug(5970) << <span class="stringliteral">"Entering stopTimerFor. task = "</span> << task-><a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>() << endl; <a name="l00463"></a>00463 <span class="keywordflow">if</span> ( task != 0 && activeTasks.findRef(task) != -1 ) { <a name="l00464"></a>00464 activeTasks.removeRef(task); <a name="l00465"></a>00465 task-><a class="code" href="classTask.html#6b36fb9311e31d5708ba0755721e8292" title="starts or stops a task">setRunning</a>(<span class="keyword">false</span>, _storage); <a name="l00466"></a>00466 <span class="keywordflow">if</span> ( activeTasks.count() == 0 ) { <a name="l00467"></a>00467 _idleTimeDetector-><a class="code" href="classIdleTimeDetector.html#d5e53c7ecaa371791e484473efd8953f" title="Stops detecting idle time.">stopIdleDetection</a>(); <a name="l00468"></a>00468 emit timersInactive(); <a name="l00469"></a>00469 } <a name="l00470"></a>00470 emit updateButtons(); <a name="l00471"></a>00471 } <a name="l00472"></a>00472 emit tasksChanged( activeTasks); <a name="l00473"></a>00473 } <a name="l00474"></a>00474 <a name="l00475"></a><a class="code" href="classTaskView.html#31ddc7a863e428bf3edf5e2eb1a50de7">00475</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#31ddc7a863e428bf3edf5e2eb1a50de7" title="Stop the timer for the current item in the view.">TaskView::stopCurrentTimer</a>() <a name="l00476"></a>00476 { <a name="l00477"></a>00477 stopTimerFor( <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()); <a name="l00478"></a>00478 } <a name="l00479"></a>00479 <a name="l00480"></a>00480 <span class="keywordtype">void</span> TaskView::minuteUpdate() <a name="l00481"></a>00481 { <a name="l00482"></a>00482 addTimeToActiveTasks(1, <span class="keyword">false</span>); <a name="l00483"></a>00483 } <a name="l00484"></a>00484 <a name="l00485"></a>00485 <span class="keywordtype">void</span> TaskView::addTimeToActiveTasks(<span class="keywordtype">int</span> minutes, <span class="keywordtype">bool</span> save_data) <a name="l00486"></a>00486 { <a name="l00487"></a>00487 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < activeTasks.count(); i++ ) <a name="l00488"></a>00488 activeTasks.at(i)->changeTime(minutes, ( save_data ? _storage : 0 ) ); <a name="l00489"></a>00489 } <a name="l00490"></a>00490 <a name="l00491"></a><a class="code" href="classTaskView.html#97a77780f5673be980ca7be887c9a436">00491</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#97a77780f5673be980ca7be887c9a436" title="Calls newTask dialog with caption &quot;New Task&quot;.">TaskView::newTask</a>() <a name="l00492"></a>00492 { <a name="l00493"></a>00493 <a class="code" href="classTaskView.html#97a77780f5673be980ca7be887c9a436" title="Calls newTask dialog with caption &quot;New Task&quot;.">newTask</a>(i18n(<span class="stringliteral">"New Task"</span>), 0); <a name="l00494"></a>00494 } <a name="l00495"></a>00495 <a name="l00496"></a><a class="code" href="classTaskView.html#45ac5c5721fee3bc856c16f54d14c746">00496</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#97a77780f5673be980ca7be887c9a436" title="Calls newTask dialog with caption &quot;New Task&quot;.">TaskView::newTask</a>(QString caption, <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *parent) <a name="l00497"></a>00497 { <a name="l00498"></a>00498 <a class="code" href="classEditTaskDialog.html" title="Dialog to add a new task or edit an existing task.">EditTaskDialog</a> *dialog = <span class="keyword">new</span> <a class="code" href="classEditTaskDialog.html" title="Dialog to add a new task or edit an existing task.">EditTaskDialog</a>(caption, <span class="keyword">false</span>); <a name="l00499"></a>00499 <span class="keywordtype">long</span> total, totalDiff, session, sessionDiff; <a name="l00500"></a>00500 DesktopList desktopList; <a name="l00501"></a>00501 <a name="l00502"></a>00502 <span class="keywordtype">int</span> result = dialog->exec(); <a name="l00503"></a>00503 <span class="keywordflow">if</span> ( result == QDialog::Accepted ) { <a name="l00504"></a>00504 QString taskName = i18n( <span class="stringliteral">"Unnamed Task"</span> ); <a name="l00505"></a>00505 <span class="keywordflow">if</span> ( !dialog-><a class="code" href="classEditTaskDialog.html#fc4d420294512781d479405adb7e0160">taskName</a>().isEmpty()) taskName = dialog-><a class="code" href="classEditTaskDialog.html#fc4d420294512781d479405adb7e0160">taskName</a>(); <a name="l00506"></a>00506 <a name="l00507"></a>00507 total = totalDiff = session = sessionDiff = 0; <a name="l00508"></a>00508 dialog-><a class="code" href="classEditTaskDialog.html#09b2d4d9ed77a971424c48dfd09f5d3e">status</a>( &total, &totalDiff, &session, &sessionDiff, &desktopList ); <a name="l00509"></a>00509 <a name="l00510"></a>00510 <span class="comment">// If all available desktops are checked, disable auto tracking,</span> <a name="l00511"></a>00511 <span class="comment">// since it makes no sense to track for every desktop.</span> <a name="l00512"></a>00512 <span class="keywordflow">if</span> ( desktopList.size() == ( <span class="keywordtype">unsigned</span> int ) _desktopTracker-><a class="code" href="classDesktopTracker.html#01002cb3015dee782185246aaece569a">desktopCount</a>() ) <a name="l00513"></a>00513 desktopList.clear(); <a name="l00514"></a>00514 <a name="l00515"></a>00515 QString uid = <a class="code" href="classTaskView.html#95444f5b404432ec90ab3f16564cf00b" title="Add a task to view and storage.">addTask</a>( taskName, total, session, desktopList, parent ); <a name="l00516"></a>00516 <span class="keywordflow">if</span> ( uid.isNull() ) <a name="l00517"></a>00517 { <a name="l00518"></a>00518 KMessageBox::error( 0, i18n( <a name="l00519"></a>00519 <span class="stringliteral">"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/ "</span> ) ); <a name="l00520"></a>00520 } <a name="l00521"></a>00521 <a name="l00522"></a>00522 <span class="keyword">delete</span> dialog; <a name="l00523"></a>00523 } <a name="l00524"></a>00524 } <a name="l00525"></a>00525 <a name="l00526"></a>00526 QString <a class="code" href="classTaskView.html#95444f5b404432ec90ab3f16564cf00b" title="Add a task to view and storage.">TaskView::addTask</a> <a name="l00527"></a><a class="code" href="classTaskView.html#95444f5b404432ec90ab3f16564cf00b">00527</a> ( <span class="keyword">const</span> QString& taskname, <span class="keywordtype">long</span> total, <span class="keywordtype">long</span> session, <a name="l00528"></a>00528 <span class="keyword">const</span> DesktopList& desktops, <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* parent ) <a name="l00529"></a>00529 { <a name="l00530"></a>00530 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *task; <a name="l00531"></a>00531 kdDebug(5970) << <span class="stringliteral">"TaskView::addTask: taskname = "</span> << taskname << endl; <a name="l00532"></a>00532 <a name="l00533"></a>00533 <span class="keywordflow">if</span> ( parent ) task = <span class="keyword">new</span> <a class="code" href="classTask.html" title="A class representing a task.">Task</a>( taskname, total, session, desktops, parent ); <a name="l00534"></a>00534 <span class="keywordflow">else</span> task = <span class="keyword">new</span> <a class="code" href="classTask.html" title="A class representing a task.">Task</a>( taskname, total, session, desktops, <span class="keyword">this</span> ); <a name="l00535"></a>00535 <a name="l00536"></a>00536 task-><a class="code" href="classTask.html#f52bbd875ab08da52edee8769ff3fb40" title="Set unique id for the task.">setUid</a>( _storage-><a class="code" href="classKarmStorage.html#aea5b0757f27a32779ca56ba7abdb75a" title="Add this task from iCalendar file.">addTask</a>( task, parent ) ); <a name="l00537"></a>00537 QString taskuid=task-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>(); <a name="l00538"></a>00538 <span class="keywordflow">if</span> ( ! taskuid.isNull() ) <a name="l00539"></a>00539 { <a name="l00540"></a>00540 _desktopTracker-><a class="code" href="classDesktopTracker.html#01cde654bee0dc60f303d510ea5b90f4">registerForDesktops</a>( task, desktops ); <a name="l00541"></a>00541 setCurrentItem( task ); <a name="l00542"></a>00542 setSelected( task, <span class="keyword">true</span> ); <a name="l00543"></a>00543 task-><a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee" title="Sets an appropriate icon for this task based on its level of completion.">setPixmapProgress</a>(); <a name="l00544"></a>00544 <a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">save</a>(); <a name="l00545"></a>00545 } <a name="l00546"></a>00546 <span class="keywordflow">else</span> <a name="l00547"></a>00547 { <a name="l00548"></a>00548 <span class="keyword">delete</span> task; <a name="l00549"></a>00549 } <a name="l00550"></a>00550 <span class="keywordflow">return</span> taskuid; <a name="l00551"></a>00551 } <a name="l00552"></a>00552 <a name="l00553"></a><a class="code" href="classTaskView.html#b4ea749d211bf7b025bea6ceb1ad34d3">00553</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#b4ea749d211bf7b025bea6ceb1ad34d3" title="Calls newTask dialog with caption &quot;New Sub Task&quot;.">TaskView::newSubTask</a>() <a name="l00554"></a>00554 { <a name="l00555"></a>00555 <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00556"></a>00556 <span class="keywordflow">if</span>(!task) <a name="l00557"></a>00557 <span class="keywordflow">return</span>; <a name="l00558"></a>00558 <a class="code" href="classTaskView.html#97a77780f5673be980ca7be887c9a436" title="Calls newTask dialog with caption &quot;New Task&quot;.">newTask</a>(i18n(<span class="stringliteral">"New Sub Task"</span>), task); <a name="l00559"></a>00559 task->setOpen(<span class="keyword">true</span>); <a name="l00560"></a>00560 <a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664" title="Used to refresh (e.g.">refresh</a>(); <a name="l00561"></a>00561 } <a name="l00562"></a>00562 <a name="l00563"></a>00563 <span class="keywordtype">void</span> TaskView::editTask() <a name="l00564"></a>00564 { <a name="l00565"></a>00565 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00566"></a>00566 <span class="keywordflow">if</span> (!task) <a name="l00567"></a>00567 <span class="keywordflow">return</span>; <a name="l00568"></a>00568 <a name="l00569"></a>00569 DesktopList desktopList = task-><a class="code" href="classTask.html#e181eeb5a4794309abf132b5b6392fd4">getDesktops</a>(); <a name="l00570"></a>00570 <a class="code" href="classEditTaskDialog.html" title="Dialog to add a new task or edit an existing task.">EditTaskDialog</a> *dialog = <span class="keyword">new</span> <a class="code" href="classEditTaskDialog.html" title="Dialog to add a new task or edit an existing task.">EditTaskDialog</a>(i18n(<span class="stringliteral">"Edit Task"</span>), <span class="keyword">true</span>, &desktopList); <a name="l00571"></a>00571 dialog-><a class="code" href="classEditTaskDialog.html#d036a2fa206b601fe77ed9152eacdebd">setTask</a>( task-><a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>(), <a name="l00572"></a>00572 task-><a class="code" href="classTask.html#623e46356eb7d8e93ac827130c0d08a5">time</a>(), <a name="l00573"></a>00573 task-><a class="code" href="classTask.html#8234e6992334d4e80388e4918e9948d1">sessionTime</a>() ); <a name="l00574"></a>00574 <span class="keywordtype">int</span> result = dialog->exec(); <a name="l00575"></a>00575 <span class="keywordflow">if</span> (result == QDialog::Accepted) { <a name="l00576"></a>00576 QString taskName = i18n(<span class="stringliteral">"Unnamed Task"</span>); <a name="l00577"></a>00577 <span class="keywordflow">if</span> (!dialog-><a class="code" href="classEditTaskDialog.html#fc4d420294512781d479405adb7e0160">taskName</a>().isEmpty()) { <a name="l00578"></a>00578 taskName = dialog-><a class="code" href="classEditTaskDialog.html#fc4d420294512781d479405adb7e0160">taskName</a>(); <a name="l00579"></a>00579 } <a name="l00580"></a>00580 <span class="comment">// setName only does something if the new name is different</span> <a name="l00581"></a>00581 task-><a class="code" href="classTask.html#700e1105fcebc29088211bc9db9944d6" title="sets the name of the task">setName</a>(taskName, _storage); <a name="l00582"></a>00582 <a name="l00583"></a>00583 <span class="comment">// update session time as well if the time was changed</span> <a name="l00584"></a>00584 <span class="keywordtype">long</span> total, session, totalDiff, sessionDiff; <a name="l00585"></a>00585 total = totalDiff = session = sessionDiff = 0; <a name="l00586"></a>00586 DesktopList desktopList; <a name="l00587"></a>00587 dialog-><a class="code" href="classEditTaskDialog.html#09b2d4d9ed77a971424c48dfd09f5d3e">status</a>( &total, &totalDiff, &session, &sessionDiff, &desktopList); <a name="l00588"></a>00588 <a name="l00589"></a>00589 <span class="keywordflow">if</span>( totalDiff != 0 || sessionDiff != 0) <a name="l00590"></a>00590 task-><a class="code" href="classTask.html#1be2a2bf84f843d70b33be28c10a4025" title="Add minutes to time and session time, and write to storage.">changeTimes</a>( sessionDiff, totalDiff, _storage ); <a name="l00591"></a>00591 <a name="l00592"></a>00592 <span class="comment">// If all available desktops are checked, disable auto tracking,</span> <a name="l00593"></a>00593 <span class="comment">// since it makes no sense to track for every desktop.</span> <a name="l00594"></a>00594 <span class="keywordflow">if</span> (desktopList.size() == (<span class="keywordtype">unsigned</span> int)_desktopTracker-><a class="code" href="classDesktopTracker.html#01002cb3015dee782185246aaece569a">desktopCount</a>()) <a name="l00595"></a>00595 desktopList.clear(); <a name="l00596"></a>00596 <a name="l00597"></a>00597 task-><a class="code" href="classTask.html#9a45bc0b67cf9d22139d94f4c4095842">setDesktopList</a>(desktopList); <a name="l00598"></a>00598 <a name="l00599"></a>00599 _desktopTracker-><a class="code" href="classDesktopTracker.html#01cde654bee0dc60f303d510ea5b90f4">registerForDesktops</a>( task, desktopList ); <a name="l00600"></a>00600 <a name="l00601"></a>00601 emit updateButtons(); <a name="l00602"></a>00602 } <a name="l00603"></a>00603 <span class="keyword">delete</span> dialog; <a name="l00604"></a>00604 } <a name="l00605"></a>00605 <a name="l00606"></a>00606 <span class="comment">//void TaskView::addCommentToTask()</span> <a name="l00607"></a>00607 <span class="comment">//{</span> <a name="l00608"></a>00608 <span class="comment">// Task *task = current_item();</span> <a name="l00609"></a>00609 <span class="comment">// if (!task)</span> <a name="l00610"></a>00610 <span class="comment">// return;</span> <a name="l00611"></a>00611 <a name="l00612"></a>00612 <span class="comment">// bool ok;</span> <a name="l00613"></a>00613 <span class="comment">// QString comment = KLineEditDlg::getText(i18n("Comment"),</span> <a name="l00614"></a>00614 <span class="comment">// i18n("Log comment for task '%1':").arg(task->name()),</span> <a name="l00615"></a>00615 <span class="comment">// QString(), &ok, this);</span> <a name="l00616"></a>00616 <span class="comment">// if ( ok )</span> <a name="l00617"></a>00617 <span class="comment">// task->addComment( comment, _storage );</span> <a name="l00618"></a>00618 <span class="comment">//}</span> <a name="l00619"></a>00619 <a name="l00620"></a><a class="code" href="classTaskView.html#dc58f7358fbdb44a4d4a6f26890ba925">00620</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#dc58f7358fbdb44a4d4a6f26890ba925" title="Reinstates the current task as incomplete.">TaskView::reinstateTask</a>(<span class="keywordtype">int</span> completion) <a name="l00621"></a>00621 { <a name="l00622"></a>00622 <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00623"></a>00623 <span class="keywordflow">if</span> (task == 0) { <a name="l00624"></a>00624 KMessageBox::information(0,i18n(<span class="stringliteral">"No task selected."</span>)); <a name="l00625"></a>00625 <span class="keywordflow">return</span>; <a name="l00626"></a>00626 } <a name="l00627"></a>00627 <a name="l00628"></a>00628 <span class="keywordflow">if</span> (completion<0) completion=0; <a name="l00629"></a>00629 <span class="keywordflow">if</span> (completion<100) <a name="l00630"></a>00630 { <a name="l00631"></a>00631 task-><a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3" title="Update percent complete for this task.">setPercentComplete</a>(completion, _storage); <a name="l00632"></a>00632 task-><a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee" title="Sets an appropriate icon for this task based on its level of completion.">setPixmapProgress</a>(); <a name="l00633"></a>00633 <a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">save</a>(); <a name="l00634"></a>00634 emit updateButtons(); <a name="l00635"></a>00635 } <a name="l00636"></a>00636 } <a name="l00637"></a>00637 <a name="l00638"></a><a class="code" href="classTaskView.html#a936059d9cee284f85e81b1df2207a34">00638</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#a936059d9cee284f85e81b1df2207a34" title="Delete task (and children) from view.">TaskView::deleteTask</a>(<span class="keywordtype">bool</span> markingascomplete) <a name="l00639"></a>00639 { <a name="l00640"></a>00640 <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *task = <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>(); <a name="l00641"></a>00641 <span class="keywordflow">if</span> (task == 0) { <a name="l00642"></a>00642 KMessageBox::information(0,i18n(<span class="stringliteral">"No task selected."</span>)); <a name="l00643"></a>00643 <span class="keywordflow">return</span>; <a name="l00644"></a>00644 } <a name="l00645"></a>00645 <a name="l00646"></a>00646 <span class="keywordtype">int</span> response = KMessageBox::Continue; <a name="l00647"></a>00647 <span class="keywordflow">if</span> (!markingascomplete && _preferences-><a class="code" href="classPreferences.html#f0924ac19bab20c2a5aa336098c79d1a">promptDelete</a>()) { <a name="l00648"></a>00648 <span class="keywordflow">if</span> (task->childCount() == 0) { <a name="l00649"></a>00649 response = KMessageBox::warningContinueCancel( 0, <a name="l00650"></a>00650 i18n( <span class="stringliteral">"Are you sure you want to delete "</span> <a name="l00651"></a>00651 <span class="stringliteral">"the task named\n\"%1\" and its entire history?"</span>) <a name="l00652"></a>00652 .arg(task-><a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>()), <a name="l00653"></a>00653 i18n( <span class="stringliteral">"Deleting Task"</span>), KStdGuiItem::del()); <a name="l00654"></a>00654 } <a name="l00655"></a>00655 <span class="keywordflow">else</span> { <a name="l00656"></a>00656 response = KMessageBox::warningContinueCancel( 0, <a name="l00657"></a>00657 i18n( <span class="stringliteral">"Are you sure you want to delete the task named"</span> <a name="l00658"></a>00658 <span class="stringliteral">"\n\"%1\" and its entire history?\n"</span> <a name="l00659"></a>00659 <span class="stringliteral">"NOTE: all its subtasks and their history will also "</span> <a name="l00660"></a>00660 <span class="stringliteral">"be deleted."</span>).arg(task-><a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>()), <a name="l00661"></a>00661 i18n( <span class="stringliteral">"Deleting Task"</span>), KStdGuiItem::del()); <a name="l00662"></a>00662 } <a name="l00663"></a>00663 } <a name="l00664"></a>00664 <a name="l00665"></a>00665 <span class="keywordflow">if</span> (response == KMessageBox::Continue) <a name="l00666"></a>00666 { <a name="l00667"></a>00667 <span class="keywordflow">if</span> (markingascomplete) <a name="l00668"></a>00668 { <a name="l00669"></a>00669 task-><a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3" title="Update percent complete for this task.">setPercentComplete</a>(100, _storage); <a name="l00670"></a>00670 task-><a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee" title="Sets an appropriate icon for this task based on its level of completion.">setPixmapProgress</a>(); <a name="l00671"></a>00671 <a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">save</a>(); <a name="l00672"></a>00672 emit updateButtons(); <a name="l00673"></a>00673 <a name="l00674"></a>00674 <span class="comment">// Have to remove after saving, as the save routine only affects tasks</span> <a name="l00675"></a>00675 <span class="comment">// that are in the view. Otherwise, the new percent complete does not</span> <a name="l00676"></a>00676 <span class="comment">// get saved. (No longer remove when marked as complete.)</span> <a name="l00677"></a>00677 <span class="comment">//task->removeFromView();</span> <a name="l00678"></a>00678 <a name="l00679"></a>00679 } <a name="l00680"></a>00680 <span class="keywordflow">else</span> <a name="l00681"></a>00681 { <a name="l00682"></a>00682 QString uid=task-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>(); <a name="l00683"></a>00683 task-><a class="code" href="classTask.html#f3c73c4a21db23c5550c4ee25e44164b" title="remove Task with all it&#39;s children">remove</a>(activeTasks, _storage); <a name="l00684"></a>00684 task-><a class="code" href="classTask.html#4d6979d0c0f706d202fcd78849d4fe07" title="Remove current task and all it&#39;s children from the view.">removeFromView</a>(); <a name="l00685"></a>00685 <span class="keywordflow">if</span>( _preferences ) _preferences-><a class="code" href="classPreferences.html#3585923ce8827386ab30ae3de4445575">deleteEntry</a>( uid ); <span class="comment">// forget if the item was expanded or collapsed</span> <a name="l00686"></a>00686 <a class="code" href="classTaskView.html#a44fba4868b50914f03bf7b7bc45274e" title="Save to persistent storage.">save</a>(); <a name="l00687"></a>00687 } <a name="l00688"></a>00688 <a name="l00689"></a>00689 <span class="comment">// remove root decoration if there is no more children.</span> <a name="l00690"></a>00690 <a class="code" href="classTaskView.html#62a6de5702b8772e6200ec447cf9b664" title="Used to refresh (e.g.">refresh</a>(); <a name="l00691"></a>00691 <a name="l00692"></a>00692 <span class="comment">// Stop idle detection if no more counters are running</span> <a name="l00693"></a>00693 <span class="keywordflow">if</span> (activeTasks.count() == 0) { <a name="l00694"></a>00694 _idleTimeDetector-><a class="code" href="classIdleTimeDetector.html#d5e53c7ecaa371791e484473efd8953f" title="Stops detecting idle time.">stopIdleDetection</a>(); <a name="l00695"></a>00695 emit timersInactive(); <a name="l00696"></a>00696 } <a name="l00697"></a>00697 <a name="l00698"></a>00698 emit tasksChanged( activeTasks ); <a name="l00699"></a>00699 } <a name="l00700"></a>00700 } <a name="l00701"></a>00701 <a name="l00702"></a><a class="code" href="classTaskView.html#75a6aee0e21b8165ead27b25e4dd555d">00702</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#75a6aee0e21b8165ead27b25e4dd555d" title="Subtracts time from all active tasks, and does not log event.">TaskView::extractTime</a>(<span class="keywordtype">int</span> minutes) <a name="l00703"></a>00703 <span class="comment">// This procedure subtracts ''minutes'' from the active task's time in the memory.</span> <a name="l00704"></a>00704 <span class="comment">// It is called by the idletimedetector class.</span> <a name="l00705"></a>00705 <span class="comment">// When the desktop has been idle for the past 20 minutes, the past 20 minutes have </span> <a name="l00706"></a>00706 <span class="comment">// already been added to the task's time in order for the time to be displayed correctly.</span> <a name="l00707"></a>00707 <span class="comment">// That is why idletimedetector needs to subtract this time first.</span> <a name="l00708"></a>00708 { <a name="l00709"></a>00709 kdDebug(5970) << <span class="stringliteral">"Entering extractTime"</span> << endl; <a name="l00710"></a>00710 addTimeToActiveTasks(-minutes,<span class="keyword">false</span>); <span class="comment">// subtract minutes, but do not store it</span> <a name="l00711"></a>00711 } <a name="l00712"></a>00712 <a name="l00713"></a>00713 <span class="keywordtype">void</span> TaskView::autoSaveChanged(<span class="keywordtype">bool</span> on) <a name="l00714"></a>00714 { <a name="l00715"></a>00715 <span class="keywordflow">if</span> (on) _autoSaveTimer->start(_preferences-><a class="code" href="classPreferences.html#ba872aaaa43c661553f2ce0c8ccb83d0">autoSavePeriod</a>()*1000*secsPerMinute); <a name="l00716"></a>00716 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_autoSaveTimer->isActive()) _autoSaveTimer->stop(); <a name="l00717"></a>00717 } <a name="l00718"></a>00718 <a name="l00719"></a>00719 <span class="keywordtype">void</span> TaskView::autoSavePeriodChanged(<span class="keywordtype">int</span> <span class="comment">/*minutes*/</span>) <a name="l00720"></a>00720 { <a name="l00721"></a>00721 autoSaveChanged(_preferences-><a class="code" href="classPreferences.html#4cfe41a2ceedc1e1e8043da0d39566bd">autoSave</a>()); <a name="l00722"></a>00722 } <a name="l00723"></a>00723 <a name="l00724"></a>00724 <span class="keywordtype">void</span> TaskView::adaptColumns() <a name="l00725"></a>00725 { <a name="l00726"></a>00726 <span class="comment">// to hide a column X we set it's width to 0</span> <a name="l00727"></a>00727 <span class="comment">// at that moment we'll remember the original column within</span> <a name="l00728"></a>00728 <span class="comment">// previousColumnWidths[X]</span> <a name="l00729"></a>00729 <span class="comment">//</span> <a name="l00730"></a>00730 <span class="comment">// When unhiding a previously hidden column</span> <a name="l00731"></a>00731 <span class="comment">// (previousColumnWidths[X] != HIDDEN_COLUMN !)</span> <a name="l00732"></a>00732 <span class="comment">// we restore it's width from the saved value and set</span> <a name="l00733"></a>00733 <span class="comment">// previousColumnWidths[X] to HIDDEN_COLUMN</span> <a name="l00734"></a>00734 <a name="l00735"></a>00735 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> x=1; x <= 4; x++) { <a name="l00736"></a>00736 <span class="comment">// the column was invisible before and were switching it on now</span> <a name="l00737"></a>00737 <span class="keywordflow">if</span>( _preferences-><a class="code" href="classPreferences.html#31e3a9e3f2b866f491d0a020c93e0e01">displayColumn</a>(x-1) <a name="l00738"></a>00738 && previousColumnWidths[x-1] != HIDDEN_COLUMN ) <a name="l00739"></a>00739 { <a name="l00740"></a>00740 setColumnWidth( x, previousColumnWidths[x-1] ); <a name="l00741"></a>00741 previousColumnWidths[x-1] = HIDDEN_COLUMN; <a name="l00742"></a>00742 setColumnWidthMode( x, QListView::Maximum ); <a name="l00743"></a>00743 } <a name="l00744"></a>00744 <span class="comment">// the column was visible before and were switching it off now</span> <a name="l00745"></a>00745 <span class="keywordflow">else</span> <a name="l00746"></a>00746 <span class="keywordflow">if</span>( ! _preferences-><a class="code" href="classPreferences.html#31e3a9e3f2b866f491d0a020c93e0e01">displayColumn</a>(x-1) <a name="l00747"></a>00747 && previousColumnWidths[x-1] == HIDDEN_COLUMN ) <a name="l00748"></a>00748 { <a name="l00749"></a>00749 setColumnWidthMode( x, QListView::Manual ); <span class="comment">// we don't want update()</span> <a name="l00750"></a>00750 <span class="comment">// to resize/unhide the col</span> <a name="l00751"></a>00751 previousColumnWidths[x-1] = columnWidth( x ); <a name="l00752"></a>00752 setColumnWidth( x, 0 ); <a name="l00753"></a>00753 } <a name="l00754"></a>00754 } <a name="l00755"></a>00755 } <a name="l00756"></a>00756 <a name="l00757"></a><a class="code" href="classTaskView.html#59851e18b84775a2f9e3a89ec477f425">00757</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#59851e18b84775a2f9e3a89ec477f425" title="receiving signal that a task is being deleted">TaskView::deletingTask</a>(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* deletedTask) <a name="l00758"></a>00758 { <a name="l00759"></a>00759 DesktopList desktopList; <a name="l00760"></a>00760 <a name="l00761"></a>00761 _desktopTracker-><a class="code" href="classDesktopTracker.html#01cde654bee0dc60f303d510ea5b90f4">registerForDesktops</a>( deletedTask, desktopList ); <a name="l00762"></a>00762 activeTasks.removeRef( deletedTask ); <a name="l00763"></a>00763 <a name="l00764"></a>00764 emit tasksChanged( activeTasks); <a name="l00765"></a>00765 } <a name="l00766"></a>00766 <a name="l00767"></a><a class="code" href="classTaskView.html#c4054db82392999c9e0c1d53d8dc463a">00767</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#c4054db82392999c9e0c1d53d8dc463a" title="User might have picked a new iCalendar file on preferences screen.">TaskView::iCalFileChanged</a>(QString file) <a name="l00768"></a>00768 <span class="comment">// User might have picked a new file in the preferences dialog.</span> <a name="l00769"></a>00769 <span class="comment">// This is not iCalFileModified.</span> <a name="l00770"></a>00770 { <a name="l00771"></a>00771 kdDebug(5970) << <span class="stringliteral">"TaskView:iCalFileChanged: "</span> << file << endl; <a name="l00772"></a>00772 <span class="keywordflow">if</span> (_storage-><a class="code" href="classKarmStorage.html#720923b34d69c0a7db77e263d7a7fb4f">icalfile</a>() != file) <a name="l00773"></a>00773 { <a name="l00774"></a>00774 <a class="code" href="classTaskView.html#e3bb12fde718e07f246307aad386e3ba" title="Stop all running timers.">stopAllTimers</a>(); <a name="l00775"></a>00775 _storage-><a class="code" href="classKarmStorage.html#dd79932f855e7aa5fda180f177fc625e">save</a>(<span class="keyword">this</span>); <a name="l00776"></a>00776 <a class="code" href="classTaskView.html#347e02bcfcf2936ead89a6ddd0169058" title="Load the view from storage.">load</a>(); <a name="l00777"></a>00777 } <a name="l00778"></a>00778 } <a name="l00779"></a>00779 <a name="l00780"></a><a class="code" href="classTaskView.html#01feebb113c1885b3bda674167c7a88b">00780</a> QValueList<HistoryEvent> <a class="code" href="classTaskView.html#01feebb113c1885b3bda674167c7a88b" title="Return list of start/stop events for given date range.">TaskView::getHistory</a>(<span class="keyword">const</span> QDate& from, <a name="l00781"></a>00781 <span class="keyword">const</span> QDate& to)<span class="keyword"> const</span> <a name="l00782"></a>00782 <span class="keyword"></span>{ <a name="l00783"></a>00783 <span class="keywordflow">return</span> _storage-><a class="code" href="classKarmStorage.html#5cef00b43033590f9b509559540c8d22" title="Return a list of start/stop events for the given date range.">getHistory</a>(from, to); <a name="l00784"></a>00784 } <a name="l00785"></a>00785 <a name="l00786"></a>00786 <span class="keywordtype">void</span> TaskView::markTaskAsComplete() <a name="l00787"></a>00787 { <a name="l00788"></a>00788 <span class="keywordflow">if</span> (<a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()) <a name="l00789"></a>00789 kdDebug(5970) << <span class="stringliteral">"TaskView::markTaskAsComplete: "</span> <a name="l00790"></a>00790 << <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>() << endl; <a name="l00791"></a>00791 <span class="keywordflow">else</span> <a name="l00792"></a>00792 kdDebug(5970) << <span class="stringliteral">"TaskView::markTaskAsComplete: null current_item()"</span> << endl; <a name="l00793"></a>00793 <a name="l00794"></a>00794 <span class="keywordtype">bool</span> markingascomplete = <span class="keyword">true</span>; <a name="l00795"></a>00795 <a class="code" href="classTaskView.html#a936059d9cee284f85e81b1df2207a34" title="Delete task (and children) from view.">deleteTask</a>(markingascomplete); <a name="l00796"></a>00796 } <a name="l00797"></a>00797 <a name="l00798"></a>00798 <span class="keywordtype">void</span> TaskView::markTaskAsIncomplete() <a name="l00799"></a>00799 { <a name="l00800"></a>00800 <span class="keywordflow">if</span> (<a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()) <a name="l00801"></a>00801 kdDebug(5970) << <span class="stringliteral">"TaskView::markTaskAsComplete: "</span> <a name="l00802"></a>00802 << <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()-><a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>() << endl; <a name="l00803"></a>00803 <span class="keywordflow">else</span> <a name="l00804"></a>00804 kdDebug(5970) << <span class="stringliteral">"TaskView::markTaskAsComplete: null current_item()"</span> << endl; <a name="l00805"></a>00805 <a name="l00806"></a>00806 <a class="code" href="classTaskView.html#dc58f7358fbdb44a4d4a6f26890ba925" title="Reinstates the current task as incomplete.">reinstateTask</a>(50); <span class="comment">// if it has been reopened, assume half-done</span> <a name="l00807"></a>00807 } <a name="l00808"></a>00808 <a name="l00809"></a>00809 <a name="l00810"></a><a class="code" href="classTaskView.html#08c5630feb473c5b51a045b85185b616">00810</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#08c5630feb473c5b51a045b85185b616" title="Copy totals for current and all sub tasks to clipboard.">TaskView::clipTotals</a>() <a name="l00811"></a>00811 { <a name="l00812"></a>00812 <a class="code" href="classTimeKard.html" title="Routines to output timecard data.">TimeKard</a> t; <a name="l00813"></a>00813 <span class="keywordflow">if</span> (<a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>() && <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->isRoot()) <a name="l00814"></a>00814 { <a name="l00815"></a>00815 <span class="keywordtype">int</span> response = KMessageBox::questionYesNo( 0, <a name="l00816"></a>00816 i18n(<span class="stringliteral">"Copy totals for just this task and its subtasks, or copy totals for all tasks?"</span>), <a name="l00817"></a>00817 i18n(<span class="stringliteral">"Copy Totals to Clipboard"</span>), <a name="l00818"></a>00818 i18n(<span class="stringliteral">"Copy This Task"</span>), i18n(<span class="stringliteral">"Copy All Tasks"</span>) ); <a name="l00819"></a>00819 <span class="keywordflow">if</span> (response == KMessageBox::Yes) <span class="comment">// This task only</span> <a name="l00820"></a>00820 { <a name="l00821"></a>00821 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">true</span>, TimeKard::TotalTime)); <a name="l00822"></a>00822 } <a name="l00823"></a>00823 <span class="keywordflow">else</span> <span class="comment">// All tasks</span> <a name="l00824"></a>00824 { <a name="l00825"></a>00825 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">false</span>, TimeKard::TotalTime)); <a name="l00826"></a>00826 } <a name="l00827"></a>00827 } <a name="l00828"></a>00828 <span class="keywordflow">else</span> <a name="l00829"></a>00829 { <a name="l00830"></a>00830 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">true</span>, TimeKard::TotalTime)); <a name="l00831"></a>00831 } <a name="l00832"></a>00832 } <a name="l00833"></a>00833 <a name="l00834"></a><a class="code" href="classTaskView.html#823aa24a911391922c14549b2a886a96">00834</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#823aa24a911391922c14549b2a886a96" title="Copy session times for current and all sub tasks to clipboard.">TaskView::clipSession</a>() <a name="l00835"></a>00835 { <a name="l00836"></a>00836 <a class="code" href="classTimeKard.html" title="Routines to output timecard data.">TimeKard</a> t; <a name="l00837"></a>00837 <span class="keywordflow">if</span> (<a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>() && <a class="code" href="classTaskView.html#39ddafca93de0b8753014151e47734f3" title="Return the current item in the view, cast to a Task pointer.">current_item</a>()->isRoot()) <a name="l00838"></a>00838 { <a name="l00839"></a>00839 <span class="keywordtype">int</span> response = KMessageBox::questionYesNo( 0, <a name="l00840"></a>00840 i18n(<span class="stringliteral">"Copy session time for just this task and its subtasks, or copy session time for all tasks?"</span>), <a name="l00841"></a>00841 i18n(<span class="stringliteral">"Copy Session Time to Clipboard"</span>), <a name="l00842"></a>00842 i18n(<span class="stringliteral">"Copy This Task"</span>), i18n(<span class="stringliteral">"Copy All Tasks"</span>) ); <a name="l00843"></a>00843 <span class="keywordflow">if</span> (response == KMessageBox::Yes) <span class="comment">// this task only</span> <a name="l00844"></a>00844 { <a name="l00845"></a>00845 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">true</span>, TimeKard::SessionTime)); <a name="l00846"></a>00846 } <a name="l00847"></a>00847 <span class="keywordflow">else</span> <span class="comment">// only task</span> <a name="l00848"></a>00848 { <a name="l00849"></a>00849 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">false</span>, TimeKard::SessionTime)); <a name="l00850"></a>00850 } <a name="l00851"></a>00851 } <a name="l00852"></a>00852 <span class="keywordflow">else</span> <a name="l00853"></a>00853 { <a name="l00854"></a>00854 KApplication::clipboard()->setText(t.<a class="code" href="classTimeKard.html#730207cd18472b4864152eed9617fb53" title="Generates ascii text of task totals, for current task on down.">totalsAsText</a>(<span class="keyword">this</span>, <span class="keyword">true</span>, TimeKard::SessionTime)); <a name="l00855"></a>00855 } <a name="l00856"></a>00856 } <a name="l00857"></a>00857 <a name="l00858"></a><a class="code" href="classTaskView.html#a2f20d1a4ec54630840b0228f602a661">00858</a> <span class="keywordtype">void</span> <a class="code" href="classTaskView.html#a2f20d1a4ec54630840b0228f602a661" title="Copy history for current and all sub tasks to clipboard.">TaskView::clipHistory</a>() <a name="l00859"></a>00859 { <a name="l00860"></a>00860 PrintDialog dialog; <a name="l00861"></a>00861 <span class="keywordflow">if</span> (dialog.exec()== QDialog::Accepted) <a name="l00862"></a>00862 { <a name="l00863"></a>00863 <a class="code" href="classTimeKard.html" title="Routines to output timecard data.">TimeKard</a> t; <a name="l00864"></a>00864 KApplication::clipboard()-> <a name="l00865"></a>00865 setText( t.<a class="code" href="classTimeKard.html#af4e6010f2035ddba3e4fbcf1b11986b" title="Generates ascii text of weekly task history, for current task on down.">historyAsText</a>(<span class="keyword">this</span>, dialog.from(), dialog.to(), !dialog.allTasks(), dialog.perWeek(), dialog.totalsOnly() ) ); <a name="l00866"></a>00866 } <a name="l00867"></a>00867 } <a name="l00868"></a>00868 <a name="l00869"></a>00869 <span class="preprocessor">#include "taskview.moc"</span> </pre></div></div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>karm</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classDesktopTracker.html">desktoptracker</option>, <option value="classEditTaskDialog.html">edittaskdialog</option>, <option value="classHistoryEvent.html">historyevent</option>, <option value="classIdleTimeDetector.html">idletimedetector</option>, <option value="classKAccelMenuWatch.html">kaccelmenuwatch</option>, <option value="classKarmDCOPIface.html">karmdcopiface</option>, <option value="classKarmStorage.html">karmstorage</option>, <option value="classKArmTimeWidget.html">karmtimewidget</option>, <option value="classMainWindow.html">mainwindow</option>, <option value="classMyPrinter.html">myprinter</option>, <option value="classPlannerParser.html">plannerparser</option>, <option value="classPreferences.html">preferences</option>, <option value="classReportCriteria.html">reportcriteria</option>, <option value="classTask.html">task</option>, <option value="classTaskView.html">taskview</option>, <option value="classTaskViewWhatsThis.html">taskviewwhatsthis</option>, <option value="classTimeKard.html">timekard</option>, <option value="classWeek.html">week</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../akregator/html/index.html">akregator</a></li><li> <a href="../../akregator/src/html/index.html">src</a></li><li> <a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li> <a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li> <a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li> <a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>