mmappcomponents/audiofetcher/inc/audiofetcherdialogutils.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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: Utils class for Media Fetch plug-in
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AUDIOFETCHERDIALOGUTILS_H
       
    20 #define AUDIOFETCHERDIALOGUTILS_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <s32strm.h>  // RReadStream RWriteStream
       
    27 #include <f32file.h>  // RFs
       
    28 
       
    29 #include <eikspane.h>   // CEikStatusPane
       
    30 #include <aknnavi.h>    // CAknNavigationControlContainer
       
    31 #include <eikimage.h>   // CEikImage
       
    32 
       
    33 
       
    34 
       
    35 // CONSTANTS
       
    36 
       
    37 const TInt KBufSize64  = 64;
       
    38 const TInt KBufSize128 = 128;
       
    39 const TInt KBufSize256 = 256;
       
    40 const TInt KBufSize512 = 512;
       
    41 
       
    42 
       
    43 //	FORWARD DECLARATIONS
       
    44 
       
    45 class CAknAppUi;
       
    46 class CRepository;
       
    47 
       
    48 /**
       
    49 * MMFActiveCallerObserver
       
    50 *
       
    51 * MMFActiveCallerObserver is for observing CActiveCaller.
       
    52 */
       
    53 NONSHARABLE_CLASS (MActiveCallerObserver)
       
    54     {
       
    55     public:
       
    56 	    virtual void HandleActiveCallL( TInt aCallId ) = 0;
       
    57     };
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 /**
       
    63 * CActiveCaller
       
    64 *
       
    65 * CActiveCaller is used for generating a call from active scheduler.
       
    66 * Typical use is to start some operation after a short delay.
       
    67 */
       
    68 NONSHARABLE_CLASS (CActiveCaller) : public CActive
       
    69     {
       
    70     public:
       
    71         static CActiveCaller* NewL( MActiveCallerObserver* aObserver );
       
    72         virtual ~CActiveCaller();
       
    73 
       
    74     private:
       
    75 	    CActiveCaller( MActiveCallerObserver* aObserver );
       
    76 	    void ConstructL();
       
    77 
       
    78 	public:
       
    79 		void Start( TInt aCallId, TInt aMilliseconds );
       
    80 		void Stop();
       
    81 		void Request();
       
    82 
       
    83     private:
       
    84 	    void RunL();
       
    85 	    void DoCancel();
       
    86         
       
    87     private:
       
    88 		// call that is passed to observer
       
    89 		TInt iCallId;
       
    90 
       
    91 		// timer
       
    92 		RTimer iTimer;
       
    93 
       
    94 		// observer that gets called
       
    95 		MActiveCallerObserver* iObserver;
       
    96     };
       
    97 
       
    98 
       
    99 
       
   100 /**
       
   101 * CNaviPaneHandler
       
   102 * 
       
   103 * This class is used for changing navipane title.
       
   104 */
       
   105 NONSHARABLE_CLASS (CNaviPaneHandler) : public CBase
       
   106     {
       
   107     public:
       
   108         /**
       
   109         * Destructor.
       
   110         */
       
   111         virtual ~CNaviPaneHandler();
       
   112 
       
   113         /**
       
   114         * C++ default constructor.
       
   115         */
       
   116         CNaviPaneHandler(CEikStatusPane* aStatusPane);
       
   117 
       
   118     public:
       
   119 
       
   120         /**
       
   121         * Sets navi pane title.
       
   122         * @param aTitle.
       
   123         * @return None.
       
   124         */
       
   125         void SetNaviPaneTitleL(const TDesC& aTitle);
       
   126         
       
   127         /**
       
   128         * Store navi pane.
       
   129         * @param None.
       
   130         * @return None.
       
   131         */
       
   132         void StoreNavipaneL();
       
   133 
       
   134     private:
       
   135         // status pane
       
   136         CEikStatusPane* iStatusPane;
       
   137     
       
   138         // navi Pane
       
   139         CAknNavigationControlContainer* iNaviPane;
       
   140         
       
   141         // navi decorator
       
   142         CAknNavigationDecorator* iNaviDecorator;
       
   143         
       
   144         // has Navidecorator been pushed into navi pane
       
   145         TBool iNavidecoratorPushed;
       
   146         
       
   147         // has navi pane been pushed into navigation pane's object stack
       
   148         TBool iNavipanePushed;
       
   149     };
       
   150 
       
   151 
       
   152 
       
   153 /**
       
   154 * CStatusPaneHandler
       
   155 * 
       
   156 * This class is used for changing dialog title and image.
       
   157 */
       
   158 NONSHARABLE_CLASS (CStatusPaneHandler) : public CBase
       
   159     {
       
   160     public:
       
   161         /**
       
   162         * Two-phased constructor.
       
   163         */
       
   164         static CStatusPaneHandler* NewL( CAknAppUi* aAppUi );
       
   165 
       
   166         /**
       
   167         * Destructor.
       
   168         */
       
   169         virtual ~CStatusPaneHandler();
       
   170 
       
   171     private:
       
   172         /**
       
   173         * By default Symbian OS constructor is private.
       
   174         */
       
   175         void ConstructL();
       
   176 
       
   177         /**
       
   178         * C++ default constructor.
       
   179         */
       
   180         CStatusPaneHandler( CAknAppUi* aAppUi );
       
   181 
       
   182     public:
       
   183         /**
       
   184         * Stores original title so it can be restored when dialog closes.
       
   185         * @param  None.
       
   186         * @return None.
       
   187         */
       
   188         void StoreOriginalTitleL();
       
   189 
       
   190         /**
       
   191         * Restores original title.
       
   192         * @param  None.
       
   193         * @return None.
       
   194         */
       
   195         void RestoreOriginalTitleL();
       
   196 
       
   197         /**
       
   198         * Sets dialog title.
       
   199         * @param  aText.
       
   200         * @return None.
       
   201         */
       
   202         void SetTitleL( const TDesC& aText );
       
   203 
       
   204         /**
       
   205         * Sets dialog title.
       
   206         * @param  aResourceId.
       
   207         * @return None.
       
   208         */
       
   209         void SetTitleL( TInt aResourceId );
       
   210 
       
   211     public:
       
   212         /**
       
   213         * Sets dialog title.
       
   214         * @param aAppUi.
       
   215         * @param aText.
       
   216         * @return Return code.
       
   217         */
       
   218         static TBool SetTitleL( CAknAppUi* aAppUi, const TDesC& aText );
       
   219 
       
   220         /**
       
   221         * Gets dialog title.
       
   222         * @param aAppUi.
       
   223         * @param aText.
       
   224         * @return Return code.
       
   225         */
       
   226         static TBool GetTitleL( CAknAppUi* aAppUi, TDes& aText );
       
   227         
       
   228         /**
       
   229         * Sets navi pane title.
       
   230         * @param aTitle.
       
   231         * @return None.
       
   232         */
       
   233         void SetNaviPaneTitleL( const TDesC& aTitle );
       
   234         
       
   235         /**
       
   236         * Sets navi pane title.
       
   237         * @param aTitle.
       
   238         * @return None.
       
   239         */
       
   240         void SetNaviPaneTitle( const TDesC& aTitle );
       
   241         
       
   242         /**
       
   243         * Sets navi pane title.
       
   244         * @param aTitle.
       
   245         * @return None.
       
   246         */
       
   247         void SetNaviPaneTitleL( TInt aResource );
       
   248         
       
   249         /**
       
   250         * Store navi pane.
       
   251         * @param None.
       
   252         * @return None.
       
   253         */
       
   254         void StoreNavipaneL();
       
   255         
       
   256         static void StrCopy( TDes& aTarget, const TDesC& aSource );
       
   257 
       
   258     private:
       
   259         // access to app ui
       
   260         CAknAppUi* iAppUi;
       
   261 
       
   262         // original status pane title
       
   263         TBuf<KBufSize256> iOriginalTitle;
       
   264         
       
   265         // is original status pane title stored
       
   266         TBool iOriginalTitleStored;
       
   267 
       
   268         // original context pane image
       
   269         CEikImage* iOriginalImage;
       
   270         
       
   271         CNaviPaneHandler* iNaviPaneHandler;
       
   272     };
       
   273 
       
   274 
       
   275 
       
   276 
       
   277 /**
       
   278 * CDriveUtil
       
   279 *
       
   280 * CDriveUtil is used for getting drive information.
       
   281 */
       
   282 NONSHARABLE_CLASS (CDriveUtil) : public CBase
       
   283     {
       
   284     public:
       
   285         static CDriveUtil* NewL();
       
   286         virtual ~CDriveUtil();
       
   287 
       
   288     private:
       
   289         CDriveUtil();
       
   290         void ConstructL();
       
   291 
       
   292     public:
       
   293         TBool IsMemoryCard( const TDesC& aFullPath );
       
   294         TBool IsMassStorage( const TDesC& aFullPath );
       
   295         TBool IsRom( const TDesC& aFullPath );
       
   296         
       
   297     private:
       
   298         RFs iFsSession;
       
   299     };
       
   300             
       
   301 #endif // AUDIOFETCHERDIALOGUTILS_H
       
   302 
       
   303 // End of File