0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <avkon.hrh>
|
|
19 |
#include <eikmenub.h>
|
|
20 |
#include <akntitle.h>
|
|
21 |
#include <barsread.h>
|
|
22 |
#include <avkon.rsg>
|
|
23 |
#include <trkapp_200170bb.rsg>
|
|
24 |
|
|
25 |
#include "TrkApp.hrh"
|
|
26 |
#include "TrkSettingsData.h"
|
|
27 |
#include "TrkUids.h"
|
|
28 |
#include "TrkSettingsView.h"
|
|
29 |
|
|
30 |
#include "TrkAppUi.h"
|
|
31 |
|
|
32 |
_LIT(KErrorNotification,"Error in connecting to TRK server . Please restart the phone and try.");
|
|
33 |
//
|
|
34 |
// CTrkAppUi::ConstructL
|
|
35 |
//
|
|
36 |
void CTrkAppUi::ConstructL()
|
|
37 |
{
|
|
38 |
BaseConstructL(EAknEnableSkin);
|
|
39 |
|
|
40 |
TInt err = iTrkSession.ConnectToServer();
|
|
41 |
if(err)
|
|
42 |
{
|
|
43 |
CAknGlobalNote* errNote = CAknGlobalNote::NewL();
|
|
44 |
CleanupStack::PushL( errNote );
|
|
45 |
TInt noteid = errNote->ShowNoteL(EAknGlobalErrorNote, KErrorNotification);
|
|
46 |
CleanupStack::PopAndDestroy();
|
|
47 |
User::Leave(err);
|
|
48 |
}
|
|
49 |
iSettingsData = CTrkSettingsData::NewL(iTrkSession);
|
|
50 |
|
|
51 |
iAppView = CTrkAppView::NewL(iSettingsData, iTrkSession);
|
|
52 |
AddViewL(iAppView);
|
|
53 |
|
|
54 |
iSettingsView = CTrkSettingsView::NewL(iSettingsData);
|
|
55 |
AddViewL(iSettingsView);
|
|
56 |
|
|
57 |
//set the main app view as the default view
|
|
58 |
SetDefaultViewL(*iAppView);
|
|
59 |
}
|
|
60 |
|
|
61 |
//
|
|
62 |
// CTrkAppUi Desctructor
|
|
63 |
//
|
|
64 |
CTrkAppUi::~CTrkAppUi()
|
|
65 |
{
|
|
66 |
if (iSettingsData)
|
|
67 |
{
|
|
68 |
delete iSettingsData;
|
|
69 |
iSettingsData = NULL;
|
|
70 |
}
|
|
71 |
|
|
72 |
iSettingsView = NULL;
|
|
73 |
iAppView = NULL;
|
|
74 |
}
|
|
75 |
|
|
76 |
//
|
|
77 |
// CTrkAppUi::HandleCommandL
|
|
78 |
//
|
|
79 |
void CTrkAppUi::HandleCommandL(TInt aCommand)
|
|
80 |
{
|
|
81 |
switch (aCommand)
|
|
82 |
{
|
|
83 |
case EEikCmdExit:
|
|
84 |
case EAknSoftkeyExit:
|
|
85 |
{
|
|
86 |
//if (!iEngine->IsDebugging())
|
|
87 |
{
|
|
88 |
Exit();
|
|
89 |
}
|
|
90 |
break;
|
|
91 |
}
|
|
92 |
}
|
|
93 |
}
|
|
94 |
|
|
95 |
//
|
|
96 |
// CTrkAppUi::HandleResourceChangeL
|
|
97 |
//
|
|
98 |
void CTrkAppUi::HandleResourceChangeL( TInt aType )
|
|
99 |
{
|
|
100 |
CAknViewAppUi::HandleResourceChangeL(aType);
|
|
101 |
|
|
102 |
if (aType == KEikDynamicLayoutVariantSwitch ||
|
|
103 |
aType == KEikMessageUnfadeWindows ||
|
|
104 |
aType == KEikMessageWindowsFadeChange )
|
|
105 |
{
|
|
106 |
iAppView->HandleSizeChange();
|
|
107 |
iSettingsView->HandleSizeChange();
|
|
108 |
|
|
109 |
CEikStatusPane* pane = StatusPane();
|
|
110 |
if (pane)
|
|
111 |
{
|
|
112 |
pane->HandleResourceChange(aType);
|
|
113 |
}
|
|
114 |
}
|
|
115 |
}
|
|
116 |
|
|
117 |
// ----------------------------------------------------
|
|
118 |
// CCcorAppUi::SetTitleL
|
|
119 |
// Set title pane text from a resource.
|
|
120 |
// ----------------------------------------------------
|
|
121 |
//
|
|
122 |
void CTrkAppUi::SetTitleL(TInt aResourceId)
|
|
123 |
{
|
|
124 |
// Set title
|
|
125 |
CAknTitlePane* title = static_cast<CAknTitlePane*>(StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
|
|
126 |
TResourceReader reader;
|
|
127 |
iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
|
|
128 |
title->SetFromResourceL(reader);
|
|
129 |
CleanupStack::PopAndDestroy(); // resource reader
|
|
130 |
}
|
|
131 |
|
|
132 |
|
|
133 |
// ----------------------------------------------------
|
|
134 |
// CTrkAppUi::SetTitleL
|
|
135 |
// Set title pane text from a descriptor.
|
|
136 |
// ----------------------------------------------------
|
|
137 |
//
|
|
138 |
void CTrkAppUi::SetTitleL(const TDesC& aText)
|
|
139 |
{
|
|
140 |
CAknTitlePane* title = static_cast<CAknTitlePane*>(StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
|
|
141 |
title->SetTextL(aText);
|
|
142 |
}
|