2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Dialog used to prompt filename.
19 #ifndef CAKNFILENAMEPROMPTDIALOG_H
20 #define CAKNFILENAMEPROMPTDIALOG_H
23 #include <CAknCommonDialogsBase.h>
25 // FORWARD DECLARATIONS
26 class MAknFileSelectionObserver;
30 * A class that launches a pop-up dialog for filename prompting.
32 * @lib CommonDialogs.lib
35 NONSHARABLE_CLASS(CAknFileNamePromptDialog) : public CAknCommonDialogsBase
37 public: // Constructors and destructors
41 * Creates Filename Prompt Dialog with default values.
42 * @return Returns a pointer to an instance of itself.
44 IMPORT_C static CAknFileNamePromptDialog* NewL();
48 * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
49 * @return Returns a pointer to an instance of itself.
51 IMPORT_C static CAknFileNamePromptDialog* NewL( TInt aResourceId );
53 IMPORT_C ~CAknFileNamePromptDialog();
55 public: // New functions
58 * Sets path from which is checked if a file already exists.
59 * @param aPath Full path with trailing backslash.
61 IMPORT_C void SetPathL( const TDesC& aPath );
64 * Sets an observer which is asked if if the filename user inputs
66 * @param aObserver A pointer to an observer (implemented in an application).
68 IMPORT_C void SetObserver( MAknFileSelectionObserver* aObserver );
71 * Sets prompt text (title) for dialog.
72 * @param aText Title text.
74 IMPORT_C void SetTitleL( const TDesC& aText );
77 * Sets the text used for left softkey.
78 * @param aText The text used for left softkey.
80 IMPORT_C void SetLeftSoftkeyL( const TDesC& aText );
83 * Sets the text used for right softkey.
84 * @param aText The text used for right softkey.
86 IMPORT_C void SetRightSoftkeyL( const TDesC& aText );
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.
95 IMPORT_C TBool ExecuteL( TDes& aFileName );
98 * A static method for launching a filename prompt dialog.
99 * Parameters are described in method RunL
101 IMPORT_C static TBool RunDlgLD( TDes& aFileName,
103 MAknFileSelectionObserver* aObserver = NULL );
106 * A static method for launching a filename prompt dialog.
107 * Parameters are described in method RunL
109 IMPORT_C static TBool RunDlgLD( TDes& aFileName,
112 MAknFileSelectionObserver* aObserver = NULL );
115 * A static method for launching a filename prompt dialog.
116 * Parameters are described in method RunL
118 IMPORT_C static TBool RunDlgLD( TDes& aFileName,
121 MAknFileSelectionObserver* aObserver = NULL );
124 * A method for use this dialog for renaming file
126 * @param aFileName File name user input
127 * @return Returns true if user has accepted filename and false
128 * if user hits cancel.
131 IMPORT_C TBool RenameL( TDes& aFileName );
132 private: // New functions
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.
148 MAknFileSelectionObserver* aObserver );
151 * Sets default CFD resource id.
153 void SetResourceId( TInt& aResourceId ) const;
156 * Reads settings from resource.
158 void ReadFromResourceL( TInt aResourceId );
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.
168 TBool ShowDialogL( TDes& aFilename, TBool aIfRename );
169 private: // Constructors and destructors
172 * Second phase construct from resource.
173 * @param aResourceId A resource id (FILENAMEPROMPTDIALOG).
175 void ConstructFromResourceL( TInt aResourceId );
177 CAknFileNamePromptDialog();
182 MAknFileSelectionObserver* iObserver;
184 // Own: Descriptor for default filename
185 HBufC* iDefaultFileName;
187 // Own: Descriptor for path
190 // Own: Descriptor for window title
193 // Own: Descriptor for left softkey
196 // Own: Descriptor for right softkey
197 HBufC* iRightSoftkey;
200 #endif // CAKNFILENAMEPROMPTDIALOG_H