Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 98d6b53e11e983e268c3e19f14e091a0 > files > 1434

kdepim-devel-doc-3.5.9-9mdv2008.1.x86_64.rpm

<?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: task.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>task.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;qcstring.h&gt;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;qdatetime.h&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;qstring.h&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;qtimer.h&gt;</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;kiconloader.h&gt;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include "kapplication.h"</span>       <span class="comment">// kapp</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include "kdebug.h"</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include "event.h"</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#include "karmutility.h"</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include "task.h"</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include "taskview.h"</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include "preferences.h"</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="keyword">const</span> <span class="keywordtype">int</span> gSecondsPerMinute = 60;
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 QPtrVector&lt;QPixmap&gt; *Task::icons = 0;
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 Task::Task( <span class="keyword">const</span> QString&amp; taskName, <span class="keywordtype">long</span> minutes, <span class="keywordtype">long</span> sessionTime,
<a name="l00025"></a>00025             DesktopList desktops, <a class="code" href="classTaskView.html" title="Container and interface for the tasks.">TaskView</a> *parent)
<a name="l00026"></a>00026   : QObject(), QListViewItem(parent)
<a name="l00027"></a>00027 { 
<a name="l00028"></a>00028   init(taskName, minutes, sessionTime, desktops, 0);
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 Task::Task( <span class="keyword">const</span> QString&amp; taskName, <span class="keywordtype">long</span> minutes, <span class="keywordtype">long</span> sessionTime,
<a name="l00032"></a>00032             DesktopList desktops, <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *parent)
<a name="l00033"></a>00033   : QObject(), QListViewItem(parent)
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035   init(taskName, minutes, sessionTime, desktops, 0);
<a name="l00036"></a>00036 }
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 Task::Task( KCal::Todo* todo, <a class="code" href="classTaskView.html" title="Container and interface for the tasks.">TaskView</a>* parent )
<a name="l00039"></a>00039   : QObject(), QListViewItem( parent )
<a name="l00040"></a>00040 {
<a name="l00041"></a>00041   <span class="keywordtype">long</span> minutes = 0;
<a name="l00042"></a>00042   QString name;
<a name="l00043"></a>00043   <span class="keywordtype">long</span> sessionTime = 0;
<a name="l00044"></a>00044   <span class="keywordtype">int</span> percent_complete = 0;
<a name="l00045"></a>00045   DesktopList desktops;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047   parseIncidence(todo, minutes, sessionTime, name, desktops, percent_complete);
<a name="l00048"></a>00048   init(name, minutes, sessionTime, desktops, percent_complete);
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="keywordtype">void</span> Task::init( <span class="keyword">const</span> QString&amp; taskName, <span class="keywordtype">long</span> minutes, <span class="keywordtype">long</span> sessionTime,
<a name="l00052"></a>00052                  DesktopList desktops, <span class="keywordtype">int</span> percent_complete)
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054   <span class="comment">// If our parent is the taskview then connect our totalTimesChanged</span>
<a name="l00055"></a>00055   <span class="comment">// signal to its receiver</span>
<a name="l00056"></a>00056   <span class="keywordflow">if</span> ( ! parent() )
<a name="l00057"></a>00057     connect( <span class="keyword">this</span>, SIGNAL( totalTimesChanged ( <span class="keywordtype">long</span>, <span class="keywordtype">long</span> ) ),
<a name="l00058"></a>00058              listView(), SLOT( taskTotalTimesChanged( <span class="keywordtype">long</span>, <span class="keywordtype">long</span>) ));
<a name="l00059"></a>00059 
<a name="l00060"></a>00060   connect( <span class="keyword">this</span>, SIGNAL( <a class="code" href="classTask.html#e6ca164d2abc21da0695a33c9d476015" title="signal that we&amp;#39;re about to delete a task">deletingTask</a>( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* ) ),
<a name="l00061"></a>00061            listView(), SLOT( <a class="code" href="classTask.html#e6ca164d2abc21da0695a33c9d476015" title="signal that we&amp;#39;re about to delete a task">deletingTask</a>( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* ) ));
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   <span class="keywordflow">if</span> (icons == 0) {
<a name="l00064"></a>00064     icons = <span class="keyword">new</span> QPtrVector&lt;QPixmap&gt;(8);
<a name="l00065"></a>00065     KIconLoader* kil = <span class="keyword">new</span> KIconLoader(<span class="stringliteral">"karm"</span>); <span class="comment">// always load icons from the KArm application</span>
<a name="l00066"></a>00066     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;8; i++)
<a name="l00067"></a>00067     {
<a name="l00068"></a>00068       QPixmap *icon = <span class="keyword">new</span> QPixmap();
<a name="l00069"></a>00069       QString <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>;
<a name="l00070"></a>00070       name.sprintf(<span class="stringliteral">"watch-%d.xpm"</span>,i);
<a name="l00071"></a>00071       *icon = kil-&gt;loadIcon( name, KIcon::User );
<a name="l00072"></a>00072       icons-&gt;insert(i,icon);
<a name="l00073"></a>00073     }
<a name="l00074"></a>00074   }
<a name="l00075"></a>00075 
<a name="l00076"></a>00076   _removing = <span class="keyword">false</span>;
<a name="l00077"></a>00077   _name = taskName.stripWhiteSpace();
<a name="l00078"></a>00078   _lastStart = QDateTime::currentDateTime();
<a name="l00079"></a>00079   _totalTime = _time = minutes;
<a name="l00080"></a>00080   _totalSessionTime = _sessionTime = sessionTime;
<a name="l00081"></a>00081   _timer = <span class="keyword">new</span> QTimer(<span class="keyword">this</span>);
<a name="l00082"></a>00082   _desktops = desktops;
<a name="l00083"></a>00083   connect(_timer, SIGNAL(timeout()), <span class="keyword">this</span>, SLOT(<a class="code" href="classTask.html#73851f2e76b40b6c99cfbe02752d8059" title="animate the active icon">updateActiveIcon</a>()));
<a name="l00084"></a>00084   setPixmap(1, UserIcon(QString::fromLatin1(<span class="stringliteral">"empty-watch.xpm"</span>)));
<a name="l00085"></a>00085   _currentPic = 0;
<a name="l00086"></a>00086   _percentcomplete = percent_complete;
<a name="l00087"></a>00087 
<a name="l00088"></a>00088   <a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89" title="Update the display of the task (all columns) in the UI.">update</a>();
<a name="l00089"></a>00089   changeParentTotalTimes( _sessionTime, _time);
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091 
<a name="l00092"></a>00092 Task::~Task() {
<a name="l00093"></a>00093   emit <a class="code" href="classTask.html#e6ca164d2abc21da0695a33c9d476015" title="signal that we&amp;#39;re about to delete a task">deletingTask</a>(<span class="keyword">this</span>);
<a name="l00094"></a>00094   <span class="keyword">delete</span> _timer;
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a><a class="code" href="classTask.html#6b36fb9311e31d5708ba0755721e8292">00097</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#6b36fb9311e31d5708ba0755721e8292" title="starts or stops a task">Task::setRunning</a>( <span class="keywordtype">bool</span> on, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage, QDateTime whenStarted, QDateTime whenStopped  )
<a name="l00098"></a>00098 <span class="comment">// Sets a task running or stopped. If the task is to be stopped, whenStarted is not evaluated.</span>
<a name="l00099"></a>00099 <span class="comment">// on=true if the task shall be started on=false if the task shall be stopped</span>
<a name="l00100"></a>00100 <span class="comment">// This is the back-end, the front-end is StartTimerFor()</span>
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102   kdDebug(5970) &lt;&lt; <span class="stringliteral">"Entering Task::setRunning "</span> &lt;&lt; <span class="stringliteral">"on="</span> &lt;&lt; on &lt;&lt; <span class="stringliteral">"whenStarted="</span> &lt;&lt; whenStarted &lt;&lt; <span class="stringliteral">" whenStopped="</span> &lt;&lt; whenStopped &lt;&lt; endl;
<a name="l00103"></a>00103   <span class="keywordflow">if</span> ( on ) 
<a name="l00104"></a>00104   {
<a name="l00105"></a>00105     <span class="keywordflow">if</span> (!_timer-&gt;isActive()) 
<a name="l00106"></a>00106     {
<a name="l00107"></a>00107       _timer-&gt;start(1000);
<a name="l00108"></a>00108       storage-&gt;<a class="code" href="classKarmStorage.html#905f23e1bab55b4493d237dfcc469134" title="Log the event that a timer has started for a task.">startTimer</a>(<span class="keyword">this</span>);
<a name="l00109"></a>00109       _currentPic=7;
<a name="l00110"></a>00110       _lastStart = whenStarted;
<a name="l00111"></a>00111       <a class="code" href="classTask.html#73851f2e76b40b6c99cfbe02752d8059" title="animate the active icon">updateActiveIcon</a>();
<a name="l00112"></a>00112     }
<a name="l00113"></a>00113   }
<a name="l00114"></a>00114   <span class="keywordflow">else</span> 
<a name="l00115"></a>00115   {
<a name="l00116"></a>00116     <span class="keywordflow">if</span> (_timer-&gt;isActive()) 
<a name="l00117"></a>00117     {
<a name="l00118"></a>00118       _timer-&gt;stop();
<a name="l00119"></a>00119       <span class="keywordflow">if</span> ( ! _removing ) 
<a name="l00120"></a>00120       {
<a name="l00121"></a>00121         storage-&gt;<a class="code" href="classKarmStorage.html#9deb86884cc80783e4488b39f0fac128" title="Log the event that the timer has stopped for this task.">stopTimer</a>(<span class="keyword">this</span>, whenStopped);
<a name="l00122"></a>00122         setPixmap(1, UserIcon(QString::fromLatin1(<span class="stringliteral">"empty-watch.xpm"</span>)));
<a name="l00123"></a>00123       }
<a name="l00124"></a>00124     }
<a name="l00125"></a>00125   }
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 
<a name="l00128"></a><a class="code" href="classTask.html#f52bbd875ab08da52edee8769ff3fb40">00128</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#f52bbd875ab08da52edee8769ff3fb40" title="Set unique id for the task.">Task::setUid</a>(QString <a class="code" href="classTask.html#9a822ba9744f31d2e2bc92c74b757ac2" title="Return unique iCalendar Todo ID for this task.">uid</a>) {
<a name="l00129"></a>00129   _uid = uid;
<a name="l00130"></a>00130 }
<a name="l00131"></a>00131 
<a name="l00132"></a><a class="code" href="classTask.html#810ac835cff9a3fab9f7c8983a950431">00132</a> <span class="keywordtype">bool</span> <a class="code" href="classTask.html#810ac835cff9a3fab9f7c8983a950431" title="return the state of a task - if it&amp;#39;s running or not">Task::isRunning</a>()<span class="keyword"> const</span>
<a name="l00133"></a>00133 <span class="keyword"></span>{
<a name="l00134"></a>00134   <span class="keywordflow">return</span> _timer-&gt;isActive();
<a name="l00135"></a>00135 }
<a name="l00136"></a>00136 
<a name="l00137"></a><a class="code" href="classTask.html#700e1105fcebc29088211bc9db9944d6">00137</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#700e1105fcebc29088211bc9db9944d6" title="sets the name of the task">Task::setName</a>( <span class="keyword">const</span> QString&amp; name, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage )
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139   kdDebug(5970) &lt;&lt; <span class="stringliteral">"Task:setName: "</span> &lt;&lt; name &lt;&lt; endl;
<a name="l00140"></a>00140 
<a name="l00141"></a>00141   QString oldname = _name;
<a name="l00142"></a>00142   <span class="keywordflow">if</span> ( oldname != name ) {
<a name="l00143"></a>00143     _name = name;
<a name="l00144"></a>00144     storage-&gt;<a class="code" href="classKarmStorage.html#a9a16025d66033522656c8fd33996453" title="Log a change to a task name.">setName</a>(<span class="keyword">this</span>, oldname);
<a name="l00145"></a>00145     <a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89" title="Update the display of the task (all columns) in the UI.">update</a>();
<a name="l00146"></a>00146   }
<a name="l00147"></a>00147 }
<a name="l00148"></a>00148 
<a name="l00149"></a><a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3">00149</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#ab22020f954727f597dd7a610b9182d3" title="Update percent complete for this task.">Task::setPercentComplete</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> percent, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a> *storage)
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151   kdDebug(5970) &lt;&lt; <span class="stringliteral">"Task::setPercentComplete("</span> &lt;&lt; percent &lt;&lt; <span class="stringliteral">", storage): "</span>
<a name="l00152"></a>00152     &lt;&lt; _uid &lt;&lt; endl;
<a name="l00153"></a>00153 
<a name="l00154"></a>00154   <span class="keywordflow">if</span> (!percent)
<a name="l00155"></a>00155     _percentcomplete = 0;
<a name="l00156"></a>00156   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (percent &gt; 100)
<a name="l00157"></a>00157     _percentcomplete = 100;
<a name="l00158"></a>00158   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (percent &lt; 0)
<a name="l00159"></a>00159     _percentcomplete = 0;
<a name="l00160"></a>00160   <span class="keywordflow">else</span>
<a name="l00161"></a>00161     _percentcomplete = percent;
<a name="l00162"></a>00162 
<a name="l00163"></a>00163   <span class="keywordflow">if</span> (<a class="code" href="classTask.html#810ac835cff9a3fab9f7c8983a950431" title="return the state of a task - if it&amp;#39;s running or not">isRunning</a>() &amp;&amp; _percentcomplete==100) <a class="code" href="classTask.html#d76165e22581f54e9fda8a639cdffe7a" title="Return task view for this task.">taskView</a>()-&gt;<a class="code" href="classTaskView.html#2c591387533dafe6b6482f34fca6934f">stopTimerFor</a>(<span class="keyword">this</span>);
<a name="l00164"></a>00164 
<a name="l00165"></a>00165   <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="l00166"></a>00166 
<a name="l00167"></a>00167   <span class="comment">// When parent marked as complete, mark all children as complete as well.</span>
<a name="l00168"></a>00168   <span class="comment">// Complete tasks are not displayed in the task view, so if a parent is</span>
<a name="l00169"></a>00169   <span class="comment">// marked as complete and some of the children are not, then we get an error</span>
<a name="l00170"></a>00170   <span class="comment">// message.  KArm actually keep chugging along in this case and displays the</span>
<a name="l00171"></a>00171   <span class="comment">// child tasks just fine, so an alternative solution is to remove that error</span>
<a name="l00172"></a>00172   <span class="comment">// message (from KarmStorage::load).  But I think it makes more sense that</span>
<a name="l00173"></a>00173   <span class="comment">// if you mark a parent task as complete, then all children should be</span>
<a name="l00174"></a>00174   <span class="comment">// complete as well.</span>
<a name="l00175"></a>00175   <span class="comment">//</span>
<a name="l00176"></a>00176   <span class="comment">// This behavior is consistent with KOrganizer (as of 2003-09-24).</span>
<a name="l00177"></a>00177   <span class="keywordflow">if</span> (_percentcomplete == 100)
<a name="l00178"></a>00178   {
<a name="l00179"></a>00179     <span class="keywordflow">for</span> (<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* child= this-&gt;<a class="code" href="classTask.html#aaedcc7fa646b15e0451a638ed3fdf63" title="return parent Task or null in case of TaskView.">firstChild</a>(); child; child = child-&gt;<a class="code" href="classTask.html#a7c59fd2c4318c9eac3bf10fb0201422">nextSibling</a>())
<a name="l00180"></a>00180       child-&gt;setPercentComplete(_percentcomplete, storage);
<a name="l00181"></a>00181   }
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 
<a name="l00184"></a><a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee">00184</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#8440f07186682b23c1c1212a461a33ee" title="Sets an appropriate icon for this task based on its level of completion.">Task::setPixmapProgress</a>()
<a name="l00185"></a>00185 {
<a name="l00186"></a>00186   QPixmap* icon = <span class="keyword">new</span> QPixmap();
<a name="l00187"></a>00187   <span class="keywordflow">if</span> (_percentcomplete &gt;= 100)
<a name="l00188"></a>00188     *icon = UserIcon(<span class="stringliteral">"task-complete.xpm"</span>);
<a name="l00189"></a>00189   <span class="keywordflow">else</span>
<a name="l00190"></a>00190     *icon = UserIcon(<span class="stringliteral">"task-incomplete.xpm"</span>);
<a name="l00191"></a>00191   setPixmap(0, *icon);
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 
<a name="l00194"></a><a class="code" href="classTask.html#465cfd298427ead3becc3911098f776c">00194</a> <span class="keywordtype">bool</span> <a class="code" href="classTask.html#465cfd298427ead3becc3911098f776c" title="Return true if task is complete (percent complete equals 100).">Task::isComplete</a>() { <span class="keywordflow">return</span> _percentcomplete == 100; }
<a name="l00195"></a>00195 
<a name="l00196"></a><a class="code" href="classTask.html#4d6979d0c0f706d202fcd78849d4fe07">00196</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#4d6979d0c0f706d202fcd78849d4fe07" title="Remove current task and all it&amp;#39;s children from the view.">Task::removeFromView</a>()
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198   <span class="keywordflow">while</span> ( <a class="code" href="classTask.html" title="A class representing a task.">Task</a>* child = <a class="code" href="classTask.html#aaedcc7fa646b15e0451a638ed3fdf63" title="return parent Task or null in case of TaskView.">firstChild</a>() )
<a name="l00199"></a>00199     child-&gt;removeFromView();
<a name="l00200"></a>00200   <span class="keyword">delete</span> <span class="keyword">this</span>;
<a name="l00201"></a>00201 }
<a name="l00202"></a>00202 
<a name="l00203"></a>00203 <span class="keywordtype">void</span> Task::setDesktopList ( DesktopList desktopList )
<a name="l00204"></a>00204 {
<a name="l00205"></a>00205   _desktops = desktopList;
<a name="l00206"></a>00206 }
<a name="l00207"></a>00207 
<a name="l00208"></a><a class="code" href="classTask.html#4bdbf1a80fc1172dd2a2545bca272b3a">00208</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#4bdbf1a80fc1172dd2a2545bca272b3a" title="Change task time.">Task::changeTime</a>( <span class="keywordtype">long</span> minutes, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage )
<a name="l00209"></a>00209 {
<a name="l00210"></a>00210   <a class="code" href="classTask.html#1be2a2bf84f843d70b33be28c10a4025" title="Add minutes to time and session time, and write to storage.">changeTimes</a>( minutes, minutes, storage); 
<a name="l00211"></a>00211 }
<a name="l00212"></a>00212 
<a name="l00213"></a><a class="code" href="classTask.html#1be2a2bf84f843d70b33be28c10a4025">00213</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#1be2a2bf84f843d70b33be28c10a4025" title="Add minutes to time and session time, and write to storage.">Task::changeTimes</a>( <span class="keywordtype">long</span> minutesSession, <span class="keywordtype">long</span> minutes, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage)
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215   <span class="keywordflow">if</span>( minutesSession != 0 || minutes != 0) 
<a name="l00216"></a>00216   {
<a name="l00217"></a>00217     _sessionTime += minutesSession;
<a name="l00218"></a>00218     _time += minutes;
<a name="l00219"></a>00219     <span class="keywordflow">if</span> ( storage ) storage-&gt;<a class="code" href="classKarmStorage.html#bd6111b30d7c4930d8c6d7b9d4daf294" title="Log the change in a task&amp;#39;s time.">changeTime</a>(<span class="keyword">this</span>, minutes * gSecondsPerMinute);
<a name="l00220"></a>00220     <a class="code" href="classTask.html#958864b71ceb9134557fcecd1bb6c7df" title="adds minutes to total and session time">changeTotalTimes</a>( minutesSession, minutes );
<a name="l00221"></a>00221   }
<a name="l00222"></a>00222 }
<a name="l00223"></a>00223 
<a name="l00224"></a><a class="code" href="classTask.html#958864b71ceb9134557fcecd1bb6c7df">00224</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#958864b71ceb9134557fcecd1bb6c7df" title="adds minutes to total and session time">Task::changeTotalTimes</a>( <span class="keywordtype">long</span> minutesSession, <span class="keywordtype">long</span> minutes )
<a name="l00225"></a>00225 {
<a name="l00226"></a>00226   kdDebug(5970)
<a name="l00227"></a>00227     &lt;&lt; <span class="stringliteral">"Task::changeTotalTimes("</span> &lt;&lt; minutesSession &lt;&lt; <span class="stringliteral">", "</span>
<a name="l00228"></a>00228     &lt;&lt; minutes &lt;&lt; <span class="stringliteral">") for "</span> &lt;&lt; <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>() &lt;&lt; endl;
<a name="l00229"></a>00229 
<a name="l00230"></a>00230   _totalSessionTime += minutesSession;
<a name="l00231"></a>00231   _totalTime += minutes;
<a name="l00232"></a>00232   <a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89" title="Update the display of the task (all columns) in the UI.">update</a>();
<a name="l00233"></a>00233   changeParentTotalTimes( minutesSession, minutes );
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="classTask.html#3a6b331837192d762fcf06b45fd4b609">00236</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#3a6b331837192d762fcf06b45fd4b609" title="Reset all times to 0.">Task::resetTimes</a>()
<a name="l00237"></a>00237 {
<a name="l00238"></a>00238   _totalSessionTime -= _sessionTime;
<a name="l00239"></a>00239   _totalTime -= _time;
<a name="l00240"></a>00240   changeParentTotalTimes( -_sessionTime, -_time);
<a name="l00241"></a>00241   _sessionTime = 0;
<a name="l00242"></a>00242   _time = 0;
<a name="l00243"></a>00243   <a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89" title="Update the display of the task (all columns) in the UI.">update</a>();
<a name="l00244"></a>00244 }
<a name="l00245"></a>00245 
<a name="l00246"></a>00246 <span class="keywordtype">void</span> Task::changeParentTotalTimes( <span class="keywordtype">long</span> minutesSession, <span class="keywordtype">long</span> minutes )
<a name="l00247"></a>00247 {
<a name="l00248"></a>00248   <span class="comment">//kdDebug(5970)</span>
<a name="l00249"></a>00249   <span class="comment">//  &lt;&lt; "Task::changeParentTotalTimes(" &lt;&lt; minutesSession &lt;&lt; ", "</span>
<a name="l00250"></a>00250   <span class="comment">//  &lt;&lt; minutes &lt;&lt; ") for " &lt;&lt; name() &lt;&lt; endl;</span>
<a name="l00251"></a>00251 
<a name="l00252"></a>00252   <span class="keywordflow">if</span> ( <a class="code" href="classTask.html#ca18708f5b4570c5efd2fa01f4170a3b" title="tells you whether this task is the root of the task tree">isRoot</a>() )
<a name="l00253"></a>00253     emit totalTimesChanged( minutesSession, minutes );
<a name="l00254"></a>00254   <span class="keywordflow">else</span>
<a name="l00255"></a>00255     parent()-&gt;<a class="code" href="classTask.html#958864b71ceb9134557fcecd1bb6c7df" title="adds minutes to total and session time">changeTotalTimes</a>( minutesSession, minutes );
<a name="l00256"></a>00256 }
<a name="l00257"></a>00257 
<a name="l00258"></a><a class="code" href="classTask.html#f3c73c4a21db23c5550c4ee25e44164b">00258</a> <span class="keywordtype">bool</span> <a class="code" href="classTask.html#f3c73c4a21db23c5550c4ee25e44164b" title="remove Task with all it&amp;#39;s children">Task::remove</a>( QPtrList&lt;Task&gt;&amp; activeTasks, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage)
<a name="l00259"></a>00259 {
<a name="l00260"></a>00260   kdDebug(5970) &lt;&lt; <span class="stringliteral">"Task::remove: "</span> &lt;&lt; _name &lt;&lt; endl;
<a name="l00261"></a>00261 
<a name="l00262"></a>00262   <span class="keywordtype">bool</span> ok = <span class="keyword">true</span>;
<a name="l00263"></a>00263 
<a name="l00264"></a>00264   _removing = <span class="keyword">true</span>;
<a name="l00265"></a>00265   storage-&gt;<a class="code" href="classKarmStorage.html#602128e1797fa4b69cf86ae2b5b57705" title="Remove this task from iCalendar file.">removeTask</a>(<span class="keyword">this</span>);
<a name="l00266"></a>00266   <span class="keywordflow">if</span>( <a class="code" href="classTask.html#810ac835cff9a3fab9f7c8983a950431" title="return the state of a task - if it&amp;#39;s running or not">isRunning</a>() ) <a class="code" href="classTask.html#6b36fb9311e31d5708ba0755721e8292" title="starts or stops a task">setRunning</a>( <span class="keyword">false</span>, storage );
<a name="l00267"></a>00267 
<a name="l00268"></a>00268   <span class="keywordflow">for</span> (<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* child = this-&gt;<a class="code" href="classTask.html#aaedcc7fa646b15e0451a638ed3fdf63" title="return parent Task or null in case of TaskView.">firstChild</a>(); child; child = child-&gt;<a class="code" href="classTask.html#a7c59fd2c4318c9eac3bf10fb0201422">nextSibling</a>())
<a name="l00269"></a>00269   {
<a name="l00270"></a>00270     <span class="keywordflow">if</span> (child-&gt;isRunning())
<a name="l00271"></a>00271       child-&gt;setRunning(<span class="keyword">false</span>, storage);
<a name="l00272"></a>00272     child-&gt;remove(activeTasks, storage);
<a name="l00273"></a>00273   }
<a name="l00274"></a>00274 
<a name="l00275"></a>00275   changeParentTotalTimes( -_sessionTime, -_time);
<a name="l00276"></a>00276 
<a name="l00277"></a>00277   _removing = <span class="keyword">false</span>;
<a name="l00278"></a>00278 
<a name="l00279"></a>00279   <span class="keywordflow">return</span> ok;
<a name="l00280"></a>00280 }
<a name="l00281"></a>00281 
<a name="l00282"></a><a class="code" href="classTask.html#73851f2e76b40b6c99cfbe02752d8059">00282</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#73851f2e76b40b6c99cfbe02752d8059" title="animate the active icon">Task::updateActiveIcon</a>()
<a name="l00283"></a>00283 {
<a name="l00284"></a>00284   _currentPic = (_currentPic+1) % 8;
<a name="l00285"></a>00285   setPixmap(1, *(*icons)[_currentPic]);
<a name="l00286"></a>00286 }
<a name="l00287"></a>00287 
<a name="l00288"></a><a class="code" href="classTask.html#f7aab51b1dc16e9f650611bce5283b5f">00288</a> QString <a class="code" href="classTask.html#f7aab51b1dc16e9f650611bce5283b5f" title="Returns that task name, prefixed by parent tree up to root.">Task::fullName</a>()<span class="keyword"> const</span>
<a name="l00289"></a>00289 <span class="keyword"></span>{
<a name="l00290"></a>00290   <span class="keywordflow">if</span> (<a class="code" href="classTask.html#ca18708f5b4570c5efd2fa01f4170a3b" title="tells you whether this task is the root of the task tree">isRoot</a>())
<a name="l00291"></a>00291     <span class="keywordflow">return</span> <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>();
<a name="l00292"></a>00292   <span class="keywordflow">else</span>
<a name="l00293"></a>00293     <span class="keywordflow">return</span> parent()-&gt;<a class="code" href="classTask.html#f7aab51b1dc16e9f650611bce5283b5f" title="Returns that task name, prefixed by parent tree up to root.">fullName</a>() + QString::fromLatin1(<span class="stringliteral">"/"</span>) + <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>();
<a name="l00294"></a>00294 }
<a name="l00295"></a>00295 
<a name="l00296"></a><a class="code" href="classTask.html#fe2427b39575f149d4064d4537b61a87">00296</a> KCal::Todo* <a class="code" href="classTask.html#fe2427b39575f149d4064d4537b61a87" title="Load the todo passed in with this tasks info.">Task::asTodo</a>(KCal::Todo* todo)<span class="keyword"> const</span>
<a name="l00297"></a>00297 <span class="keyword"></span>{
<a name="l00298"></a>00298 
<a name="l00299"></a>00299   Q_ASSERT( todo != NULL );
<a name="l00300"></a>00300 
<a name="l00301"></a>00301   kdDebug(5970) &lt;&lt; <span class="stringliteral">"Task::asTodo: name() = '"</span> &lt;&lt; <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>() &lt;&lt; <span class="stringliteral">"'"</span> &lt;&lt; endl;
<a name="l00302"></a>00302   todo-&gt;setSummary( <a class="code" href="classTask.html#e18d2ce750c810aa14033d6c1df99e0d" title="returns the name of this task.">name</a>() );
<a name="l00303"></a>00303 
<a name="l00304"></a>00304   <span class="comment">// Note: if the date start is empty, the KOrganizer GUI will have the</span>
<a name="l00305"></a>00305   <span class="comment">// checkbox blank, but will prefill the todo's starting datetime to the</span>
<a name="l00306"></a>00306   <span class="comment">// time the file is opened.</span>
<a name="l00307"></a>00307   <span class="comment">// todo-&gt;setDtStart( current );</span>
<a name="l00308"></a>00308 
<a name="l00309"></a>00309   todo-&gt;setCustomProperty( kapp-&gt;instanceName(),
<a name="l00310"></a>00310       QCString( <span class="stringliteral">"totalTaskTime"</span> ), QString::number( _time ) );
<a name="l00311"></a>00311   todo-&gt;setCustomProperty( kapp-&gt;instanceName(),
<a name="l00312"></a>00312       QCString( <span class="stringliteral">"totalSessionTime"</span> ), QString::number( _sessionTime) );
<a name="l00313"></a>00313 
<a name="l00314"></a>00314   <span class="keywordflow">if</span> (getDesktopStr().isEmpty())
<a name="l00315"></a>00315     todo-&gt;removeCustomProperty(kapp-&gt;instanceName(), QCString(<span class="stringliteral">"desktopList"</span>));
<a name="l00316"></a>00316   <span class="keywordflow">else</span>
<a name="l00317"></a>00317     todo-&gt;setCustomProperty( kapp-&gt;instanceName(),
<a name="l00318"></a>00318         QCString( <span class="stringliteral">"desktopList"</span> ), getDesktopStr() );
<a name="l00319"></a>00319 
<a name="l00320"></a>00320   todo-&gt;setOrganizer( Preferences::instance()-&gt;userRealName() );
<a name="l00321"></a>00321 
<a name="l00322"></a>00322   todo-&gt;setPercentComplete(_percentcomplete);
<a name="l00323"></a>00323 
<a name="l00324"></a>00324   <span class="keywordflow">return</span> todo;
<a name="l00325"></a>00325 }
<a name="l00326"></a>00326 
<a name="l00327"></a>00327 <span class="keywordtype">bool</span> Task::parseIncidence( KCal::Incidence* incident, <span class="keywordtype">long</span>&amp; minutes,
<a name="l00328"></a>00328     <span class="keywordtype">long</span>&amp; sessionMinutes, QString&amp; name, DesktopList&amp; desktops,
<a name="l00329"></a>00329     <span class="keywordtype">int</span>&amp; percent_complete )
<a name="l00330"></a>00330 {
<a name="l00331"></a>00331   <span class="keywordtype">bool</span> ok;
<a name="l00332"></a>00332 
<a name="l00333"></a>00333   name = incident-&gt;summary();
<a name="l00334"></a>00334   _uid = incident-&gt;uid();
<a name="l00335"></a>00335 
<a name="l00336"></a>00336   _comment = incident-&gt;description();
<a name="l00337"></a>00337 
<a name="l00338"></a>00338   ok = <span class="keyword">false</span>;
<a name="l00339"></a>00339   minutes = incident-&gt;customProperty( kapp-&gt;instanceName(),
<a name="l00340"></a>00340       QCString( <span class="stringliteral">"totalTaskTime"</span> )).toInt( &amp;ok );
<a name="l00341"></a>00341   <span class="keywordflow">if</span> ( !ok )
<a name="l00342"></a>00342     minutes = 0;
<a name="l00343"></a>00343 
<a name="l00344"></a>00344   ok = <span class="keyword">false</span>;
<a name="l00345"></a>00345   sessionMinutes = incident-&gt;customProperty( kapp-&gt;instanceName(),
<a name="l00346"></a>00346       QCString( <span class="stringliteral">"totalSessionTime"</span> )).toInt( &amp;ok );
<a name="l00347"></a>00347   <span class="keywordflow">if</span> ( !ok )
<a name="l00348"></a>00348     sessionMinutes = 0;
<a name="l00349"></a>00349 
<a name="l00350"></a>00350   QString desktopList = incident-&gt;customProperty( kapp-&gt;instanceName(),
<a name="l00351"></a>00351       QCString( <span class="stringliteral">"desktopList"</span> ) );
<a name="l00352"></a>00352   QStringList desktopStrList = QStringList::split( QString::fromLatin1(<span class="stringliteral">","</span>),
<a name="l00353"></a>00353       desktopList );
<a name="l00354"></a>00354   desktops.clear();
<a name="l00355"></a>00355 
<a name="l00356"></a>00356   <span class="keywordflow">for</span> ( QStringList::iterator iter = desktopStrList.begin();
<a name="l00357"></a>00357         iter != desktopStrList.end();
<a name="l00358"></a>00358         ++iter ) {
<a name="l00359"></a>00359     <span class="keywordtype">int</span> desktopInt = (*iter).toInt( &amp;ok );
<a name="l00360"></a>00360     <span class="keywordflow">if</span> ( ok ) {
<a name="l00361"></a>00361       desktops.push_back( desktopInt );
<a name="l00362"></a>00362     }
<a name="l00363"></a>00363   }
<a name="l00364"></a>00364 
<a name="l00365"></a>00365   percent_complete = <span class="keyword">static_cast&lt;</span>KCal::Todo*<span class="keyword">&gt;</span>(incident)-&gt;percentComplete();
<a name="l00366"></a>00366 
<a name="l00367"></a>00367   <span class="comment">//kdDebug(5970) &lt;&lt; "Task::parseIncidence: "</span>
<a name="l00368"></a>00368   <span class="comment">//  &lt;&lt; name &lt;&lt; ", Minutes: " &lt;&lt; minutes</span>
<a name="l00369"></a>00369   <span class="comment">//  &lt;&lt;  ", desktop: " &lt;&lt; desktopList &lt;&lt; endl;</span>
<a name="l00370"></a>00370 
<a name="l00371"></a>00371   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00372"></a>00372 }
<a name="l00373"></a>00373 
<a name="l00374"></a>00374 QString Task::getDesktopStr()<span class="keyword"> const</span>
<a name="l00375"></a>00375 <span class="keyword"></span>{
<a name="l00376"></a>00376   <span class="keywordflow">if</span> ( _desktops.empty() )
<a name="l00377"></a>00377     <span class="keywordflow">return</span> QString();
<a name="l00378"></a>00378 
<a name="l00379"></a>00379   QString desktopstr;
<a name="l00380"></a>00380   <span class="keywordflow">for</span> ( DesktopList::const_iterator iter = _desktops.begin();
<a name="l00381"></a>00381         iter != _desktops.end();
<a name="l00382"></a>00382         ++iter ) {
<a name="l00383"></a>00383     desktopstr += QString::number( *iter ) + QString::fromLatin1( <span class="stringliteral">","</span> );
<a name="l00384"></a>00384   }
<a name="l00385"></a>00385   desktopstr.remove( desktopstr.length() - 1, 1 );
<a name="l00386"></a>00386   <span class="keywordflow">return</span> desktopstr;
<a name="l00387"></a>00387 }
<a name="l00388"></a>00388 
<a name="l00389"></a><a class="code" href="classTask.html#d999ac7a55fc18de3dae5804da154616">00389</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#d999ac7a55fc18de3dae5804da154616" title="cut Task out of parent Task or the TaskView">Task::cut</a>()
<a name="l00390"></a>00390 {
<a name="l00391"></a>00391   <span class="comment">//kdDebug(5970) &lt;&lt; "Task::cut - " &lt;&lt; name() &lt;&lt; endl;</span>
<a name="l00392"></a>00392   changeParentTotalTimes( -_totalSessionTime, -_totalTime);
<a name="l00393"></a>00393   <span class="keywordflow">if</span> ( ! parent())
<a name="l00394"></a>00394     listView()-&gt;takeItem(<span class="keyword">this</span>);
<a name="l00395"></a>00395   <span class="keywordflow">else</span>
<a name="l00396"></a>00396     parent()-&gt;takeItem(<span class="keyword">this</span>);
<a name="l00397"></a>00397 }
<a name="l00398"></a>00398 
<a name="l00399"></a><a class="code" href="classTask.html#c5b97ac4b67457341ee4c9e8b00e74f1">00399</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#c5b97ac4b67457341ee4c9e8b00e74f1" title="cut Task out of parent Task or the TaskView and into the destination Task">Task::move</a>(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* destination)
<a name="l00400"></a>00400 {
<a name="l00401"></a>00401   <a class="code" href="classTask.html#d999ac7a55fc18de3dae5804da154616" title="cut Task out of parent Task or the TaskView">cut</a>();
<a name="l00402"></a>00402   <a class="code" href="classTask.html#d38eca4755860b9e477dd54eb427cb9e" title="insert Task into the destination Task">paste</a>(destination);
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404 
<a name="l00405"></a><a class="code" href="classTask.html#d38eca4755860b9e477dd54eb427cb9e">00405</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#d38eca4755860b9e477dd54eb427cb9e" title="insert Task into the destination Task">Task::paste</a>(<a class="code" href="classTask.html" title="A class representing a task.">Task</a>* destination)
<a name="l00406"></a>00406 {
<a name="l00407"></a>00407   destination-&gt;insertItem(<span class="keyword">this</span>);
<a name="l00408"></a>00408   changeParentTotalTimes( _totalSessionTime, _totalTime);
<a name="l00409"></a>00409 }
<a name="l00410"></a>00410 
<a name="l00411"></a><a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89">00411</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#4ceb4bba9ac808a61e346031a6beac89" title="Update the display of the task (all columns) in the UI.">Task::update</a>()
<a name="l00412"></a>00412 {
<a name="l00413"></a>00413   setText(0, _name);
<a name="l00414"></a>00414   setText(1, formatTime(_sessionTime));
<a name="l00415"></a>00415   setText(2, formatTime(_time));
<a name="l00416"></a>00416   setText(3, formatTime(_totalSessionTime));
<a name="l00417"></a>00417   setText(4, formatTime(_totalTime));
<a name="l00418"></a>00418 }
<a name="l00419"></a>00419 
<a name="l00420"></a><a class="code" href="classTask.html#3bc5347f68d1c44eb5ddff2990c73051">00420</a> <span class="keywordtype">void</span> <a class="code" href="classTask.html#3bc5347f68d1c44eb5ddff2990c73051" title="Add a comment to this task.">Task::addComment</a>( QString <a class="code" href="classTask.html#2a946793a28513235c856bf8766d7dee" title="Retrieve the entire comment for the task.">comment</a>, <a class="code" href="classKarmStorage.html" title="Singleton to store/retrieve KArm data to/from persistent storage.">KarmStorage</a>* storage )
<a name="l00421"></a>00421 {
<a name="l00422"></a>00422   _comment = _comment + QString::fromLatin1(<span class="stringliteral">"\n"</span>) + comment;
<a name="l00423"></a>00423   storage-&gt;<a class="code" href="classKarmStorage.html#851699a706f7f2f98333023547908539" title="Log a new comment for this task.">addComment</a>(<span class="keyword">this</span>, comment);
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 
<a name="l00426"></a><a class="code" href="classTask.html#2a946793a28513235c856bf8766d7dee">00426</a> QString <a class="code" href="classTask.html#2a946793a28513235c856bf8766d7dee" title="Retrieve the entire comment for the task.">Task::comment</a>()<span class="keyword"> const</span>
<a name="l00427"></a>00427 <span class="keyword"></span>{
<a name="l00428"></a>00428   <span class="keywordflow">return</span> _comment;
<a name="l00429"></a>00429 }
<a name="l00430"></a>00430 
<a name="l00431"></a><a class="code" href="classTask.html#47a638f833e2587d50ee9f7a7b32fd07">00431</a> <span class="keywordtype">int</span> <a class="code" href="classTask.html#47a638f833e2587d50ee9f7a7b32fd07" title="Sort times numerically, not alphabetically.">Task::compare</a> ( QListViewItem * i, <span class="keywordtype">int</span> col, <span class="keywordtype">bool</span> ascending )<span class="keyword"> const</span>
<a name="l00432"></a>00432 <span class="keyword"></span>{
<a name="l00433"></a>00433   <span class="keywordtype">long</span> thistime = 0;
<a name="l00434"></a>00434   <span class="keywordtype">long</span> thattime = 0;
<a name="l00435"></a>00435   <a class="code" href="classTask.html" title="A class representing a task.">Task</a> *task = <span class="keyword">static_cast&lt;</span><a class="code" href="classTask.html" title="A class representing a task.">Task</a>*<span class="keyword">&gt;</span>(i);
<a name="l00436"></a>00436 
<a name="l00437"></a>00437   <span class="keywordflow">switch</span> ( col )
<a name="l00438"></a>00438   {
<a name="l00439"></a>00439     <span class="keywordflow">case</span> 1: 
<a name="l00440"></a>00440       thistime = _sessionTime;
<a name="l00441"></a>00441       thattime = task-&gt;<a class="code" href="classTask.html#8234e6992334d4e80388e4918e9948d1">sessionTime</a>();
<a name="l00442"></a>00442       <span class="keywordflow">break</span>;
<a name="l00443"></a>00443     <span class="keywordflow">case</span> 2:
<a name="l00444"></a>00444       thistime = _time;
<a name="l00445"></a>00445       thattime = task-&gt;<a class="code" href="classTask.html#623e46356eb7d8e93ac827130c0d08a5">time</a>();
<a name="l00446"></a>00446       <span class="keywordflow">break</span>;
<a name="l00447"></a>00447     <span class="keywordflow">case</span> 3:
<a name="l00448"></a>00448       thistime = _totalSessionTime;
<a name="l00449"></a>00449       thattime = task-&gt;<a class="code" href="classTask.html#48b06f2ba66c3cfb369427c810688610">totalSessionTime</a>();
<a name="l00450"></a>00450       <span class="keywordflow">break</span>;
<a name="l00451"></a>00451     <span class="keywordflow">case</span> 4:
<a name="l00452"></a>00452       thistime = _totalTime;
<a name="l00453"></a>00453       thattime = task-&gt;<a class="code" href="classTask.html#e36175fb3aebe274f2938b680757f23a">totalTime</a>();
<a name="l00454"></a>00454       <span class="keywordflow">break</span>;
<a name="l00455"></a>00455     <span class="keywordflow">default</span>:
<a name="l00456"></a>00456       <span class="keywordflow">return</span> key(col, ascending).localeAwareCompare( i-&gt;key(col, ascending) );
<a name="l00457"></a>00457   }
<a name="l00458"></a>00458 
<a name="l00459"></a>00459   <span class="keywordflow">if</span> ( thistime &lt; thattime ) <span class="keywordflow">return</span> -1;
<a name="l00460"></a>00460   <span class="keywordflow">if</span> ( thistime &gt; thattime ) <span class="keywordflow">return</span> 1;
<a name="l00461"></a>00461   <span class="keywordflow">return</span> 0;
<a name="l00462"></a>00462 
<a name="l00463"></a>00463 }
<a name="l00464"></a>00464 
<a name="l00465"></a>00465 <span class="preprocessor">#include "task.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>&nbsp;&nbsp;<a href="../../akregator/src/html/index.html">src</a></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li>&nbsp;&nbsp;<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>&nbsp;&nbsp;<a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li>&nbsp;&nbsp;<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="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">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>