locationsystemui/locationsysui/locverifier/src/lpdmessageplugindialog.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2002 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:  List query dialog suitable for verifier plug-in use.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "lpdmessageplugindialog.h"
       
    21 #include "lpddlgobserver.h"
       
    22 #include "locverifierdlg.hrh"
       
    23 #include <uikon/eiksrvui.h>
       
    24 #include <AknNotiferAppServerApplication.h>
       
    25 #include <e32des16.h>
       
    26 #include "lpdbkupevtlistenerao.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CLpdMessagePluginDialog::CLpdMessagePluginDialog
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CLpdMessagePluginDialog::CLpdMessagePluginDialog(  
       
    37     MLpdDlgObserver& aCallBack,
       
    38     CLpdMessagePluginDialog ** aSelfPtr)
       
    39     : CAknMessageQueryDialog( static_cast<TTone>(EAvkonSIDLocationRequest) ),
       
    40       iCallBack( aCallBack ),
       
    41       iAppSwitchSuppressed( EFalse ),
       
    42       iSelfPtr( aSelfPtr )
       
    43     {
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CLpdMessagePluginDialog::ConstructL
       
    48 // Two-phased constructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CLpdMessagePluginDialog::ConstructL()
       
    52 	{
       
    53 	iBkupListener = CLpdBkupEvtListenerAO::NewL( *this );
       
    54 	iBkupListener->StartL();
       
    55 	}
       
    56 
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CLpdMessagePluginDialog::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CLpdMessagePluginDialog* CLpdMessagePluginDialog::NewL(                    
       
    64     MLpdDlgObserver& aCallBack,
       
    65     CLpdMessagePluginDialog ** aSelfPtr
       
    66     )
       
    67     {
       
    68     CLpdMessagePluginDialog* self =
       
    69         new( ELeave ) CLpdMessagePluginDialog( aCallBack, aSelfPtr);
       
    70 	  CleanupStack::PushL(self);
       
    71 	  self->ConstructL();
       
    72 	  CleanupStack::Pop(self);  
       
    73     return self;
       
    74     }
       
    75 
       
    76 // Destructor
       
    77 CLpdMessagePluginDialog::~CLpdMessagePluginDialog()
       
    78 	{
       
    79     if ( iSelfPtr )
       
    80         {
       
    81         *iSelfPtr = NULL;
       
    82         }
       
    83     if ( iBkupListener )
       
    84     	{
       
    85     	delete iBkupListener;	
       
    86     	}
       
    87 	}
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CLpdMessagePluginDialog::PrepareLC
       
    91 // (other items were commented in a header).
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CLpdMessagePluginDialog::PrepareLC( TInt aResourceId )
       
    95 	{
       
    96 	CAknDialog::PrepareLC( aResourceId );
       
    97 	}
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CLpdMessagePluginDialog::RunLD
       
   101 // (other items were commented in a header).
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 TInt CLpdMessagePluginDialog::RunLD()
       
   105     {
       
   106  		if ( !iAppSwitchSuppressed )
       
   107       {
       
   108 			TInt err = 
       
   109 				((CAknNotifierAppServerAppUi *)
       
   110 					iEikonEnv->EikAppUi())->SuppressAppSwitching(ETrue);
       
   111 	 		if (!err)        
       
   112 	 			{
       
   113 	 			iAppSwitchSuppressed = ETrue;	
       
   114 	 			}
       
   115       }
       
   116     return CAknQueryDialog::RunLD();
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CLpdMessagePluginDialog::ExitDialogL
       
   121 // (other items were commented in a header).
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void CLpdMessagePluginDialog::ExitDialogL()
       
   125     {
       
   126     TryExitL( EEikCmdExit );
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CLpdMessagePluginDialog::ExitDialogL
       
   131 // (other items were commented in a header).
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CLpdMessagePluginDialog::ExitDialogQuietlyL()
       
   135     {
       
   136     TryExitL( ELpdCmdQuietExit );
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CLpdMessagePluginDialog::OkToExitL
       
   141 // (other items were commented in a header).
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 TBool CLpdMessagePluginDialog::OkToExitL( TInt aButtonId )
       
   145     {
       
   146     if ( aButtonId == EAknSoftkeyCancel || aButtonId == EAknSoftkeyOk )
       
   147         {
       
   148         iCallBack.HandleDlgDismissedL( aButtonId, 
       
   149                     -1 );
       
   150         }
       
   151     else if ( ( aButtonId == EEikCmdExit ) || 
       
   152               ( aButtonId == ELpdCmdEmergency ) )
       
   153         { // Dialog needs to be exited or emergency key has been pressed.
       
   154         iCallBack.HandleDlgDismissedL( aButtonId, -1 );
       
   155         }
       
   156     else if ( aButtonId == ELpdCmdQuietExit )
       
   157         {
       
   158         // No callback.
       
   159         }
       
   160     else
       
   161         {
       
   162         return EFalse; //dialog is not exited
       
   163         }
       
   164 
       
   165     if ( iAppSwitchSuppressed )
       
   166         {
       
   167 				TInt er = 
       
   168 					((CAknNotifierAppServerAppUi *)
       
   169 						iEikonEnv->EikAppUi())->SuppressAppSwitching(EFalse);
       
   170 		 		if (!er)
       
   171 		 			{
       
   172 		 			iAppSwitchSuppressed = EFalse;
       
   173 		 			}
       
   174         }
       
   175     return ETrue; // dialog is exited
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------
       
   179 // CLpdMessagePluginDialog::HandleResourceChange
       
   180 // (other items were commented in a header).
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 void CLpdMessagePluginDialog::HandleResourceChange(TInt aType)
       
   184 	{
       
   185 	CAknMessageQueryDialog::HandleResourceChange(aType);
       
   186 	}
       
   187 // End of file
       
   188