⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_c_address_book_engine.html

📁 symbian v9.1 下的地址本程序
💻 HTML
📖 第 1 页 / 共 5 页
字号:
  </tr></table><a class="anchor" name="c53d64c2194748449107eeb2403042dc"></a><!-- doxytag: member="CAddressBookEngine::GetContact" ref="c53d64c2194748449107eeb2403042dc" args="(TInt aPosition, CAddressBookContact *&amp;aContact)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">TInt CAddressBookEngine::GetContact           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">TInt&nbsp;</td>          <td class="mdname" nowrap> <em>aPosition</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap><a class="el" href="class_c_address_book_contact.html">CAddressBookContact</a> *&amp;&nbsp;</td>          <td class="mdname" nowrap> <em>aContact</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>This function need to get a current contact (<a class="el" href="class_c_address_book_view.html#3fca94e0717b8f64d65f54d582de140c">CAddressBookView::CurrentContact()</a>) or to open an item (<a class="el" href="class_c_address_book_view.html#701faad87d37369ca943be1b272f3615">CAddressBookView::OpenItemL()</a>) <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>aPosition</em>&nbsp;</td><td>- Index of Item whose data is needed to get </td></tr>    <tr><td valign="top"></td><td valign="top"><em>aContact</em>&nbsp;</td><td>- gets Value of Item whose Index == aPosition </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>if there is such item, KErrorNotFound is returned otherwise returns KIndexError. </dd></dl><p>Definition at line <a class="el" href="_address_book_engine_8cpp-source.html#l00686">686</a> of file <a class="el" href="_address_book_engine_8cpp-source.html">AddressBookEngine.cpp</a>.<p>References <a class="el" href="_address_book_engine_8h-source.html#l00290">iContacts</a>.<div class="fragment"><pre class="fragment"><a name="l00687"></a>00687         {<a name="l00688"></a>00688         _LIT( KGetContact, <span class="stringliteral">"CAddressBookEngine::GetContact()"</span>);<a name="l00689"></a>00689         LOG( KGetContact);<a name="l00690"></a>00690         TInt retVal(KErrNotFound);<a name="l00691"></a>00691         <span class="keywordflow">if</span> (aPosition &lt; <a class="code" href="class_c_address_book_engine.html#941a218168fb890451d01114c235c0cc">iContacts</a>.Count() &amp;&amp; aPosition &gt;= 0)<a name="l00692"></a>00692                 {<a name="l00693"></a>00693                 aContact = <a class="code" href="class_c_address_book_engine.html#941a218168fb890451d01114c235c0cc">iContacts</a>[aPosition];<a name="l00694"></a>00694                 retVal = KErrNone;<a name="l00695"></a>00695                 }<a name="l00696"></a>00696         <span class="keywordflow">return</span> retVal;<a name="l00697"></a>00697         }</pre></div><p>    </td>  </tr></table><a class="anchor" name="e5feacc99c7a1d3ff42a6d3109717c3c"></a><!-- doxytag: member="CAddressBookEngine::Cancel" ref="e5feacc99c7a1d3ff42a6d3109717c3c" args="()" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void CAddressBookEngine::Cancel           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Close WebServices-connection if user canceled <p>Definition at line <a class="el" href="_address_book_engine_8cpp-source.html#l00704">704</a> of file <a class="el" href="_address_book_engine_8cpp-source.html">AddressBookEngine.cpp</a>.<p>References <a class="el" href="_address_book_engine_8h-source.html#l00292">iConnection</a>, and <a class="el" href="_address_book_engine_8h-source.html#l00291">iConnectionState</a>.<div class="fragment"><pre class="fragment"><a name="l00705"></a>00705         {<a name="l00706"></a>00706         _LIT( KCancel, <span class="stringliteral">"CAddressBookEngine::Cancel()"</span>);<a name="l00707"></a>00707         LOG( KCancel);<a name="l00708"></a>00708         <span class="keyword">delete</span> <a class="code" href="class_c_address_book_engine.html#f702971f167e073a81134fd2876d0298">iConnection</a>;<a name="l00709"></a>00709         <a class="code" href="class_c_address_book_engine.html#20b48b0c027e674d1e8d373e2c83cc84">iConnectionState</a> = 0;    <span class="comment">// not connected</span><a name="l00710"></a>00710         <a class="code" href="class_c_address_book_engine.html#f702971f167e073a81134fd2876d0298">iConnection</a> = NULL;<a name="l00711"></a>00711         }</pre></div><p>    </td>  </tr></table><a class="anchor" name="95d3e261b03f0a2bf7f648406a80904f"></a><!-- doxytag: member="CAddressBookEngine::GenerateQueryRequestL" ref="95d3e261b03f0a2bf7f648406a80904f" args="(const TDesC &amp;aSearchPattern)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">HBufC8 * CAddressBookEngine::GenerateQueryRequestL           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const TDesC &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>aSearchPattern</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Gets the XML query based on the search parameter passed Method also calls WSF ServiceDescriptionL() getter and resolves either ResourceID or EncryptedResourceID element. Later on, this resource id may be used when generating the actual query which is sent to the service (WSP) <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>aSearchPattern</em>&nbsp;</td><td>- descriptor on Searching note that an user has typed </td></tr>  </table></dl><p>Definition at line <a class="el" href="_address_book_engine_8cpp-source.html#l00267">267</a> of file <a class="el" href="_address_book_engine_8cpp-source.html">AddressBookEngine.cpp</a>.<p>References <a class="el" href="_address_book_engine_8cpp-source.html#l00198">ResolveResourceIdL()</a>.<div class="fragment"><pre class="fragment"><a name="l00268"></a>00268         {<a name="l00269"></a>00269         _LIT( KGenQueryReqL, <span class="stringliteral">"CAddressBookEngine::GenerateQueryRequestL(const TDesC&amp; aSearchPattern)"</span>);<a name="l00270"></a>00270         LOG( KGenQueryReqL);<a name="l00271"></a>00271  <a name="l00272"></a>00272         <span class="comment">// Create Query Tag</span><a name="l00273"></a>00273         _LIT8 (KElement, <span class="stringliteral">"Query"</span>);<a name="l00274"></a>00274     CSenElement* element = CSenBaseElement::NewL(KElement);<a name="l00275"></a>00275         CleanupStack::PushL(element);<a name="l00276"></a>00276         element-&gt;SetNamespaceL(KQueryNS, KPpContract);<a name="l00277"></a>00277         <a name="l00278"></a>00278         <span class="comment">// Create QueryItem element</span><a name="l00279"></a>00279         _LIT8 (KQueryItem, <span class="stringliteral">"ab:QueryItem"</span>);     <a name="l00280"></a>00280         CSenElement* queryItem = CSenBaseElement::NewL(KQueryItem);<a name="l00281"></a>00281         CleanupStack::PushL(queryItem);<a name="l00282"></a>00282         <a name="l00283"></a>00283         <span class="comment">// Create Select element</span><a name="l00284"></a>00284         _LIT8 (KSelectElement, <span class="stringliteral">"ab:Select"</span>);<a name="l00285"></a>00285         CSenBaseElement* selectElement=CSenBaseElement::NewL(KSelectElement);   <a name="l00286"></a>00286         CleanupStack::PushL(selectElement);<a name="l00287"></a>00287         <a name="l00288"></a>00288         <span class="comment">//Create temporary buffer and perform UTF8 conversion for parameter passed      </span><a name="l00289"></a>00289         HBufC8* tempBuffer = HBufC8::NewLC(512);        <a name="l00290"></a>00290         TPtr8 ptrSelectQuery = tempBuffer-&gt;Des();       <a name="l00291"></a>00291         HBufC8* pattern = SenXmlUtils::ToUtf8LC(aSearchPattern); <a name="l00292"></a>00292         <span class="comment">//Replace %S with pattern passed in parameter</span><a name="l00293"></a>00293         ptrSelectQuery.Format(KSelectQuery, pattern, pattern, pattern); <a name="l00294"></a>00294                 <a name="l00295"></a>00295         selectElement-&gt;SetContentL(ptrSelectQuery);     <a name="l00296"></a>00296         <span class="comment">// Add select element to QueryItem</span><a name="l00297"></a>00297         queryItem-&gt;AddElementL(*selectElement);<a name="l00298"></a>00298                 <a name="l00299"></a>00299         <span class="comment">//Add QueryItemto Query</span><a name="l00300"></a>00300         element-&gt;AddElementL(*queryItem);<a name="l00301"></a>00301 <a name="l00302"></a>00302         <span class="comment">// Next phase is to create and add ResourceID element into the query.</span><a name="l00303"></a>00303         CSenElement* resourceID = <a class="code" href="class_c_address_book_engine.html#14d7e3cddf3d688054a3b08f070919af">ResolveResourceIdL</a>();<a name="l00304"></a>00304         CSenBaseElement* resourceElement = NULL; <a name="l00305"></a>00305         <span class="keywordflow">if</span>(resourceID)<a name="l00306"></a>00306                 {<a name="l00307"></a>00307                 <span class="comment">// (Encrypted)Resource was successfully resolved. Now check</span><a name="l00308"></a>00308                 <span class="comment">// whether plain ResourceID or EncryptedResourceID is</span><a name="l00309"></a>00309                 <span class="comment">// available and create according element into the query.</span><a name="l00310"></a>00310                 <span class="keywordflow">if</span> (resourceID-&gt;Content().Find(KEncrypted()) != KErrNotFound) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -