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