javauis/coreui_akn/src/coreuijni.cpp
branchRCL_3
changeset 77 7cee158cb8cd
parent 19 04becd199f91
child 83 26b2b12093af
--- a/javauis/coreui_akn/src/coreuijni.cpp	Tue Sep 14 21:06:50 2010 +0300
+++ b/javauis/coreui_akn/src/coreuijni.cpp	Wed Sep 15 12:05:25 2010 +0300
@@ -17,6 +17,8 @@
 
 #include "com_nokia_mj_impl_coreuiavkon_CoreUiImpl.h"
 
+#include <apgwgnam.h>
+
 #include "logger.h"
 #include "coreuiavkonimpl.h"
 #include "javauiavkonimpl.h"
@@ -143,6 +145,17 @@
     return success;
 }
 
+void hideFromTaskManager(TBool aHide)
+{
+    CApaWindowGroupName* wgName = java::ui::CoreUiAvkonLcdui::getInstance().getWindowGroupName();
+    if (wgName)
+    {
+        wgName->SetHidden(aHide);
+        // Refresh displayed name in tasklist
+        wgName->SetWindowGroupName(CCoeEnv::Static()->RootWin());
+    }
+}
+
 void bringToForeGround()
 {
     CCoeEnv::Static()->RootWin().SetOrdinalPosition(0);
@@ -219,3 +232,36 @@
     }
     return fg;
 }
+
+
+JNIEXPORT void JNICALL Java_com_nokia_mj_impl_coreuiavkon_CoreUiImpl__1hideApplication
+(JNIEnv* env, jobject peer, jboolean hide)
+{
+    try
+    {
+        if (CoreUiAvkonImpl::isCoreUiCreated())
+        {
+            int esHandle = CoreUiAvkonImpl::getInstanceImpl().getLcduiSupport().getEventServerHandle();
+            if (esHandle > 0)
+            {
+                int handle = CoreUiEventSource::New(*env, peer, esHandle);
+                if (handle > 0)
+                {
+                    CoreUiEventSource* es = JavaUnhand<CoreUiEventSource>(handle);
+                    es->ExecuteV(&hideFromTaskManager, (TBool)hide);
+                    es->Dispose(*env);
+                }
+            }
+        }
+    }
+    catch (ExceptionBase& ex)
+    {
+        ELOG1(EJavaUI,"ERROR in core UI to hideApplication. ExceptionBase: %s",
+              ex.toString().c_str());
+    }
+    catch (std::exception& e)
+    {
+        ELOG1(EJavaUI,"ERROR in core UI to hideApplication. std::exception: %s",
+              e.what());
+    }
+}