logsui/logsapp/src/logsappsettings.cpp
changeset 18 acd4e87b24b4
equal deleted inserted replaced
17:90fe74753f71 18:acd4e87b24b4
       
     1 /*
       
     2 * Copyright (c) 2009-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 #include "logsappsettings.h"
       
    19 #include "logsdefs.h"
       
    20 #include "logslogger.h"
       
    21 #include "logsforegroundwatcher.h"
       
    22 #include <xqsettingsmanager.h>
       
    23 #include <LogsDomainCRKeys.h>
       
    24 #include <QVariant>
       
    25 
       
    26 const int logsFakeExitDisabled = 0;
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // 
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 LogsAppSettings::LogsAppSettings(int &argc, char *argv[]) :
       
    33       mFeaturePreloadedEnabled(isBootupStart(argc, argv)), 
       
    34       mFeatureFakeExitEnabledVal(-1)
       
    35 {
       
    36     if ( mFeaturePreloadedEnabled ){
       
    37         LogsForegroundWatcher::ensureBackgroundStartup();
       
    38     }
       
    39 }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 LogsAppSettings::~LogsAppSettings()
       
    46 {
       
    47 }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // 
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 bool LogsAppSettings::logsFeaturePreloadingEnabled()
       
    54 {
       
    55     return mFeaturePreloadedEnabled;
       
    56 }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // 
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 bool LogsAppSettings::logsFeatureFakeExitEnabled()
       
    63 {
       
    64     if ( mFeatureFakeExitEnabledVal < 0 ){
       
    65         XQSettingsManager manager;
       
    66         XQSettingsKey key(XQSettingsKey::TargetCentralRepository, 
       
    67                           KCRUidLogs.iUid, 
       
    68                           KLogsFakeExitEnabled);
       
    69         QVariant value = manager.readItemValue(
       
    70                                 key, XQSettingsManager::TypeInt);
       
    71         if (!value.isNull()) {
       
    72             mFeatureFakeExitEnabledVal = value.toInt();
       
    73         }
       
    74         if ( mFeatureFakeExitEnabledVal < 0 ){
       
    75             mFeatureFakeExitEnabledVal = logsFakeExitDisabled;
       
    76         }
       
    77     }
       
    78     return ( mFeatureFakeExitEnabledVal != logsFakeExitDisabled );
       
    79 }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // 
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 bool LogsAppSettings::isBootupStart(int &argc, char *argv[])
       
    86 {
       
    87     for (int i=0; i<argc; i++) {
       
    88         if ( QString(argv[i]) == logsBootupStartCmdLineArg ){
       
    89             return true;
       
    90         }
       
    91     }
       
    92     return false;
       
    93 }
       
    94 
       
    95 // end of file