summaryrefslogtreecommitdiffstats
path: root/doc/html/commandlist_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/commandlist_8cpp-source.html')
-rw-r--r--doc/html/commandlist_8cpp-source.html153
1 files changed, 153 insertions, 0 deletions
diff --git a/doc/html/commandlist_8cpp-source.html b/doc/html/commandlist_8cpp-source.html
new file mode 100644
index 0000000..913d2df
--- /dev/null
+++ b/doc/html/commandlist_8cpp-source.html
@@ -0,0 +1,153 @@
+<!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/commandlist.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>commandlist.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"> commandlist.cpp - description</span>
+<a name="l00003"></a>00003 <span class="comment"> -------------------</span>
+<a name="l00004"></a>00004 <span class="comment"> begin : Wed Oct 31 2001</span>
+<a name="l00005"></a>00005 <span class="comment"> copyright : (C) 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
+<a name="l00009"></a>00009 <span class="comment">/***************************************************************************</span>
+<a name="l00010"></a>00010 <span class="comment"> * *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span>
+<a name="l00012"></a>00012 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span>
+<a name="l00013"></a>00013 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span>
+<a name="l00014"></a>00014 <span class="comment"> * (at your option) any later version. *</span>
+<a name="l00015"></a>00015 <span class="comment"> * *</span>
+<a name="l00016"></a>00016 <span class="comment"> ***************************************************************************/</span>
+<a name="l00017"></a>00017
+<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
+<a name="l00019"></a>00019 <span class="preprocessor">#include "commandentry.h"</span>
+<a name="l00020"></a>00020 <span class="preprocessor">#include "commandlist.h"</span>
+<a name="l00021"></a>00021
+<a name="l00022"></a><a class="code" href="classCommandList.html#a5cc72c5c68da1d3e18f808da93025c6">00022</a> <a class="code" href="classCommandList.html#a5cc72c5c68da1d3e18f808da93025c6">CommandList::CommandList</a>()
+<a name="l00023"></a>00023 {
+<a name="l00024"></a>00024 setAutoDelete (<span class="keyword">true</span>);
+<a name="l00025"></a>00025 }
+<a name="l00026"></a>00026
+<a name="l00027"></a><a class="code" href="classCommandList.html#ada18ff9b6162b3ca25b9e4c28a05031">00027</a> <a class="code" href="classCommandList.html#ada18ff9b6162b3ca25b9e4c28a05031">CommandList::~CommandList</a>()
+<a name="l00028"></a>00028 {
+<a name="l00029"></a>00029 }
+<a name="l00030"></a>00030
+<a name="l00031"></a><a class="code" href="classCommandList.html#e5a8632fb53943a8ec5b8edfa268e668">00031</a> <span class="keywordtype">void</span> <a class="code" href="classCommandList.html#e5a8632fb53943a8ec5b8edfa268e668">CommandList::setCombo</a> (QComboBox* combo, <span class="keywordtype">int</span> nIndex)
+<a name="l00032"></a>00032 {
+<a name="l00033"></a>00033 combo-&gt;clear ();
+<a name="l00034"></a>00034 <span class="keywordflow">for</span> (<a class="code" href="classCommandEntry.html">CommandEntry</a>* pElem = first(); pElem; pElem = next())
+<a name="l00035"></a>00035 {
+<a name="l00036"></a>00036 combo-&gt;insertItem (pElem-&gt;m_name);
+<a name="l00037"></a>00037 }
+<a name="l00038"></a>00038 <span class="keywordflow">if</span> (nIndex &gt;= 0)
+<a name="l00039"></a>00039 {
+<a name="l00040"></a>00040 at (nIndex);
+<a name="l00041"></a>00041 combo-&gt;setCurrentItem (nIndex);
+<a name="l00042"></a>00042 }
+<a name="l00043"></a>00043 }
+<a name="l00044"></a>00044
+<a name="l00045"></a><a class="code" href="classCommandList.html#5db2a340101b2c274fa4691e4a90caa9">00045</a> <a class="code" href="classCommandList.html">CommandList</a>&amp; <a class="code" href="classCommandList.html#5db2a340101b2c274fa4691e4a90caa9">CommandList::operator = </a>(<a class="code" href="classCommandList.html">CommandList</a>&amp; list)
+<a name="l00046"></a>00046 {
+<a name="l00047"></a>00047 clear ();
+<a name="l00048"></a>00048 <span class="keywordtype">int</span> nIndex = list.at ();
+<a name="l00049"></a>00049 <span class="keywordflow">for</span> (<a class="code" href="classCommandEntry.html">CommandEntry</a>* item = list.first (); item; item = list.next ())
+<a name="l00050"></a>00050 {
+<a name="l00051"></a>00051 append (<span class="keyword">new</span> <a class="code" href="classCommandEntry.html">CommandEntry</a> (item));
+<a name="l00052"></a>00052 }
+<a name="l00053"></a>00053 at (nIndex);
+<a name="l00054"></a>00054 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
+<a name="l00055"></a>00055 }
+<a name="l00056"></a>00056
+<a name="l00057"></a><a class="code" href="classCommandList.html#99f8a7c87e09a186bd5664638b704619">00057</a> <span class="keywordtype">bool</span> <a class="code" href="classCommandList.html#99f8a7c87e09a186bd5664638b704619">CommandList::exec</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <a class="code" href="classConfigElem.html">ConfigElem</a>* pelem, <span class="keyword">const</span> <span class="keywordtype">char</span>* header, <span class="keyword">const</span> <span class="keywordtype">char</span>* body)
+<a name="l00058"></a>00058 {
+<a name="l00059"></a>00059 <span class="keywordtype">bool</span> result = <span class="keyword">false</span>;
+<a name="l00060"></a>00060 <a class="code" href="classCommandEntry.html">CommandEntry</a>* test = <span class="keyword">new</span> <a class="code" href="classCommandEntry.html">CommandEntry</a> (NULL, NULL, <span class="keywordtype">id</span>, <span class="keyword">true</span>);
+<a name="l00061"></a>00061 <span class="keywordtype">int</span> pos = find (test);
+<a name="l00062"></a>00062 <span class="keywordflow">if</span> (pos &gt;= 0)
+<a name="l00063"></a>00063 {
+<a name="l00064"></a>00064 result = at (pos)-&gt;exec (pelem, header, body);
+<a name="l00065"></a>00065 }
+<a name="l00066"></a>00066 <span class="keywordflow">else</span>
+<a name="l00067"></a>00067 kdError () &lt;&lt; <span class="stringliteral">"No ID "</span> &lt;&lt; <span class="keywordtype">id</span> &lt;&lt; <span class="stringliteral">" found in commandlist."</span> &lt;&lt; endl;
+<a name="l00068"></a>00068 <span class="keyword">delete</span> test;
+<a name="l00069"></a>00069 <span class="keywordflow">return</span> result;
+<a name="l00070"></a>00070 }
+<a name="l00071"></a>00071
+<a name="l00072"></a><a class="code" href="classCommandList.html#7450f5fc2f7d1fafd3b490f5d39a72e3">00072</a> <span class="keywordtype">bool</span> <a class="code" href="classCommandList.html#99f8a7c87e09a186bd5664638b704619">CommandList::exec</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos, <a class="code" href="classConfigElem.html">ConfigElem</a>* pelem)
+<a name="l00073"></a>00073 {
+<a name="l00074"></a>00074 <span class="comment">// command may have bee deleted</span>
+<a name="l00075"></a>00075 <span class="keywordflow">if</span> (pos &lt; count ())
+<a name="l00076"></a>00076 <span class="keywordflow">return</span> at (pos)-&gt;exec (pelem);
+<a name="l00077"></a>00077 <span class="keywordflow">else</span>
+<a name="l00078"></a>00078 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+<a name="l00079"></a>00079 }
+<a name="l00080"></a>00080
+<a name="l00081"></a><a class="code" href="classCommandList.html#75139c46235d0453af653bfaf9018a11">00081</a> <span class="keywordtype">int</span> <a class="code" href="classCommandList.html#75139c46235d0453af653bfaf9018a11">CommandList::compareItems</a> (QCollection::Item item1, QCollection::Item item2 )
+<a name="l00082"></a>00082 {
+<a name="l00083"></a>00083 <a class="code" href="classCommandEntry.html">CommandEntry</a>* entry1 = (<a class="code" href="classCommandEntry.html">CommandEntry</a>*) item1;
+<a name="l00084"></a>00084 <a class="code" href="classCommandEntry.html">CommandEntry</a>* entry2 = (<a class="code" href="classCommandEntry.html">CommandEntry</a>*) item2;
+<a name="l00085"></a>00085 <span class="keywordflow">if</span> (entry1-&gt;<a class="code" href="classCommandEntry.html#5f1098dd21df36fae20591ba0fc9a5fa">m_id</a> &gt; entry2-&gt;<a class="code" href="classCommandEntry.html#5f1098dd21df36fae20591ba0fc9a5fa">m_id</a>)
+<a name="l00086"></a>00086 <span class="keywordflow">return</span> 1;
+<a name="l00087"></a>00087 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (entry1-&gt;<a class="code" href="classCommandEntry.html#5f1098dd21df36fae20591ba0fc9a5fa">m_id</a> == entry2-&gt;<a class="code" href="classCommandEntry.html#5f1098dd21df36fae20591ba0fc9a5fa">m_id</a>)
+<a name="l00088"></a>00088 <span class="keywordflow">return</span> 0;
+<a name="l00089"></a>00089 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1;
+<a name="l00090"></a>00090 }
+<a name="l00091"></a>00091
+<a name="l00092"></a><a class="code" href="classCommandList.html#5037135701a78aadeebc9520df6abf2b">00092</a> QCollection::Item <a class="code" href="classCommandList.html#5037135701a78aadeebc9520df6abf2b">CommandList::newItem</a> (QCollection::Item d)
+<a name="l00093"></a>00093 {
+<a name="l00094"></a>00094 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCommandEntry.html">CommandEntry</a> ((<a class="code" href="classCommandEntry.html">CommandEntry</a>*)d);
+<a name="l00095"></a>00095 }
+<a name="l00096"></a>00096
+<a name="l00097"></a><a class="code" href="classCommandList.html#154b13cfab656e47790f1f12f92401a4">00097</a> <span class="keywordtype">void</span> <a class="code" href="classCommandList.html#154b13cfab656e47790f1f12f92401a4">CommandList::readOptions</a> (KConfig* config)
+<a name="l00098"></a>00098 {
+<a name="l00099"></a>00099 config-&gt;setGroup (<span class="stringliteral">"usercommands"</span>);
+<a name="l00100"></a>00100 <span class="keywordtype">bool</span> goon = <span class="keyword">true</span>;
+<a name="l00101"></a>00101 <span class="keywordtype">int</span> i = 0;
+<a name="l00102"></a>00102 <span class="keywordflow">while</span> (goon)
+<a name="l00103"></a>00103 {
+<a name="l00104"></a>00104 QString cmd (config-&gt;readEntry (QString (<span class="stringliteral">"cmd%1"</span>).arg(i)));
+<a name="l00105"></a>00105 <span class="keywordflow">if</span> (!cmd.isEmpty ())
+<a name="l00106"></a>00106 {
+<a name="l00107"></a>00107 QString path = config-&gt;readEntry (QString(<span class="stringliteral">"path%1"</span>).arg(i));
+<a name="l00108"></a>00108 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = config-&gt;readNumEntry (QString(<span class="stringliteral">"id%1"</span>).arg(i));
+<a name="l00109"></a>00109 <span class="keywordtype">bool</span> modal = config-&gt;readBoolEntry (QString(<span class="stringliteral">"modal%1"</span>).arg(i), <span class="keyword">true</span>);
+<a name="l00110"></a>00110 append (<span class="keyword">new</span> <a class="code" href="classCommandEntry.html">CommandEntry</a> (cmd, path, <span class="keywordtype">id</span>, modal));
+<a name="l00111"></a>00111 i++;
+<a name="l00112"></a>00112 }
+<a name="l00113"></a>00113 <span class="keywordflow">else</span>
+<a name="l00114"></a>00114 goon = <span class="keyword">false</span>;
+<a name="l00115"></a>00115 }
+<a name="l00116"></a>00116 <span class="keywordflow">if</span> (i &gt; 0)
+<a name="l00117"></a>00117 at (0);
+<a name="l00118"></a>00118 }
+<a name="l00119"></a>00119
+<a name="l00120"></a><a class="code" href="classCommandList.html#49d6d504715977b9d20fbc931ab62641">00120</a> <span class="keywordtype">void</span> <a class="code" href="classCommandList.html#49d6d504715977b9d20fbc931ab62641">CommandList::saveOptions</a> (KConfig* config)
+<a name="l00121"></a>00121 {
+<a name="l00122"></a>00122 kdDebug () &lt;&lt; <span class="stringliteral">"CommandList::saveOptions"</span> &lt;&lt; endl;
+<a name="l00123"></a>00123 config-&gt;setGroup (<span class="stringliteral">"usercommands"</span>);
+<a name="l00124"></a>00124 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; count (); i++)
+<a name="l00125"></a>00125 {
+<a name="l00126"></a>00126 config-&gt;writeEntry (QString(<span class="stringliteral">"cmd%1"</span>).arg(i), at(i)-&gt;m_name);
+<a name="l00127"></a>00127 config-&gt;writeEntry (QString(<span class="stringliteral">"path%1"</span>).arg(i), at(i)-&gt;m_path);
+<a name="l00128"></a>00128 config-&gt;writeEntry (QString(<span class="stringliteral">"id%1"</span>).arg(i), at(i)-&gt;m_id);
+<a name="l00129"></a>00129 config-&gt;writeEntry (QString(<span class="stringliteral">"modal%1"</span>).arg(i), at(i)-&gt;m_waitForCommand);
+<a name="l00130"></a>00130 }
+<a name="l00131"></a>00131 }
+</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed May 16 21:15:18 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>