profilesservices/MediaFileList/Inc/mediafiledialogutils.h
branchRCL_3
changeset 25 7e0eff37aedb
equal deleted inserted replaced
24:8ee96d21d9bf 25:7e0eff37aedb
       
     1 /*
       
     2 * Copyright (c) 2007 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:   Basic functionality of MediaFileList.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MEDIALFILEDIALOGUTILS_H
       
    22 #define MEDIALFILEDIALOGUTILS_H
       
    23 
       
    24 
       
    25 //  INCLUDES
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <s32strm.h>  // RReadStream RWriteStream
       
    29 #include <f32file.h>  // RFs
       
    30 
       
    31 #include <eikspane.h>   // CEikStatusPane
       
    32 #include <aknnavi.h>    // CAknNavigationControlContainer
       
    33 #include <eikimage.h>   // CEikImage
       
    34 
       
    35 #include <downloadedcontenthandler.h> // MDownloadedContentHandler
       
    36 
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 const TInt KBufSize64  = 64;
       
    41 const TInt KBufSize128 = 128;
       
    42 const TInt KBufSize256 = 256;
       
    43 const TInt KBufSize512 = 512;
       
    44 
       
    45 
       
    46 //	FORWARD DECLARATIONS
       
    47 
       
    48 class CAknAppUi;
       
    49 class CRepository;
       
    50 
       
    51 class CDocumentHandler;
       
    52 class CBrowserLauncher;
       
    53 
       
    54 
       
    55 
       
    56 /**
       
    57 * TMFDialogUtil
       
    58 *
       
    59 * TMFDialogUtil is utility class for media file dialog.
       
    60 */
       
    61 NONSHARABLE_CLASS (TMFDialogUtil)
       
    62     {
       
    63     public:
       
    64 
       
    65     enum TMFDialogPrivateAttribute
       
    66         {
       
    67         EAttrFileName = 100,
       
    68         EAttrDrawingWindow
       
    69         };
       
    70     
       
    71         
       
    72     public:
       
    73         static void ShowInformationQueryL( const TDesC& aText );
       
    74         static void ShowInformationQueryL( TInt aResource );
       
    75         static void ShowInformationNoteL( const TDesC& aText );
       
    76         static void ShowInformationNoteL( TInt aResource );
       
    77 
       
    78         static void ShowErrorNoteL( const TDesC& aText );
       
    79         static void ShowErrorNoteL( TInt aResource );
       
    80         static void ShowErrorNoteL( const TDesC& aText, TInt aError );
       
    81         static TBool ShowNumberQueryL( TInt& aNumber, const TDesC& aTitle );
       
    82         
       
    83         static TBool ShowListQueryL( const TDesC& aTitle, CDesCArray* aList,
       
    84                                      TInt* aSelectedIndex );
       
    85 
       
    86         
       
    87         static TInt AddResFileL();
       
    88         static void StrCopy( TDes& aTarget, const TDesC& aSource );
       
    89         static void Panic( TInt aReason );
       
    90         static void SetIconFileNameL( const TDesC& aName, TDes& aFullName );
       
    91         static CEikImage* CreateImageLC( TAknsItemID aId, const TDesC& aFileName,
       
    92                                          TInt aFileBitmapId, TInt aFileMaskId );
       
    93         static TBool IsEmpty( const TDesC& aText );
       
    94         
       
    95     };
       
    96 
       
    97 
       
    98 /**
       
    99 * MMFActiveCallerObserver
       
   100 *
       
   101 * MMFActiveCallerObserver is for observing CMFActiveCaller.
       
   102 */
       
   103 NONSHARABLE_CLASS (MMFActiveCallerObserver)
       
   104     {
       
   105     public:
       
   106 	    virtual void HandleActiveCallL( TInt aCallId ) = 0;
       
   107     };
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 /**
       
   113 * CMFActiveCaller
       
   114 *
       
   115 * CMFActiveCaller is used for generating a call from active scheduler.
       
   116 * Typical use is to start some operation after a short delay.
       
   117 */
       
   118 NONSHARABLE_CLASS (CMFActiveCaller) : public CActive
       
   119     {
       
   120     public:
       
   121         static CMFActiveCaller* NewL( MMFActiveCallerObserver* aObserver );
       
   122         virtual ~CMFActiveCaller();
       
   123 
       
   124     private:
       
   125 	    CMFActiveCaller( MMFActiveCallerObserver* aObserver );
       
   126 	    void ConstructL();
       
   127 
       
   128 	public:
       
   129 		void Start( TInt aCallId, TInt aMilliseconds );
       
   130 		void Stop();
       
   131 		void Request();
       
   132 
       
   133     private:
       
   134 	    void RunL();
       
   135 	    void DoCancel();
       
   136         
       
   137     private:
       
   138 		// call that is passed to observer
       
   139 		TInt iCallId;
       
   140 
       
   141 		// timer
       
   142 		RTimer iTimer;
       
   143 
       
   144 		// observer that gets called
       
   145 		MMFActiveCallerObserver* iObserver;
       
   146     };
       
   147 
       
   148 
       
   149 
       
   150 /**
       
   151 * CNaviPaneHandler
       
   152 * 
       
   153 * This class is used for changing navipane title.
       
   154 */
       
   155 NONSHARABLE_CLASS (CNaviPaneHandler) : public CBase
       
   156     {
       
   157     public:
       
   158         /**
       
   159         * Destructor.
       
   160         */
       
   161         virtual ~CNaviPaneHandler();
       
   162 
       
   163         /**
       
   164         * C++ default constructor.
       
   165         */
       
   166         CNaviPaneHandler(CEikStatusPane* aStatusPane);
       
   167 
       
   168     public:
       
   169 
       
   170         /**
       
   171         * Sets navi pane title.
       
   172         * @param aTitle.
       
   173         * @return None.
       
   174         */
       
   175         void SetNaviPaneTitleL(const TDesC& aTitle);
       
   176         
       
   177         /**
       
   178         * Store navi pane.
       
   179         * @param None.
       
   180         * @return None.
       
   181         */
       
   182         void StoreNavipaneL();
       
   183 
       
   184     private:
       
   185         // status pane
       
   186         CEikStatusPane* iStatusPane;
       
   187     
       
   188         // navi Pane
       
   189         CAknNavigationControlContainer* iNaviPane;
       
   190         
       
   191         // navi decorator
       
   192         CAknNavigationDecorator* iNaviDecorator;
       
   193         
       
   194         // has Navidecorator been pushed into navi pane
       
   195         TBool iNavidecoratorPushed;
       
   196         
       
   197         // has navi pane been pushed into navigation pane's object stack
       
   198         TBool iNavipanePushed;
       
   199     };
       
   200 
       
   201 
       
   202 
       
   203 /**
       
   204 * CStatusPaneHandler
       
   205 * 
       
   206 * This class is used for changing dialog title and image.
       
   207 */
       
   208 NONSHARABLE_CLASS (CStatusPaneHandler) : public CBase
       
   209     {
       
   210     public:
       
   211         /**
       
   212         * Two-phased constructor.
       
   213         */
       
   214         static CStatusPaneHandler* NewL( CAknAppUi* aAppUi );
       
   215 
       
   216         /**
       
   217         * Destructor.
       
   218         */
       
   219         virtual ~CStatusPaneHandler();
       
   220 
       
   221     private:
       
   222         /**
       
   223         * By default Symbian OS constructor is private.
       
   224         */
       
   225         void ConstructL();
       
   226 
       
   227         /**
       
   228         * C++ default constructor.
       
   229         */
       
   230         CStatusPaneHandler( CAknAppUi* aAppUi );
       
   231 
       
   232     public:
       
   233         /**
       
   234         * Stores original title so it can be restored when dialog closes.
       
   235         * @param  None.
       
   236         * @return None.
       
   237         */
       
   238         void StoreOriginalTitleL();
       
   239 
       
   240         /**
       
   241         * Restores original title.
       
   242         * @param  None.
       
   243         * @return None.
       
   244         */
       
   245         void RestoreOriginalTitleL();
       
   246 
       
   247         /**
       
   248         * Sets dialog title.
       
   249         * @param  aText.
       
   250         * @return None.
       
   251         */
       
   252         void SetTitleL( const TDesC& aText );
       
   253 
       
   254         /**
       
   255         * Sets dialog title.
       
   256         * @param  aResourceId.
       
   257         * @return None.
       
   258         */
       
   259         void SetTitleL( TInt aResourceId );
       
   260 
       
   261     public:
       
   262         /**
       
   263         * Sets dialog title.
       
   264         * @param aAppUi.
       
   265         * @param aText.
       
   266         * @return Return code.
       
   267         */
       
   268         static TBool SetTitleL( CAknAppUi* aAppUi, const TDesC& aText );
       
   269 
       
   270         /**
       
   271         * Gets dialog title.
       
   272         * @param aAppUi.
       
   273         * @param aText.
       
   274         * @return Return code.
       
   275         */
       
   276         static TBool GetTitleL( CAknAppUi* aAppUi, TDes& aText );
       
   277         
       
   278         /**
       
   279         * Sets navi pane title.
       
   280         * @param aTitle.
       
   281         * @return None.
       
   282         */
       
   283         void SetNaviPaneTitleL( const TDesC& aTitle );
       
   284         
       
   285         /**
       
   286         * Sets navi pane title.
       
   287         * @param aTitle.
       
   288         * @return None.
       
   289         */
       
   290         void SetNaviPaneTitle( const TDesC& aTitle );
       
   291         
       
   292         /**
       
   293         * Sets navi pane title.
       
   294         * @param aTitle.
       
   295         * @return None.
       
   296         */
       
   297         void SetNaviPaneTitleL( TInt aResource );
       
   298         
       
   299         /**
       
   300         * Store navi pane.
       
   301         * @param None.
       
   302         * @return None.
       
   303         */
       
   304         void StoreNavipaneL();
       
   305 
       
   306     private:
       
   307         // access to app ui
       
   308         CAknAppUi* iAppUi;
       
   309 
       
   310         // original status pane title
       
   311         TBuf<KBufSize256> iOriginalTitle;
       
   312         
       
   313         // is original status pane title stored
       
   314         TBool iOriginalTitleStored;
       
   315 
       
   316         // original context pane image
       
   317         CEikImage* iOriginalImage;
       
   318         
       
   319         CNaviPaneHandler* iNaviPaneHandler;
       
   320     };
       
   321 
       
   322 
       
   323 
       
   324 
       
   325 /**
       
   326 * CDriveUtil
       
   327 *
       
   328 * CDriveUtil is used for getting drive information.
       
   329 */
       
   330 NONSHARABLE_CLASS (CDriveUtil) : public CBase
       
   331     {
       
   332     public:
       
   333         static CDriveUtil* NewL();
       
   334         virtual ~CDriveUtil();
       
   335 
       
   336     private:
       
   337         CDriveUtil();
       
   338         void ConstructL();
       
   339 
       
   340     public:
       
   341         TBool IsMemoryCard( const TDesC& aFullPath );
       
   342         TBool IsMassStorage( const TDesC& aFullPath );
       
   343         TBool IsRom( const TDesC& aFullPath );
       
   344         
       
   345     private:
       
   346         RFs iFsSession;
       
   347     };
       
   348 
       
   349 
       
   350 /**
       
   351 * CMimeTypeList
       
   352 *
       
   353 * CMimeTypeList is used for storing mime types that 
       
   354 * are excluded from media file list.
       
   355 */
       
   356 NONSHARABLE_CLASS (CMimeTypeList) : public CBase
       
   357     {
       
   358     public:
       
   359         static CMimeTypeList* NewL();
       
   360         virtual ~CMimeTypeList();
       
   361 
       
   362     private:
       
   363         CMimeTypeList();
       
   364         void ConstructL();
       
   365 
       
   366     public:
       
   367         void ResetL();
       
   368         TInt Count();
       
   369         const TDesC& MimeType( TInt aIndex );
       
   370         void AddMimeTypeL( const TDesC& aText );
       
   371         TBool FindMimeTypeL( const TDesC& aText );
       
   372         
       
   373        
       
   374     public:
       
   375         static TInt Compare( const TFileName& aFirst, const TFileName& aSecond );        
       
   376     
       
   377     private:
       
   378         RArray<TFileName> iList;
       
   379     };
       
   380 
       
   381 
       
   382 /**
       
   383 * CWebBrowserLauncher
       
   384 *
       
   385 * CWebBrowserLauncher is used for launching web browser.
       
   386 */
       
   387 NONSHARABLE_CLASS(CWebBrowserLauncher) : public CBase,
       
   388                                          public MDownloadedContentHandler
       
   389     {
       
   390     public:
       
   391         static CWebBrowserLauncher* NewLC();
       
   392         virtual ~CWebBrowserLauncher();
       
   393 
       
   394     private:
       
   395         CWebBrowserLauncher();
       
   396         void ConstructL();
       
   397 
       
   398     public:
       
   399         void LaunchBrowserL();
       
   400 
       
   401     public:
       
   402         TBool HandleContentL( const TDesC& aFileName,
       
   403                               const CAiwGenericParamList& aParamList,
       
   404                               TBool& aContinue );
       
   405         
       
   406         TAny* DownloadedContentHandlerReserved1( TAny* aAnyParam );
       
   407 
       
   408 
       
   409     private:
       
   410         // Browser Launcher
       
   411         CBrowserLauncher* iBrowserLauncher;
       
   412 
       
   413         // Document Handler for saving downloaded tones.
       
   414         CDocumentHandler* iDocumentHandler;
       
   415     };
       
   416 
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 #endif      // MEDIALFILEDIALOGUTILS_H
       
   422 
       
   423 
       
   424             
       
   425 // End of File