javauis/coreui_akn/src/coreuijni.cpp
branchRCL_3
changeset 77 7cee158cb8cd
parent 19 04becd199f91
child 83 26b2b12093af
equal deleted inserted replaced
71:d5e927d5853b 77:7cee158cb8cd
    14 * Description: Avkon CoreUI JNI methods.
    14 * Description: Avkon CoreUI JNI methods.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "com_nokia_mj_impl_coreuiavkon_CoreUiImpl.h"
    18 #include "com_nokia_mj_impl_coreuiavkon_CoreUiImpl.h"
       
    19 
       
    20 #include <apgwgnam.h>
    19 
    21 
    20 #include "logger.h"
    22 #include "logger.h"
    21 #include "coreuiavkonimpl.h"
    23 #include "coreuiavkonimpl.h"
    22 #include "javauiavkonimpl.h"
    24 #include "javauiavkonimpl.h"
    23 #include "coreuieventsource.h"
    25 #include "coreuieventsource.h"
   139 
   141 
   140         ELOG1(EJavaUI,"ERROR in core UI create ui. std::exception: %s",
   142         ELOG1(EJavaUI,"ERROR in core UI create ui. std::exception: %s",
   141               e.what());
   143               e.what());
   142     }
   144     }
   143     return success;
   145     return success;
       
   146 }
       
   147 
       
   148 void hideFromTaskManager(TBool aHide)
       
   149 {
       
   150     CApaWindowGroupName* wgName = java::ui::CoreUiAvkonLcdui::getInstance().getWindowGroupName();
       
   151     if (wgName)
       
   152     {
       
   153         wgName->SetHidden(aHide);
       
   154         // Refresh displayed name in tasklist
       
   155         wgName->SetWindowGroupName(CCoeEnv::Static()->RootWin());
       
   156     }
   144 }
   157 }
   145 
   158 
   146 void bringToForeGround()
   159 void bringToForeGround()
   147 {
   160 {
   148     CCoeEnv::Static()->RootWin().SetOrdinalPosition(0);
   161     CCoeEnv::Static()->RootWin().SetOrdinalPosition(0);
   217         ELOG1(EJavaUI,"ERROR in core UI isForeground. std::exception: %s",
   230         ELOG1(EJavaUI,"ERROR in core UI isForeground. std::exception: %s",
   218               e.what());
   231               e.what());
   219     }
   232     }
   220     return fg;
   233     return fg;
   221 }
   234 }
       
   235 
       
   236 
       
   237 JNIEXPORT void JNICALL Java_com_nokia_mj_impl_coreuiavkon_CoreUiImpl__1hideApplication
       
   238 (JNIEnv* env, jobject peer, jboolean hide)
       
   239 {
       
   240     try
       
   241     {
       
   242         if (CoreUiAvkonImpl::isCoreUiCreated())
       
   243         {
       
   244             int esHandle = CoreUiAvkonImpl::getInstanceImpl().getLcduiSupport().getEventServerHandle();
       
   245             if (esHandle > 0)
       
   246             {
       
   247                 int handle = CoreUiEventSource::New(*env, peer, esHandle);
       
   248                 if (handle > 0)
       
   249                 {
       
   250                     CoreUiEventSource* es = JavaUnhand<CoreUiEventSource>(handle);
       
   251                     es->ExecuteV(&hideFromTaskManager, (TBool)hide);
       
   252                     es->Dispose(*env);
       
   253                 }
       
   254             }
       
   255         }
       
   256     }
       
   257     catch (ExceptionBase& ex)
       
   258     {
       
   259         ELOG1(EJavaUI,"ERROR in core UI to hideApplication. ExceptionBase: %s",
       
   260               ex.toString().c_str());
       
   261     }
       
   262     catch (std::exception& e)
       
   263     {
       
   264         ELOG1(EJavaUI,"ERROR in core UI to hideApplication. std::exception: %s",
       
   265               e.what());
       
   266     }
       
   267 }