83 // Create the listbox |
83 // Create the listbox |
84 CreateListboxControlL(); |
84 CreateListboxControlL(); |
85 // Create the header |
85 // Create the header |
86 iHeaderCtrl = CCCAppCommLauncherHeaderControl::NewL( iPlugin ); |
86 iHeaderCtrl = CCCAppCommLauncherHeaderControl::NewL( iPlugin ); |
87 iHeaderCtrl->SetContainerWindowL(*this); |
87 iHeaderCtrl->SetContainerWindowL(*this); |
88 |
88 |
89 FeatureManager::InitializeLibL(); |
89 // create status control |
90 if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) |
90 CreateStatusControlL(); |
91 { |
91 |
92 MVPbkContactLink* link = NULL; |
|
93 MVPbkContactLinkArray* contactArray = NULL; |
|
94 TInt isSame = KErrNotFound; |
|
95 |
|
96 iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
97 iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), |
|
98 iAppServices->StoreManager(), |
|
99 CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); |
|
100 |
|
101 HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); |
|
102 HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); |
|
103 TPtr8 contactData8Ptr( contactData8->Des() ); |
|
104 contactData8Ptr.Copy( contactData.Des() ); |
|
105 |
|
106 CVPbkContactManager* vPbkContactManager = &iAppServices->ContactManager(); |
|
107 |
|
108 if( vPbkContactManager ) |
|
109 { |
|
110 contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); |
|
111 |
|
112 if( contactArray->Count() > 0 ) |
|
113 { |
|
114 link = contactArray->At( 0 ).CloneLC(); |
|
115 } |
|
116 |
|
117 if ( link ) |
|
118 { |
|
119 const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); |
|
120 TVPbkContactStoreUriPtr uri = storeProperties.Uri(); |
|
121 |
|
122 isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), |
|
123 TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); |
|
124 } |
|
125 } |
|
126 |
|
127 if( isSame == 0 ) |
|
128 { |
|
129 iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); |
|
130 iStatusControl->SetContainerWindowL( *this ); |
|
131 iStatusControl->MakeVisible( EFalse ); |
|
132 iHeaderCtrl->SetStatusButtonVisibility( EFalse ); |
|
133 CFbsBitmap* bmp = NULL; |
|
134 CFbsBitmap* bmpMask = NULL; |
|
135 |
|
136 AknsUtils::CreateIconL( |
|
137 AknsUtils::SkinInstance(), |
|
138 KAknsIIDQgnPropWmlBmOvi, |
|
139 bmp, |
|
140 bmpMask, |
|
141 KCcaIconDefaultFileName, |
|
142 EMbmPhonebook2eceQgn_prop_wml_bm_ovi, |
|
143 EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); |
|
144 |
|
145 CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); |
|
146 iStatusControl->SetDefaultStatusIconL( guiIcon ); |
|
147 iStatusControl->SetContactLinkL( *link ); |
|
148 |
|
149 iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); |
|
150 TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); |
|
151 iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); |
|
152 } |
|
153 |
|
154 if( link ) |
|
155 { |
|
156 CleanupStack::PopAndDestroy(); //link |
|
157 } |
|
158 |
|
159 if( contactArray ) |
|
160 { |
|
161 CleanupStack::PopAndDestroy(); // contactArray |
|
162 } |
|
163 |
|
164 CleanupStack::PopAndDestroy(); // contactData8 |
|
165 } // KFeatureIdFfContactsSocial |
|
166 FeatureManager::UnInitializeLib(); |
|
167 |
|
168 // Get the skin background for the view |
92 // Get the skin background for the view |
169 iBackground = CAknsBasicBackgroundControlContext::NewL( |
93 iBackground = CAknsBasicBackgroundControlContext::NewL( |
170 KAknsIIDQsnBgAreaMain, TRect(0, 0, 0, 0), EFalse); |
94 KAknsIIDQsnBgAreaMain, TRect(0, 0, 0, 0), EFalse); |
171 LongTapDetectorL(); |
95 LongTapDetectorL(); |
172 } |
96 } |
196 //Set listbox observer |
120 //Set listbox observer |
197 iListBox->SetListBoxObserver(this); |
121 iListBox->SetListBoxObserver(this); |
198 iListBox->ActivateL(); |
122 iListBox->ActivateL(); |
199 } |
123 } |
200 |
124 |
|
125 //----------------------------------------------------------------------------- |
|
126 // CCCAppCommLauncherContainer::CreateStatusControlL() |
|
127 //----------------------------------------------------------------------------- |
|
128 // |
|
129 void CCCAppCommLauncherContainer::CreateStatusControlL() |
|
130 { |
|
131 FeatureManager::InitializeLibL(); |
|
132 const TBool isFeatureIdFfContactsSocial = |
|
133 FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ); |
|
134 FeatureManager::UnInitializeLib(); |
|
135 |
|
136 if( isFeatureIdFfContactsSocial ) |
|
137 { |
|
138 MVPbkContactLink* link = NULL; |
|
139 MVPbkContactLinkArray* contactArray = NULL; |
|
140 TInt isSame = KErrNotFound; |
|
141 |
|
142 if( !iAppServices ) |
|
143 { |
|
144 iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
145 } |
|
146 if( !iProvider ) |
|
147 { |
|
148 iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), |
|
149 iAppServices->StoreManager(), |
|
150 CSpbContentProvider::EStatusMessage | |
|
151 CSpbContentProvider::EServiceIcon ); |
|
152 } |
|
153 HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); |
|
154 HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); |
|
155 TPtr8 contactData8Ptr( contactData8->Des() ); |
|
156 contactData8Ptr.Copy( contactData.Des() ); |
|
157 |
|
158 CVPbkContactManager* vPbkContactManager = |
|
159 &iAppServices->ContactManager(); |
|
160 |
|
161 if( vPbkContactManager ) |
|
162 { |
|
163 contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); |
|
164 |
|
165 if( contactArray->Count() > 0 ) |
|
166 { |
|
167 link = contactArray->At( 0 ).CloneLC(); |
|
168 } |
|
169 |
|
170 if ( link ) |
|
171 { |
|
172 const MVPbkContactStoreProperties& storeProperties = |
|
173 link->ContactStore().StoreProperties(); |
|
174 TVPbkContactStoreUriPtr uri = storeProperties.Uri(); |
|
175 |
|
176 isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), |
|
177 TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); |
|
178 } |
|
179 } |
|
180 |
|
181 if( isSame == 0 ) |
|
182 { |
|
183 iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this, CCCAppStatusControl::ENormalContact ); |
|
184 iStatusControl->SetContainerWindowL( *this ); |
|
185 iStatusControl->MakeVisible( EFalse ); |
|
186 iHeaderCtrl->SetStatusButtonVisibility( EFalse ); |
|
187 CFbsBitmap* bmp = NULL; |
|
188 CFbsBitmap* bmpMask = NULL; |
|
189 |
|
190 AknsUtils::CreateIconL( |
|
191 AknsUtils::SkinInstance(), |
|
192 KAknsIIDQgnPropSocialCommunities, |
|
193 bmp, |
|
194 bmpMask, |
|
195 KCcaIconDefaultFileName, |
|
196 EMbmPhonebook2eceQgn_prop_social_communities, |
|
197 EMbmPhonebook2eceQgn_prop_social_communities_mask ); |
|
198 |
|
199 CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); |
|
200 iStatusControl->SetDefaultStatusIconL( guiIcon ); |
|
201 HBufC* defaultText = |
|
202 StringLoader::LoadL( R_QTN_CCA_SOCIAL_NETWORKS ); |
|
203 iStatusControl->SetDefaultStatusTextL( defaultText ); |
|
204 iStatusControl->SetContactLinkL( *link ); |
|
205 |
|
206 iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); |
|
207 TCallBack callBack( |
|
208 CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); |
|
209 iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); |
|
210 } |
|
211 |
|
212 if( link ) |
|
213 { |
|
214 CleanupStack::PopAndDestroy(); //link |
|
215 } |
|
216 |
|
217 if( contactArray ) |
|
218 { |
|
219 CleanupStack::PopAndDestroy(); // contactArray |
|
220 } |
|
221 |
|
222 CleanupStack::PopAndDestroy(); // contactData8 |
|
223 } // KFeatureIdFfContactsSocial |
|
224 } |
|
225 |
|
226 |
201 // ---------------------------------------------------------------------------- |
227 // ---------------------------------------------------------------------------- |
202 // CCCAppCommLauncherContainer::Draw() |
228 // CCCAppCommLauncherContainer::Draw() |
203 // ---------------------------------------------------------------------------- |
229 // ---------------------------------------------------------------------------- |
204 // |
230 // |
205 void CCCAppCommLauncherContainer::Draw(const TRect& /*aRect*/) const |
231 void CCCAppCommLauncherContainer::Draw(const TRect& /*aRect*/) const |
635 { |
661 { |
636 // Forwarding to header-part |
662 // Forwarding to header-part |
637 iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField); |
663 iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField); |
638 // Forwarding to listbox-model |
664 // Forwarding to listbox-model |
639 iModel->ContactFieldFetchedNotifyL(aContactField); |
665 iModel->ContactFieldFetchedNotifyL(aContactField); |
640 |
|
641 if( iStatusControl && iStatusControl->IsVisible() ) |
|
642 { |
|
643 SetDefaultStatusTextL(); |
|
644 } |
|
645 } |
666 } |
646 |
667 |
647 // ---------------------------------------------------------------------------- |
668 // ---------------------------------------------------------------------------- |
648 // CCCAppCommLauncherContainer::ContactFieldFetchedNotifyL() |
669 // CCCAppCommLauncherContainer::ContactFieldFetchedNotifyL() |
649 // ---------------------------------------------------------------------------- |
670 // ---------------------------------------------------------------------------- |
720 void CCCAppCommLauncherContainer::ContactsChangedL() |
736 void CCCAppCommLauncherContainer::ContactsChangedL() |
721 { |
737 { |
722 iModel->Reset(); |
738 iModel->Reset(); |
723 iListBox->HandleItemRemovalL(); |
739 iListBox->HandleItemRemovalL(); |
724 iHeaderCtrl->ClearL(); |
740 iHeaderCtrl->ClearL(); |
|
741 |
|
742 if (!iStatusControl && iPlugin.ContactHandler().ContactStore() == ECmsContactStorePbk) |
|
743 { |
|
744 // create status control |
|
745 CreateStatusControlL(); |
|
746 //reset control's rect |
|
747 SizeChanged(); |
|
748 } |
|
749 |
725 } |
750 } |
726 |
751 |
727 // --------------------------------------------------------------------------- |
752 // --------------------------------------------------------------------------- |
728 // CCCAppCommLauncherContainer::ContactPresenceChangedL |
753 // CCCAppCommLauncherContainer::ContactPresenceChangedL |
729 // --------------------------------------------------------------------------- |
754 // --------------------------------------------------------------------------- |
797 { |
822 { |
798 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
823 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
799 } |
824 } |
800 return *iLongTapDetector; |
825 return *iLongTapDetector; |
801 } |
826 } |
802 |
|
803 // -------------------------------------------------------------------------- |
|
804 // CCCAppCommLauncherContainer::SetDefaultStatusTextL |
|
805 // -------------------------------------------------------------------------- |
|
806 // |
|
807 void CCCAppCommLauncherContainer::SetDefaultStatusTextL() |
|
808 { |
|
809 TPtrC fullName; |
|
810 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
811 CCmsContactFieldItem::ECmsFullName, |
|
812 fullName ); |
|
813 |
|
814 if( fullName.Size() == 0 ) |
|
815 { |
|
816 return; |
|
817 } |
|
818 |
|
819 HBufC* defaultStatusText = StringLoader::LoadL( |
|
820 R_QTN_CCA_FTU_DISCOVER, fullName, iCoeEnv ); |
|
821 |
|
822 iStatusControl->SetDefaultStatusTextL( defaultStatusText ); |
|
823 } |
|
824 |
827 |
825 //----------------------------------------------------------------------------- |
828 //----------------------------------------------------------------------------- |
826 // CCCAppCommLauncherContainer::StatusClicked() |
829 // CCCAppCommLauncherContainer::StatusClicked() |
827 //----------------------------------------------------------------------------- |
830 //----------------------------------------------------------------------------- |
828 // |
831 // |
855 //----------------------------------------------------------------------------- |
858 //----------------------------------------------------------------------------- |
856 // |
859 // |
857 void CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() |
860 void CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() |
858 { |
861 { |
859 CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); |
862 CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); |
|
863 |
|
864 MCCAStatusProvider* ccaStatusProvider = NULL; |
|
865 |
860 // if extension is not null, extensionfactory plugins are available -> |
866 // if extension is not null, extensionfactory plugins are available -> |
861 // show statuscontrol |
867 // show statuscontrol |
862 if( extension ) |
868 if( extension ) |
863 { |
869 { |
864 if ( !iViewLauncher ) |
870 if ( !iViewLauncher ) |
865 { |
871 { |
866 iViewLauncher = extension->CreateViewLauncherL(); |
872 iViewLauncher = extension->CreateViewLauncherL(); |
867 } |
873 } |
868 if( iStatusControl ) |
874 if( iStatusControl ) |
869 { |
875 { |
|
876 if( extension ) |
|
877 { |
|
878 TAny* factoryExtension = extension->FactoryExtension( KCCAExtensionFactoryStatusProviderCreatorUid ); |
|
879 |
|
880 if( factoryExtension ) |
|
881 { |
|
882 MCCAExtensionFactoryStatusProviderCreator* statusProviderCreator = |
|
883 static_cast<MCCAExtensionFactoryStatusProviderCreator*>( factoryExtension ); |
|
884 |
|
885 if( statusProviderCreator ) |
|
886 { |
|
887 ccaStatusProvider = statusProviderCreator->CreateStatusProviderL(); |
|
888 } |
|
889 } |
|
890 } |
|
891 |
|
892 iStatusControl->SetStatusProvider( ccaStatusProvider ); |
870 iStatusControl->MakeVisible( ETrue ); |
893 iStatusControl->MakeVisible( ETrue ); |
871 iHeaderCtrl->SetStatusButtonVisibility( ETrue ); |
894 iHeaderCtrl->SetStatusButtonVisibility( ETrue ); |
872 } |
895 } |
873 } |
896 } |
874 else |
897 else |