commonuisupport/uikon/examples/notifier1/notifier/Notifier1.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "Notifier1.h"
       
    17 #include <eikenv.h>
       
    18 #include <bautils.h>
       
    19 #include <Notifier1Dialog.rsg>
       
    20 #include <ImplementationProxy.h>	// For the ECom entry point definitions
       
    21 
       
    22 const TUid KNotifier1Uid = { 0x102826DC };
       
    23 const TUid KScreenOutput = { 0x10009D48 };
       
    24 
       
    25 CNotifier1* CNotifier1::NewLC()
       
    26 	{
       
    27 	CNotifier1* self = new(ELeave) CNotifier1();
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	return self;
       
    31 	}
       
    32 	
       
    33 CNotifier1::~CNotifier1()
       
    34 	{
       
    35 	}
       
    36 	
       
    37 CNotifier1::CNotifier1()
       
    38 	{
       
    39 	}
       
    40 	
       
    41 void CNotifier1::ConstructL()
       
    42 	{
       
    43 	_LIT(KResourceFile, "z:\\resource\\apps\\Notifier1Dialog.rsc");
       
    44 	TFileName resourceFileName(KResourceFile);
       
    45 	BaflUtils::NearestLanguageFile(iEikonEnv->FsSession(), resourceFileName);
       
    46 	TInt offset = iEikonEnv->AddResourceFileL(resourceFileName);
       
    47 	TRAPD(err,ConstructSleepingAlertDialogL(R_NOTIFIER1));
       
    48 	iEikonEnv->DeleteResourceFile(offset);
       
    49 	User::LeaveIfError(err);
       
    50 	}
       
    51 
       
    52 void CNotifier1::Release()
       
    53 	{
       
    54 	delete this;
       
    55 	}
       
    56 	
       
    57 CNotifier1::TNotifierInfo CNotifier1::RegisterL()
       
    58 	{
       
    59 	iInfo.iUid=KNotifier1Uid;
       
    60 	iInfo.iChannel=KScreenOutput;
       
    61 	iInfo.iPriority=ENotifierPriorityHigh;
       
    62 	return iInfo;
       
    63 	}
       
    64 	
       
    65 CNotifier1::TNotifierInfo CNotifier1::Info() const
       
    66 	{
       
    67 	return iInfo;
       
    68 	}
       
    69 	
       
    70 void CNotifier1::StartL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
       
    71 	{
       
    72 	aMessage.Complete(KErrNotSupported);
       
    73 	}
       
    74 	
       
    75 TPtrC8 CNotifier1::StartL(const TDesC8& /*aBuffer*/)
       
    76 	{
       
    77 	if (!IsVisible())
       
    78 		{
       
    79 		RouseSleepingDialog();
       
    80 		}
       
    81 	return KNullDesC8();
       
    82 	}
       
    83 	
       
    84 void CNotifier1::Cancel()
       
    85 	{
       
    86 	ExitSleepingDialog();
       
    87 	}
       
    88 	
       
    89 TPtrC8 CNotifier1::UpdateL(const TDesC8& /*aBuffer*/)
       
    90 	{
       
    91 	_LIT(KNewTitle, "Still Notifier1");
       
    92 	SetTitleL(KNewTitle);
       
    93 	DrawNow();
       
    94 	return KNullDesC8();
       
    95 	}
       
    96 		
       
    97 void CNotifier1::UpdateL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
       
    98 	{
       
    99 	aMessage.Complete(KErrNotSupported);
       
   100 	}
       
   101 
       
   102 CArrayPtr<MEikSrvNotifierBase2>* NotifierArrayL()
       
   103 	{
       
   104 	CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = new(ELeave) CArrayPtrFlat<MEikSrvNotifierBase2>(1);
       
   105 	CleanupStack::PushL(notifiers);
       
   106 	CNotifier1* notifier1 = CNotifier1::NewLC();
       
   107 	notifiers->AppendL(notifier1);
       
   108 	CleanupStack::Pop(notifier1);
       
   109 	CleanupStack::Pop(notifiers);
       
   110 	return notifiers;
       
   111 	}
       
   112 
       
   113 
       
   114 // ECom plugin entry point
       
   115 
       
   116 const TImplementationProxy ImplementationTable[] =
       
   117 	{
       
   118     IMPLEMENTATION_PROXY_ENTRY(0x102826DB, NotifierArrayL)
       
   119 	};
       
   120 
       
   121 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   122 	{
       
   123 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   124 	return ImplementationTable;
       
   125 	}