src/hbcore/core/hbapplication.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/core/hbapplication.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/core/hbapplication.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -34,6 +34,7 @@
 #include <qwindowsstyle.h>
 #include <qsymbianevent.h>
 #include <e32debug.h>
+#include <apacmdln.h>
 #endif // Q_OS_SYMBIAN
 
 #ifdef HB_GESTURE_FW
@@ -93,6 +94,12 @@
     Hb::NoSplash only when absolutely needed (or when the splash screen will not
     be shown at all).
 
+    On Symbian the splash will be automatically suppressed (i.e. not shown) if
+    the application is started to background, that is,
+    HbApplication::startedToBackground() returns true. To override this default
+    behavior, pass Hb::ShowSplashWhenStartingToBackground to the HbApplication
+    constructor.
+
     Applications that support the 'activities' concept may check the start-up
     reason like this:
 
@@ -142,6 +149,9 @@
     if (flags & Hb::ForceQtSplash) {
         splashFlags |= HbSplashScreen::ForceQt;
     }
+    if (flags & Hb::ShowSplashWhenStartingToBackground) {
+        splashFlags |= HbSplashScreen::ShowWhenStartingToBackground;
+    }
 
 #if defined(Q_OS_SYMBIAN) && defined(HBAPP_LOGGING)
     ELAPSED_TIMER t;
@@ -465,3 +475,29 @@
     Q_D(HbApplication);
     return d->activateData();
 }
+
+/*!
+  Returns true if the process command line indicates that
+  application is started to background.
+
+  This is usually achieved by setting the corresponding 'background'
+  flag in the startup list entry (for auto-started applications) or,
+  in case of services, starting the service provider application to
+  background.
+
+  When an application is launched normally, the result will be false.
+ */
+bool HbApplication::startedToBackground()
+{
+#if defined(Q_OS_SYMBIAN)
+    CApaCommandLine *commandLine = 0;
+    if (CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine) == KErrNone
+        && commandLine) {
+        TApaCommand command = commandLine->Command();
+        delete commandLine;
+        return command == EApaCommandBackground
+            || command == EApaCommandBackgroundAndWithoutViews;
+    }
+#endif
+    return false;
+}