|
1 /*! |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Provides information about ongoing calls. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "dialpadsymbianwrapper.h" |
|
19 #include "dialpadsymbianwrapper_p.h" |
|
20 #include <cvoicemailbox.h> |
|
21 #include <cvoicemailboxentry.h> |
|
22 |
|
23 DialpadSymbianWrapperPrivate::DialpadSymbianWrapperPrivate(DialpadSymbianWrapper *parent) : |
|
24 q_ptr(parent) |
|
25 { |
|
26 TRAPD(error, mVmbx = CVoiceMailbox::NewL()); |
|
27 qt_symbian_throwIfError(error); |
|
28 } |
|
29 |
|
30 DialpadSymbianWrapperPrivate::~DialpadSymbianWrapperPrivate() |
|
31 { |
|
32 delete mVmbx; |
|
33 mVmbx = NULL; |
|
34 } |
|
35 |
|
36 int DialpadSymbianWrapperPrivate::getMailboxNumber(QString &vmbxNumber) |
|
37 { |
|
38 int errValue(KErrNone); |
|
39 CVoiceMailboxEntry* vmbxEntry = NULL; |
|
40 TVoiceMailboxParams vmbxParams; |
|
41 errValue = mVmbx->QueryVmbxType( vmbxParams ); |
|
42 |
|
43 if ((KErrNone == errValue) && |
|
44 (KErrNone == mVmbx->GetStoredEntry(vmbxParams, vmbxEntry))) { |
|
45 // Number retrieved succesfully: |
|
46 vmbxNumber = getVmbxNumber(*vmbxEntry); |
|
47 } |
|
48 // Entry ownership was transferred. |
|
49 delete vmbxEntry; |
|
50 vmbxEntry = NULL; |
|
51 return errValue; |
|
52 } |
|
53 |
|
54 |
|
55 int DialpadSymbianWrapperPrivate::defineMailboxNumber(QString &vmbxNumber) |
|
56 { |
|
57 CVoiceMailboxEntry* vmbxEntry = NULL; |
|
58 TVoiceMailboxParams vmbxParams; |
|
59 int errValue = mVmbx->QueryVmbxType( vmbxParams ); |
|
60 |
|
61 if ((KErrNotFound == errValue)) { |
|
62 errValue = mVmbx->QueryNewEntry(vmbxParams, vmbxEntry); |
|
63 if (KErrNone == errValue) { |
|
64 mVmbx->SaveEntry(*vmbxEntry); |
|
65 // Do appropriate tasks, e.g. save number. |
|
66 vmbxNumber = getVmbxNumber(*vmbxEntry); |
|
67 } |
|
68 } |
|
69 return errValue; |
|
70 } |
|
71 |
|
72 QString DialpadSymbianWrapperPrivate::getVmbxNumber(CVoiceMailboxEntry &vmbxEntry) |
|
73 { |
|
74 TPtrC ptrNumber(KNullDesC); |
|
75 QString dialpadText = NULL; |
|
76 if(KErrNone == vmbxEntry.GetVmbxNumber(ptrNumber)) { |
|
77 dialpadText = QString::fromUtf16(ptrNumber.Ptr(), ptrNumber.Length()); |
|
78 } |
|
79 return dialpadText; |
|
80 } |
|
81 |