~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiAppUi.cpp

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: symbian_ua_guiAppUi.cpp 3550 2011-05-05 05:33:27Z nanang $ */
 
2
/*
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
// [[[ begin generated region: do not modify [Generated System Includes]
 
20
#include <eikmenub.h>
 
21
#include <akncontext.h>
 
22
#include <akntitle.h>
 
23
#include <symbian_ua_gui.rsg>
 
24
// ]]] end generated region [Generated System Includes]
 
25
 
 
26
// [[[ begin generated region: do not modify [Generated User Includes]
 
27
#include "symbian_ua_guiAppUi.h"
 
28
#include "symbian_ua_gui.hrh"
 
29
#include "symbian_ua_guiContainer.hrh"
 
30
#include "symbian_ua_guiSettingItemList.hrh"
 
31
#include "symbian_ua_guiContainerView.h"
 
32
#include "symbian_ua_guiSettingItemListView.h"
 
33
// ]]] end generated region [Generated User Includes]
 
34
 
 
35
// [[[ begin generated region: do not modify [Generated Constants]
 
36
// ]]] end generated region [Generated Constants]
 
37
 
 
38
#include "symbian_ua.h"
 
39
 
 
40
/**
 
41
 * Construct the Csymbian_ua_guiAppUi instance
 
42
 */
 
43
Csymbian_ua_guiAppUi::Csymbian_ua_guiAppUi() : CTimer(0)
 
44
        {
 
45
        // [[[ begin generated region: do not modify [Generated Contents]
 
46
        // ]]] end generated region [Generated Contents]
 
47
 
 
48
        }
 
49
 
 
50
/**
 
51
 * The appui's destructor removes the container from the control
 
52
 * stack and destroys it.
 
53
 */
 
54
Csymbian_ua_guiAppUi::~Csymbian_ua_guiAppUi()
 
55
        {
 
56
        // [[[ begin generated region: do not modify [Generated Contents]
 
57
        TRAPD( err_Dlg_wait_init, RemoveDlg_wait_initL() );
 
58
        // ]]] end generated region [Generated Contents]
 
59
        }
 
60
 
 
61
// [[[ begin generated function: do not modify
 
62
void Csymbian_ua_guiAppUi::InitializeContainersL()
 
63
        {
 
64
        iSymbian_ua_guiContainerView = Csymbian_ua_guiContainerView::NewL();
 
65
        AddViewL( iSymbian_ua_guiContainerView );
 
66
        iSymbian_ua_guiSettingItemListView = Csymbian_ua_guiSettingItemListView::NewL();
 
67
        AddViewL( iSymbian_ua_guiSettingItemListView );
 
68
        SetDefaultViewL( *iSymbian_ua_guiSettingItemListView );
 
69
        }
 
70
// ]]] end generated function
 
71
 
 
72
/**
 
73
 * Handle a command for this appui (override)
 
74
 * @param aCommand command id to be handled
 
75
 */
 
76
void Csymbian_ua_guiAppUi::HandleCommandL( TInt aCommand )
 
77
        {
 
78
        // [[[ begin generated region: do not modify [Generated Code]
 
79
        TBool commandHandled = EFalse;
 
80
        switch ( aCommand )
 
81
                { // code to dispatch to the AppUi's menu and CBA commands is generated here
 
82
                default:
 
83
                        break;
 
84
                }
 
85
 
 
86
 
 
87
        if ( !commandHandled )
 
88
                {
 
89
                if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
 
90
                        {
 
91
                        symbian_ua_destroy();
 
92
                        Exit();
 
93
                        }
 
94
                }
 
95
        // ]]] end generated region [Generated Code]
 
96
 
 
97
        }
 
98
 
 
99
/**
 
100
 * Override of the HandleResourceChangeL virtual function
 
101
 */
 
102
void Csymbian_ua_guiAppUi::HandleResourceChangeL( TInt aType )
 
103
        {
 
104
        CAknViewAppUi::HandleResourceChangeL( aType );
 
105
        // [[[ begin generated region: do not modify [Generated Code]
 
106
        // ]]] end generated region [Generated Code]
 
107
 
 
108
        }
 
109
 
 
110
/**
 
111
 * Override of the HandleKeyEventL virtual function
 
112
 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not
 
113
 * @param aKeyEvent
 
114
 * @param aType
 
115
 */
 
116
TKeyResponse Csymbian_ua_guiAppUi::HandleKeyEventL(
 
117
                const TKeyEvent& aKeyEvent,
 
118
                TEventCode aType )
 
119
        {
 
120
        // The inherited HandleKeyEventL is private and cannot be called
 
121
        // [[[ begin generated region: do not modify [Generated Contents]
 
122
        // ]]] end generated region [Generated Contents]
 
123
 
 
124
        return EKeyWasNotConsumed;
 
125
        }
 
126
 
 
127
/**
 
128
 * Override of the HandleViewDeactivation virtual function
 
129
 *
 
130
 * @param aViewIdToBeDeactivated
 
131
 * @param aNewlyActivatedViewId
 
132
 */
 
133
void Csymbian_ua_guiAppUi::HandleViewDeactivation(
 
134
                const TVwsViewId& aViewIdToBeDeactivated,
 
135
                const TVwsViewId& aNewlyActivatedViewId )
 
136
        {
 
137
        CAknViewAppUi::HandleViewDeactivation(
 
138
                        aViewIdToBeDeactivated,
 
139
                        aNewlyActivatedViewId );
 
140
        // [[[ begin generated region: do not modify [Generated Contents]
 
141
        // ]]] end generated region [Generated Contents]
 
142
 
 
143
        }
 
144
 
 
145
/**
 
146
 * @brief Completes the second phase of Symbian object construction.
 
147
 * Put initialization code that could leave here.
 
148
 */
 
149
void Csymbian_ua_guiAppUi::ConstructL()
 
150
        {
 
151
        // [[[ begin generated region: do not modify [Generated Contents]
 
152
        BaseConstructL( EAknEnableSkin );
 
153
        InitializeContainersL();
 
154
        // ]]] end generated region [Generated Contents]
 
155
 
 
156
        // Create private folder
 
157
        RProcess process;
 
158
        TFileName path;
 
159
 
 
160
        path.Copy( process.FileName().Left(2) );
 
161
 
 
162
        if(path.Compare(_L("c")) || path.Compare(_L("C")))
 
163
                CEikonEnv::Static()->FsSession().CreatePrivatePath(EDriveC);
 
164
        else if(path.Compare(_L("e")) || path.Compare(_L("E")))
 
165
                CEikonEnv::Static()->FsSession().CreatePrivatePath(EDriveE);
 
166
 
 
167
        // Init PJSUA
 
168
        if (symbian_ua_init() != 0) {
 
169
            symbian_ua_destroy();
 
170
            Exit();
 
171
        }
 
172
 
 
173
        ExecuteDlg_wait_initLD();
 
174
 
 
175
        CTimer::ConstructL();
 
176
        CActiveScheduler::Add( this );
 
177
        After(4000000);
 
178
        }
 
179
 
 
180
/**
 
181
 * Override of the HandleApplicationSpecificEventL virtual function
 
182
 */
 
183
void Csymbian_ua_guiAppUi::HandleApplicationSpecificEventL(
 
184
                TInt aType,
 
185
                const TWsEvent& anEvent )
 
186
        {
 
187
        CAknViewAppUi::HandleApplicationSpecificEventL( aType, anEvent );
 
188
        // [[[ begin generated region: do not modify [Generated Code]
 
189
        // ]]] end generated region [Generated Code]
 
190
 
 
191
        }
 
192
 
 
193
/**
 
194
 * Handle the applicationSpecificEvent event.
 
195
 */
 
196
void Csymbian_ua_guiAppUi::HandleSymbian_ua_guiAppUiApplicationSpecificEventL(
 
197
                TInt /* aType */,
 
198
                const TWsEvent& /* anEvent */ )
 
199
        {
 
200
        // TODO: implement applicationSpecificEvent event handler
 
201
        }
 
202
 
 
203
// [[[ begin generated function: do not modify
 
204
/**
 
205
 * Execute the wait dialog for dlg_wait_init. This routine returns
 
206
 * while the dialog is showing. It will be closed and destroyed when
 
207
 * RemoveDlg_wait_initL() or the user selects the Cancel soft key.
 
208
 * @param aOverrideText optional override text. When null the text configured
 
209
 * in the UI Designer is used.
 
210
 */
 
211
void Csymbian_ua_guiAppUi::ExecuteDlg_wait_initLD( const TDesC* aOverrideText )
 
212
        {
 
213
        iDlg_wait_init = new ( ELeave ) CAknWaitDialog(
 
214
                        reinterpret_cast< CEikDialog** >( &iDlg_wait_init ), EFalse );
 
215
        if ( aOverrideText != NULL )
 
216
                {
 
217
                iDlg_wait_init->SetTextL( *aOverrideText );
 
218
                }
 
219
        iDlg_wait_init->ExecuteLD( R_APPLICATION_DLG_WAIT_INIT );
 
220
        iDlg_wait_initCallback = new ( ELeave ) CProgressDialogCallback(
 
221
                this, iDlg_wait_init, &Csymbian_ua_guiAppUi::HandleDlg_wait_initCanceledL );
 
222
        iDlg_wait_init->SetCallback( iDlg_wait_initCallback );
 
223
        }
 
224
// ]]] end generated function
 
225
 
 
226
// [[[ begin generated function: do not modify
 
227
/**
 
228
 * Close and dispose of the wait dialog for dlg_wait_init
 
229
 */
 
230
void Csymbian_ua_guiAppUi::RemoveDlg_wait_initL()
 
231
        {
 
232
        if ( iDlg_wait_init != NULL )
 
233
                {
 
234
                iDlg_wait_init->SetCallback( NULL );
 
235
                iDlg_wait_init->ProcessFinishedL();    // deletes the dialog
 
236
                iDlg_wait_init = NULL;
 
237
                }
 
238
        delete iDlg_wait_initCallback;
 
239
        iDlg_wait_initCallback = NULL;
 
240
 
 
241
        }
 
242
// ]]] end generated function
 
243
 
 
244
/**
 
245
 * Handle the canceled event.
 
246
 */
 
247
void Csymbian_ua_guiAppUi::HandleDlg_wait_initCanceledL( CAknProgressDialog* /* aDialog */ )
 
248
        {
 
249
        // TODO: implement canceled event handler
 
250
 
 
251
        }
 
252
 
 
253
void Csymbian_ua_guiAppUi::RunL()
 
254
        {
 
255
        RemoveDlg_wait_initL();
 
256
        iSymbian_ua_guiSettingItemListView->HandleCommandL(EAknSoftkeySave);
 
257
        }