uifw/AvKon/AknNotifyPlugin_dll/src/AknDialogController.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:  System soft notifications.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "akndialogcontroller.h"
       
    19 
       
    20 // CNotifierDialogController
       
    21 // For use by notifiers external to Aknnotifyplugin2.DLL.
       
    22 CNotifierDialogController::CNotifierDialogController(MAknGlobalNoteController* aGlobalNoteNotifier)
       
    23 :iGlobalNoteNotifier(aGlobalNoteNotifier)
       
    24     {
       
    25     }
       
    26 
       
    27 EXPORT_C TInt CNotifierDialogController::LaunchNoteL(TInt aNoteResource, TInt aSoftkeys, 
       
    28     TInt aPriority)
       
    29     {
       
    30     TInt note = 0;
       
    31     
       
    32     if (iGlobalNoteNotifier)
       
    33         {
       
    34         note = iGlobalNoteNotifier->AddSoftNotificationL(
       
    35             KNullDesC, 
       
    36             aNoteResource, 
       
    37             0, 
       
    38             aPriority, 
       
    39             aSoftkeys);
       
    40             
       
    41         iGlobalNoteNotifier->TryDisplayNextNoteL();
       
    42         }
       
    43 
       
    44     return note;
       
    45     }
       
    46 
       
    47 EXPORT_C TInt CNotifierDialogController::LaunchNoteL(TInt aResourceId, TInt aSoftkeys, 
       
    48     TInt aPriority, CAknNoteDialog::TTimeout aTimeout, CAknNoteDialog::TTone aTone)
       
    49     {
       
    50     TInt note = 0;
       
    51     if (iGlobalNoteNotifier)
       
    52         {
       
    53         note = iGlobalNoteNotifier->AddNoteToQueueL(
       
    54             aResourceId, 
       
    55             KNullDesC,  
       
    56             aPriority, 
       
    57             aTimeout, 
       
    58             aTone, 
       
    59             -1, 
       
    60             -1, 
       
    61             0, 
       
    62             aSoftkeys);
       
    63             
       
    64         iGlobalNoteNotifier->TryDisplayNextNoteL();
       
    65         }
       
    66 
       
    67     return note;
       
    68     }
       
    69 
       
    70 EXPORT_C void CNotifierDialogController::SetNoteObserver(MNotifierDialogObserver* aObserver)
       
    71     {
       
    72     iObserver = aObserver;
       
    73     }
       
    74 
       
    75 void CNotifierDialogController::SoftNoteCompleted(TInt aId, TInt aCommand)
       
    76     {
       
    77     if (iObserver)
       
    78         {
       
    79         iObserver->NoteCompleted(aId, aCommand);
       
    80         }
       
    81     }
       
    82 
       
    83 TBool CNotifierDialogController::ShowSoftNoteL(TInt aPriority, const TDesC& /*aText*/)
       
    84     {
       
    85     if (iObserver)
       
    86         {
       
    87         return iObserver->DisplayDialogL(aPriority);
       
    88         }
       
    89     return EFalse;
       
    90     }
       
    91 
       
    92 TBool CNotifierDialogController::CancelSoftNote(TInt aPriority)
       
    93     {
       
    94     if (iObserver)
       
    95         {
       
    96         return iObserver->CancelDialog(aPriority);
       
    97         }
       
    98     return EFalse;
       
    99     }
       
   100 
       
   101 EXPORT_C void CNotifierDialogController::CancelNote(TInt aNoteId)
       
   102     {
       
   103     if (iGlobalNoteNotifier)
       
   104         {
       
   105         iGlobalNoteNotifier->CancelNote(aNoteId);
       
   106         }
       
   107     }
       
   108 
       
   109 EXPORT_C TInt CNotifierDialogController::DisplayNonNoteDialogL(TInt aPriority)
       
   110     {
       
   111     TInt note = 0;
       
   112     if (iGlobalNoteNotifier)
       
   113         {
       
   114         note = iGlobalNoteNotifier->AddSoftNotificationL(KNullDesC, 0, 0, aPriority, 0);
       
   115         iGlobalNoteNotifier->TryDisplayNextNoteL();
       
   116         }
       
   117 
       
   118     return note;
       
   119     }
       
   120 
       
   121 EXPORT_C TInt CNotifierDialogController::DisplayAlarmL(TInt aType, const TDesC& aDescription,
       
   122     const TDesC& aTime)
       
   123     {
       
   124     TInt noteId = 0;
       
   125     
       
   126     if (iGlobalNoteNotifier)
       
   127         {
       
   128         noteId = iGlobalNoteNotifier->DisplayAlarmL(aType,aDescription,aTime);
       
   129         }
       
   130 
       
   131     return noteId;
       
   132     }
       
   133 
       
   134 EXPORT_C CNotifierDialogController* CNotifierDialogController::NewL(
       
   135     MAknGlobalNoteController* aGlobalNoteNotifier)
       
   136     {
       
   137     CNotifierDialogController* me = new (ELeave) CNotifierDialogController(aGlobalNoteNotifier);
       
   138     return me;
       
   139     }
       
   140 
       
   141 EXPORT_C void CNotifierDialogController::AddAlarmAdditionalInfo(
       
   142     TInt aType,
       
   143     const TDesC& aTime,
       
   144     const TDesC& aDate,
       
   145     const TDesC& aSubject,
       
   146     const TDesC& aLocation)
       
   147     {
       
   148     if (iGlobalNoteNotifier)
       
   149         {
       
   150         iGlobalNoteNotifier->AddAlarmAdditionalInfo(aType,aTime,aDate,aSubject,aLocation);
       
   151         }
       
   152     }
       
   153