classicui_pub/common_file_dialogs_api/tsrc/src/testsdkcfdblocksfilenamepromptdialog.cpp
branchGCC_SURGE
changeset 44 484cb5040995
parent 32 512f698a535d
parent 40 7165f928e888
equal deleted inserted replaced
32:512f698a535d 44:484cb5040995
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  Test CAknFileNamePromptDialog.h
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // [INCLUDE FILES]
       
    20 #include "testsdkcfd.h"
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS ===============================
       
    23 
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CTestSDKCFD::TestFNPDNewL
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 
       
    30 TInt CTestSDKCFD::TestFNPDNewL( CStifItemParser& /*aItem*/ )
       
    31     {
       
    32     // Print to UI
       
    33     _LIT( KCFDTestModule, "CFDTestModule" );
       
    34     _LIT( KTestFNPDNewL, "In TestFNPDNewL" );
       
    35     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDNewL );
       
    36     // Print to log file
       
    37     iLog->Log( KTestFNPDNewL );
       
    38 
       
    39     TInt err = KErrNone;
       
    40     TRAP( err, iFNPDialog = CAknFileNamePromptDialog::NewL(); );
       
    41     return err;
       
    42 
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CTestSDKCFD::TestFNPDNewLWithResL
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 TInt CTestSDKCFD::TestFNPDNewLWithResL( CStifItemParser& /*aItem*/ )
       
    50     {
       
    51     // Print to UI
       
    52     _LIT( KCFDTestModule, "CFDTestModule" );
       
    53     _LIT( KTestFNPDNewL, "In TestFNPDNewL" );
       
    54     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDNewL );
       
    55     // Print to log file
       
    56     iLog->Log( KTestFNPDNewL );
       
    57 
       
    58     TInt err = KErrNone;
       
    59     TRAP( err, iFNPDialog = CAknFileNamePromptDialog::NewL(0); );
       
    60     return err;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CTestSDKCFD::TestFNPDSetPathL
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 TInt CTestSDKCFD::TestFNPDSetPathL( CStifItemParser& /*aItem*/ )
       
    68     {
       
    69     // Print to UI
       
    70     _LIT( KCFDTestModule, "CFDTestModule" );
       
    71     _LIT( KTestFNPDSetPathL, "In TestFNPDSetPathL" );
       
    72     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDSetPathL );
       
    73     // Print to log file
       
    74     iLog->Log( KTestFNPDSetPathL );
       
    75 
       
    76     TFileName folder(_L("C:\\Data\\"));
       
    77     TInt err = KErrNone;
       
    78     TRAP( err, iFNPDialog->SetPathL(folder); );
       
    79     return err;
       
    80     }
       
    81 // -----------------------------------------------------------------------------
       
    82 // CTestSDKCFD::TestFNPDExecuteL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 TInt CTestSDKCFD::TestFNPDExecuteL( CStifItemParser& /*aItem*/ )
       
    86     {
       
    87     // Print to UI
       
    88     _LIT( KCFDTestModule, "CFDTestModule" );
       
    89     _LIT( KTestFNPDExecuteL, "In TestFNPDExecuteL" );
       
    90     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDExecuteL );
       
    91     // Print to log file
       
    92     iLog->Log( KTestFNPDExecuteL );
       
    93 
       
    94     TFileName filename(_L("C:\\"));
       
    95 
       
    96     TInt err = KErrNone;
       
    97     TRAP( err, iFNPDialog->ExecuteL(filename); );
       
    98     return err;
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CTestSDKCFD::TestFNPDRunDlgLD
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TInt CTestSDKCFD::TestFNPDRunDlgLD( CStifItemParser& /*aItem*/ )
       
   106     {
       
   107     // Print to UI
       
   108     _LIT( KCFDTestModule, "CFDTestModule" );
       
   109     _LIT( KTestFNPDRunDlgLD, "In TestFNPDRunDlgLD" );
       
   110     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDRunDlgLD );
       
   111     // Print to log file
       
   112     iLog->Log( KTestFNPDRunDlgLD );
       
   113 
       
   114     TFileName filename(_L("C:\\"));
       
   115     TFileName folder(_L("C:\\Data\\"));
       
   116     TInt err = KErrNone;
       
   117 
       
   118     TRAP( err, CAknFileNamePromptDialog::RunDlgLD(filename, folder); );
       
   119 
       
   120     return err;
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CTestSDKCFD::TestFNPDRunDlgLDWithTitleLD
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CTestSDKCFD::TestFNPDRunDlgLDWithTitleLD( CStifItemParser& /*aItem*/ )
       
   128     {
       
   129     // Print to UI
       
   130     _LIT( KCFDTestModule, "CFDTestModule" );
       
   131     _LIT( KTestFNPDRunDlgLD, "In TestFNPDRunDlgLD" );
       
   132     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDRunDlgLD );
       
   133     // Print to log file
       
   134     iLog->Log( KTestFNPDRunDlgLD );
       
   135 
       
   136     TFileName filename(_L("C:\\"));
       
   137     TFileName folder(_L("C:\\Data\\"));
       
   138     TInt err = KErrNone;
       
   139 
       
   140     TRAP( err, CAknFileNamePromptDialog::RunDlgLD(filename, folder, _L("a title")); );
       
   141 
       
   142     return err;
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CTestSDKCFD::TestFNPDRunDlgLDWithResLD
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 TInt CTestSDKCFD::TestFNPDRunDlgLDWithResLD( CStifItemParser& /*aItem*/ )
       
   150     {
       
   151     // Print to UI
       
   152     _LIT( KCFDTestModule, "CFDTestModule" );
       
   153     _LIT( KTestFNPDRunDlgLD, "In TestFNPDRunDlgLD" );
       
   154     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDRunDlgLD );
       
   155     // Print to log file
       
   156     iLog->Log( KTestFNPDRunDlgLD );
       
   157 
       
   158     TFileName filename(_L("C:\\"));
       
   159     TFileName folder(_L("C:\\Data\\"));
       
   160     TInt err = KErrNone;
       
   161 
       
   162     TRAP( err, CAknFileNamePromptDialog::RunDlgLD(filename, folder, 0); );
       
   163 
       
   164     return err;
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CTestSDKCFD::TestFNPDDeleteL
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 TInt CTestSDKCFD::TestFNPDDeleteL( CStifItemParser& /*aItem*/ )
       
   172     {
       
   173     // Print to UI
       
   174     _LIT( KCFDTestModule, "CFDTestModule" );
       
   175     _LIT( KTestFNPDDeleteL, "In TestFNPDDeleteL" );
       
   176     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDDeleteL );
       
   177     // Print to log file
       
   178     iLog->Log( KTestFNPDDeleteL );
       
   179 
       
   180     delete iFNPDialog;
       
   181     iFNPDialog = NULL;
       
   182 
       
   183     return KErrNone;
       
   184     }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CTestSDKCFD::TestFNPDSetObserverL
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 TInt CTestSDKCFD::TestFNPDSetObserverL( CStifItemParser& /*aItem*/ )
       
   191     {
       
   192     // Print to UI
       
   193     _LIT( KCFDTestModule, "CFDTestModule" );
       
   194     _LIT( KTestFNPDSetObserverL, "In TestFNPDSetObserverL" );
       
   195     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDSetObserverL );
       
   196     // Print to log file
       
   197     iLog->Log( KTestFNPDSetObserverL );
       
   198 
       
   199     struct MonkObserver : public MAknFileSelectionObserver
       
   200         {
       
   201         TBool OkToExitL( const TDesC& /*aDriveAndPath*/, const TEntry& /*aEntry*/)
       
   202             {
       
   203             return ETrue;
       
   204             }
       
   205         } monkObserver;
       
   206 
       
   207     TInt err = KErrNone;
       
   208 
       
   209     TRAP( err, iFNPDialog->SetObserver(&monkObserver); );
       
   210 
       
   211     TFileName filename(_L("C:\\Data\\"));
       
   212     iFNPDialog->ExecuteL( filename );
       
   213 
       
   214     return err;
       
   215     }
       
   216 
       
   217 TInt CTestSDKCFD::TestFNPDSetTitleL( CStifItemParser& /*aItem*/ )
       
   218     {
       
   219     // Print to UI
       
   220     _LIT( KCFDTestModule, "CFDTestModule" );
       
   221     _LIT( KTestFNPDSetTitleL, "In TestFNPDSetTitleL" );
       
   222     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDSetTitleL );
       
   223     // Print to log file
       
   224     iLog->Log( KTestFNPDSetTitleL );
       
   225 
       
   226     TInt err = KErrNone;
       
   227 
       
   228     TRAP( err, iFNPDialog->SetTitleL(_L("FNPD Title")); );
       
   229 
       
   230     return err;
       
   231     }
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // CTestSDKCFD::TestFNPDSetLeftSoftkeyL
       
   235 // -----------------------------------------------------------------------------
       
   236 //
       
   237 TInt CTestSDKCFD::TestFNPDSetLeftSoftkeyL( CStifItemParser& /*aItem*/ )
       
   238     {
       
   239     // Print to UI
       
   240     _LIT( KCFDTestModule, "CFDTestModule" );
       
   241     _LIT( KTestFNPDSetLeftSoftkeyL, "In TestFNPDSetLeftSoftkeyL" );
       
   242     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDSetLeftSoftkeyL );
       
   243     // Print to log file
       
   244     iLog->Log( KTestFNPDSetLeftSoftkeyL );
       
   245 
       
   246     TInt err = KErrNone;
       
   247 
       
   248     TRAP( err, iFNPDialog->SetLeftSoftkeyL(_L("FNPD LSoftkey")); );
       
   249 
       
   250     return err;
       
   251     }
       
   252 
       
   253 // -----------------------------------------------------------------------------
       
   254 // CTestSDKCFD::TestFNPDSetRightSoftkeyL
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 TInt CTestSDKCFD::TestFNPDSetRightSoftkeyL( CStifItemParser& /*aItem*/ )
       
   258     {
       
   259     // Print to UI
       
   260     _LIT( KCFDTestModule, "CFDTestModule" );
       
   261     _LIT( KTestFNPDSetRightSoftkeyL, "In TestFNPDSetRightSoftkeyL" );
       
   262     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDSetRightSoftkeyL );
       
   263     // Print to log file
       
   264     iLog->Log( KTestFNPDSetRightSoftkeyL );
       
   265 
       
   266     TInt err = KErrNone;
       
   267 
       
   268     TRAP( err, iFNPDialog->SetRightSoftkeyL(_L("FNPD RSoftkey")); );
       
   269 
       
   270     return err;
       
   271     }
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 // CTestSDKCFD::TestFNPDRenameL
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 TInt CTestSDKCFD::TestFNPDRenameL( CStifItemParser& /*aItem*/ )
       
   278     {
       
   279     // Print to UI
       
   280     _LIT( KCFDTestModule, "CFDTestModule" );
       
   281     _LIT( KTestFNPDRenameL, "In TestFNPDRenameL" );
       
   282     TestModuleIf().Printf( 0, KCFDTestModule, KTestFNPDRenameL );
       
   283     // Print to log file
       
   284     iLog->Log( KTestFNPDRenameL );
       
   285 
       
   286     TInt err = KErrNone;
       
   287     TFileName filename;
       
   288 
       
   289     TRAP( err, iFNPDialog->RenameL(filename); );
       
   290 
       
   291     return err;
       
   292     }
       
   293 
       
   294 //  [End of File]