epoc32/include/mw/caknfilenamepromptdialog.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002-2006 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:  Dialog used to prompt filename.
    15 *
    16 */
    17 
    18 
    19 #ifndef CAKNFILENAMEPROMPTDIALOG_H
    20 #define CAKNFILENAMEPROMPTDIALOG_H
    21 
    22 // INCLUDES
    23 #include <CAknCommonDialogsBase.h>
    24 
    25 // FORWARD DECLARATIONS
    26 class MAknFileSelectionObserver;
    27 
    28 //  CLASS DEFINITION
    29 /**
    30 * A class that launches a pop-up dialog for filename prompting.
    31 *
    32 *  @lib CommonDialogs.lib
    33 *  @since 1.2
    34 */
    35 NONSHARABLE_CLASS(CAknFileNamePromptDialog) : public CAknCommonDialogsBase
    36     {
    37     public:     // Constructors and destructors
    38 
    39         /**
    40         * Static constructor.
    41         * Creates Filename Prompt Dialog with default values.
    42         * @return Returns a pointer to an instance of itself.
    43         */
    44         IMPORT_C static CAknFileNamePromptDialog* NewL();
    45 
    46         /**
    47         * Static constructor.
    48         * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
    49         * @return Returns a pointer to an instance of itself.
    50         */
    51         IMPORT_C static CAknFileNamePromptDialog* NewL( TInt aResourceId );
    52 
    53         IMPORT_C ~CAknFileNamePromptDialog();
    54 
    55     public:     // New functions
    56 
    57         /**
    58         * Sets path from which is checked if a file already exists.
    59         * @param aPath Full path with trailing backslash.
    60         */
    61         IMPORT_C void SetPathL( const TDesC& aPath );
    62 
    63         /**
    64         * Sets an observer which is asked if if the filename user inputs
    65         *  can be accepted.
    66         * @param aObserver A pointer to an observer (implemented in an application).
    67         */
    68         IMPORT_C void SetObserver( MAknFileSelectionObserver* aObserver );
    69 
    70         /**
    71         * Sets prompt text (title) for dialog.
    72         * @param aText Title text.
    73         */
    74         IMPORT_C void SetTitleL( const TDesC& aText );
    75 
    76         /**
    77         * Sets the text used for left softkey.
    78         * @param aText The text used for left softkey.
    79         */
    80         IMPORT_C void SetLeftSoftkeyL( const TDesC& aText );
    81 
    82         /**
    83         * Sets the text used for right softkey.
    84         * @param aText The text used for right softkey.
    85         */
    86         IMPORT_C void SetRightSoftkeyL( const TDesC& aText );
    87 
    88         /**
    89         * Executes the filename prompt dialog.
    90         * @param aFileName A reference to filename.
    91         *        If parameter is set, it is used as default filename.
    92         * @return Returns true if user has accepted filename and false
    93         *         if user hits cancel.
    94         */
    95         IMPORT_C TBool ExecuteL( TDes& aFileName );
    96 
    97         /**
    98         * A static method for launching a filename prompt dialog.
    99         * Parameters are described in method RunL
   100         */
   101         IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   102             const TDesC& aPath,
   103             MAknFileSelectionObserver* aObserver = NULL );
   104 
   105         /**
   106         * A static method for launching a filename prompt dialog.
   107         * Parameters are described in method RunL
   108         */
   109         IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   110             const TDesC& aPath,
   111             const TDesC& aTitle,
   112             MAknFileSelectionObserver* aObserver = NULL );
   113 
   114         /**
   115         * A static method for launching a filename prompt dialog.
   116         * Parameters are described in method RunL
   117         */
   118         IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   119             const TDesC& aPath,
   120             TInt aResourceId,
   121             MAknFileSelectionObserver* aObserver = NULL );
   122 
   123         /**
   124         * A method for use this dialog for renaming file
   125         *
   126         * @param aFileName File name user input
   127         * @return Returns true if user has accepted filename and false
   128         *         if user hits cancel.
   129         * @since 3.2
   130         */
   131         IMPORT_C TBool RenameL( TDes& aFileName );
   132     private:    // New functions
   133 
   134         /**
   135         * A static method for launching a filename prompt dialog.
   136         * Method is called from a RunDlgLD method with correct parameters.
   137         * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
   138         * @param aFileName A reference to a filename as described in ExecuteL.
   139         * @param aPath Full path with trailing backslash.
   140         * @param aTitle The text for title.
   141         * @param aObserver An observer which is assigned to NULL by default.
   142         */
   143         static TBool RunL(
   144             TInt aResourceId,
   145             TDes& aFileName,
   146             const TDesC& aPath,
   147             const TDesC& aTitle,
   148             MAknFileSelectionObserver* aObserver );
   149 
   150         /**
   151         * Sets default CFD resource id.
   152         */
   153         void SetResourceId( TInt& aResourceId ) const;
   154 
   155         /**
   156         * Reads settings from resource.
   157         */
   158         void ReadFromResourceL( TInt aResourceId );
   159 
   160         /**
   161         * Handle file name dialog for both creating and renaming
   162         * @param aFileName File name user input
   163         * @param aIfRename True for renaming; False for creating
   164         * @return Returns true if user has accepted filename and false
   165         *         if user hits cancel.
   166         * @since 3.2
   167         */
   168         TBool ShowDialogL( TDes& aFilename, TBool aIfRename );
   169     private:    // Constructors and destructors
   170 
   171         /**
   172         * Second phase construct from resource.
   173         * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
   174         */
   175         void ConstructFromResourceL( TInt aResourceId );
   176 
   177         CAknFileNamePromptDialog();
   178 
   179     protected:  // Data
   180 
   181         // Ref: observer
   182         MAknFileSelectionObserver* iObserver;
   183 
   184         // Own: Descriptor for default filename
   185         HBufC* iDefaultFileName;
   186 
   187         // Own: Descriptor for path
   188         HBufC* iPath;
   189 
   190         // Own: Descriptor for window title
   191         HBufC* iTitle;
   192 
   193         // Own: Descriptor for left softkey
   194         HBufC* iLeftSoftkey;
   195 
   196         // Own: Descriptor for right softkey
   197         HBufC* iRightSoftkey;
   198     };
   199 
   200 #endif // CAKNFILENAMEPROMPTDIALOG_H
   201 
   202 // End of File