epoc32/include/mw/caknfilenamepromptdialog.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/caknfilenamepromptdialog.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/caknfilenamepromptdialog.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,202 @@
     1.4 -caknfilenamepromptdialog.h
     1.5 +/*
     1.6 +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  Dialog used to prompt filename.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef CAKNFILENAMEPROMPTDIALOG_H
    1.24 +#define CAKNFILENAMEPROMPTDIALOG_H
    1.25 +
    1.26 +// INCLUDES
    1.27 +#include <CAknCommonDialogsBase.h>
    1.28 +
    1.29 +// FORWARD DECLARATIONS
    1.30 +class MAknFileSelectionObserver;
    1.31 +
    1.32 +//  CLASS DEFINITION
    1.33 +/**
    1.34 +* A class that launches a pop-up dialog for filename prompting.
    1.35 +*
    1.36 +*  @lib CommonDialogs.lib
    1.37 +*  @since 1.2
    1.38 +*/
    1.39 +NONSHARABLE_CLASS(CAknFileNamePromptDialog) : public CAknCommonDialogsBase
    1.40 +    {
    1.41 +    public:     // Constructors and destructors
    1.42 +
    1.43 +        /**
    1.44 +        * Static constructor.
    1.45 +        * Creates Filename Prompt Dialog with default values.
    1.46 +        * @return Returns a pointer to an instance of itself.
    1.47 +        */
    1.48 +        IMPORT_C static CAknFileNamePromptDialog* NewL();
    1.49 +
    1.50 +        /**
    1.51 +        * Static constructor.
    1.52 +        * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
    1.53 +        * @return Returns a pointer to an instance of itself.
    1.54 +        */
    1.55 +        IMPORT_C static CAknFileNamePromptDialog* NewL( TInt aResourceId );
    1.56 +
    1.57 +        IMPORT_C ~CAknFileNamePromptDialog();
    1.58 +
    1.59 +    public:     // New functions
    1.60 +
    1.61 +        /**
    1.62 +        * Sets path from which is checked if a file already exists.
    1.63 +        * @param aPath Full path with trailing backslash.
    1.64 +        */
    1.65 +        IMPORT_C void SetPathL( const TDesC& aPath );
    1.66 +
    1.67 +        /**
    1.68 +        * Sets an observer which is asked if if the filename user inputs
    1.69 +        *  can be accepted.
    1.70 +        * @param aObserver A pointer to an observer (implemented in an application).
    1.71 +        */
    1.72 +        IMPORT_C void SetObserver( MAknFileSelectionObserver* aObserver );
    1.73 +
    1.74 +        /**
    1.75 +        * Sets prompt text (title) for dialog.
    1.76 +        * @param aText Title text.
    1.77 +        */
    1.78 +        IMPORT_C void SetTitleL( const TDesC& aText );
    1.79 +
    1.80 +        /**
    1.81 +        * Sets the text used for left softkey.
    1.82 +        * @param aText The text used for left softkey.
    1.83 +        */
    1.84 +        IMPORT_C void SetLeftSoftkeyL( const TDesC& aText );
    1.85 +
    1.86 +        /**
    1.87 +        * Sets the text used for right softkey.
    1.88 +        * @param aText The text used for right softkey.
    1.89 +        */
    1.90 +        IMPORT_C void SetRightSoftkeyL( const TDesC& aText );
    1.91 +
    1.92 +        /**
    1.93 +        * Executes the filename prompt dialog.
    1.94 +        * @param aFileName A reference to filename.
    1.95 +        *        If parameter is set, it is used as default filename.
    1.96 +        * @return Returns true if user has accepted filename and false
    1.97 +        *         if user hits cancel.
    1.98 +        */
    1.99 +        IMPORT_C TBool ExecuteL( TDes& aFileName );
   1.100 +
   1.101 +        /**
   1.102 +        * A static method for launching a filename prompt dialog.
   1.103 +        * Parameters are described in method RunL
   1.104 +        */
   1.105 +        IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   1.106 +            const TDesC& aPath,
   1.107 +            MAknFileSelectionObserver* aObserver = NULL );
   1.108 +
   1.109 +        /**
   1.110 +        * A static method for launching a filename prompt dialog.
   1.111 +        * Parameters are described in method RunL
   1.112 +        */
   1.113 +        IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   1.114 +            const TDesC& aPath,
   1.115 +            const TDesC& aTitle,
   1.116 +            MAknFileSelectionObserver* aObserver = NULL );
   1.117 +
   1.118 +        /**
   1.119 +        * A static method for launching a filename prompt dialog.
   1.120 +        * Parameters are described in method RunL
   1.121 +        */
   1.122 +        IMPORT_C static TBool RunDlgLD( TDes& aFileName,
   1.123 +            const TDesC& aPath,
   1.124 +            TInt aResourceId,
   1.125 +            MAknFileSelectionObserver* aObserver = NULL );
   1.126 +
   1.127 +        /**
   1.128 +        * A method for use this dialog for renaming file
   1.129 +        *
   1.130 +        * @param aFileName File name user input
   1.131 +        * @return Returns true if user has accepted filename and false
   1.132 +        *         if user hits cancel.
   1.133 +        * @since 3.2
   1.134 +        */
   1.135 +        IMPORT_C TBool RenameL( TDes& aFileName );
   1.136 +    private:    // New functions
   1.137 +
   1.138 +        /**
   1.139 +        * A static method for launching a filename prompt dialog.
   1.140 +        * Method is called from a RunDlgLD method with correct parameters.
   1.141 +        * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
   1.142 +        * @param aFileName A reference to a filename as described in ExecuteL.
   1.143 +        * @param aPath Full path with trailing backslash.
   1.144 +        * @param aTitle The text for title.
   1.145 +        * @param aObserver An observer which is assigned to NULL by default.
   1.146 +        */
   1.147 +        static TBool RunL(
   1.148 +            TInt aResourceId,
   1.149 +            TDes& aFileName,
   1.150 +            const TDesC& aPath,
   1.151 +            const TDesC& aTitle,
   1.152 +            MAknFileSelectionObserver* aObserver );
   1.153 +
   1.154 +        /**
   1.155 +        * Sets default CFD resource id.
   1.156 +        */
   1.157 +        void SetResourceId( TInt& aResourceId ) const;
   1.158 +
   1.159 +        /**
   1.160 +        * Reads settings from resource.
   1.161 +        */
   1.162 +        void ReadFromResourceL( TInt aResourceId );
   1.163 +
   1.164 +        /**
   1.165 +        * Handle file name dialog for both creating and renaming
   1.166 +        * @param aFileName File name user input
   1.167 +        * @param aIfRename True for renaming; False for creating
   1.168 +        * @return Returns true if user has accepted filename and false
   1.169 +        *         if user hits cancel.
   1.170 +        * @since 3.2
   1.171 +        */
   1.172 +        TBool ShowDialogL( TDes& aFilename, TBool aIfRename );
   1.173 +    private:    // Constructors and destructors
   1.174 +
   1.175 +        /**
   1.176 +        * Second phase construct from resource.
   1.177 +        * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
   1.178 +        */
   1.179 +        void ConstructFromResourceL( TInt aResourceId );
   1.180 +
   1.181 +        CAknFileNamePromptDialog();
   1.182 +
   1.183 +    protected:  // Data
   1.184 +
   1.185 +        // Ref: observer
   1.186 +        MAknFileSelectionObserver* iObserver;
   1.187 +
   1.188 +        // Own: Descriptor for default filename
   1.189 +        HBufC* iDefaultFileName;
   1.190 +
   1.191 +        // Own: Descriptor for path
   1.192 +        HBufC* iPath;
   1.193 +
   1.194 +        // Own: Descriptor for window title
   1.195 +        HBufC* iTitle;
   1.196 +
   1.197 +        // Own: Descriptor for left softkey
   1.198 +        HBufC* iLeftSoftkey;
   1.199 +
   1.200 +        // Own: Descriptor for right softkey
   1.201 +        HBufC* iRightSoftkey;
   1.202 +    };
   1.203 +
   1.204 +#endif // CAKNFILENAMEPROMPTDIALOG_H
   1.205 +
   1.206 +// End of File