mpxplugins/viewplugins/views/waitnotedialog/src/mpxwaitnoteconstructor.cpp
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c)  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:  Constructor class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <mpxuser.h>
       
    22 #include "mpxwaitnoteobserver.h"
       
    23 #include "mpxwaitnoteconstructor.h"
       
    24 #include "mpxwaitnotedialog.h"
       
    25 #include "mpxscanningdialog.h"
       
    26 #include "mpxwaitnotedefs.h"
       
    27 #include "mpxusbdialog.h"
       
    28 #include "mpxmtpdialog.h"
       
    29 #include "mpxopeningdialog.h"
       
    30 #include "mpxformatdialog.h"
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // Generic Constructor function
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CMPXWaitNoteDialog* CMPXWaitNoteConstructor::ConstructWaitNoteL(const TDesC& aArg,
       
    37                                                            MMPXWaitNoteObserver* aObs )
       
    38     {
       
    39     // Make sure argument is provided
       
    40     //
       
    41     if( &aArg == NULL )
       
    42         {
       
    43         User::Leave(KErrArgument);
       
    44         }
       
    45 
       
    46     // Deserialize the data
       
    47     //
       
    48     HBufC8* arg = MPXUser::Alloc8L( aArg );
       
    49     TPckg<TWaitNoteType> buf(EMPXNoteNotDefined);
       
    50     buf.Copy(*arg);
       
    51     TWaitNoteType type = buf();
       
    52     delete arg;  // no leaving funcs
       
    53 
       
    54     // Construct the wait note according to the type
       
    55     //
       
    56     CMPXWaitNoteDialog* note = (NULL);
       
    57     switch( type )
       
    58         {
       
    59         case EMPXScanningNote:
       
    60         case EMPXRefreshingNote:
       
    61         case EMPXCorruptScanningNote:
       
    62             {
       
    63             note = CMPXScanningWaitDialog::NewL( aObs, type );
       
    64             break;
       
    65             }
       
    66         case EMPXMTPEventNote:
       
    67             {
       
    68             note = CMPXMtpWaitDialog::NewL( aObs );
       
    69             break;
       
    70             }
       
    71         case EMPXUsbEventNote:
       
    72             {
       
    73             note = CMPXUsbWaitDialog::NewL( aObs );
       
    74             break;
       
    75             }
       
    76         case EMPXOpeningNote:
       
    77             {
       
    78             note = CMPXOpeningWaitDialog::NewL( aObs, EFalse );
       
    79             break;
       
    80             }
       
    81         case EMPXFormatScanningNote:
       
    82             {
       
    83             note = CMPXFormattingWaitDialog::NewL( aObs );
       
    84             break;
       
    85             }
       
    86 		case EMPXImmediatelyOpeningNote:
       
    87 			{
       
    88 			note = CMPXOpeningWaitDialog::NewL( aObs );
       
    89             break;
       
    90             }
       
    91         default:
       
    92             {
       
    93             User::Leave( KErrNotSupported );
       
    94             break;
       
    95             }
       
    96         }
       
    97     return note;
       
    98     }
       
    99