javauis/runtimeui_qt/javasrc.s60/com/nokia/mj/impl/rt/ui/qt/RuntimeUiQt.java
branchRCL_3
changeset 19 04becd199f91
child 78 71ad690e91f5
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2010 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 package com.nokia.mj.impl.rt.ui.qt;
       
    19 
       
    20 import com.nokia.mj.impl.rt.ui.ConfirmData;
       
    21 import com.nokia.mj.impl.rt.ui.RuntimeUi;
       
    22 import com.nokia.mj.impl.utils.Logger;
       
    23 import com.nokia.mj.impl.utils.exception.ExceptionBase;
       
    24 import com.nokia.mj.impl.rt.support.Jvm;
       
    25 
       
    26 /**
       
    27  * Runtime UI QT implementation.
       
    28  *
       
    29  */
       
    30 public class RuntimeUiQt extends RuntimeUi
       
    31 {
       
    32 
       
    33     static
       
    34     {
       
    35         Jvm.loadSystemLibrary("javaruntimeui");
       
    36     }
       
    37 
       
    38     /**
       
    39      * Constructor
       
    40      */
       
    41     public RuntimeUiQt()
       
    42     {
       
    43         super();
       
    44     }
       
    45 
       
    46     /**
       
    47      * Seeks confirmation from the user.
       
    48      *
       
    49      * @param aAppName     the name of the application on behalf of which the
       
    50      *                     confirmation is requested
       
    51      * @param aConfirmData the data to be confirmed. Unless the user has
       
    52      *                     canceled the confirmation, this data will be filled
       
    53      *                     in with user's answer upon return
       
    54      * @return             true if the user has answered, false if the user has
       
    55      *                     canceled the confirmation
       
    56      */
       
    57     public boolean confirm(String aAppName, ConfirmData aConfirmData)
       
    58     {
       
    59         if (aConfirmData != null)
       
    60         {
       
    61             return _confirm(aAppName, aConfirmData, isIdentified());
       
    62         }
       
    63         else
       
    64         {
       
    65             Logger.LOG(Logger.EJavaRuntime,
       
    66                        Logger.EError, "RuntimeUi: ConfirmData null");
       
    67         }
       
    68         return true;
       
    69     }
       
    70 
       
    71     /**
       
    72      * Notifies the user that an error has occurred.
       
    73      * This method must return quickly.
       
    74      *
       
    75      * @param aAppName   the name of the application which generated the error
       
    76      *                   situation
       
    77      * @param aException exception indicating the error reason
       
    78      */
       
    79     public void error(String aAppName, ExceptionBase aException)
       
    80     {
       
    81         if (aException != null)
       
    82         {
       
    83             _error(aAppName, aException.getShortMessage(), aException.getDetailedMessage());
       
    84         }
       
    85         else
       
    86         {
       
    87             Logger.LOG(Logger.EJavaRuntime,
       
    88                        Logger.EError, "RuntimeUi: Error null");
       
    89         }
       
    90     }
       
    91 
       
    92     private native boolean _confirm(String aAppName, ConfirmData aConfirmData, boolean aIdentifiedApp);
       
    93     private native void _error(String aAppName, String aShortMessage, String aDetailedMessage);
       
    94 }