vmbx/vmbxengine/src/vmbxuiutilities.cpp
changeset 12 ae8abd0db65c
child 13 e32024264ebb
equal deleted inserted replaced
0:ff3b6d0fd310 12:ae8abd0db65c
       
     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 the VmbxUtilities class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <cvoicemailboxentry.h>
       
    21 
       
    22 #include "voicemailboxdefsinternal.h"
       
    23 #include "vmbxutilities.h"
       
    24 #include "vmbxlogger.h"
       
    25 #include "vmbxuiutilities.h"
       
    26 #include "vmbxuihandler.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS =============================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // VmbxUtilities::CVmbxUiUtilities
       
    32 // C++ default constructor can NOT contain any code
       
    33 // ---------------------------------------------------------------------------
       
    34 CVmbxUiUtilities::CVmbxUiUtilities()
       
    35     {
       
    36     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::CVmbxUiUtilities <=>" );
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // VmbxUtilities::~CVmbxUiUtilities
       
    41 // Destructor
       
    42 // ---------------------------------------------------------------------------
       
    43 CVmbxUiUtilities::~CVmbxUiUtilities()
       
    44     {
       
    45     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::~CVmbxUiUtilities =>" );
       
    46     delete iUiHandler;
       
    47     //If there are still dialog is running, The dialogs should be dismissed.
       
    48     //The leave will be ignored as the CVmbxUiUtilities is distructing
       
    49     TRAP_IGNORE( DismissDialogL() );
       
    50     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::~CVmbxUiUtilities <=" );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CVoiceMailboxImpl::NewL
       
    55 // Two-phased constructor.
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CVmbxUiUtilities* CVmbxUiUtilities::NewL()
       
    59     {
       
    60     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::NewL =>" );
       
    61     CVmbxUiUtilities* vmbx = new( ELeave )CVmbxUiUtilities();
       
    62     CleanupStack::PushL( vmbx );
       
    63     vmbx->ConstructL();
       
    64     CleanupStack::Pop( vmbx );
       
    65     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::NewL <=" );
       
    66     return vmbx;
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CVoiceMailboxImpl::ConstructL
       
    71 // Two-phased constructor.
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CVmbxUiUtilities::ConstructL()
       
    75     {
       
    76     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ConstructL =>" );
       
    77     // create resource handler
       
    78     iUiHandler = CVmbxUiHandler::NewL();
       
    79     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ConstructL <=" );
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // VmbxUtilities::ShowQuery
       
    84 // Show query
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CVmbxUiUtilities::ShowQueryL( const TVmbxType& aType,
       
    88         const TVmbxQueryMode & aMode, TDes& aNumber )
       
    89     {
       
    90     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowQueryL =>" );
       
    91     VMBLOGSTRING2( "VMBX: CVmbxUiUtilities::ShowQueryL: aNumber =%S ", &aNumber );
       
    92     TInt result( KErrNone );
       
    93     FOREVER
       
    94         {
       
    95         ShowQueryDialogL( aType, aMode, aNumber, result );
       
    96         if ( KErrCancel == result )
       
    97             {
       
    98             break;
       
    99             }
       
   100 
       
   101         if ( KErrNone == result )
       
   102             {
       
   103             if ( aNumber.Length() )
       
   104                 {
       
   105                 // Convert back to western digits
       
   106                 // check the given number here (emergency numbers not allowed)
       
   107                 if ( VmbxUtilities::IsValidPhoneNumber( aNumber )
       
   108                      && !VmbxUtilities::IsEmergencyNumber( aNumber ) )
       
   109                     {
       
   110                     break;
       
   111                     }// valid number
       
   112                 else
       
   113                     {
       
   114                     //invalid dialog
       
   115                     ShowInvalidWarningDialogL();
       
   116                     continue;
       
   117                     }// invalid number
       
   118                 }
       
   119             else
       
   120                 {
       
   121                 result = KErrNone;
       
   122                 break;
       
   123                 }// number NULL
       
   124             }
       
   125         }// End FOREVER;
       
   126     VMBLOGSTRING2( "VMBX: CVmbxUiUtilities::ShowQueryL: result=%I ", result );
       
   127     User::LeaveIfError( result );
       
   128     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowQueryL <=" );
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // VmbxUtilities::ShowQueryDialogL
       
   133 // Show query dialog
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 void CVmbxUiUtilities::ShowQueryDialogL( const TVmbxType& aType,
       
   137                                          const TVmbxQueryMode& aMode,
       
   138                                          TDes& aNumber, TInt& aResult )
       
   139     {
       
   140     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowQueryDialogL =>" );
       
   141 
       
   142     if( EVmbxVideo != aType && EVmbxVoice != aType  )
       
   143         {
       
   144         VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowQueryDialogL: \
       
   145                             User::Leave( KErrNotSupported )" );
       
   146         User::Leave( KErrNotSupported );
       
   147         }
       
   148     VMBLOGSTRING2( "VMBX: CVmbxUiUtilities::ShowQueryDialogL: in\
       
   149     aNumber = %S", &aNumber );
       
   150     // to show dialog via qt part
       
   151     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowQueryDialogL to show qt" );
       
   152     iUiHandler->ShowVmbxQueryDialog( aType, aMode, aNumber, aResult );
       
   153     VMBLOGSTRING2( "VMBX: CVmbxUiUtilities::ShowQueryDialogL: out\
       
   154     aNumber = %S", &aNumber );
       
   155     VMBLOGSTRING2( "VMBX: CVmbxUiUtilities::ShowQueryDialogL: aResult=%I <=",
       
   156      aResult );
       
   157     }
       
   158 
       
   159 
       
   160 // ---------------------------------------------------------------------------
       
   161 // VmbxUtilities::ShowSaveEmptyNoteL
       
   162 // Show dialog when save empty data
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 void CVmbxUiUtilities::ShowSaveEmptyNoteL( const TVmbxType& aType )
       
   166     {
       
   167     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveEmptyNoteL =>" );
       
   168     if ( EVmbxVoice != aType && EVmbxVideo != aType )
       
   169         {
       
   170         User::Leave( KErrNotSupported );
       
   171         }
       
   172     iUiHandler->ShowSaveEmptyNote( aType );
       
   173     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveEmptyNoteL <=" );
       
   174     }
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // VmbxUtilities::ShowInvalidWarningDialogL
       
   178 // Check the characters
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 void CVmbxUiUtilities::ShowInvalidWarningDialogL()
       
   182     {
       
   183     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowInvalidWarningDialogL =>" );
       
   184     iUiHandler->ShowInvalidWarningNote();
       
   185     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowInvalidWarningDialogL <=" );
       
   186     }
       
   187 
       
   188 // ---------------------------------------------------------------------------
       
   189 // VmbxUtilities::ShowSaveToPhoneNote
       
   190 // Check the characters
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 void CVmbxUiUtilities::ShowSaveToPhoneNote()
       
   194     {
       
   195     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveToPhoneConfirmDialog =>" );
       
   196     iUiHandler->ShowSaveToPhoneNote();
       
   197     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveToPhoneConfirmDialog <=" );
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // VmbxUtilities::ShowSaveToSimConfirmDialog
       
   202 // Check the characters
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 void CVmbxUiUtilities::ShowSaveToSimNote()
       
   206     {
       
   207     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveToSimNote =>" );
       
   208     iUiHandler->ShowSaveToSimNote();
       
   209     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowSaveToSimNote <=" );
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // VmbxUtilities::ShowVideoSaveConfirmDialog
       
   214 // Check the characters
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 void CVmbxUiUtilities::ShowVideoSavedNote()
       
   218     {
       
   219     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowVideoSavedNote =>" );
       
   220     iUiHandler->ShowVideoSavedNote();
       
   221     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowVideoSavedNote <=" );
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // VmbxUtilities::ShowDefineSelectionDialog
       
   226 // Show define number in selection list
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 void CVmbxUiUtilities::ShowDefineSelectionDialogL( TVmbxType& aType,
       
   230                                                          TInt& aResult )
       
   231     {
       
   232     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowDefineSelectionDialogL =>" );
       
   233     iUiHandler->ShowDefineSelectionDialog( aType, aResult );
       
   234     VMBLOGSTRING3( "VMBX: CVmbxUiUtilities::ShowDefineSelectionDialogL: \
       
   235                      aType=%I, aResult=%I <=", aType, aResult );
       
   236     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowDefineSelectionDialogL <=" );
       
   237     }
       
   238 
       
   239 // ---------------------------------------------------------------------------
       
   240 // VmbxUtilities::ShowCallSelectionDialog
       
   241 // Show call number in selection list
       
   242 // ---------------------------------------------------------------------------
       
   243 //
       
   244 void CVmbxUiUtilities::ShowCallSelectionDialogL(
       
   245                     const RPointerArray<CVoiceMailboxEntry>& aArray,
       
   246                     TVoiceMailboxParams& aParams,
       
   247                     TInt& aResult )
       
   248     {
       
   249     VMBLOGSTRING(
       
   250     "VMBX: CVmbxUiUtilities::ShowCallSelectionDialog EMPTY IMPLEMENTATION! =>"
       
   251     );
       
   252     // TODO: not supported yet, to be implemented.
       
   253     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowCallSelectionDialog <=" );
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // VmbxUtilities::DismissDialogL
       
   258 // Tries to close all open dialogs
       
   259 // ---------------------------------------------------------------------------
       
   260 //
       
   261 void CVmbxUiUtilities::DismissDialogL()
       
   262     {
       
   263     VMBLOGSTRING( 
       
   264     "VMBX: CVmbxUiUtilities::DismissDialogL EMPTY IMPLEMENTATION!=>" );
       
   265     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::DismissDialogL <=" );
       
   266     }
       
   267     
       
   268 // Commented out because branding is not supported yet.
       
   269 // ---------------------------------------------------------------------------
       
   270 // CVmbxUiUtilities::GetVmbxImageL
       
   271 //
       
   272 // ---------------------------------------------------------------------------
       
   273 /*
       
   274 CGulIcon* CVmbxUiUtilities::GetVmbxImageL(
       
   275                         const TVoiceMailboxParams& aParams )
       
   276     {
       
   277     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::GetVmbxImageL" );
       
   278 */
       
   279 
       
   280 // --------------------------------------------------------------------------
       
   281 // CVmbxUiUtilities::ShowErrorDialogL
       
   282 // --------------------------------------------------------------------------
       
   283 //
       
   284 void CVmbxUiUtilities::ShowErrorDialogL()
       
   285     {
       
   286     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowErrorDialogL =>" );
       
   287     iUiHandler->ShowInvalidNumberNote();// temporary dialog
       
   288     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::ShowErrorDialogL <=" );
       
   289     }
       
   290 
       
   291 // -----------------------------------------------------------------------------
       
   292 // CVmbxUiUtilities::FetchNumberFromPhonebook2L
       
   293 // Create and show Phonebook's Single Fetch Dialog
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 void CVmbxUiUtilities::FetchNumberFromPhonebook2L( 
       
   297                                           TDes& aPhoneNumber )
       
   298     {
       
   299     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::FetchNumberFromPhonebook2L =>" );
       
   300     /* TODO: Later remove this or replace with some Qt Phonebook API
       
   301         */
       
   302     VMBLOGSTRING( "VMBX: CVmbxUiUtilities::FetchNumberFromPhonebook2L <=" );
       
   303     }
       
   304 // End of file