00001 /* 00002 * ============================================================================ 00003 * Name : SpdiaControl.h 00004 * Part of : SpeedDial / SpdCtrl.dll 00005 * Interface : 00006 * Description : A utility that provides services to both the Speeddial and 00007 * PhoneBook applications for getting and setting speeddial 00008 * number configuration. 00009 * Version : 00010 * 00011 * Copyright © 2002 - 2005 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 * ============================================================================ 00021 */ 00022 00023 00024 #ifndef SPDIACONTROL_H 00025 #define SPDIACONTROL_H 00026 00027 // INCLUDES 00028 #include <coecntrl.h> 00029 #include <TPbkContactItemField.h> 00030 #include <aknutils.h> 00031 #include <MPbkContactDbObserver.h> 00032 #include <MPbkThumbnailOperationObservers.h> 00033 00034 // FORWARD DECLARATIONS 00035 class CAknGrid; 00036 class CGulIcon; 00037 class CEikonEnv; 00038 class TSpdiaIndexData; 00039 class CPbkContactEngine; 00040 class RPbkViewResourceFile; 00041 class CEikStatusPane; 00042 class CPAlbImageData; 00043 class CSpdiaGridDlg; 00044 class CPbkContactChangeNotifier; 00045 class CPbkSingleItemFetchDlg; 00046 class CAknQueryDialog; 00047 00048 class CPAlbImageFactory; 00049 class CPbkThumbnailManager; 00050 00051 class CAknsBasicBackgroundControlContext; 00052 #include <AknsConstants.h> 00053 00054 // CLASS DECLARATION 00055 00063 // one line code added for build ver 2.6 00064 const TInt KArraySize =9; 00065 class CSpdiaControl : public CCoeControl, 00066 public MPbkContactDbObserver, 00067 private MPbkThumbnailGetObserver 00068 { 00069 public: // SpdiaControl APIs 00073 IMPORT_C static CSpdiaControl* NewL(); 00074 00080 IMPORT_C static CSpdiaControl* NewL( 00081 CPbkContactEngine& aPbkEngine); 00082 00091 IMPORT_C TBool AssignDialNumberL(TInt aLocation, 00092 CEikStatusPane* aStatusPane = NULL); 00093 00104 IMPORT_C TInt ExecuteLD(TContactItemId aId, TInt aFieldIdx); 00105 00112 IMPORT_C void Cancel(); 00113 00126 IMPORT_C TBool DialNumberL(TInt aLocation, TDes& aPhoneNumber, 00127 CEikStatusPane* aStatusPane = NULL); 00128 00129 private: // Constructors 00133 CSpdiaControl(); 00134 00138 CSpdiaControl(CPbkContactEngine* aPbkEngine); 00139 00144 TSize GetThumbnailSize(); 00145 00146 public: // Destructor 00147 00151 IMPORT_C virtual ~CSpdiaControl(); 00152 00153 public: // New function 00162 IMPORT_C TBool VoiceMailL(TDes& aNumber); 00163 00167 IMPORT_C CPbkContactEngine* PbkEngine() const; 00168 00176 IMPORT_C TInt Index(TInt aDial) const; 00177 00185 IMPORT_C TInt Number(TInt aIndex) const; 00186 00193 IMPORT_C TContactItemId ContactId(TInt aIndex) const; 00194 00202 IMPORT_C const TDesC& PhoneDialNumber(TInt aDial) const; 00203 00210 IMPORT_C const TDesC& PhoneNumber(TInt aIndex) const; 00211 00212 public: // SpeedDial internal API 00223 IMPORT_C HBufC* ContactTitleL(TContactItemId aCid, TBool aUnnamed); 00224 00230 IMPORT_C TInt IconIndex(TInt aIndex) const; 00231 00237 IMPORT_C TInt ThumbIndex(TInt aIndex) const; 00238 00242 IMPORT_C CArrayPtr<CGulIcon>* IconArray() const; 00243 00253 IMPORT_C TBool CreateGridDataL(CAknGrid* aGrid, TBool aIndex); 00254 00260 IMPORT_C TBool AssignDialIndexL(TInt aIndex); 00261 00269 IMPORT_C TBool RemoveDialIndexL(TInt aIndex, 00270 TBool aConfirmation = ETrue); 00274 IMPORT_C TBool AssignNumberL(TInt aIndex, 00275 CEikStatusPane* aStatusPane, 00276 CCoeControl* aContainer, 00277 TBool aConfirmation); 00278 IMPORT_C void ApplyCellSpdiaPaneStyleL(CAknGrid& aListBox, TSize& aSize); 00279 IMPORT_C void DrawShadow(CWindowGc& aGc, const TSize& aSize); 00280 00286 IMPORT_C void SetLayout(const TRect& aRect); 00287 00291 IMPORT_C TInt Size() const; 00292 00296 IMPORT_C TInt VMBoxPosition() const; 00297 00301 IMPORT_C TInt SpdIconIndex(TInt aIndex) const; 00302 00306 IMPORT_C TInt NumberType(TInt aIndex) const; 00310 IMPORT_C void DeleteIconArray(); 00314 IMPORT_C void ReloadIconArray(); 00315 IMPORT_C TInt VoiceMailType(); 00319 IMPORT_C TInt GetSpdCtrlLastError(); 00320 #start_since SINCE_3_1_SDK 00321 00327 IMPORT_C TBool CheckingIfPopUpNeeded( ); 00328 #end_since SINCE_3_1_SDK 00329 00330 public: 00338 TBool CreateDataL(const CAknGrid& aGrid); 00339 00343 // TSize GridSize() const; // not referenced... 00344 00352 TBool ConfirmationNumberL(TInt aIndex, 00353 TInt aId, 00354 TInt aPromptId); 00355 00361 void DrawShadow(CWindowGc& aGc) const; 00362 00363 private: // Functions from base classes 00364 // from MpblThumbnailOperation 00372 void PbkThumbnailGetComplete(MPbkThumbnailOperation& aOperation, 00373 CFbsBitmap* aBitmap); 00374 00381 void PbkThumbnailGetFailed 00382 (MPbkThumbnailOperation& aOperation, TInt aError); 00383 00387 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 00388 00389 private: // from CCoeControl 00393 void Draw(const TRect& aRect) const; 00394 00398 void SizeChanged(); 00399 00400 private: 00404 void HandleDatabaseEventL(TContactDbObserverEvent aEvent); 00405 00406 private: // functions 00410 void ConstructL(); 00411 00415 void InitIndexDataL(); 00416 00420 TBool UpdateIndexDataL(TInt aIndex); 00421 00428 TInt FindIconIndex(TInt aId) const; 00429 00435 TInt ThumbType(TInt aIndex) const; 00436 00442 TSize ThumbSize(TInt aIndex) const; 00443 00450 void SetContactId(TInt aIndex, TContactItemId aCid); // not referenced... 00451 00459 TInt IconPositionL(const CPbkContactItem& aItem, TInt aDial, TInt& aFieldId); 00460 00466 TInt SetIconArrayL(CArrayPtrFlat<CGulIcon>* aArray); 00467 00475 HBufC* ItemDescriptorLC(TInt aIndex, const TSpdiaIndexData& aSdmData); 00476 00483 HBufC* CreateItemDescriptorLC(const TSpdiaIndexData& aSdmData); 00484 00491 void AppendTextL(const TSpdiaIndexData& aSdmData, TPtr& aText); 00492 00500 TPbkContactItemField* FindFieldL(CPbkContactItem& aItem, 00501 TPbkFieldId aFieldId); 00502 00510 void AppendThumbnail(const TSpdiaIndexData& aSdmData, 00511 TPtr& aText, 00512 TBool aFixedLocation); 00513 00519 TInt ConvThumbType(const TSize& aSize) const; 00520 00525 void SetOperationsL(); 00526 00532 void SetItemDataL(CDesCArray& aArray); 00533 00540 void AssignDialL(TContactItemId aId, TInt aFieldIdx, TInt aDial); 00541 00549 TBool CheckSpaceBelowCriticalLevelL(); 00550 00557 TInt HasOperation(const MPbkThumbnailOperation& aOperation); 00558 00562 void ResetArray(); 00563 00570 void SetIndexDataL(TInt aIndex, TSpdiaIndexData& aSdmData); 00571 00578 void ChangeIndexDataL(TInt aIndex, const TSpdiaIndexData& aSdmData); 00579 00587 TBool CreateIndexIconL(TInt aIndex, TSpdiaIndexData& aSdmData, 00588 TBool aSetUpdateThumb); 00589 00590 00591 private: 00592 //code added for build ver 2.6 00593 void InitializeArray(); 00594 00595 private: // Data 00596 // The type of the caller application. 00597 enum TGridUse 00598 { 00599 EGridUse, // SpeedDial 00600 EGridUseAndUpdate, // PhoneBook 00601 EGridNoUse // PhoneClient 00602 }; 00603 CPbkContactEngine* iEngine; // owned by this 00604 TBool iExEngine; // engine owned flags 00605 TGridUse iGridUsed; 00606 00607 TInt iSdmCount; // Grid cell count(Row * col) 00608 00609 CArrayFixFlat<TSpdiaIndexData>* iSdmArray; // owned by this 00610 CArrayFixFlat<TAknLayoutRect>* iShadowLayout; // owned by this 00611 00612 CPbkContactChangeNotifier* iPbkNotifier; // owned by this 00613 CPbkSingleItemFetchDlg* iPbkSingleItem; // owned by this 00614 CAknQueryDialog* iQueryDialog; // owned by this 00615 RPbkViewResourceFile* iPbkResourceFile; // owned by this 00616 CSpdiaGridDlg* iGridDlg; // owned by this 00617 00619 CPbkThumbnailManager* iManager; 00621 CPAlbImageFactory* iThumbFactory; 00622 00623 CAknGrid* iGrid; 00624 TInt iFileOffset; 00625 CArrayPtrFlat<CGulIcon>* iIconArray; 00626 00627 CAknsBasicBackgroundControlContext* iBgContext; 00628 00629 // Variable used to know if the popup dialog has to be shown 00630 // according to the release. 00631 TBool iBooleanVarForAddingDialogVariation; 00632 //Code added for build ver 2.6. 00633 RArray<TAknsItemID>*iDialSkinBmp; 00634 RArray<TAknsItemID>*iSkinIcons; 00635 TAknLayoutRect icellLayout[KArraySize]; 00636 TBuf<254> iBmpPath; 00637 TBuf<254> iRscPath; 00638 TInt iType; 00639 TInt iError; 00640 TBool iPopupDialog; 00641 CAknQueryDialog* iSaveChangesDialog; 00642 TBool iSaveDlg; 00643 }; 00644 00645 // SPDIACONTROL_H 00646 #endif 00647 00648 // End of File 00649