1 /* |
|
2 * Copyright (c) 2008 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: CMSBaseView class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <akntitle.h> |
|
22 #include <eikspane.h> |
|
23 #include <avkon.hrh> |
|
24 #include <aknnavide.h> |
|
25 #include <barsread.h> |
|
26 |
|
27 #include "msbaseview.h" |
|
28 #include "msconstants.h" |
|
29 #include "msappui.h" |
|
30 #include "msengine.h" |
|
31 |
|
32 #include "msdebug.h" |
|
33 |
|
34 // -------------------------------------------------------------------------- |
|
35 // CMSBaseView::CMSBaseView() |
|
36 // Default constructor. |
|
37 // -------------------------------------------------------------------------- |
|
38 // |
|
39 CMSBaseView::CMSBaseView() |
|
40 { |
|
41 LOG(_L("[MediaServant]\t CMSBaseView::CMSBaseView")); |
|
42 } |
|
43 |
|
44 // -------------------------------------------------------------------------- |
|
45 // CMSBaseView::~CMSBaseView() |
|
46 // Destructor. |
|
47 // -------------------------------------------------------------------------- |
|
48 // |
|
49 CMSBaseView::~CMSBaseView() |
|
50 { |
|
51 LOG(_L("[MediaServant]\t CMSBaseView::~CMSBaseView")); |
|
52 ClearCurrentNaviPaneText(); |
|
53 } |
|
54 |
|
55 // -------------------------------------------------------------------------- |
|
56 // CMSBaseView::SetTitlePaneTextL() |
|
57 // Sets text to title pane. |
|
58 // -------------------------------------------------------------------------- |
|
59 void CMSBaseView::SetTitlePaneTextL( TInt aResourceId ) |
|
60 { |
|
61 LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL")); |
|
62 |
|
63 // Fetches pointer to the default title pane control. |
|
64 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( |
|
65 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
66 |
|
67 // Makes and sets text which is used title pane. |
|
68 if ( aResourceId == KMSDefaultTitleId ) |
|
69 { |
|
70 titlePane->SetTextToDefaultL(); |
|
71 } |
|
72 else |
|
73 { |
|
74 TBuf<KMSTitleBufLength> titleText( 0 ); |
|
75 iCoeEnv->ReadResourceL( titleText, aResourceId ); |
|
76 titlePane->SetTextL( titleText ); |
|
77 } |
|
78 } |
|
79 |
|
80 // -------------------------------------------------------------------------- |
|
81 // CMSBaseView::SetTitlePaneTextL() |
|
82 // Sets text to title pane. |
|
83 // -------------------------------------------------------------------------- |
|
84 void CMSBaseView::SetTitlePaneTextL( const TDesC& aText ) |
|
85 { |
|
86 LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL")); |
|
87 |
|
88 // Fetches pointer to the default title pane control. |
|
89 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( |
|
90 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
91 |
|
92 titlePane->SetTextL( aText ); |
|
93 } |
|
94 |
|
95 |
|
96 // -------------------------------------------------------------------------- |
|
97 // CMSBaseView::SetNavigationPaneTextL() |
|
98 // Sets navigation pane text. |
|
99 // -------------------------------------------------------------------------- |
|
100 // |
|
101 void CMSBaseView::SetNavigationPaneTextL(const TDesC& aText ) |
|
102 { |
|
103 // old decorator is popped and deleted |
|
104 ClearCurrentNaviPaneText(); |
|
105 |
|
106 if ( !iNaviPane ) |
|
107 { |
|
108 iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
109 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
110 // ownership of decorator is transfered to application |
|
111 } |
|
112 |
|
113 iNaviDecorator = iNaviPane->CreateNavigationLabelL( aText ); |
|
114 iNaviPane->PushL( *iNaviDecorator ); |
|
115 } |
|
116 |
|
117 // -------------------------------------------------------------------------- |
|
118 // CMSBaseView::ClearCurrentNaviPaneText() |
|
119 // Clears navi pane text. |
|
120 // -------------------------------------------------------------------------- |
|
121 // |
|
122 void CMSBaseView::ClearCurrentNaviPaneText() |
|
123 { |
|
124 if ( iNaviDecorator ) |
|
125 { |
|
126 iNaviPane->Pop( iNaviDecorator ); |
|
127 delete iNaviDecorator; |
|
128 iNaviDecorator = NULL; |
|
129 } |
|
130 } |
|
131 |
|
132 // -------------------------------------------------------------------------- |
|
133 // CMSFillView::CancelAsyncOperation() |
|
134 // Cancels current operation |
|
135 // -------------------------------------------------------------------------- |
|
136 // |
|
137 void CMSBaseView::CancelAsyncOperation( CMSAppUi* aAppUi ) |
|
138 { |
|
139 // getting data not yet finished so we must cancel the operation |
|
140 TCmServerState state; |
|
141 aAppUi->MSEngine()->ServerState( state ); |
|
142 if ( state != ECmServerStateIdle ) |
|
143 { |
|
144 LOG( _L( "[MediaServant]\t CMSBaseView::\ |
|
145 CancelAsyncOperation cancel operation" ) ); |
|
146 aAppUi->MSEngine()->StopOperation(); |
|
147 ClearCurrentNaviPaneText(); |
|
148 } |
|
149 } |
|
150 // End of File |
|