src/hbcore/core/hbapplication.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    32 
    32 
    33 #if defined(Q_OS_SYMBIAN)
    33 #if defined(Q_OS_SYMBIAN)
    34 #include <qwindowsstyle.h>
    34 #include <qwindowsstyle.h>
    35 #include <qsymbianevent.h>
    35 #include <qsymbianevent.h>
    36 #include <e32debug.h>
    36 #include <e32debug.h>
       
    37 #include <apacmdln.h>
    37 #endif // Q_OS_SYMBIAN
    38 #endif // Q_OS_SYMBIAN
    38 
    39 
    39 #ifdef HB_GESTURE_FW
    40 #ifdef HB_GESTURE_FW
    40 #include "hbgesturerecognizers_p.h"
    41 #include "hbgesturerecognizers_p.h"
    41 #endif
    42 #endif
    90     even executing the QApplication constructor. When passing Hb::NoSplash this
    91     even executing the QApplication constructor. When passing Hb::NoSplash this
    91     will not happen and the splash is only shown after spending a possibly
    92     will not happen and the splash is only shown after spending a possibly
    92     substantial time on initializing Qt and other frameworks. So use
    93     substantial time on initializing Qt and other frameworks. So use
    93     Hb::NoSplash only when absolutely needed (or when the splash screen will not
    94     Hb::NoSplash only when absolutely needed (or when the splash screen will not
    94     be shown at all).
    95     be shown at all).
       
    96 
       
    97     On Symbian the splash will be automatically suppressed (i.e. not shown) if
       
    98     the application is started to background, that is,
       
    99     HbApplication::startedToBackground() returns true. To override this default
       
   100     behavior, pass Hb::ShowSplashWhenStartingToBackground to the HbApplication
       
   101     constructor.
    95 
   102 
    96     Applications that support the 'activities' concept may check the start-up
   103     Applications that support the 'activities' concept may check the start-up
    97     reason like this:
   104     reason like this:
    98 
   105 
    99     \code
   106     \code
   139     } else if (flags & Hb::SplashFixedHorizontal) {
   146     } else if (flags & Hb::SplashFixedHorizontal) {
   140         splashFlags |= HbSplashScreen::FixedHorizontal;
   147         splashFlags |= HbSplashScreen::FixedHorizontal;
   141     }
   148     }
   142     if (flags & Hb::ForceQtSplash) {
   149     if (flags & Hb::ForceQtSplash) {
   143         splashFlags |= HbSplashScreen::ForceQt;
   150         splashFlags |= HbSplashScreen::ForceQt;
       
   151     }
       
   152     if (flags & Hb::ShowSplashWhenStartingToBackground) {
       
   153         splashFlags |= HbSplashScreen::ShowWhenStartingToBackground;
   144     }
   154     }
   145 
   155 
   146 #if defined(Q_OS_SYMBIAN) && defined(HBAPP_LOGGING)
   156 #if defined(Q_OS_SYMBIAN) && defined(HBAPP_LOGGING)
   147     ELAPSED_TIMER t;
   157     ELAPSED_TIMER t;
   148     t.start();
   158     t.start();
   463 QVariant HbApplication::activateData()
   473 QVariant HbApplication::activateData()
   464 {
   474 {
   465     Q_D(HbApplication);
   475     Q_D(HbApplication);
   466     return d->activateData();
   476     return d->activateData();
   467 }
   477 }
       
   478 
       
   479 /*!
       
   480   Returns true if the process command line indicates that
       
   481   application is started to background.
       
   482 
       
   483   This is usually achieved by setting the corresponding 'background'
       
   484   flag in the startup list entry (for auto-started applications) or,
       
   485   in case of services, starting the service provider application to
       
   486   background.
       
   487 
       
   488   When an application is launched normally, the result will be false.
       
   489  */
       
   490 bool HbApplication::startedToBackground()
       
   491 {
       
   492 #if defined(Q_OS_SYMBIAN)
       
   493     CApaCommandLine *commandLine = 0;
       
   494     if (CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine) == KErrNone
       
   495         && commandLine) {
       
   496         TApaCommand command = commandLine->Command();
       
   497         delete commandLine;
       
   498         return command == EApaCommandBackground
       
   499             || command == EApaCommandBackgroundAndWithoutViews;
       
   500     }
       
   501 #endif
       
   502     return false;
       
   503 }