messagingappbase/msgavkon/msgnotifiers/src/MsgConfirmSendNotifier.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *     CMsgConfirmSendNotifier implementation file
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include <uikon/eiksrvui.h>
       
    22 #include <eikenv.h>
       
    23 #include <eiknotapi.h>
       
    24 
       
    25 #include "MsgConfirmSendNotifier.h"
       
    26 #include "MsgConfirmSendQuery.h"
       
    27 #include "MsgNotifiersConst.h"
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // CMsgConfirmSendNotifier::NewL
       
    31 // ---------------------------------------------------------
       
    32 //
       
    33 CMsgConfirmSendNotifier* CMsgConfirmSendNotifier::NewL( TBool aSendAs )
       
    34 	{
       
    35 	CMsgConfirmSendNotifier* self = new ( ELeave ) CMsgConfirmSendNotifier( aSendAs );
       
    36 	CleanupStack::PushL( self );
       
    37 	self->ConstructL();
       
    38 	CleanupStack::Pop( self );
       
    39 	return self;
       
    40 	}
       
    41 	
       
    42 // ---------------------------------------------------------
       
    43 // CMsgConfirmSendNotifier::ConstructL
       
    44 // ---------------------------------------------------------
       
    45 //
       
    46 void CMsgConfirmSendNotifier::ConstructL()
       
    47 	{
       
    48 	}
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // Destructor.
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 CMsgConfirmSendNotifier::~CMsgConfirmSendNotifier()
       
    55 	{
       
    56 	delete iQuery;
       
    57 	}
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // Constructor.
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 CMsgConfirmSendNotifier::CMsgConfirmSendNotifier( TBool aSendAs )
       
    64 	{
       
    65 	if ( aSendAs )
       
    66 	    {
       
    67     	iInfo.iUid      = KSendAsNotifierPluginUid;
       
    68     	iInfo.iChannel  = KSendAsNotifierPluginUid; // use the plugin uid
       
    69     	iInfo.iPriority = MEikSrvNotifierBase2::ENotifierPriorityHigh;
       
    70 	    }
       
    71 	else
       
    72 	    {
       
    73     	iInfo.iUid      = KSendUiNotifierPluginUid;
       
    74     	iInfo.iChannel  = KSendUiNotifierPluginUid; // use the plugin uid
       
    75     	iInfo.iPriority = MEikSrvNotifierBase2::ENotifierPriorityHigh;
       
    76 	    }
       
    77 	}
       
    78 
       
    79 // ---------------------------------------------------------
       
    80 // CMsgConfirmSendNotifier::Release
       
    81 // ---------------------------------------------------------
       
    82 //
       
    83 void CMsgConfirmSendNotifier::Release()
       
    84 	{
       
    85 	delete this;
       
    86 	}
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CMsgConfirmSendNotifier::RegisterL
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 CMsgConfirmSendNotifier::TNotifierInfo CMsgConfirmSendNotifier::RegisterL()
       
    93 	{
       
    94 	return iInfo;
       
    95 	}
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CMsgConfirmSendNotifier::Info
       
    99 // ---------------------------------------------------------
       
   100 //
       
   101 CMsgConfirmSendNotifier::TNotifierInfo CMsgConfirmSendNotifier::Info() const
       
   102 	{
       
   103 	return iInfo;
       
   104 	}
       
   105 	
       
   106 // ---------------------------------------------------------
       
   107 // CMsgConfirmSendNotifier::Cancel
       
   108 //
       
   109 // The notifier has been deactivated so resources can be
       
   110 // freed and outstanding messages completed.
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 void CMsgConfirmSendNotifier::Cancel()
       
   114 	{
       
   115 	if ( iQuery )
       
   116 	    {
       
   117 	    iQuery->Cancel();
       
   118 	    }
       
   119 	// Complete iMessage?
       
   120 	}
       
   121 
       
   122 // ---------------------------------------------------------
       
   123 // CMsgConfirmSendNotifier::StartL
       
   124 //
       
   125 // Start the Notifier with data aBuffer. 
       
   126 // Not used for confirm notifiers
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 TPtrC8 CMsgConfirmSendNotifier::StartL(const TDesC8& /*aBuffer*/)
       
   130 	{
       
   131 	User::Leave( KErrNotSupported );
       
   132 	return KNullDesC8();
       
   133 	}
       
   134 	
       
   135 // ---------------------------------------------------------
       
   136 // CMsgConfirmSendNotifier::StartL
       
   137 //
       
   138 // Start the notifier with data aBuffer. aMessage should be
       
   139 // completed when the notifier is deactivated.
       
   140 //
       
   141 // May be called multiple times if more than one client starts
       
   142 // the notifier. The notifier is immediately responsible for
       
   143 // completing aMessage.
       
   144 // ---------------------------------------------------------
       
   145 //
       
   146 void CMsgConfirmSendNotifier::StartL(
       
   147         const TDesC8& aBuffer,
       
   148         TInt /*aReplySlot*/,
       
   149         const RMessagePtr2& aMessage )
       
   150 	{
       
   151 	iMessage = aMessage;
       
   152 	
       
   153     if ( !iQuery )
       
   154         {
       
   155         iQuery = CMsgConfirmSendQuery::NewL( *this );
       
   156         }
       
   157     iQuery->ShowQueryL( aBuffer, ( iInfo.iUid == KSendAsNotifierPluginUid ) );
       
   158 	}
       
   159 	
       
   160 // ---------------------------------------------------------
       
   161 // CMsgConfirmSendNotifier::UpdateL
       
   162 //
       
   163 // Update a currently active notifier with data aBuffer.
       
   164 // Not used for confirm notifiers.
       
   165 // ---------------------------------------------------------
       
   166 //
       
   167 TPtrC8 CMsgConfirmSendNotifier::UpdateL( const TDesC8& /*aBuffer*/ )
       
   168 	{
       
   169 	User::Leave( KErrNotSupported );
       
   170 	return KNullDesC8();
       
   171 	}
       
   172 
       
   173 
       
   174 // ---------------------------------------------------------
       
   175 // CMsgConfirmSendNotifier::HandleActiveEvent
       
   176 // ---------------------------------------------------------
       
   177 //
       
   178 void CMsgConfirmSendNotifier::HandleActiveEvent( const TInt aStatus )
       
   179 	{
       
   180     if ( !iMessage.IsNull() )
       
   181         {
       
   182         // "Cancel" returns "0".
       
   183         iMessage.Complete( aStatus == 0
       
   184 	            ? KErrPermissionDenied
       
   185 	            : KErrNone );
       
   186 	    //iMessage.Complete( iMessage.Write(
       
   187 	    //    0,
       
   188 	    //    TPckgC<TInt>( aButtonVal == EEikBidCancel
       
   189 	    //        ? KErrPermissionDenied
       
   190 	    //        : KErrNone ) ) );
       
   191         }
       
   192     }
       
   193         
       
   194 
       
   195 // End of File