You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kshowmail/doc/html/configlist_8cpp-source.html

1056 lines
100 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>kshowmail: kshowmail/configlist.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.0 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul></div>
<div class="nav">
<a class="el" href="dir_656923b733374505e0e2f68ecb68d952.html">kshowmail</a></div>
<h1>configlist.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> configlist.cpp - description</span>
<a name="l00003"></a>00003 <span class="comment"> -------------------</span>
<a name="l00004"></a>00004 <span class="comment"> begin : Tue May 9 2000</span>
<a name="l00005"></a>00005 <span class="comment"> copyright : (C) 2000-2001 by Eggert Ehmke</span>
<a name="l00006"></a>00006 <span class="comment"> email : eggert.ehmke@berlin.de</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment"> 26 Sep 2002 - Allow for columns to be hidden. Allistar Melville</span>
<a name="l00009"></a>00009 <span class="comment"> ***************************************************************************/</span>
<a name="l00010"></a>00010
<a name="l00011"></a>00011 <span class="comment">/***************************************************************************</span>
<a name="l00012"></a>00012 <span class="comment"> * *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span>
<a name="l00014"></a>00014 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span>
<a name="l00015"></a>00015 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span>
<a name="l00016"></a>00016 <span class="comment"> * (at your option) any later version. *</span>
<a name="l00017"></a>00017 <span class="comment"> * *</span>
<a name="l00018"></a>00018 <span class="comment"> ***************************************************************************/</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;qfile.h&gt;</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;kconfig.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;ksavefile.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;kapplication.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;kstandarddirs.h&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;kaudioplayer.h&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="preprocessor">#include "configlist.h"</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include "filter.h"</span>
<a name="l00033"></a>00033
<a name="l00034"></a><a class="code" href="classConfigList.html#457897bbe5bd27799e6f920d4cea2173">00034</a> <a class="code" href="classConfigList.html#457897bbe5bd27799e6f920d4cea2173">ConfigList::ConfigList</a>() : QObject()
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 setAutoDelete (<span class="keyword">true</span>);
<a name="l00037"></a>00037
<a name="l00038"></a>00038 <span class="comment">//assume, no window to show a mail is open at beginning</span>
<a name="l00039"></a>00039 <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> = 0;
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="comment">//set default values</span>
<a name="l00042"></a>00042 <a class="code" href="classConfigList.html#35d80df8b80f34868140a2163d207490">m_bShowMessage</a> = DEFAULT_ACTION_NEW_MAIL_ALERTWINDOW;
<a name="l00043"></a>00043 <a class="code" href="classConfigList.html#b9613ab5f07edb0ef04383867674a5ce">m_bShowMainWindow</a> = DEFAULT_ACTION_NEW_MAIL_MAINWINDOW;
<a name="l00044"></a>00044 <a class="code" href="classConfigList.html#a866f2fd4fb32d49ab99306150d79c50">m_bBeep</a> = DEFAULT_ACTION_NEW_MAIL_BEEP;
<a name="l00045"></a>00045 <a class="code" href="classConfigList.html#a50d4f3ca2c1f7814aec63df25de1811">m_bSound</a> = DEFAULT_ACTION_NEW_MAIL_SOUND;
<a name="l00046"></a>00046 <a class="code" href="classConfigList.html#ae8d4084a4b83a09722015793afb974c">m_bCommand</a> = DEFAULT_ACTION_NEW_MAIL_COMMAND;
<a name="l00047"></a>00047 <a class="code" href="classConfigList.html#f22fd0f8854795662a444bc2b4f8a9b9">m_bMinimize</a> = DEFAULT_ACTION_NO_NEW_MAIL_MINIMIZE;
<a name="l00048"></a>00048 <a class="code" href="classConfigList.html#cdf78356d632253ac463907e526eb26a">m_bTerminate</a> = DEFAULT_ACTION_NO_NEW_MAIL_TERMINATE;
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <a class="code" href="classConfigList.html#80b1f5a036cdaf9054ba57831a0c013e">m_bConfirmClose</a> = DEFAULT_CONFIRM_CLOSE;
<a name="l00051"></a>00051 <a class="code" href="classConfigList.html#8b8d0d0a2d78c9f3ede1db0a9e77f8be">m_bConfirmDelete</a> = DEFAULT_CONFIRM_DELETE;
<a name="l00052"></a>00052 <a class="code" href="classConfigList.html#fb4f1f200303a7e94114a8c4c85eb47e">m_bStartMinimized</a> = DEFAULT_START_MINIMIZED;
<a name="l00053"></a>00053 <a class="code" href="classConfigList.html#da6c14776958a3b28f68797c7feb6c5b">m_bCloseMinimizes</a> = DEFAULT_CLOSE_TO_TRAY;
<a name="l00054"></a>00054 <a class="code" href="classConfigList.html#af4cc3801f229ae974131ef1e000a8cf">m_bMinimizeToTray</a> = DEFAULT_MINIMIZE_TO_TRAY;
<a name="l00055"></a>00055 <a class="code" href="classConfigList.html#1bd48d8596694d5b39e0ead274689010">m_bShowConnectionErrors</a> = DEFAULT_SHOW_CONNECTION_ERRORS;
<a name="l00056"></a>00056 <a class="code" href="classConfigList.html#54c7671d25847b7b16cf71ec61c640d0">m_bKeepNew</a> = DEFAULT_KEEP_NEW;
<a name="l00057"></a>00057 <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a> = DEFAULT_INITIAL_TIME;
<a name="l00058"></a>00058 <a class="code" href="classConfigList.html#b15e5bd9334e36428c5d44b9ee2a97d5">m_nIntervalTimer</a> = DEFAULT_INTERVAL_TIME;
<a name="l00059"></a>00059 <a class="code" href="classConfigList.html#f4a428e650cf89e8ae0df0a2983f96f4">m_nPop3Timer</a> = DEFAULT_TIMEOUT_TIME;
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061
<a name="l00062"></a><a class="code" href="classConfigList.html#8bf1aaa71ff8971369466e5c2a36d27f">00062</a> <span class="keywordtype">int</span> <a class="code" href="classConfigList.html#8bf1aaa71ff8971369466e5c2a36d27f">ConfigList::compareItems</a>( QCollection::Item item1, QCollection::Item item2 )
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064 <a class="code" href="classConfigElem.html">ConfigElem</a>* p1 = (<a class="code" href="classConfigElem.html">ConfigElem</a>*)item1;
<a name="l00065"></a>00065 <a class="code" href="classConfigElem.html">ConfigElem</a>* p2 = (<a class="code" href="classConfigElem.html">ConfigElem</a>*)item2;
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <span class="keywordflow">return</span> strcmp( p1-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>(), p2-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>() );
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069
<a name="l00070"></a><a class="code" href="classConfigList.html#24464fe479402405ee9b849ddcc9c567">00070</a> QCollection::Item <a class="code" href="classConfigList.html#24464fe479402405ee9b849ddcc9c567">ConfigList::newItem</a>( QCollection::Item item )
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classConfigElem.html">ConfigElem</a>( (<a class="code" href="classConfigElem.html">ConfigElem</a>*)item );
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074
<a name="l00075"></a><a class="code" href="classConfigList.html#f4faa44af3bbe318a2623b3146dc2c2d">00075</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#f4faa44af3bbe318a2623b3146dc2c2d">ConfigList::saveOptions</a> ()
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 kdDebug () &lt;&lt; <span class="stringliteral">"ConfigList::saveOptions"</span> &lt;&lt; endl;
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <span class="comment">//create XML document</span>
<a name="l00080"></a>00080 QDomDocument doc( <span class="stringliteral">"KShowmail"</span> );
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <span class="comment">//create root element</span>
<a name="l00083"></a>00083 QDomElement accounts = doc.createElement( ROOT_ELEMENT );
<a name="l00084"></a>00084
<a name="l00085"></a>00085 <span class="comment">//create for every account an element</span>
<a name="l00086"></a>00086 <span class="comment">//the account saves its mails into this element</span>
<a name="l00087"></a>00087 <span class="comment">//after that the element will be appended to the root element</span>
<a name="l00088"></a>00088 <span class="keywordtype">int</span> i = 0;
<a name="l00089"></a>00089 <a class="code" href="classConfigElem.html">ConfigElem</a>* account = NULL; <span class="comment">//current processed account</span>
<a name="l00090"></a>00090 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//iterator for the account list</span>
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="comment">//iterate over all accounts</span>
<a name="l00093"></a>00093 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095 <span class="comment">//increment iterator to next account</span>
<a name="l00096"></a>00096 ++it;
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <span class="comment">//save mails</span>
<a name="l00099"></a>00099 QDomElement accElem = doc.createElement( QString( ACCOUNT_ELEMENT ) + QString( <span class="stringliteral">"%1"</span> ).arg( i++ ) );
<a name="l00100"></a>00100 account-&gt;<a class="code" href="classConfigElem.html#bda433f60b1eed0d4b8d207707d5005c">saveOptions</a>( doc, accElem ); <span class="comment">//account saves the mails into given XML document and the setup into the application config file</span>
<a name="l00101"></a>00101 accounts.appendChild( accElem );
<a name="l00102"></a>00102
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="comment">//append root element to XML document</span>
<a name="l00106"></a>00106 doc.appendChild( accounts );
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <span class="comment">//save XML document</span>
<a name="l00109"></a>00109 QCString str = doc.toCString(); <span class="comment">//convert XML document to a string</span>
<a name="l00110"></a>00110 QString cachefilename = locateLocal( <span class="stringliteral">"config"</span>, <span class="stringliteral">"kshowmail.xml"</span> ); <span class="comment">//get file path</span>
<a name="l00111"></a>00111 KSaveFile file( cachefilename, 0600 ); <span class="comment">//create file</span>
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="keywordflow">if</span>( file.status() != 0 )
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115 kdError() &lt;&lt; <span class="stringliteral">"Couldn't save mail cache. "</span> &lt;&lt; strerror( file.status() );
<a name="l00116"></a>00116 <span class="keywordflow">return</span>;
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118
<a name="l00119"></a>00119 <span class="comment">//write data</span>
<a name="l00120"></a>00120 file.file()-&gt;writeBlock( str.data(), str.length() );
<a name="l00121"></a>00121
<a name="l00122"></a>00122 <span class="comment">//close file</span>
<a name="l00123"></a>00123 <span class="keywordflow">if</span>( !file.close() )
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125 kdError () &lt;&lt; <span class="stringliteral">"Couldn't save mail cache. "</span> &lt;&lt; strerror(file.status());
<a name="l00126"></a>00126 <span class="keywordflow">return</span>;
<a name="l00127"></a>00127 }
<a name="l00128"></a>00128 }
<a name="l00129"></a>00129
<a name="l00130"></a>00130
<a name="l00131"></a><a class="code" href="classConfigList.html#e595f764ea9b38f0634137438bdd4d70">00131</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#e595f764ea9b38f0634137438bdd4d70">ConfigList::setList</a> (QListView* list)
<a name="l00132"></a>00132 {
<a name="l00133"></a>00133 QPixmap pix (::locate (<span class="stringliteral">"data"</span>, <span class="stringliteral">"kshowmail/pics/ok.png"</span>));
<a name="l00134"></a>00134 list-&gt;clear ();
<a name="l00135"></a>00135 <span class="keywordtype">int</span> nIndex = at ();
<a name="l00136"></a>00136 QListViewItem* last = NULL;
<a name="l00137"></a>00137 <span class="keywordflow">for</span> (<a class="code" href="classConfigElem.html">ConfigElem</a>* pElem = first(); pElem; pElem = next())
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139 last = <span class="keyword">new</span> QListViewItem (list, last, <span class="stringliteral">""</span>, pElem-&gt;getAccountName(), pElem-&gt;getURL().host(), pElem-&gt;getURL().user(), <span class="stringliteral">"?"</span>);
<a name="l00140"></a>00140 pElem-&gt;setListViewItem( last );
<a name="l00141"></a>00141 <span class="keywordflow">if</span> (pElem-&gt;isActive())
<a name="l00142"></a>00142 pElem-&gt;getListViewItem()-&gt;setPixmap (0, pix);
<a name="l00143"></a>00143 }
<a name="l00144"></a>00144
<a name="l00145"></a>00145 <span class="keywordflow">if</span> (nIndex &gt;= 0)
<a name="l00146"></a>00146 {
<a name="l00147"></a>00147 at (nIndex);
<a name="l00148"></a>00148 <span class="comment">// list-&gt;setCurrentItem (nIndex);</span>
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151
<a name="l00152"></a>00152
<a name="l00153"></a><a class="code" href="classConfigList.html#633c6c07518ecf2405ad472ab843790f">00153</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#633c6c07518ecf2405ad472ab843790f">ConfigList::setItem</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* item)
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155 <span class="keywordtype">int</span> nPos = at ();
<a name="l00156"></a>00156 <a class="code" href="classConfigElem.html">ConfigElem</a>* pActive = <span class="keyword">new</span> <a class="code" href="classConfigElem.html">ConfigElem</a> (<span class="keyword">this</span>, item);
<a name="l00157"></a>00157 <span class="keywordtype">bool</span> result = (find (pActive) &gt;= 0);
<a name="l00158"></a>00158 <span class="keyword">delete</span> pActive;
<a name="l00159"></a>00159 <span class="keywordflow">if</span> (result)
<a name="l00160"></a>00160 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00161"></a>00161 <span class="keywordflow">else</span>
<a name="l00162"></a>00162 {
<a name="l00163"></a>00163 at (nPos);
<a name="l00164"></a>00164 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167
<a name="l00168"></a><a class="code" href="classConfigList.html#28739bc3cd7ce87dbd7f994081375a41">00168</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#28739bc3cd7ce87dbd7f994081375a41">ConfigList::beep</a> ()
<a name="l00169"></a>00169 {
<a name="l00170"></a>00170 <span class="keywordflow">if</span> (<a class="code" href="classConfigList.html#a866f2fd4fb32d49ab99306150d79c50">m_bBeep</a>)
<a name="l00171"></a>00171 kapp-&gt;beep ();
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173
<a name="l00174"></a><a class="code" href="classConfigList.html#5e7a5e2323ebbbad7d960bae9814ce5d">00174</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#5e7a5e2323ebbbad7d960bae9814ce5d">ConfigList::playSound</a> ()
<a name="l00175"></a>00175 {
<a name="l00176"></a>00176 <span class="keywordflow">if</span> (<a class="code" href="classConfigList.html#a50d4f3ca2c1f7814aec63df25de1811">m_bSound</a>)
<a name="l00177"></a>00177 <a class="code" href="classConfigList.html#5e7a5e2323ebbbad7d960bae9814ce5d">playSound</a> (<a class="code" href="classConfigList.html#be34e6084394fa6fa99422a7cc50d8f0">m_strSoundFile</a>);
<a name="l00178"></a>00178 }
<a name="l00179"></a>00179
<a name="l00180"></a><a class="code" href="classConfigList.html#77c53c4e4120961c2647d4081486aeda">00180</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#5e7a5e2323ebbbad7d960bae9814ce5d">ConfigList::playSound</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* file)
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182 KAudioPlayer::play(file);
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184
<a name="l00185"></a>00185
<a name="l00186"></a><a class="code" href="classConfigList.html#439057b64856d457b9d9a4d9d381509f">00186</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#439057b64856d457b9d9a4d9d381509f">ConfigList::applyFilters</a> ()
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188 <span class="keywordflow">if</span> (<a class="code" href="classFilter.html#13f81ff1452d6cdc1076393813163df5">Filter::_status</a> != Filter::off)
<a name="l00189"></a>00189 {
<a name="l00190"></a>00190 <span class="keywordflow">for</span> (<a class="code" href="classConfigElem.html">ConfigElem</a>* pElem = first(); pElem; pElem = next())
<a name="l00191"></a>00191 {
<a name="l00192"></a>00192 <span class="keywordflow">if</span> (pElem-&gt;isActive() )
<a name="l00193"></a>00193 {
<a name="l00194"></a>00194 pElem-&gt;applyFilters ();
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197 }
<a name="l00198"></a>00198 }
<a name="l00199"></a>00199
<a name="l00200"></a><a class="code" href="classConfigList.html#3e41f463a87fbc8523bbd731cf36b473">00200</a> <span class="keywordtype">int</span> <a class="code" href="classConfigList.html#3e41f463a87fbc8523bbd731cf36b473">ConfigList::getRefreshTimeInterval</a>( )<span class="keyword"> const</span>
<a name="l00201"></a>00201 <span class="keyword"></span>{
<a name="l00202"></a>00202 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#b15e5bd9334e36428c5d44b9ee2a97d5">m_nIntervalTimer</a>;
<a name="l00203"></a>00203 }
<a name="l00204"></a>00204
<a name="l00205"></a><a class="code" href="classConfigList.html#1676756c27b3578802dba1ce47b39dcd">00205</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#1676756c27b3578802dba1ce47b39dcd">ConfigList::setRefreshTimeInterval</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> interval )
<a name="l00206"></a>00206 {
<a name="l00207"></a>00207 <a class="code" href="classConfigList.html#b15e5bd9334e36428c5d44b9ee2a97d5">m_nIntervalTimer</a> = interval;
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209
<a name="l00210"></a><a class="code" href="classConfigList.html#cae6685097cd8e5e63cee28e17d92d41">00210</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#cae6685097cd8e5e63cee28e17d92d41">ConfigList::AutoRefreshOn</a>( )<span class="keyword"> const</span>
<a name="l00211"></a>00211 <span class="keyword"></span>{
<a name="l00212"></a>00212 <span class="keywordflow">return</span> ( <a class="code" href="classConfigList.html#b15e5bd9334e36428c5d44b9ee2a97d5">m_nIntervalTimer</a> &gt; 0 );
<a name="l00213"></a>00213 }
<a name="l00214"></a>00214
<a name="l00215"></a><a class="code" href="classConfigList.html#14b38a4e600859c0b6f3ef38afffc037">00215</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#14b38a4e600859c0b6f3ef38afffc037">ConfigList::hasActiveAccounts</a>( )
<a name="l00216"></a>00216 {
<a name="l00217"></a>00217 <span class="keywordtype">bool</span> activeAccountFound = <span class="keyword">false</span>; <span class="comment">//when a active account was found, this will be set to TRUE</span>
<a name="l00218"></a>00218 <a class="code" href="classConfigElem.html">ConfigElem</a>* currentAccount; <span class="comment">//saved current account</span>
<a name="l00219"></a>00219 <a class="code" href="classConfigElem.html">ConfigElem</a>* Account; <span class="comment">//used by the search</span>
<a name="l00220"></a>00220
<a name="l00221"></a>00221 <span class="comment">//save the current account</span>
<a name="l00222"></a>00222 currentAccount = current();
<a name="l00223"></a>00223
<a name="l00224"></a>00224 <span class="comment">//get the first account</span>
<a name="l00225"></a>00225 Account = first();
<a name="l00226"></a>00226
<a name="l00227"></a>00227 <span class="comment">//looking for an active account</span>
<a name="l00228"></a>00228 <span class="keywordflow">while</span>( Account != NULL &amp;&amp; !activeAccountFound )
<a name="l00229"></a>00229 {
<a name="l00230"></a>00230 <span class="comment">//have we found one?</span>
<a name="l00231"></a>00231 activeAccountFound = Account-&gt;<a class="code" href="classConfigElem.html#9c91fce81b58e9d0d1b37688711e9014">isActive</a>();
<a name="l00232"></a>00232
<a name="l00233"></a>00233 <span class="comment">//get next account</span>
<a name="l00234"></a>00234 Account = next();
<a name="l00235"></a>00235 }
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <span class="comment">//set the saved account to current</span>
<a name="l00238"></a>00238 <span class="keywordflow">if</span>( currentAccount != NULL )
<a name="l00239"></a>00239 findRef( currentAccount );
<a name="l00240"></a>00240
<a name="l00241"></a>00241 <span class="comment">//return the result</span>
<a name="l00242"></a>00242 <span class="keywordflow">return</span> activeAccountFound;
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244
<a name="l00245"></a>00245
<a name="l00246"></a><a class="code" href="classConfigList.html#80a368db22ca3a29c668a544611d16f4">00246</a> uint <a class="code" href="classConfigList.html#80a368db22ca3a29c668a544611d16f4">ConfigList::getTimeoutTime</a>( )<span class="keyword"> const</span>
<a name="l00247"></a>00247 <span class="keyword"></span>{
<a name="l00248"></a>00248 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#f4a428e650cf89e8ae0df0a2983f96f4">m_nPop3Timer</a>;
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250
<a name="l00251"></a><a class="code" href="classConfigList.html#2470bfe4948ada050b08b93cef51b969">00251</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#2470bfe4948ada050b08b93cef51b969">ConfigList::setTimeoutTime</a>( uint time )
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253 <span class="keywordflow">if</span>( time &lt; MINIMUM_TIMEOUT_TIME )
<a name="l00254"></a>00254 <a class="code" href="classConfigList.html#f4a428e650cf89e8ae0df0a2983f96f4">m_nPop3Timer</a> = MINIMUM_TIMEOUT_TIME;
<a name="l00255"></a>00255 <span class="keywordflow">else</span>
<a name="l00256"></a>00256 <a class="code" href="classConfigList.html#f4a428e650cf89e8ae0df0a2983f96f4">m_nPop3Timer</a> = time;
<a name="l00257"></a>00257 }
<a name="l00258"></a>00258
<a name="l00259"></a><a class="code" href="classConfigList.html#83776f91a264d92cea2b6f7ef0c02765">00259</a> <a class="code" href="classConfigElem.html">ConfigElem</a>* <a class="code" href="classConfigList.html#83776f91a264d92cea2b6f7ef0c02765">ConfigList::getSelectedAccount</a>( )
<a name="l00260"></a>00260 {
<a name="l00261"></a>00261 <span class="comment">//get the first account in the list</span>
<a name="l00262"></a>00262 <a class="code" href="classConfigElem.html">ConfigElem</a>* account = first();
<a name="l00263"></a>00263
<a name="l00264"></a>00264 <span class="comment">//return NULL if there are no accounts</span>
<a name="l00265"></a>00265 <span class="keywordflow">if</span>( account == NULL )
<a name="l00266"></a>00266 <span class="keywordflow">return</span> NULL;
<a name="l00267"></a>00267
<a name="l00268"></a>00268 <span class="comment">//return the account, if it is selected</span>
<a name="l00269"></a>00269 <span class="keywordflow">if</span>( account-&gt;<a class="code" href="classConfigElem.html#8e8e1f32420d051a8c6d4df4a3ad4b93">isSelected</a>() )
<a name="l00270"></a>00270 <span class="keywordflow">return</span> account;
<a name="l00271"></a>00271
<a name="l00272"></a>00272 <span class="comment">//iterate over all accounts</span>
<a name="l00273"></a>00273 <span class="keywordtype">bool</span> selectedAccountFound = <span class="keyword">false</span>; <span class="comment">//is TRUE, if a selected account was found</span>
<a name="l00274"></a>00274 <span class="keywordflow">while</span>( account != NULL &amp;&amp; !selectedAccountFound )
<a name="l00275"></a>00275 {
<a name="l00276"></a>00276 <span class="comment">//get next account</span>
<a name="l00277"></a>00277 account = next();
<a name="l00278"></a>00278
<a name="l00279"></a>00279 <span class="comment">//is the account selected?</span>
<a name="l00280"></a>00280 <span class="keywordflow">if</span>( account != NULL )
<a name="l00281"></a>00281 selectedAccountFound = account-&gt;<a class="code" href="classConfigElem.html#8e8e1f32420d051a8c6d4df4a3ad4b93">isSelected</a>();
<a name="l00282"></a>00282 <span class="keywordflow">else</span>
<a name="l00283"></a>00283 selectedAccountFound = <span class="keyword">false</span>;
<a name="l00284"></a>00284 }
<a name="l00285"></a>00285
<a name="l00286"></a>00286 <span class="comment">//return the current account if we have found a selected account</span>
<a name="l00287"></a>00287 <span class="comment">//otherwise return FALSE</span>
<a name="l00288"></a>00288 <span class="keywordflow">if</span>( selectedAccountFound )
<a name="l00289"></a>00289 <span class="keywordflow">return</span> account;
<a name="l00290"></a>00290 <span class="keywordflow">else</span>
<a name="l00291"></a>00291 <span class="keywordflow">return</span> NULL;
<a name="l00292"></a>00292 }
<a name="l00293"></a>00293
<a name="l00294"></a><a class="code" href="classConfigList.html#ac13c19975a07aa87da0047cc66b4ce1">00294</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#ac13c19975a07aa87da0047cc66b4ce1">ConfigList::deleteSelectedMails</a>( )
<a name="l00295"></a>00295 {
<a name="l00296"></a>00296 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00297"></a>00297 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00298"></a>00298
<a name="l00299"></a>00299 <span class="comment">//clear the map, which contains the names of the accounts,</span>
<a name="l00300"></a>00300 <span class="comment">//which have gotten an order to delete</span>
<a name="l00301"></a>00301 <a class="code" href="classConfigList.html#bc124e934246f773aeab03b5f0940f01">AccountDeletionMap</a>.clear();
<a name="l00302"></a>00302
<a name="l00303"></a>00303 <span class="comment">//refresh connects</span>
<a name="l00304"></a>00304 <a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">connectAccounts</a>();
<a name="l00305"></a>00305
<a name="l00306"></a>00306 <span class="comment">//inserts an item for every account which will get an order to delete</span>
<a name="l00307"></a>00307 <span class="comment">//its selected mails. The key is the account name and the data is TRUE.</span>
<a name="l00308"></a>00308 <span class="comment">//it is important to do this in a seperate iteration because this avoids</span>
<a name="l00309"></a>00309 <span class="comment">//race conditions</span>
<a name="l00310"></a>00310 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00311"></a>00311 {
<a name="l00312"></a>00312 <span class="comment">//insert item</span>
<a name="l00313"></a>00313 <a class="code" href="classConfigList.html#bc124e934246f773aeab03b5f0940f01">AccountDeletionMap</a>.insert( account-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>(), true );
<a name="l00314"></a>00314
<a name="l00315"></a>00315 <span class="comment">//get next account</span>
<a name="l00316"></a>00316 ++it;
<a name="l00317"></a>00317 }
<a name="l00318"></a>00318
<a name="l00319"></a>00319 <span class="comment">//order all accounts to delete its selected mail</span>
<a name="l00320"></a>00320 it.toFirst();
<a name="l00321"></a>00321 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00322"></a>00322 {
<a name="l00323"></a>00323 account-&gt;<a class="code" href="classConfigElem.html#750ccb3fb3f7d1857b79f7218f5a0767">deleteSelectedMails</a>();
<a name="l00324"></a>00324
<a name="l00325"></a>00325 <span class="comment">//get next account</span>
<a name="l00326"></a>00326 ++it;
<a name="l00327"></a>00327 }
<a name="l00328"></a>00328 }
<a name="l00329"></a>00329
<a name="l00330"></a><a class="code" href="classConfigList.html#f8495aff41becdac4998b0c2881cccde">00330</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#f8495aff41becdac4998b0c2881cccde">ConfigList::slotAccountConfigChanged</a>( )
<a name="l00331"></a>00331 {
<a name="l00332"></a>00332 emit <a class="code" href="classConfigList.html#9b5c13b885ba99acefb6bcb81f54b563">sigConfigChanged</a>();
<a name="l00333"></a>00333 }
<a name="l00334"></a>00334
<a name="l00335"></a><a class="code" href="classConfigList.html#640d6202cfb38c449e95906e7581693b">00335</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#640d6202cfb38c449e95906e7581693b">ConfigList::slotCheckDeletionState</a>( QString account )
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337 <span class="keywordtype">bool</span> accountDeleting = <span class="keyword">false</span>; <span class="comment">//set to TRUE if an account is still deleting</span>
<a name="l00338"></a>00338 AccountTaskMap_Type::Iterator it; <span class="comment">//iterator over the account deletion map</span>
<a name="l00339"></a>00339
<a name="l00340"></a>00340 <span class="comment">//set the appropriate item in AccountDeletionMap to FALSE</span>
<a name="l00341"></a>00341 <a class="code" href="classConfigList.html#bc124e934246f773aeab03b5f0940f01">AccountDeletionMap</a>[ account ] = <span class="keyword">false</span>;
<a name="l00342"></a>00342
<a name="l00343"></a>00343 <span class="comment">//iterate over the account deletion map to check, whether all accounts</span>
<a name="l00344"></a>00344 <span class="comment">//are ready</span>
<a name="l00345"></a>00345 <span class="keywordflow">for</span> ( it = <a class="code" href="classConfigList.html#bc124e934246f773aeab03b5f0940f01">AccountDeletionMap</a>.begin(); it != <a class="code" href="classConfigList.html#bc124e934246f773aeab03b5f0940f01">AccountDeletionMap</a>.end(); ++it )
<a name="l00346"></a>00346 {
<a name="l00347"></a>00347 <span class="keywordflow">if</span>( *it == <span class="keyword">true</span> )
<a name="l00348"></a>00348 accountDeleting = <span class="keyword">true</span>;
<a name="l00349"></a>00349 }
<a name="l00350"></a>00350
<a name="l00351"></a>00351 <span class="comment">//emit sigDeleteReady if all accounts are ready</span>
<a name="l00352"></a>00352 <span class="keywordflow">if</span>( !accountDeleting )
<a name="l00353"></a>00353 emit <a class="code" href="classConfigList.html#6d5f55c7447fc52efd5800daeb8302dc">sigDeleteReady</a>();
<a name="l00354"></a>00354 }
<a name="l00355"></a>00355
<a name="l00356"></a><a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">00356</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">ConfigList::connectAccounts</a>( )
<a name="l00357"></a>00357 {
<a name="l00358"></a>00358 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00359"></a>00359 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to connect</span>
<a name="l00360"></a>00360
<a name="l00361"></a>00361 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00362"></a>00362 {
<a name="l00363"></a>00363 <span class="comment">//disconnect old connections</span>
<a name="l00364"></a>00364 account-&gt;disconnect();
<a name="l00365"></a>00365
<a name="l00366"></a>00366 <span class="comment">//connect</span>
<a name="l00367"></a>00367 connect( account, SIGNAL( <a class="code" href="classConfigList.html#9b5c13b885ba99acefb6bcb81f54b563">sigConfigChanged</a>() ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#f8495aff41becdac4998b0c2881cccde">slotAccountConfigChanged</a>() ) );
<a name="l00368"></a>00368 connect( account, SIGNAL( <a class="code" href="classConfigList.html#6d5f55c7447fc52efd5800daeb8302dc">sigDeleteReady</a>( QString ) ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#640d6202cfb38c449e95906e7581693b">slotCheckDeletionState</a>( QString ) ) );
<a name="l00369"></a>00369 connect( account, SIGNAL( <a class="code" href="classConfigList.html#4df89bc3cd1da72c4404cbe6fe1f10d1">sigShowBodiesReady</a>( QString ) ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#bdbf21b25f8e963e5c32d167aff1fe16">slotCheckShowBodiesState</a>( QString ) ) );
<a name="l00370"></a>00370 connect( account, SIGNAL( <a class="code" href="classConfigList.html#4e33dcc16368960e9a41dca3bb878360">sigMessageWindowOpened</a>() ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#1ffbc4bf4ef66872162065b80a248b7a">slotMessageWindowOpened</a>() ) );
<a name="l00371"></a>00371 connect( account, SIGNAL( sigMessageWindowClosed() ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#6a9cc47ba150c0923b558752f118ec6c">slotMessageWindowClosed</a>() ) );
<a name="l00372"></a>00372 connect( account, SIGNAL( <a class="code" href="classConfigList.html#cd0d056e66a4c054306dca9936b9d5da">sigRefreshReady</a>( QString ) ), <span class="keyword">this</span>, SLOT( <a class="code" href="classConfigList.html#beaa15863a4aae563a8539d176067f79">slotCheckRefreshState</a>( QString ) ) );
<a name="l00373"></a>00373
<a name="l00374"></a>00374 <span class="comment">//get next account</span>
<a name="l00375"></a>00375 ++it;
<a name="l00376"></a>00376 }
<a name="l00377"></a>00377 }
<a name="l00378"></a>00378
<a name="l00379"></a><a class="code" href="classConfigList.html#5f798d2e62d3d8d013e3b2f54d51e94e">00379</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#5f798d2e62d3d8d013e3b2f54d51e94e">ConfigList::setConfirmDeletion</a>( <span class="keywordtype">bool</span> confirm )
<a name="l00380"></a>00380 {
<a name="l00381"></a>00381 <a class="code" href="classConfigList.html#8b8d0d0a2d78c9f3ede1db0a9e77f8be">m_bConfirmDelete</a> = confirm;
<a name="l00382"></a>00382 }
<a name="l00383"></a>00383
<a name="l00384"></a><a class="code" href="classConfigList.html#a466577c54fec821ff484a378ce32e98">00384</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#a466577c54fec821ff484a378ce32e98">ConfigList::confirmDeletion</a>( )
<a name="l00385"></a>00385 {
<a name="l00386"></a>00386 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#8b8d0d0a2d78c9f3ede1db0a9e77f8be">m_bConfirmDelete</a>;
<a name="l00387"></a>00387 }
<a name="l00388"></a>00388
<a name="l00389"></a><a class="code" href="classConfigList.html#d489b548662d865fe34686507dc801ef">00389</a> QStringList <a class="code" href="classConfigList.html#d489b548662d865fe34686507dc801ef">ConfigList::getSelectedSubjects</a>( )<span class="keyword"> const</span>
<a name="l00390"></a>00390 <span class="keyword"></span>{
<a name="l00391"></a>00391 QStringList subjects; <span class="comment">//contains all subjects</span>
<a name="l00392"></a>00392 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00393"></a>00393 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//current account</span>
<a name="l00394"></a>00394
<a name="l00395"></a>00395 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00396"></a>00396 {
<a name="l00397"></a>00397 <span class="comment">//get subjects of the current account and append them to the list</span>
<a name="l00398"></a>00398 subjects += account-&gt;<a class="code" href="classConfigElem.html#93c5c182878b9809188933046e04a998">getSelectedSubjects</a>();
<a name="l00399"></a>00399
<a name="l00400"></a>00400 <span class="comment">//get next account</span>
<a name="l00401"></a>00401 ++it;
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403
<a name="l00404"></a>00404 <span class="keywordflow">return</span> subjects;
<a name="l00405"></a>00405 }
<a name="l00406"></a>00406
<a name="l00407"></a><a class="code" href="classConfigList.html#d80765bfadbd675b9b89ebdec0cf3566">00407</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#d80765bfadbd675b9b89ebdec0cf3566">ConfigList::hasSelectedMails</a>( )
<a name="l00408"></a>00408 {
<a name="l00409"></a>00409 <span class="keywordtype">bool</span> foundSelected = <span class="keyword">false</span>; <span class="comment">//set to TRUE, when an account with selected mails was found</span>
<a name="l00410"></a>00410 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00411"></a>00411 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//current account</span>
<a name="l00412"></a>00412
<a name="l00413"></a>00413 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL &amp;&amp; !foundSelected )
<a name="l00414"></a>00414 {
<a name="l00415"></a>00415 foundSelected = account-&gt;<a class="code" href="classConfigElem.html#748ec06f6ad44f36143389bb9501a1f7">hasSelectedMails</a>();
<a name="l00416"></a>00416
<a name="l00417"></a>00417 <span class="comment">//get next account</span>
<a name="l00418"></a>00418 ++it;
<a name="l00419"></a>00419 }
<a name="l00420"></a>00420
<a name="l00421"></a>00421 <span class="keywordflow">return</span> foundSelected;
<a name="l00422"></a>00422
<a name="l00423"></a>00423 }
<a name="l00424"></a>00424
<a name="l00425"></a><a class="code" href="classConfigList.html#69be8d63f8363fe9c727ebdaeb9eb7fa">00425</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#69be8d63f8363fe9c727ebdaeb9eb7fa">ConfigList::showSelectedMails</a>( )
<a name="l00426"></a>00426 {
<a name="l00427"></a>00427 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00428"></a>00428 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00429"></a>00429
<a name="l00430"></a>00430 <span class="comment">//clear the map, which contains the names of the accounts,</span>
<a name="l00431"></a>00431 <span class="comment">//which have gotten an order to show mails</span>
<a name="l00432"></a>00432 <a class="code" href="classConfigList.html#6fcc9096444b71e03865ac2402bb0d23">AccountShowBodiesMap</a>.clear();
<a name="l00433"></a>00433
<a name="l00434"></a>00434 <span class="comment">//refresh connects</span>
<a name="l00435"></a>00435 <a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">connectAccounts</a>();
<a name="l00436"></a>00436
<a name="l00437"></a>00437 <span class="comment">//inserts an item for every account which will get an order to show</span>
<a name="l00438"></a>00438 <span class="comment">//its selected mails. The key is the account name and the data is TRUE.</span>
<a name="l00439"></a>00439 <span class="comment">//it is important to do this in a seperate iteration because this avoids</span>
<a name="l00440"></a>00440 <span class="comment">//race conditions</span>
<a name="l00441"></a>00441 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00442"></a>00442 {
<a name="l00443"></a>00443 <span class="comment">//insert item</span>
<a name="l00444"></a>00444 <a class="code" href="classConfigList.html#6fcc9096444b71e03865ac2402bb0d23">AccountShowBodiesMap</a>.insert( account-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>(), true );
<a name="l00445"></a>00445
<a name="l00446"></a>00446 <span class="comment">//get next account</span>
<a name="l00447"></a>00447 ++it;
<a name="l00448"></a>00448 }
<a name="l00449"></a>00449
<a name="l00450"></a>00450 <span class="comment">//order all accounts to show its selected mail</span>
<a name="l00451"></a>00451 it.toFirst();
<a name="l00452"></a>00452 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00453"></a>00453 {
<a name="l00454"></a>00454 account-&gt;<a class="code" href="classConfigElem.html#01e5735260c23f43480d807e7e9070c9">showSelectedMails</a>();
<a name="l00455"></a>00455
<a name="l00456"></a>00456 <span class="comment">//get next account</span>
<a name="l00457"></a>00457 ++it;
<a name="l00458"></a>00458 }
<a name="l00459"></a>00459
<a name="l00460"></a>00460 }
<a name="l00461"></a>00461
<a name="l00462"></a><a class="code" href="classConfigList.html#bdbf21b25f8e963e5c32d167aff1fe16">00462</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#bdbf21b25f8e963e5c32d167aff1fe16">ConfigList::slotCheckShowBodiesState</a>( QString account )
<a name="l00463"></a>00463 {
<a name="l00464"></a>00464 <span class="keywordtype">bool</span> accountDownloading = <span class="keyword">false</span>; <span class="comment">//set to TRUE if an account is downloading mail body yet</span>
<a name="l00465"></a>00465 AccountTaskMap_Type::Iterator it; <span class="comment">//iterator over the account map</span>
<a name="l00466"></a>00466
<a name="l00467"></a>00467 <span class="comment">//set the appropriate item in AccountShowBodiesMap to FALSE</span>
<a name="l00468"></a>00468 <a class="code" href="classConfigList.html#6fcc9096444b71e03865ac2402bb0d23">AccountShowBodiesMap</a>[ account ] = <span class="keyword">false</span>;
<a name="l00469"></a>00469
<a name="l00470"></a>00470 <span class="comment">//iterate over the account map to check, whether all accounts</span>
<a name="l00471"></a>00471 <span class="comment">//are ready</span>
<a name="l00472"></a>00472 <span class="keywordflow">for</span> ( it = <a class="code" href="classConfigList.html#6fcc9096444b71e03865ac2402bb0d23">AccountShowBodiesMap</a>.begin(); it != <a class="code" href="classConfigList.html#6fcc9096444b71e03865ac2402bb0d23">AccountShowBodiesMap</a>.end(); ++it )
<a name="l00473"></a>00473 {
<a name="l00474"></a>00474 <span class="keywordflow">if</span>( *it == <span class="keyword">true</span> )
<a name="l00475"></a>00475 accountDownloading = <span class="keyword">true</span>;
<a name="l00476"></a>00476 }
<a name="l00477"></a>00477
<a name="l00478"></a>00478 <span class="comment">//emit sigShowBodiesReady if all accounts are ready</span>
<a name="l00479"></a>00479 <span class="comment">//and assume all windows to show the mails are closed</span>
<a name="l00480"></a>00480 <span class="keywordflow">if</span>( !accountDownloading )
<a name="l00481"></a>00481 {
<a name="l00482"></a>00482 emit <a class="code" href="classConfigList.html#4df89bc3cd1da72c4404cbe6fe1f10d1">sigShowBodiesReady</a>();
<a name="l00483"></a>00483 <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> = 0;
<a name="l00484"></a>00484 }
<a name="l00485"></a>00485 }
<a name="l00486"></a>00486
<a name="l00487"></a><a class="code" href="classConfigList.html#9f3341f60b7f800b58f50e67c1f872b4">00487</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#9f3341f60b7f800b58f50e67c1f872b4">ConfigList::setAllowHTML</a>( <span class="keywordtype">bool</span> allowHTML )
<a name="l00488"></a>00488 {
<a name="l00489"></a>00489 <a class="code" href="classConfigList.html#017597159dc4b62d147aade09140e942">m_bAllowHTML</a> = allowHTML;
<a name="l00490"></a>00490 }
<a name="l00491"></a>00491
<a name="l00492"></a><a class="code" href="classConfigList.html#4cd09107151c848fafe17db0c8e9a4a6">00492</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#4cd09107151c848fafe17db0c8e9a4a6">ConfigList::allowHTML</a>( )<span class="keyword"> const</span>
<a name="l00493"></a>00493 <span class="keyword"></span>{
<a name="l00494"></a>00494 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#017597159dc4b62d147aade09140e942">m_bAllowHTML</a>;
<a name="l00495"></a>00495 }
<a name="l00496"></a>00496
<a name="l00497"></a><a class="code" href="classConfigList.html#1ffbc4bf4ef66872162065b80a248b7a">00497</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#1ffbc4bf4ef66872162065b80a248b7a">ConfigList::slotMessageWindowOpened</a>( )
<a name="l00498"></a>00498 {
<a name="l00499"></a>00499 <span class="comment">//increment the window counter</span>
<a name="l00500"></a>00500 <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a>++;
<a name="l00501"></a>00501
<a name="l00502"></a>00502 <span class="comment">//if the counter was incremented from zero</span>
<a name="l00503"></a>00503 <span class="comment">//(the first window was opened), emit the</span>
<a name="l00504"></a>00504 <span class="comment">//signal</span>
<a name="l00505"></a>00505 <span class="keywordflow">if</span>( <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> == 1 )
<a name="l00506"></a>00506 emit <a class="code" href="classConfigList.html#4e33dcc16368960e9a41dca3bb878360">sigMessageWindowOpened</a>();
<a name="l00507"></a>00507 }
<a name="l00508"></a>00508
<a name="l00509"></a><a class="code" href="classConfigList.html#6a9cc47ba150c0923b558752f118ec6c">00509</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#6a9cc47ba150c0923b558752f118ec6c">ConfigList::slotMessageWindowClosed</a>( )
<a name="l00510"></a>00510 {
<a name="l00511"></a>00511 <span class="comment">//decrement the window counter</span>
<a name="l00512"></a>00512 <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a>--;
<a name="l00513"></a>00513 <span class="keywordflow">if</span>( <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> &lt; 0 )
<a name="l00514"></a>00514 <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> = 0;
<a name="l00515"></a>00515
<a name="l00516"></a>00516 <span class="comment">//if counter is zero (all windows was closed),</span>
<a name="l00517"></a>00517 <span class="comment">//emit signal</span>
<a name="l00518"></a>00518 <span class="keywordflow">if</span>( <a class="code" href="classConfigList.html#6a3a4e9a8428c350a53bbf7b39f27e39">ctrOpenMessageWindows</a> == 0 )
<a name="l00519"></a>00519 emit <a class="code" href="classConfigList.html#6cc47a8e403bad408356604c0888c292">sigAllMessageWindowsClosed</a>();
<a name="l00520"></a>00520 }
<a name="l00521"></a>00521
<a name="l00522"></a><a class="code" href="classConfigList.html#563ce9fd520ec23325c3b7797ed6d0f1">00522</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#563ce9fd520ec23325c3b7797ed6d0f1">ConfigList::refreshMailLists</a>( )
<a name="l00523"></a>00523 {
<a name="l00524"></a>00524 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00525"></a>00525 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00526"></a>00526
<a name="l00527"></a>00527 <span class="comment">//return, if no accounts available</span>
<a name="l00528"></a>00528 <span class="keywordflow">if</span>( count() == 0 )
<a name="l00529"></a>00529 {
<a name="l00530"></a>00530 emit <a class="code" href="classConfigList.html#cd0d056e66a4c054306dca9936b9d5da">sigRefreshReady</a>();
<a name="l00531"></a>00531 <span class="keywordflow">return</span>;
<a name="l00532"></a>00532 }
<a name="l00533"></a>00533
<a name="l00534"></a>00534 <span class="comment">//clear the map, which contains the names of the accounts,</span>
<a name="l00535"></a>00535 <span class="comment">//which have gotten an order to show mails</span>
<a name="l00536"></a>00536 <a class="code" href="classConfigList.html#9c266b75b6629ff8f850ac9b9a2a8a08">AccountRefreshMap</a>.clear();
<a name="l00537"></a>00537
<a name="l00538"></a>00538 <span class="comment">//refresh connects</span>
<a name="l00539"></a>00539 <a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">connectAccounts</a>();
<a name="l00540"></a>00540
<a name="l00541"></a>00541 <span class="comment">//inserts an item for every account which will get an order to refresh</span>
<a name="l00542"></a>00542 <span class="comment">//its mail list. The key is the account name and the data is TRUE.</span>
<a name="l00543"></a>00543 <span class="comment">//it is important to do this in a seperate iteration because this avoids</span>
<a name="l00544"></a>00544 <span class="comment">//race conditions</span>
<a name="l00545"></a>00545 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00546"></a>00546 {
<a name="l00547"></a>00547 <span class="comment">//insert item</span>
<a name="l00548"></a>00548 <a class="code" href="classConfigList.html#9c266b75b6629ff8f850ac9b9a2a8a08">AccountRefreshMap</a>.insert( account-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>(), true );
<a name="l00549"></a>00549
<a name="l00550"></a>00550 <span class="comment">//get next account</span>
<a name="l00551"></a>00551 ++it;
<a name="l00552"></a>00552 }
<a name="l00553"></a>00553
<a name="l00554"></a>00554 <span class="comment">//order all accounts to refresh their mail lists</span>
<a name="l00555"></a>00555 it.toFirst();
<a name="l00556"></a>00556 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00557"></a>00557 {
<a name="l00558"></a>00558 account-&gt;<a class="code" href="classConfigElem.html#5a687317c6470c06111b176056c2a81e">refreshMailList</a>();
<a name="l00559"></a>00559
<a name="l00560"></a>00560 <span class="comment">//get next account</span>
<a name="l00561"></a>00561 ++it;
<a name="l00562"></a>00562 }
<a name="l00563"></a>00563
<a name="l00564"></a>00564 }
<a name="l00565"></a>00565
<a name="l00566"></a><a class="code" href="classConfigList.html#beaa15863a4aae563a8539d176067f79">00566</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#beaa15863a4aae563a8539d176067f79">ConfigList::slotCheckRefreshState</a>( QString account )
<a name="l00567"></a>00567 {
<a name="l00568"></a>00568 <span class="keywordtype">bool</span> accountRefreshing = <span class="keyword">false</span>; <span class="comment">//set to TRUE if an account is still refreshing</span>
<a name="l00569"></a>00569 AccountTaskMap_Type::Iterator it; <span class="comment">//iterator over the account map</span>
<a name="l00570"></a>00570
<a name="l00571"></a>00571 <span class="comment">//set the appropriate item in AccountRefreshMap to FALSE</span>
<a name="l00572"></a>00572 <a class="code" href="classConfigList.html#9c266b75b6629ff8f850ac9b9a2a8a08">AccountRefreshMap</a>[ account ] = <span class="keyword">false</span>;
<a name="l00573"></a>00573
<a name="l00574"></a>00574 <span class="comment">//iterate over the account map to check whether all accounts</span>
<a name="l00575"></a>00575 <span class="comment">//are ready</span>
<a name="l00576"></a>00576 <span class="keywordflow">for</span> ( it = <a class="code" href="classConfigList.html#9c266b75b6629ff8f850ac9b9a2a8a08">AccountRefreshMap</a>.begin(); it != <a class="code" href="classConfigList.html#9c266b75b6629ff8f850ac9b9a2a8a08">AccountRefreshMap</a>.end(); ++it )
<a name="l00577"></a>00577 {
<a name="l00578"></a>00578 <span class="keywordflow">if</span>( *it == <span class="keyword">true</span> )
<a name="l00579"></a>00579 accountRefreshing = <span class="keyword">true</span>;
<a name="l00580"></a>00580 }
<a name="l00581"></a>00581
<a name="l00582"></a>00582 <span class="comment">//emit sigRefreshReady if all accounts are ready</span>
<a name="l00583"></a>00583 <span class="keywordflow">if</span>( !accountRefreshing )
<a name="l00584"></a>00584 {
<a name="l00585"></a>00585 emit <a class="code" href="classConfigList.html#cd0d056e66a4c054306dca9936b9d5da">sigRefreshReady</a>();
<a name="l00586"></a>00586 }
<a name="l00587"></a>00587
<a name="l00588"></a>00588 }
<a name="l00589"></a>00589
<a name="l00590"></a><a class="code" href="classConfigList.html#c68944845fe63749fc073947fbdd44d6">00590</a> <span class="keywordtype">int</span> <a class="code" href="classConfigList.html#c68944845fe63749fc073947fbdd44d6">ConfigList::getNumberNewMails</a>( )
<a name="l00591"></a>00591 {
<a name="l00592"></a>00592 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00593"></a>00593 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00594"></a>00594 <span class="keywordtype">int</span> number = 0; <span class="comment">//number of new mails</span>
<a name="l00595"></a>00595
<a name="l00596"></a>00596 <span class="comment">//iterate over all accounts and sum up the number of new mails</span>
<a name="l00597"></a>00597 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00598"></a>00598 {
<a name="l00599"></a>00599 number += account-&gt;<a class="code" href="classConfigElem.html#2725f96acd936fd8a9008d6ddf04ba76">getNumberNewMails</a>();
<a name="l00600"></a>00600
<a name="l00601"></a>00601 <span class="comment">//get next account</span>
<a name="l00602"></a>00602 ++it;
<a name="l00603"></a>00603 }
<a name="l00604"></a>00604
<a name="l00605"></a>00605 <span class="keywordflow">return</span> number;
<a name="l00606"></a>00606 }
<a name="l00607"></a>00607
<a name="l00608"></a><a class="code" href="classConfigList.html#493eec8637f0f34fb25e13d07b6d838a">00608</a> <span class="keywordtype">int</span> <a class="code" href="classConfigList.html#493eec8637f0f34fb25e13d07b6d838a">ConfigList::getNumberMails</a>( )
<a name="l00609"></a>00609 {
<a name="l00610"></a>00610 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00611"></a>00611 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00612"></a>00612 <span class="keywordtype">int</span> number = 0; <span class="comment">//number of mails</span>
<a name="l00613"></a>00613
<a name="l00614"></a>00614 <span class="comment">//iterate over all accounts and sum up the number of mails</span>
<a name="l00615"></a>00615 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00616"></a>00616 {
<a name="l00617"></a>00617 number += account-&gt;<a class="code" href="classConfigElem.html#c072d6241f981b1e0ffffb63a0a52250">getNumberMails</a>();
<a name="l00618"></a>00618
<a name="l00619"></a>00619 <span class="comment">//get next account</span>
<a name="l00620"></a>00620 ++it;
<a name="l00621"></a>00621 }
<a name="l00622"></a>00622
<a name="l00623"></a>00623 <span class="keywordflow">return</span> number;
<a name="l00624"></a>00624 }
<a name="l00625"></a>00625
<a name="l00626"></a><a class="code" href="classConfigList.html#2e6d8a00456ca4b61ddba18ab419dd38">00626</a> <span class="keywordtype">long</span> <a class="code" href="classConfigList.html#2e6d8a00456ca4b61ddba18ab419dd38">ConfigList::getTotalSize</a>( )
<a name="l00627"></a>00627 {
<a name="l00628"></a>00628 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00629"></a>00629 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00630"></a>00630 <span class="keywordtype">long</span> size = 0; <span class="comment">//total size of all mails</span>
<a name="l00631"></a>00631
<a name="l00632"></a>00632 <span class="comment">//iterate over all accounts and sum up the size of all mails</span>
<a name="l00633"></a>00633 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00634"></a>00634 {
<a name="l00635"></a>00635 size += account-&gt;<a class="code" href="classConfigElem.html#bb71d58016499cd57784e60efee37b0f">getTotalSize</a>();
<a name="l00636"></a>00636
<a name="l00637"></a>00637 <span class="comment">//get next account</span>
<a name="l00638"></a>00638 ++it;
<a name="l00639"></a>00639 }
<a name="l00640"></a>00640
<a name="l00641"></a>00641 <span class="keywordflow">return</span> size;
<a name="l00642"></a>00642 }
<a name="l00643"></a>00643
<a name="l00644"></a><a class="code" href="classConfigList.html#1db2530c553952aef3c23483dd6b6567">00644</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#1db2530c553952aef3c23483dd6b6567">ConfigList::fillMailListView</a>( <a class="code" href="classKshowmailView.html">KshowmailView</a> * view )
<a name="l00645"></a>00645 {
<a name="l00646"></a>00646 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00647"></a>00647 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00648"></a>00648
<a name="l00649"></a>00649 <span class="comment">//iterate over all accounts and order the active accounts to fill their mails</span>
<a name="l00650"></a>00650 <span class="comment">//into the list view</span>
<a name="l00651"></a>00651 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00652"></a>00652 {
<a name="l00653"></a>00653 <span class="keywordflow">if</span>( account-&gt;<a class="code" href="classConfigElem.html#9c91fce81b58e9d0d1b37688711e9014">isActive</a>() )
<a name="l00654"></a>00654 account-&gt;<a class="code" href="classConfigElem.html#365bd67f2ec657beaf98ded2463b61a2">fillMailListView</a>( view );
<a name="l00655"></a>00655
<a name="l00656"></a>00656 <span class="comment">//get next account</span>
<a name="l00657"></a>00657 ++it;
<a name="l00658"></a>00658 }
<a name="l00659"></a>00659
<a name="l00660"></a>00660 }
<a name="l00661"></a>00661
<a name="l00662"></a><a class="code" href="classConfigList.html#b4021a1f9087d447649a362d8779ec34">00662</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#b4021a1f9087d447649a362d8779ec34">ConfigList::showMainWindowForNewMails</a>( )
<a name="l00663"></a>00663 {
<a name="l00664"></a>00664 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#b9613ab5f07edb0ef04383867674a5ce">m_bShowMainWindow</a>;
<a name="l00665"></a>00665 }
<a name="l00666"></a>00666
<a name="l00667"></a><a class="code" href="classConfigList.html#2270af8a5ce1740958f0f0b39359051f">00667</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#2270af8a5ce1740958f0f0b39359051f">ConfigList::showAlertMessageForNewMails</a>( )
<a name="l00668"></a>00668 {
<a name="l00669"></a>00669 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#35d80df8b80f34868140a2163d207490">m_bShowMessage</a>;
<a name="l00670"></a>00670 }
<a name="l00671"></a>00671
<a name="l00672"></a><a class="code" href="classConfigList.html#e24d2fa3175996ba24faa1ed1efcf35a">00672</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#e24d2fa3175996ba24faa1ed1efcf35a">ConfigList::quitNoNewMails</a>( )
<a name="l00673"></a>00673 {
<a name="l00674"></a>00674 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#cdf78356d632253ac463907e526eb26a">m_bTerminate</a>;
<a name="l00675"></a>00675 }
<a name="l00676"></a>00676
<a name="l00677"></a><a class="code" href="classConfigList.html#94f99e48dfcc902ef18ea7310f395beb">00677</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#94f99e48dfcc902ef18ea7310f395beb">ConfigList::minimizeMainWindowNoNewMails</a>( )
<a name="l00678"></a>00678 {
<a name="l00679"></a>00679 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#f22fd0f8854795662a444bc2b4f8a9b9">m_bMinimize</a>;
<a name="l00680"></a>00680 }
<a name="l00681"></a>00681
<a name="l00682"></a><a class="code" href="classConfigList.html#3b74518a8dc0aff55be667276bc4597b">00682</a> <span class="keywordtype">int</span> <a class="code" href="classConfigList.html#3b74518a8dc0aff55be667276bc4597b">ConfigList::getInitTime</a>( )
<a name="l00683"></a>00683 {
<a name="l00684"></a>00684 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a>;
<a name="l00685"></a>00685 }
<a name="l00686"></a>00686
<a name="l00687"></a><a class="code" href="classConfigList.html#c40250ce119d3e6f75b32b296ffaa36c">00687</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#c40250ce119d3e6f75b32b296ffaa36c">ConfigList::setInitTime</a>( <span class="keywordtype">int</span> time )
<a name="l00688"></a>00688 {
<a name="l00689"></a>00689 <span class="keywordflow">if</span>( time &gt;= 0 )
<a name="l00690"></a>00690 <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a> = time;
<a name="l00691"></a>00691 <span class="keywordflow">else</span>
<a name="l00692"></a>00692 <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a> = 0;
<a name="l00693"></a>00693 }
<a name="l00694"></a>00694
<a name="l00695"></a><a class="code" href="classConfigList.html#ed405d97a4a1d20cac93bf2a23cf40bf">00695</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#ed405d97a4a1d20cac93bf2a23cf40bf">ConfigList::hasInitTime</a>( )
<a name="l00696"></a>00696 {
<a name="l00697"></a>00697 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a> &gt; 0;
<a name="l00698"></a>00698 }
<a name="l00699"></a>00699
<a name="l00700"></a><a class="code" href="classConfigList.html#b3d5530c7419f6aa4b43e4247f3036a5">00700</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#b3d5530c7419f6aa4b43e4247f3036a5">ConfigList::refreshAccountList</a>( )
<a name="l00701"></a>00701 {
<a name="l00702"></a>00702 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00703"></a>00703 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00704"></a>00704
<a name="l00705"></a>00705 <span class="comment">//iterate over all accounts and order the account to refresh its</span>
<a name="l00706"></a>00706 <span class="comment">//account list view item</span>
<a name="l00707"></a>00707 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00708"></a>00708 {
<a name="l00709"></a>00709 account-&gt;<a class="code" href="classConfigElem.html#3a709da00728e100343bfde8aac61491">refreshAccountListItem</a>();
<a name="l00710"></a>00710
<a name="l00711"></a>00711 <span class="comment">//get next account</span>
<a name="l00712"></a>00712 ++it;
<a name="l00713"></a>00713 }
<a name="l00714"></a>00714
<a name="l00715"></a>00715 }
<a name="l00716"></a>00716
<a name="l00717"></a><a class="code" href="classConfigList.html#3c7523934753f98f3087ed4083df3ab2">00717</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#3c7523934753f98f3087ed4083df3ab2">ConfigList::killPOP3Jobs</a>( )
<a name="l00718"></a>00718 {
<a name="l00719"></a>00719 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00720"></a>00720 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00721"></a>00721
<a name="l00722"></a>00722 <span class="comment">//iterate over all accounts and order the account to kill</span>
<a name="l00723"></a>00723 <span class="comment">//a running pop3 job</span>
<a name="l00724"></a>00724 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00725"></a>00725 {
<a name="l00726"></a>00726 account-&gt;<a class="code" href="classConfigElem.html#be79ff49926793b27e8af8b5101c7b70">killPOP3Job</a>();
<a name="l00727"></a>00727
<a name="l00728"></a>00728 <span class="comment">//get next account</span>
<a name="l00729"></a>00729 ++it;
<a name="l00730"></a>00730 }
<a name="l00731"></a>00731 }
<a name="l00732"></a>00732
<a name="l00733"></a><a class="code" href="classConfigList.html#9578f65f771482e727dfb3e1da861aa3">00733</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#9578f65f771482e727dfb3e1da861aa3">ConfigList::showSelectedHeaders</a>( )
<a name="l00734"></a>00734 {
<a name="l00735"></a>00735 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//to iterate over all accounts</span>
<a name="l00736"></a>00736 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account to process</span>
<a name="l00737"></a>00737 <span class="keywordtype">int</span> showNextHeader = <a class="code" href="classConfigElem.html#8dc234323fe966a322ae8649bc2cd76e">ConfigElem::continueShowHeaders</a>; <span class="comment">//return value of ConfigElem::showSelectedHeaders</span>
<a name="l00738"></a>00738
<a name="l00739"></a>00739 <span class="comment">//iterate over all accounts and order the account to show</span>
<a name="l00740"></a>00740 <span class="comment">//the headers of all selected mails.</span>
<a name="l00741"></a>00741 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL &amp;&amp; showNextHeader == <a class="code" href="classConfigElem.html#8dc234323fe966a322ae8649bc2cd76e">ConfigElem::continueShowHeaders</a> )
<a name="l00742"></a>00742 {
<a name="l00743"></a>00743 <span class="keywordflow">if</span>( account-&gt;<a class="code" href="classConfigElem.html#748ec06f6ad44f36143389bb9501a1f7">hasSelectedMails</a>() )
<a name="l00744"></a>00744 showNextHeader = account-&gt;<a class="code" href="classConfigElem.html#0725bb36943ca6fd1ca82af5ef6913a3">showSelectedHeaders</a>();
<a name="l00745"></a>00745
<a name="l00746"></a>00746 <span class="comment">//get next account</span>
<a name="l00747"></a>00747 ++it;
<a name="l00748"></a>00748 }
<a name="l00749"></a>00749 }
<a name="l00750"></a>00750
<a name="l00751"></a><a class="code" href="classConfigList.html#8ab66c254c66635f97df7e17882b4ab2">00751</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#8ab66c254c66635f97df7e17882b4ab2">ConfigList::refreshSetup</a>( KListView* view )
<a name="l00752"></a>00752 {
<a name="l00753"></a>00753 <span class="comment">//get application config object (kshowmailrc)</span>
<a name="l00754"></a>00754 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a> = KApplication::kApplication()-&gt;config();
<a name="l00755"></a>00755
<a name="l00756"></a>00756 <span class="comment">//read actions group</span>
<a name="l00757"></a>00757 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;setGroup( CONFIG_GROUP_ACTIONS );
<a name="l00758"></a>00758
<a name="l00759"></a>00759 <a class="code" href="classConfigList.html#35d80df8b80f34868140a2163d207490">m_bShowMessage</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NEW_MAIL_ALERTWINDOW, DEFAULT_ACTION_NEW_MAIL_ALERTWINDOW );
<a name="l00760"></a>00760 <a class="code" href="classConfigList.html#b9613ab5f07edb0ef04383867674a5ce">m_bShowMainWindow</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NEW_MAIL_MAINWINDOW, DEFAULT_ACTION_NEW_MAIL_MAINWINDOW );
<a name="l00761"></a>00761 <a class="code" href="classConfigList.html#a866f2fd4fb32d49ab99306150d79c50">m_bBeep</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NEW_MAIL_BEEP, DEFAULT_ACTION_NEW_MAIL_BEEP );
<a name="l00762"></a>00762 <a class="code" href="classConfigList.html#a50d4f3ca2c1f7814aec63df25de1811">m_bSound</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NEW_MAIL_SOUND, DEFAULT_ACTION_NEW_MAIL_SOUND );
<a name="l00763"></a>00763 <a class="code" href="classConfigList.html#be34e6084394fa6fa99422a7cc50d8f0">m_strSoundFile</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_NEW_MAIL_SOUNDPATH );
<a name="l00764"></a>00764 <a class="code" href="classConfigList.html#ae8d4084a4b83a09722015793afb974c">m_bCommand</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NEW_MAIL_COMMAND, DEFAULT_ACTION_NEW_MAIL_COMMAND );
<a name="l00765"></a>00765 <a class="code" href="classConfigList.html#ea53a55a83d06cb76e3e686dd29ca034">m_strCommandPath</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_NEW_MAIL_COMMANDPATH );
<a name="l00766"></a>00766 <a class="code" href="classConfigList.html#f22fd0f8854795662a444bc2b4f8a9b9">m_bMinimize</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NO_NEW_MAIL_MINIMIZE, DEFAULT_ACTION_NO_NEW_MAIL_MINIMIZE );
<a name="l00767"></a>00767 <a class="code" href="classConfigList.html#cdf78356d632253ac463907e526eb26a">m_bTerminate</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_NO_NEW_MAIL_TERMINATE, DEFAULT_ACTION_NO_NEW_MAIL_TERMINATE );
<a name="l00768"></a>00768
<a name="l00769"></a>00769 <span class="comment">//read general group</span>
<a name="l00770"></a>00770 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;setGroup( CONFIG_GROUP_GENERAL );
<a name="l00771"></a>00771 <a class="code" href="classConfigList.html#80b1f5a036cdaf9054ba57831a0c013e">m_bConfirmClose</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_CONFIRM_CLOSE, DEFAULT_CONFIRM_CLOSE );
<a name="l00772"></a>00772 <a class="code" href="classConfigList.html#8b8d0d0a2d78c9f3ede1db0a9e77f8be">m_bConfirmDelete</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_CONFIRM_DELETE, DEFAULT_CONFIRM_DELETE );
<a name="l00773"></a>00773 <a class="code" href="classConfigList.html#fb4f1f200303a7e94114a8c4c85eb47e">m_bStartMinimized</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_START_MINIMIZED, DEFAULT_START_MINIMIZED );
<a name="l00774"></a>00774 <a class="code" href="classConfigList.html#da6c14776958a3b28f68797c7feb6c5b">m_bCloseMinimizes</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_CLOSE_TO_TRAY, DEFAULT_CLOSE_TO_TRAY );
<a name="l00775"></a>00775 <a class="code" href="classConfigList.html#af4cc3801f229ae974131ef1e000a8cf">m_bMinimizeToTray</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_MINIMIZE_TO_TRAY, DEFAULT_MINIMIZE_TO_TRAY );
<a name="l00776"></a>00776 <a class="code" href="classConfigList.html#1bd48d8596694d5b39e0ead274689010">m_bShowConnectionErrors</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_SHOW_CONNECTION_ERRORS, DEFAULT_SHOW_CONNECTION_ERRORS );
<a name="l00777"></a>00777 <a class="code" href="classConfigList.html#54c7671d25847b7b16cf71ec61c640d0">m_bKeepNew</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_KEEP_NEW, DEFAULT_KEEP_NEW );
<a name="l00778"></a>00778
<a name="l00779"></a>00779 <a class="code" href="classConfigList.html#872222b57b257e2ba67cf360dffc2a1b">m_nInitTimer</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readNumEntry( CONFIG_ENTRY_INITIAL_TIME, DEFAULT_INITIAL_TIME );
<a name="l00780"></a>00780 <a class="code" href="classConfigList.html#b15e5bd9334e36428c5d44b9ee2a97d5">m_nIntervalTimer</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readNumEntry( CONFIG_ENTRY_INTERVAL_TIME, DEFAULT_INTERVAL_TIME);
<a name="l00781"></a>00781 <a class="code" href="classConfigList.html#f4a428e650cf89e8ae0df0a2983f96f4">m_nPop3Timer</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readNumEntry( CONFIG_ENTRY_TIMEOUT_TIME, DEFAULT_TIMEOUT_TIME );
<a name="l00782"></a>00782
<a name="l00783"></a>00783 <span class="comment">//read display group</span>
<a name="l00784"></a>00784 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;setGroup( CONFIG_GROUP_VIEW );
<a name="l00785"></a>00785 <a class="code" href="classConfigList.html#017597159dc4b62d147aade09140e942">m_bAllowHTML</a> = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_VIEW_USE_HTML, DEFAULT_VIEW_USE_HTML );
<a name="l00786"></a>00786
<a name="l00787"></a>00787 <span class="comment">//read account configuration and setup accounts</span>
<a name="l00788"></a>00788 <span class="comment">//---------------------------------------------</span>
<a name="l00789"></a>00789
<a name="l00790"></a>00790 <span class="comment">//get account names from the config file</span>
<a name="l00791"></a>00791 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;setGroup( CONFIG_GROUP_ACCOUNTS );
<a name="l00792"></a>00792 QStringList accounts = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readListEntry( CONFIG_ENTRY_ACCOUNTS_LIST, QStringList() );
<a name="l00793"></a>00793
<a name="l00794"></a>00794 <span class="comment">//remove deleted accounts from the account list</span>
<a name="l00795"></a>00795 <span class="comment">//accounts are deleted, if the are in ConfigList yet, but not in the list of the config file (accounts)</span>
<a name="l00796"></a>00796 <a class="code" href="classConfigElem.html">ConfigElem</a>* accountDel = NULL; <span class="comment">//current processed account</span>
<a name="l00797"></a>00797 QPtrListIterator&lt;ConfigElem&gt; iter( *<span class="keyword">this</span> ); <span class="comment">//iterator for the account list (ConfigList)</span>
<a name="l00798"></a>00798
<a name="l00799"></a>00799 <span class="comment">//iterate over all accounts (ConfigList)</span>
<a name="l00800"></a>00800 <span class="keywordflow">while</span>( ( accountDel = iter.current() ) != NULL )
<a name="l00801"></a>00801 {
<a name="l00802"></a>00802 <span class="comment">//increment iterator to get next account</span>
<a name="l00803"></a>00803 ++iter;
<a name="l00804"></a>00804
<a name="l00805"></a>00805 <span class="comment">//search for the current account in the account list of the config file</span>
<a name="l00806"></a>00806 QStringList::Iterator foundAccount = accounts.find( accountDel-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>() );
<a name="l00807"></a>00807
<a name="l00808"></a>00808 <span class="comment">//remove account from ConfigList, if it is not in the list of the config file</span>
<a name="l00809"></a>00809 <span class="keywordflow">if</span>( foundAccount == accounts.end() )
<a name="l00810"></a>00810 remove( accountDel );
<a name="l00811"></a>00811 }
<a name="l00812"></a>00812
<a name="l00813"></a>00813 <span class="comment">//add or edit accounts</span>
<a name="l00814"></a>00814 <a class="code" href="classConfigElem.html">ConfigElem</a>* acc;
<a name="l00815"></a>00815 <span class="comment">//iterate over all items of the account list of the config file</span>
<a name="l00816"></a>00816 <span class="keywordflow">for</span>( QStringList::Iterator it = accounts.begin(); it != accounts.end(); ++it )
<a name="l00817"></a>00817 {
<a name="l00818"></a>00818 <span class="comment">//create a new account, if it is not in the list yet (ConfigList)</span>
<a name="l00819"></a>00819 <span class="comment">//or get the account</span>
<a name="l00820"></a>00820 <span class="keywordflow">if</span>( !<a class="code" href="classConfigList.html#47d7852e47d047dc7c00ad76715aa4df">hasAccount</a>( *it ) )
<a name="l00821"></a>00821 {
<a name="l00822"></a>00822 <span class="comment">//create new account</span>
<a name="l00823"></a>00823 acc = <span class="keyword">new</span> <a class="code" href="classConfigElem.html">ConfigElem</a>( <span class="keyword">this</span>, *it );
<a name="l00824"></a>00824 inSort( acc );
<a name="l00825"></a>00825
<a name="l00826"></a>00826 <span class="comment">//the pointer list inserts a copy of the new account object</span>
<a name="l00827"></a>00827 <span class="comment">//we have to delete the original</span>
<a name="l00828"></a>00828 <span class="keyword">delete</span> acc;
<a name="l00829"></a>00829 }
<a name="l00830"></a>00830
<a name="l00831"></a>00831 <span class="comment">//get account from ConfigList</span>
<a name="l00832"></a>00832 acc = <a class="code" href="classConfigList.html#f5155dad83daf4956ebfb09f6ebd50c6">getAccount</a>( *it );
<a name="l00833"></a>00833
<a name="l00834"></a>00834 <span class="comment">//get the setup of the account from the config file and setup the account</span>
<a name="l00835"></a>00835 <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;setGroup( *it );
<a name="l00836"></a>00836
<a name="l00837"></a>00837 acc-&gt;<a class="code" href="classConfigElem.html#cf56636bf7537e7f5dbc1a762b4670d2">setHost</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_ACCOUNT_SERVER, DEFAULT_ACCOUNT_SERVER ) );
<a name="l00838"></a>00838 acc-&gt;<a class="code" href="classConfigElem.html#103236b06a88a8d14b629170df1a7ca9">setProtocol</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_ACCOUNT_PROTOCOL, DEFAULT_ACCOUNT_PROTOCOL ).lower() );
<a name="l00839"></a>00839 acc-&gt;<a class="code" href="classConfigElem.html#cc66eba0b4fbf308cddad0478f20ef0f">setPort</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readNumEntry( CONFIG_ENTRY_ACCOUNT_PORT, DEFAULT_ACCOUNT_PORT_POP3 ) );
<a name="l00840"></a>00840 acc-&gt;<a class="code" href="classConfigElem.html#856ca37e391329be6b06f8be2f0a1f74">setUser</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_ACCOUNT_USER, DEFAULT_ACCOUNT_USER ) );
<a name="l00841"></a>00841 acc-&gt;<a class="code" href="classConfigElem.html#4a5aa6b86e56403fa453c9d642b71812">setActive</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readBoolEntry( CONFIG_ENTRY_ACCOUNT_ACTIVE, DEFAULT_ACCOUNT_ACTIVE ) );
<a name="l00842"></a>00842 <span class="keywordtype">int</span> StorageType = <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readNumEntry( CONFIG_ENTRY_ACCOUNT_PASSWORD_STORAGE, DEFAULT_ACCOUNT_PASSWORD_STORAGE );
<a name="l00843"></a>00843
<a name="l00844"></a>00844 <span class="keywordflow">switch</span>( StorageType )
<a name="l00845"></a>00845 {
<a name="l00846"></a>00846 <span class="keywordflow">case</span> CONFIG_VALUE_ACCOUNT_PASSWORD_DONT_SAVE:
<a name="l00847"></a>00847 acc-&gt;<a class="code" href="classConfigElem.html#58f9d269bd389c52718d78d7615c4431">setPasswordStorage</a>( CONFIG_VALUE_ACCOUNT_PASSWORD_DONT_SAVE );
<a name="l00848"></a>00848 acc-&gt;<a class="code" href="classConfigElem.html#6edf15369f3e906a04dff0b92f5b3c2d">setPassword</a>( QString::null );
<a name="l00849"></a>00849 <span class="keywordflow">break</span>;
<a name="l00850"></a>00850
<a name="l00851"></a>00851 <span class="keywordflow">case</span> CONFIG_VALUE_ACCOUNT_PASSWORD_SAVE_FILE:
<a name="l00852"></a>00852 acc-&gt;<a class="code" href="classConfigElem.html#58f9d269bd389c52718d78d7615c4431">setPasswordStorage</a>( CONFIG_VALUE_ACCOUNT_PASSWORD_SAVE_FILE );
<a name="l00853"></a>00853 acc-&gt;<a class="code" href="classConfigElem.html#6edf15369f3e906a04dff0b92f5b3c2d">setPassword</a>( <a class="code" href="namespaceEncryption.html#df6ae41daa3eebed6cc7a74a37936981">Encryption::decrypt</a>( <a class="code" href="classConfigList.html#4bed3e796400897fbffd3eb19e4ff296">config</a>-&gt;readEntry( CONFIG_ENTRY_ACCOUNT_PASSWORD, DEFAULT_ACCOUNT_PASSWORD ) ) );
<a name="l00854"></a>00854 <span class="keywordflow">break</span>;
<a name="l00855"></a>00855
<a name="l00856"></a>00856 <span class="keywordflow">case</span> CONFIG_VALUE_ACCOUNT_PASSWORD_SAVE_KWALLET:
<a name="l00857"></a>00857 acc-&gt;<a class="code" href="classConfigElem.html#58f9d269bd389c52718d78d7615c4431">setPasswordStorage</a>( CONFIG_VALUE_ACCOUNT_PASSWORD_SAVE_KWALLET );
<a name="l00858"></a>00858 acc-&gt;<a class="code" href="classConfigElem.html#6edf15369f3e906a04dff0b92f5b3c2d">setPassword</a>( <a class="code" href="namespaceKWalletAccess.html#2ce179e4ef9e2a06990252aca555b2fa">KWalletAccess::getPassword</a>( *it ) );
<a name="l00859"></a>00859 <span class="keywordflow">break</span>;
<a name="l00860"></a>00860
<a name="l00861"></a>00861 <span class="keywordflow">default</span>:
<a name="l00862"></a>00862 acc-&gt;<a class="code" href="classConfigElem.html#58f9d269bd389c52718d78d7615c4431">setPasswordStorage</a>( DEFAULT_ACCOUNT_PASSWORD_STORAGE );
<a name="l00863"></a>00863 acc-&gt;<a class="code" href="classConfigElem.html#6edf15369f3e906a04dff0b92f5b3c2d">setPassword</a>( QString::null );
<a name="l00864"></a>00864 }
<a name="l00865"></a>00865
<a name="l00866"></a>00866 }
<a name="l00867"></a>00867
<a name="l00868"></a>00868 <span class="comment">//connect the signals of the accounts with ConfigList</span>
<a name="l00869"></a>00869 <a class="code" href="classConfigList.html#ea02d4502c51afab1e50f9fabd36a722">connectAccounts</a>();
<a name="l00870"></a>00870
<a name="l00871"></a>00871 <span class="comment">//refresh account list view</span>
<a name="l00872"></a>00872 <a class="code" href="classConfigList.html#e595f764ea9b38f0634137438bdd4d70">setList</a>( view );
<a name="l00873"></a>00873 }
<a name="l00874"></a>00874
<a name="l00875"></a><a class="code" href="classConfigList.html#01cf49eac83ba56d1f9b3fbaa6bf4648">00875</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#01cf49eac83ba56d1f9b3fbaa6bf4648">ConfigList::executeNewMailCommand</a>( )
<a name="l00876"></a>00876 {
<a name="l00877"></a>00877 <span class="keywordflow">if</span>( <a class="code" href="classConfigList.html#ae8d4084a4b83a09722015793afb974c">m_bCommand</a> )
<a name="l00878"></a>00878 {
<a name="l00879"></a>00879 <span class="keywordflow">if</span>( <a class="code" href="classConfigList.html#ea53a55a83d06cb76e3e686dd29ca034">m_strCommandPath</a> != QString::null &amp;&amp; <a class="code" href="classConfigList.html#ea53a55a83d06cb76e3e686dd29ca034">m_strCommandPath</a> != <span class="stringliteral">""</span> )
<a name="l00880"></a>00880 {
<a name="l00881"></a>00881 KShellProcess proc; <span class="comment">//process handler to execute the binary</span>
<a name="l00882"></a>00882
<a name="l00883"></a>00883 proc &lt;&lt; <a class="code" href="classConfigList.html#ea53a55a83d06cb76e3e686dd29ca034">m_strCommandPath</a>;
<a name="l00884"></a>00884
<a name="l00885"></a>00885 proc.start( KShellProcess::DontCare );
<a name="l00886"></a>00886 }
<a name="l00887"></a>00887 }
<a name="l00888"></a>00888 }
<a name="l00889"></a>00889
<a name="l00890"></a><a class="code" href="classConfigList.html#49a20af219bc1a4f20e50b59b6f2310c">00890</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#49a20af219bc1a4f20e50b59b6f2310c">ConfigList::keepNew</a>( )
<a name="l00891"></a>00891 {
<a name="l00892"></a>00892 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#54c7671d25847b7b16cf71ec61c640d0">m_bKeepNew</a>;
<a name="l00893"></a>00893 }
<a name="l00894"></a>00894
<a name="l00895"></a><a class="code" href="classConfigList.html#4886c3988fef0e227cd03af094b21415">00895</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#4886c3988fef0e227cd03af094b21415">ConfigList::confirmClose</a>( )<span class="keyword"> const</span>
<a name="l00896"></a>00896 <span class="keyword"></span>{
<a name="l00897"></a>00897 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#80b1f5a036cdaf9054ba57831a0c013e">m_bConfirmClose</a>;
<a name="l00898"></a>00898 }
<a name="l00899"></a>00899
<a name="l00900"></a><a class="code" href="classConfigList.html#6b5567437e81508f071d31acb4509994">00900</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#6b5567437e81508f071d31acb4509994">ConfigList::startMinimized</a>( )<span class="keyword"> const</span>
<a name="l00901"></a>00901 <span class="keyword"></span>{
<a name="l00902"></a>00902 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#fb4f1f200303a7e94114a8c4c85eb47e">m_bStartMinimized</a>;
<a name="l00903"></a>00903 }
<a name="l00904"></a>00904
<a name="l00905"></a><a class="code" href="classConfigList.html#fa610dea65deb4e7e26c01926e740e84">00905</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#fa610dea65deb4e7e26c01926e740e84">ConfigList::closeToTray</a>( )<span class="keyword"> const</span>
<a name="l00906"></a>00906 <span class="keyword"></span>{
<a name="l00907"></a>00907 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#da6c14776958a3b28f68797c7feb6c5b">m_bCloseMinimizes</a>;
<a name="l00908"></a>00908 }
<a name="l00909"></a>00909
<a name="l00910"></a><a class="code" href="classConfigList.html#c64e08e3c1469622763dd462612a83ca">00910</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#c64e08e3c1469622763dd462612a83ca">ConfigList::minimizesToTray</a>( )<span class="keyword"> const</span>
<a name="l00911"></a>00911 <span class="keyword"></span>{
<a name="l00912"></a>00912 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#af4cc3801f229ae974131ef1e000a8cf">m_bMinimizeToTray</a>;
<a name="l00913"></a>00913 }
<a name="l00914"></a>00914
<a name="l00915"></a><a class="code" href="classConfigList.html#04033fd5903daf6b1286891a2c7a228c">00915</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#04033fd5903daf6b1286891a2c7a228c">ConfigList::showConnectionErrors</a>( )<span class="keyword"> const</span>
<a name="l00916"></a>00916 <span class="keyword"></span>{
<a name="l00917"></a>00917 <span class="keywordflow">return</span> <a class="code" href="classConfigList.html#1bd48d8596694d5b39e0ead274689010">m_bShowConnectionErrors</a>;
<a name="l00918"></a>00918 }
<a name="l00919"></a>00919
<a name="l00920"></a><a class="code" href="classConfigList.html#47d7852e47d047dc7c00ad76715aa4df">00920</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigList.html#47d7852e47d047dc7c00ad76715aa4df">ConfigList::hasAccount</a>( <span class="keyword">const</span> QString &amp; name )<span class="keyword"> const</span>
<a name="l00921"></a>00921 <span class="keyword"></span>{
<a name="l00922"></a>00922 <span class="keywordtype">bool</span> found = <span class="keyword">false</span>; <span class="comment">//TRUE if we have found the given account</span>
<a name="l00923"></a>00923 <a class="code" href="classConfigElem.html">ConfigElem</a>* account; <span class="comment">//account from which we want to get its name</span>
<a name="l00924"></a>00924 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//iterator for the account list</span>
<a name="l00925"></a>00925
<a name="l00926"></a>00926 <span class="comment">//iterate over all accounts</span>
<a name="l00927"></a>00927 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL &amp;&amp; !found )
<a name="l00928"></a>00928 {
<a name="l00929"></a>00929 <span class="comment">//increment iterator to next account</span>
<a name="l00930"></a>00930 ++it;
<a name="l00931"></a>00931
<a name="l00932"></a>00932 <span class="comment">//if current account is the searched one set found to TRUE</span>
<a name="l00933"></a>00933 <span class="keywordflow">if</span>( account-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>() == name )
<a name="l00934"></a>00934 found = <span class="keyword">true</span>;
<a name="l00935"></a>00935 }
<a name="l00936"></a>00936
<a name="l00937"></a>00937 <span class="keywordflow">return</span> found;
<a name="l00938"></a>00938 }
<a name="l00939"></a>00939
<a name="l00940"></a><a class="code" href="classConfigList.html#f5155dad83daf4956ebfb09f6ebd50c6">00940</a> <a class="code" href="classConfigElem.html">ConfigElem</a> * <a class="code" href="classConfigList.html#f5155dad83daf4956ebfb09f6ebd50c6">ConfigList::getAccount</a>( <span class="keyword">const</span> QString &amp; name )<span class="keyword"> const</span>
<a name="l00941"></a>00941 <span class="keyword"></span>{
<a name="l00942"></a>00942 <span class="keywordtype">bool</span> found = <span class="keyword">false</span>; <span class="comment">//TRUE if we have found the given account</span>
<a name="l00943"></a>00943 <a class="code" href="classConfigElem.html">ConfigElem</a>* account = NULL; <span class="comment">//account from which we want to get its name</span>
<a name="l00944"></a>00944 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//iterator for the account list</span>
<a name="l00945"></a>00945 <a class="code" href="classConfigElem.html">ConfigElem</a>* returnValue = NULL;
<a name="l00946"></a>00946
<a name="l00947"></a>00947 <span class="comment">//iterate over all accounts</span>
<a name="l00948"></a>00948 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL &amp;&amp; !found )
<a name="l00949"></a>00949 {
<a name="l00950"></a>00950 <span class="comment">//increment iterator to next account</span>
<a name="l00951"></a>00951 ++it;
<a name="l00952"></a>00952
<a name="l00953"></a>00953 <span class="comment">//if current account is the searched one set found to TRUE</span>
<a name="l00954"></a>00954 <span class="keywordflow">if</span>( account-&gt;<a class="code" href="classConfigElem.html#760e18ad688d55cd76bfeeb4958df769">getAccountName</a>() == name )
<a name="l00955"></a>00955 {
<a name="l00956"></a>00956 found = <span class="keyword">true</span>;
<a name="l00957"></a>00957 returnValue = account;
<a name="l00958"></a>00958 }
<a name="l00959"></a>00959 }
<a name="l00960"></a>00960
<a name="l00961"></a>00961 <span class="keywordflow">return</span> returnValue;
<a name="l00962"></a>00962 }
<a name="l00963"></a>00963
<a name="l00964"></a><a class="code" href="classConfigList.html#ac706ab3763709422de0ccfa91db7776">00964</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#ac706ab3763709422de0ccfa91db7776">ConfigList::printSetup</a>( )
<a name="l00965"></a>00965 {
<a name="l00966"></a>00966 <a class="code" href="classConfigElem.html">ConfigElem</a>* account = NULL; <span class="comment">//account from which we want to print the setup</span>
<a name="l00967"></a>00967 QPtrListIterator&lt;ConfigElem&gt; it( *<span class="keyword">this</span> ); <span class="comment">//iterator for the account list</span>
<a name="l00968"></a>00968
<a name="l00969"></a>00969 <span class="comment">//iterate over all accounts</span>
<a name="l00970"></a>00970 <span class="keywordflow">while</span>( ( account = it.current() ) != NULL )
<a name="l00971"></a>00971 {
<a name="l00972"></a>00972 <span class="comment">//increment iterator to next account</span>
<a name="l00973"></a>00973 ++it;
<a name="l00974"></a>00974
<a name="l00975"></a>00975 <span class="comment">//print setup</span>
<a name="l00976"></a>00976 account-&gt;<a class="code" href="classConfigElem.html#46e0d578a0c537e8d13ad689044f1fe7">printSetup</a>();
<a name="l00977"></a>00977 }
<a name="l00978"></a>00978 }
<a name="l00979"></a>00979
<a name="l00980"></a><a class="code" href="classConfigList.html#18b093749b6a474b68a4c2bfe952d65c">00980</a> <span class="keywordtype">void</span> <a class="code" href="classConfigList.html#18b093749b6a474b68a4c2bfe952d65c">ConfigList::readStoredMails</a>( )
<a name="l00981"></a>00981 {
<a name="l00982"></a>00982 <span class="comment">//open file</span>
<a name="l00983"></a>00983 QString MailFileName = locateLocal( <span class="stringliteral">"config"</span>, MAIL_FILE );
<a name="l00984"></a>00984 QFile file( MailFileName );
<a name="l00985"></a>00985 <span class="keywordtype">bool</span> fileOpen = file.open( IO_ReadOnly );
<a name="l00986"></a>00986
<a name="l00987"></a>00987 <span class="comment">//return, if the file could not be opened</span>
<a name="l00988"></a>00988 <span class="keywordflow">if</span>( !fileOpen )
<a name="l00989"></a>00989 {
<a name="l00990"></a>00990 kdError() &lt;&lt; <span class="stringliteral">"ConfigList::readStoredMails: File "</span> &lt;&lt; MailFileName &lt;&lt; <span class="stringliteral">" could not be opened."</span> &lt;&lt; endl;
<a name="l00991"></a>00991 <span class="keywordflow">return</span>;
<a name="l00992"></a>00992 }
<a name="l00993"></a>00993
<a name="l00994"></a>00994 <span class="comment">//create DOM document with the content read from the file</span>
<a name="l00995"></a>00995 QDomDocument doc( MAIL_FILE_DOCTYPE );
<a name="l00996"></a>00996 QString* errorMsg = <span class="keyword">new</span> QString();
<a name="l00997"></a>00997
<a name="l00998"></a>00998 <span class="keywordtype">bool</span> success = doc.setContent( &amp;file );
<a name="l00999"></a>00999 <span class="keywordflow">if</span>( !success )
<a name="l01000"></a>01000 {
<a name="l01001"></a>01001 kdError() &lt;&lt; <span class="stringliteral">"ConfigList::readStoredMails: Invalid content in "</span> &lt;&lt; MAIL_FILE &lt;&lt; <span class="stringliteral">". "</span> &lt;&lt; *errorMsg &lt;&lt; endl;
<a name="l01002"></a>01002 }
<a name="l01003"></a>01003
<a name="l01004"></a>01004 <span class="comment">//get the root element</span>
<a name="l01005"></a>01005 QDomElement accounts = doc.namedItem ( ROOT_ELEMENT ).toElement();
<a name="l01006"></a>01006
<a name="l01007"></a>01007 <span class="comment">//get the first account element</span>
<a name="l01008"></a>01008 QDomNode accNode = accounts.firstChild();
<a name="l01009"></a>01009
<a name="l01010"></a>01010 <span class="comment">//get all account elements</span>
<a name="l01011"></a>01011 <span class="keywordflow">while</span>( !accNode.isNull() )
<a name="l01012"></a>01012 {
<a name="l01013"></a>01013 <span class="comment">//convert account node to DOM element</span>
<a name="l01014"></a>01014 QDomElement accElem = accNode.toElement();
<a name="l01015"></a>01015
<a name="l01016"></a>01016 <span class="comment">//get the account name</span>
<a name="l01017"></a>01017 QString accName = accElem.attribute( ATTRIBUTE_ACCOUNT_NAME );
<a name="l01018"></a>01018
<a name="l01019"></a>01019 <span class="comment">//get the proper account object</span>
<a name="l01020"></a>01020 <a class="code" href="classConfigElem.html">ConfigElem</a>* account = <a class="code" href="classConfigList.html#f5155dad83daf4956ebfb09f6ebd50c6">getAccount</a>( accName );
<a name="l01021"></a>01021
<a name="l01022"></a>01022 <span class="comment">//order the account to read its stored mails</span>
<a name="l01023"></a>01023 account-&gt;<a class="code" href="classConfigElem.html#dee46100623211279e37f498ac43c4e4">readStoredMails</a>( accElem );
<a name="l01024"></a>01024
<a name="l01025"></a>01025 <span class="comment">//get next account node</span>
<a name="l01026"></a>01026 accNode = accNode.nextSibling();
<a name="l01027"></a>01027 }
<a name="l01028"></a>01028
<a name="l01029"></a>01029 <span class="comment">//close file</span>
<a name="l01030"></a>01030 file.close();
<a name="l01031"></a>01031 }
<a name="l01032"></a>01032
<a name="l01033"></a>01033
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Jul 5 19:36:06 2007 for kshowmail by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address>
</body>
</html>