uifw/AvKon/notifsrc/aknglobalconfirmationquery.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "AknGlobalConfirmationQuery.h"
       
    19 #include <AknNotifyStd.h>
       
    20 #include <AknPanic.h>
       
    21 #include <AknNotifySignature.h>
       
    22 #include <aknSDData.h>
       
    23 #include <s32mem.h>
       
    24 
       
    25 const TInt KBufferGranularity = 128;
       
    26 
       
    27 EXPORT_C CAknGlobalConfirmationQuery* CAknGlobalConfirmationQuery::NewL()
       
    28     {
       
    29     CAknGlobalConfirmationQuery* self = NewLC();
       
    30     CleanupStack::Pop();    // self
       
    31     return self;
       
    32     }
       
    33 
       
    34 EXPORT_C CAknGlobalConfirmationQuery* CAknGlobalConfirmationQuery::NewLC()
       
    35     {
       
    36     CAknGlobalConfirmationQuery* self = new(ELeave) CAknGlobalConfirmationQuery;
       
    37     CleanupStack::PushL(self);
       
    38     self->ConstructL();
       
    39     return self;
       
    40     }
       
    41 
       
    42 EXPORT_C CAknGlobalConfirmationQuery::~CAknGlobalConfirmationQuery()
       
    43     {
       
    44     iNotify.Close();
       
    45     delete iBuffer;
       
    46     delete iAknSDData;
       
    47     }
       
    48 
       
    49 EXPORT_C void CAknGlobalConfirmationQuery::ShowConfirmationQueryL( 
       
    50     TRequestStatus& aStatus,
       
    51     const TDesC& aPrompt,
       
    52     TInt aSoftkeys,
       
    53     TInt aAnimation,
       
    54     const TDesC& aImageFile,
       
    55     TInt aImageId,
       
    56     TInt aImageMaskId,
       
    57     CAknQueryDialog::TTone aTone,
       
    58     TBool aDismissWithAllKeys )
       
    59     {
       
    60     delete iBuffer;
       
    61     iBuffer = NULL;
       
    62     iBuffer = CBufFlat::NewL(KBufferGranularity);
       
    63 
       
    64     RBufWriteStream bufStream;
       
    65     bufStream.Open(*iBuffer);
       
    66 
       
    67     CleanupClosePushL(bufStream);
       
    68 
       
    69     bufStream.WriteInt32L(KAKNNOTIFIERSIGNATURE);
       
    70 
       
    71     if ( aDismissWithAllKeys )
       
    72         {
       
    73         bufStream.WriteInt8L( ETrue );
       
    74         }
       
    75     else
       
    76         {
       
    77         bufStream.WriteInt8L( EFalse );
       
    78         }
       
    79 
       
    80     bufStream.WriteInt32L(aSoftkeys);
       
    81     bufStream.WriteInt32L(aAnimation);
       
    82     bufStream.WriteInt16L(aImageId);
       
    83     bufStream.WriteInt16L(aImageMaskId);
       
    84     bufStream.WriteInt16L(aTone);
       
    85     bufStream.WriteInt16L(aPrompt.Length());
       
    86     bufStream << aPrompt;
       
    87     bufStream.WriteInt16L(aImageFile.Length());
       
    88     if (aImageFile.Length())
       
    89         {
       
    90         bufStream << aImageFile;
       
    91         }
       
    92 
       
    93     bufStream.WriteInt32L(iSkinsMajorId);
       
    94     bufStream.WriteInt32L(iSkinsMinorId); 
       
    95 
       
    96     if (iAknSDData)
       
    97         {
       
    98         bufStream.WriteInt8L(ETrue);
       
    99         bufStream << *iAknSDData;        
       
   100         }
       
   101     else 
       
   102         {
       
   103         bufStream.WriteInt8L(EFalse);            
       
   104         }
       
   105 
       
   106     iBufferPtr.Set(iBuffer->Ptr(0));
       
   107     iNotify.StartNotifierAndGetResponse(aStatus, KAknGlobalConfirmationQueryUid,
       
   108         iBufferPtr, iResultBuf);
       
   109 
       
   110     CleanupStack::PopAndDestroy();  // bufStream
       
   111     }
       
   112 
       
   113 
       
   114 EXPORT_C void CAknGlobalConfirmationQuery::UpdateConfirmationQuery( TInt aSoftkeys )
       
   115     {
       
   116     iSoftkeys = aSoftkeys;
       
   117     iCmd = EAknUpdateGlobalQuery;
       
   118     TPckgBuf<SAknNotifierPackage<SAknGlobalMsgQueryParams> > pckg;
       
   119     pckg().iParamData.iCmd = iCmd;
       
   120     pckg().iParamData.iSoftkeys = iSoftkeys;
       
   121 
       
   122     TPckgBuf<TInt> ret;
       
   123     iNotify.UpdateNotifier( KAknGlobalConfirmationQueryUid, pckg, ret);
       
   124     }
       
   125 
       
   126 
       
   127 EXPORT_C void CAknGlobalConfirmationQuery::CancelConfirmationQuery()
       
   128     {
       
   129     if (iBuffer)
       
   130         {
       
   131         iNotify.CancelNotifier(KAknGlobalConfirmationQueryUid);
       
   132         delete iBuffer;
       
   133         iBuffer = 0;
       
   134         }
       
   135     }
       
   136 
       
   137 
       
   138 CAknGlobalConfirmationQuery::CAknGlobalConfirmationQuery()
       
   139     {
       
   140     }
       
   141 
       
   142 void CAknGlobalConfirmationQuery::ConstructL()
       
   143     {
       
   144     User::LeaveIfError(iNotify.Connect());
       
   145     }
       
   146 
       
   147 EXPORT_C void CAknGlobalConfirmationQuery::SetImageSkinId( TAknsItemID& aId )
       
   148     {
       
   149     iSkinsMajorId = aId.iMajor;
       
   150     iSkinsMinorId = aId.iMinor;
       
   151     }
       
   152 
       
   153 EXPORT_C void CAknGlobalConfirmationQuery::SetSecondaryDisplayData(CAknSDData* aData)
       
   154    {
       
   155    delete iAknSDData;
       
   156    iAknSDData = aData;
       
   157    }
       
   158 
       
   159 // End of File