connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/nowlannetworksavailablenotif.cpp
branchRCL_3
changeset 58 83ca720e2b9a
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Implementation of CNoWLANNetworksAvailableNotif.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <e32property.h>
       
    20 #include <ScreensaverInternalPSKeys.h>
       
    21 #include "ConnectionDialogsUidDefs.h"
       
    22 #include "nowlannetworksavailablenotif.h"
       
    23 #include "nowlansdiscreetpopup.h"
       
    24 #include "ConnUiUtilsNotif.h"
       
    25 
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // CNoWLANNetworksAvailableNotif::TNotifierInfo 
       
    31 //                 CNoWLANNetworksAvailableNotif::RegisterL()
       
    32 // ---------------------------------------------------------
       
    33 //
       
    34 CNoWLANNetworksAvailableNotif::TNotifierInfo 
       
    35                    CNoWLANNetworksAvailableNotif::RegisterL()
       
    36     {
       
    37     iInfo.iUid      = KUidNoWLANNetworksAvailableNote;
       
    38     iInfo.iPriority = ENotifierPriorityVHigh;
       
    39     iInfo.iChannel  = KUidNoWLANNetworksAvailableNote;
       
    40 
       
    41     return iInfo;
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------
       
    46 // void CNoWLANNetworksAvailableNotif::StartL()
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CNoWLANNetworksAvailableNotif::StartL( const TDesC8& /*aBuffer*/, 
       
    50                                             TInt aReplySlot,
       
    51                                             const RMessagePtr2& aMessage )
       
    52     {
       
    53     TInt screenSaverOn( 0 );
       
    54     RProperty::Get( KPSUidScreenSaver, 
       
    55                     KScreenSaverOn, 
       
    56                     screenSaverOn );
       
    57 
       
    58     if ( iActiveNote || screenSaverOn > 0 )
       
    59         {
       
    60         // Note is already active or Screensaver is on.
       
    61         aMessage.Complete( KErrNone );
       
    62         return;
       
    63         }
       
    64     
       
    65     iReplySlot = aReplySlot;
       
    66     iMessage   = aMessage;
       
    67     iCancelled = EFalse;
       
    68             
       
    69     iActiveNote = CNoWlansDiscreetPopup::NewL( this );
       
    70         
       
    71     iActiveNote->StartL();       
       
    72     }
       
    73     
       
    74 // ---------------------------------------------------------
       
    75 // void CNoWLANNetworksAvailableNotif::CompleteL( TInt aStatus )
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 void CNoWLANNetworksAvailableNotif::CompleteL( TInt aStatus )
       
    79     {
       
    80     iCancelled = ETrue;
       
    81     
       
    82     if ( !iMessage.IsNull() )
       
    83         {
       
    84         iMessage.Complete( aStatus );
       
    85         }
       
    86     }    
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CNoWLANNetworksAvailableNotif* CNoWLANNetworksAvailableNotif::NewL()
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 CNoWLANNetworksAvailableNotif* CNoWLANNetworksAvailableNotif::NewL( 
       
    93                                         const TBool aResourceFileResponsible )
       
    94     {
       
    95     CNoWLANNetworksAvailableNotif* self = 
       
    96                             new( ELeave ) CNoWLANNetworksAvailableNotif();
       
    97     CleanupStack::PushL( self );
       
    98     self->ConstructL( KResourceFileName, aResourceFileResponsible );
       
    99     CleanupStack::Pop();
       
   100 
       
   101     return self;
       
   102     }
       
   103     
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CNoWLANNetworksAvailableNotif::CNoWLANNetworksAvailableNotif()
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 CNoWLANNetworksAvailableNotif::CNoWLANNetworksAvailableNotif() 
       
   110 : CConnectionDialogsNotifBase(), 
       
   111   iActiveNote( NULL )
       
   112 {    
       
   113 }    
       
   114 
       
   115 // ---------------------------------------------------------
       
   116 // void CNoWLANNetworksAvailableNotif::Cancel()
       
   117 // ---------------------------------------------------------
       
   118 //
       
   119 void CNoWLANNetworksAvailableNotif::Cancel()
       
   120     {
       
   121     if ( !iCancelled )
       
   122         {
       
   123         iCancelled = ETrue;
       
   124         
       
   125         if ( !iMessage.IsNull() )
       
   126             {
       
   127             iMessage.Complete( KErrCancel );
       
   128             }
       
   129         }
       
   130     
       
   131     if ( iActiveNote )
       
   132         {
       
   133         delete iActiveNote;
       
   134         iActiveNote = NULL;
       
   135         }
       
   136     }
       
   137 
       
   138 // End of File