201037 PDK_4.0.a
authorhgs
Fri, 17 Sep 2010 16:47:32 +0300
changeset 18 acd4e87b24b4
parent 17 90fe74753f71
child 21 2f0af9ba7665
201037
logsui/conf/logs.confml
logsui/conf/logs_101F874E.crml
logsui/inc/logslogger.h
logsui/logsapp/inc/logsapplication.h
logsui/logsapp/inc/logsappsettings.h
logsui/logsapp/inc/logsdefs.h
logsui/logsapp/inc/logsdetailsview.h
logsui/logsapp/inc/logsmainwindow.h
logsui/logsapp/inc/logsviewmanager.h
logsui/logsapp/logsapp.pro
logsui/logsapp/logsapp.qrc
logsui/logsapp/resources/hbgroupboxcontentwidget.css
logsui/logsapp/src/logsapplication.cpp
logsui/logsapp/src/logsappsettings.cpp
logsui/logsapp/src/logsbaseview.cpp
logsui/logsapp/src/logsdetailsview.cpp
logsui/logsapp/src/logsmainwindow.cpp
logsui/logsapp/src/logsrecentcallsview.cpp
logsui/logsapp/src/logsviewmanager.cpp
logsui/logsapp/src/main.cpp
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsapplication.h
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsappsettings.h
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmainwindow.h
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsservicehandler.h
logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h
logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.cpp
logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h
logsui/logsapp/tsrc/ut_logsapp/src/main.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsapplication.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsappsettings.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp
logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp
logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h
logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingskey.h
logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingsmanager.h
logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingsmanager_stub.cpp
logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro
logsui/logscntfinder/logscntfinder.pro
logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.pro
logsui/logscntfinder/tsrc/pt_logscntfinder/pt_logscntfinder.pro
logsui/logscntfinder/tsrc/st_logscntfinder/st_logscntfinder.pro
logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro
logsui/logsengine/inc/logsdetailsmodel.h
logsui/logsengine/logsengine.pro
logsui/logsengine/logssymbianos/inc/logsforegroundwatcher.h
logsui/logsengine/logssymbianos/src/logsdbconnector.cpp
logsui/logsengine/logssymbianos/src/logsforegroundwatcher.cpp
logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsforegroundwatcher.h
logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp
logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsforegroundwatcher.cpp
logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro
logsui/logsengine/src/logsdetailsmodel.cpp
logsui/logsengine/src/logsmessage.cpp
logsui/logsengine/tsrc/at_logsengine/at_logsengine.pro
logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsdetailsmodel.h
logsui/logsengine/tsrc/ut_logsengine/src/ut_logsdetailsmodel.cpp
logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmessage.cpp
logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro
logsui/logsservices/logsservices.pro
logsui/logsservices/tsrc/at_logsservices/at_logsservices.pro
logsui/logsui.pro
logsui/tsrc/callservicesimulation/serviceapp.pro
logsui/tsrc/callservicesimulation2/serviceapp2.pro
logsui/tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp
logsui/tsrc/logdbmodifier/clearlisttest/group/clearlisttest.mmp
logsui/tsrc/logscenrepeditor/install/logscenrepeditor.pkg
logsui/tsrc/logscenrepeditor/logscenrepeditor.pro
logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.cpp
logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.h
logsui/tsrc/logsengineapitester/logsengineapitester.pro
logsui/tsrc/logsservicestester/logsservicestester.pro
logsui/tsrc/logsservicestester/logsservicetesterappcloser.cpp
logsui/tsrc/logsservicestester/logsservicetesterappcloser.h
logsui/tsrc/logsservicestester/logsservicetesterwidget.cpp
recents_plat/logs_timers_api/inc/LogsDomainCRKeys.h
Binary file logsui/conf/logs.confml has changed
Binary file logsui/conf/logs_101F874E.crml has changed
--- a/logsui/inc/logslogger.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/inc/logslogger.h	Fri Sep 17 16:47:32 2010 +0300
@@ -41,7 +41,6 @@
 
 #else // debug build; logs
 
-
 const char logsDebugPrefix[]    = "Debug: ";
 const char logsWarningPrefix[]  = "Warning: ";
 const char logsCriticalPrefix[] = "Critical: ";
@@ -57,6 +56,8 @@
 const char logsLogFile[] = "C:/logs/logsapp/logsappdebug.txt";// Logs application log filename.
 
 
+#define LOGS_DEBUG_ENABLED
+
 #define LOGS_QDEBUG( a )\
     qDebug() << a;
 
@@ -105,20 +106,6 @@
 #define LOGS_QDEBUG_EVENT_ARR( arr )
 #endif
 
-// File logging can be disabled by commenting definition below. 
-#define LOGS_FILE_LOGGING_ENABLED
-
-#if ( defined __WINSCW__ ) || ( defined __WINS__ )
-// No sense to have file logging enabled in wins
-#undef LOGS_FILE_LOGGING_ENABLED
-#endif
-
-#ifdef LOGS_FILE_LOGGING_ENABLED
-const bool logsFileLoggingEnabled = ETrue;
-#else
-const bool logsFileLoggingEnabled = EFalse;
-#endif
-
 
 #endif
 
--- a/logsui/logsapp/inc/logsapplication.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/inc/logsapplication.h	Fri Sep 17 16:47:32 2010 +0300
@@ -21,21 +21,22 @@
 #include <QObject>
 #include <hbapplication.h>
 
+class LogsAppSettings;
+
 class LogsApplication : public HbApplication
 {
     Q_OBJECT
 
 public:
-    LogsApplication(int &argc, char *argv[]);
+    LogsApplication(int &argc, char *argv[], LogsAppSettings& settings);
     ~LogsApplication();
-    
-    bool logsFeaturePreloadingEnabled();
-    bool logsFeatureFakeExitEnabled();
 
-public slots: // from HbApplication
+public slots:
 
     void testLogsAppEngineReady();
     void testLogsHandleAppViewReady();
+    void testLogsResetAppReady();
+    
 signals:
     /*!
     * Testing framework support.
@@ -47,10 +48,6 @@
     bool mViewReady;
     bool mReadCompleted;
     
-    // Temporary "feature" flags, to be replaced by real flags once those are known
-    bool mFeaturePreloadedEnabled;
-    bool mFeatureFakeExitEnabled;
-    
     friend class UT_LogsApplication;
     friend class UT_LogsViewManager;
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsappsettings.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef LOGSAPPSETTINGS_H
+#define LOGSAPPSETTINGS_H
+
+class LogsAppSettings
+{
+public:
+    LogsAppSettings(int &argc, char *argv[]);
+    virtual ~LogsAppSettings();
+    
+    bool logsFeaturePreloadingEnabled();
+    bool logsFeatureFakeExitEnabled();   
+    
+private:
+    
+    static bool isBootupStart(int &argc, char *argv[]);
+    
+private:
+    
+    bool mFeaturePreloadedEnabled;
+    int mFeatureFakeExitEnabledVal;
+    
+    friend class UT_LogsApplication;
+    friend class UT_LogsViewManager;
+    friend class UT_LogsAppSettings;
+};
+
+#endif // LOGSAPPSETTINGS_H
--- a/logsui/logsapp/inc/logsdefs.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/inc/logsdefs.h	Fri Sep 17 16:47:32 2010 +0300
@@ -104,5 +104,8 @@
 const char logsActivityParamDialpadText[] = "dialpad_text"; // val type string
 const char logsActivityParamInternalViewId[] = "view_id"; // val type int
 
+// Command line args
+const char logsBootupStartCmdLineArg[] = "-logsbootup";
+
 
 #endif // LOGSDEFS_H
--- a/logsui/logsapp/inc/logsdetailsview.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/inc/logsdetailsview.h	Fri Sep 17 16:47:32 2010 +0300
@@ -26,6 +26,8 @@
 class LogsComponentRepository;
 class HbAction;
 class LogsAbstractViewManager;
+class QGraphicsLinearLayout;
+
 
 /**
  * 
@@ -86,7 +88,7 @@
 class LogsDetailsViewItem : public HbListViewItem
 {
     Q_OBJECT
-    friend class UT_LogsDetailsViewItem;
+    friend class UT_LogsDetailsView;
     
 public:
     
@@ -102,6 +104,14 @@
     * overriding the pressStateChanged method to do nothing.
     */
     virtual void pressStateChanged(bool value, bool animate);
+
+    
+private slots:
+
+    void groupBoxClicked(bool collapsed);
+    
+private:
+    QGraphicsLinearLayout* mLayout;
 };
 
 
--- a/logsui/logsapp/inc/logsmainwindow.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/inc/logsmainwindow.h	Fri Sep 17 16:47:32 2010 +0300
@@ -50,6 +50,12 @@
     void callKeyPressed();
     void localeChanged();
     void appGainedForeground();
+    void appLostForeground();
+    
+private slots:
+
+    void obscuredCalled();
+    void revealedCalled();
 
 private:
     void startKeyCapture();
--- a/logsui/logsapp/inc/logsviewmanager.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/inc/logsviewmanager.h	Fri Sep 17 16:47:32 2010 +0300
@@ -31,6 +31,8 @@
 class LogsMainWindow;
 class HbView;
 class LogsBaseView;
+class LogsAppSettings;
+class LogsForegroundWatcher;
 
 /**
  * 
@@ -50,7 +52,7 @@
      * @param service
      */
     LogsViewManager( LogsMainWindow& mainWindow, LogsServiceHandler& service,
-            LogsServiceHandlerOld& serviceOld );
+            LogsServiceHandlerOld& serviceOld, LogsAppSettings& settings );
     ~LogsViewManager();
 
 public slots:
@@ -77,7 +79,9 @@
     void saveActivity();
     void closeEmbeddedApplication();
     void appGainedForeground();
+    void appLostForeground();
     void activityRequested(const QString &activityId);
+    void bgStartupForegroundGained();
     
 private:
     
@@ -90,22 +94,28 @@
     void handleFirstActivation();
     LogsBaseView* createView(LogsAppViewId viewId);
     void doFakeExit();
+    void endFakeExit();
     bool doLoadActivity(const QString& activityId);
     void clearActivities();
     void activateViewViaService(
         LogsAppViewId viewId, bool showDialpad, 
         const QString& dialpadText, const QVariant& args = QVariant());
+    void setTaskSwitcherVisibility(bool visible);
+    void doExitApplication(bool viewExitHandling = true);
+    void activateDefaultView();
     
 private: //data 
     
     LogsMainWindow& mMainWindow;
     LogsServiceHandler& mService;
     LogsServiceHandlerOld& mServiceOld;
+    LogsAppSettings& mSettings;
     LogsComponentRepository* mComponentsRepository;
     QList<LogsBaseView*> mViewStack;
     bool mFirstActivation;
     QVariant mViewActivationArgs;
     bool mViewActivationShowDialpad;
+    LogsForegroundWatcher* mBackgroundStartupWatcher;
     
 };
 
--- a/logsui/logsapp/logsapp.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/logsapp.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -45,6 +45,8 @@
 HEADERS += inc/logspageindicator.h
 HEADERS += inc/logspageindicatoritem.h
 HEADERS += inc/logscomponentrepository.h
+HEADERS += inc/logsappsettings.h
+HEADERS += ../logsengine/logssymbianos/inc/logsforegroundwatcher.h
 
 SOURCES += src/main.cpp 
 SOURCES += src/logsmainwindow.cpp
@@ -60,13 +62,17 @@
 SOURCES += src/logseffecthandler.cpp
 SOURCES += src/logspageindicator.cpp
 SOURCES += src/logspageindicatoritem.cpp
+SOURCES += src/logsappsettings.cpp
+SOURCES += ../logsengine/logssymbianos/src/logsforegroundwatcher.cpp
  
 symbian: {
     TARGET.UID2 = 0x100039CE
     TARGET.UID3 = 0x101F4CD5
     TARGET.CAPABILITY = CAP_APPLICATION NetworkControl
-    LIBS += -lxqservice  -lxqserviceutil -llogsengine -ldialpad -lxqkeycapture -ltstaskmonitorclient
-    
+    LIBS += -lxqservice  -lxqserviceutil -llogsengine -ldialpad -lxqkeycapture -ltstaskmonitorclient \
+            -lxqsettingsmanager -lapparc -lcone
+    SKINICON = qtg_large_dialer
+    MMP_RULES += SMPSAFE
 }
 
 SERVICE.FILE = service_conf.xml
--- a/logsui/logsapp/logsapp.qrc	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/logsapp.qrc	Fri Sep 17 16:47:32 2010 +0300
@@ -12,5 +12,6 @@
     <qresource prefix="/logslayouts" >
         <file alias="hblistviewitem.css">resources/hblistviewitem.css</file>
         <file alias="hblistviewitem.widgetml">resources/hblistviewitem.widgetml</file>
+        <file alias="hbgroupboxcontentwidget.css">resources/hbgroupboxcontentwidget.css</file>
     </qresource>
 </RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/hbgroupboxcontentwidget.css	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,8 @@
+
+HbGroupBoxContentWidget[groupBoxType="3"][scrollableContent="false"]::content
+{
+  top:0.0un;
+  left:0.0un;
+  bottom:0.0un;
+  right:0.0un;
+}
\ No newline at end of file
--- a/logsui/logsapp/src/logsapplication.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsapplication.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -18,16 +18,23 @@
 #include <QObject>
 #include <QString>
 #include "logsapplication.h"
-
+#include "logsappsettings.h"
+#include "logsdefs.h"
+#include "logslogger.h"
 
 // -----------------------------------------------------------------------------
 // 
 // -----------------------------------------------------------------------------
 //
-LogsApplication::LogsApplication(int &argc, char *argv[])
-    : HbApplication(argc, argv),mViewReady(false),mReadCompleted(false), 
-      mFeaturePreloadedEnabled(false), mFeatureFakeExitEnabled(false)
+LogsApplication::LogsApplication(int &argc, char *argv[], LogsAppSettings& settings)
+    : HbApplication(argc, argv, 
+        settings.logsFeaturePreloadingEnabled() ? Hb::NoSplash : Hb::DefaultApplicationFlags ),
+      mViewReady(false),
+      mReadCompleted(false)
 {
+#ifdef LOGS_DEBUG_ENABLED
+    LOGS_QDEBUG_2( "logs [UI] -> LogsApplication::LogsApplication args", arguments() )
+#endif
 }
 
 // -----------------------------------------------------------------------------
@@ -42,24 +49,6 @@
 // 
 // -----------------------------------------------------------------------------
 //
-bool LogsApplication::logsFeaturePreloadingEnabled()
-{
-    return mFeaturePreloadedEnabled;
-}
-
-// -----------------------------------------------------------------------------
-// 
-// -----------------------------------------------------------------------------
-//
-bool LogsApplication::logsFeatureFakeExitEnabled()
-{
-    return mFeatureFakeExitEnabled;
-}
-
-// -----------------------------------------------------------------------------
-// 
-// -----------------------------------------------------------------------------
-//
 void LogsApplication::testLogsAppEngineReady(){
     if (mViewReady && !mReadCompleted){
         emit applicationReady();
@@ -78,4 +67,15 @@
     mViewReady = true;
 }
 
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void LogsApplication::testLogsResetAppReady()
+{
+    // Wait only for read completion when handling application readiness after
+    // hidden exit as viewready signal is not received when view is not changed
+    mReadCompleted = false;
+}
+
 // end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsappsettings.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "logsappsettings.h"
+#include "logsdefs.h"
+#include "logslogger.h"
+#include "logsforegroundwatcher.h"
+#include <xqsettingsmanager.h>
+#include <LogsDomainCRKeys.h>
+#include <QVariant>
+
+const int logsFakeExitDisabled = 0;
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+LogsAppSettings::LogsAppSettings(int &argc, char *argv[]) :
+      mFeaturePreloadedEnabled(isBootupStart(argc, argv)), 
+      mFeatureFakeExitEnabledVal(-1)
+{
+    if ( mFeaturePreloadedEnabled ){
+        LogsForegroundWatcher::ensureBackgroundStartup();
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+LogsAppSettings::~LogsAppSettings()
+{
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+bool LogsAppSettings::logsFeaturePreloadingEnabled()
+{
+    return mFeaturePreloadedEnabled;
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+bool LogsAppSettings::logsFeatureFakeExitEnabled()
+{
+    if ( mFeatureFakeExitEnabledVal < 0 ){
+        XQSettingsManager manager;
+        XQSettingsKey key(XQSettingsKey::TargetCentralRepository, 
+                          KCRUidLogs.iUid, 
+                          KLogsFakeExitEnabled);
+        QVariant value = manager.readItemValue(
+                                key, XQSettingsManager::TypeInt);
+        if (!value.isNull()) {
+            mFeatureFakeExitEnabledVal = value.toInt();
+        }
+        if ( mFeatureFakeExitEnabledVal < 0 ){
+            mFeatureFakeExitEnabledVal = logsFakeExitDisabled;
+        }
+    }
+    return ( mFeatureFakeExitEnabledVal != logsFakeExitDisabled );
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+bool LogsAppSettings::isBootupStart(int &argc, char *argv[])
+{
+    for (int i=0; i<argc; i++) {
+        if ( QString(argv[i]) == logsBootupStartCmdLineArg ){
+            return true;
+        }
+    }
+    return false;
+}
+
+// end of file
--- a/logsui/logsapp/src/logsbaseview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsbaseview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -344,9 +344,7 @@
 //
 void LogsBaseView::handleExit()
 {
-    LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleExit()" );   
-    mViewManager.exitApplication();
-    LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleExit()" );
+    LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::handleExit()" );   
 }
 
 // -----------------------------------------------------------------------------
--- a/logsui/logsapp/src/logsdetailsview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsdetailsview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -35,6 +35,8 @@
 #include <hblineedit.h>
 #include <hbnotificationdialog.h>
 #include <hbabstractviewitem.h>
+#include <QGraphicsLinearLayout>
+
 Q_DECLARE_METATYPE(LogsDetailsModel*)
 
 
@@ -321,7 +323,6 @@
     Q_ASSERT_X(mListView != 0, "logs [UI] ", "couldn't find list widget !!");
 
     mListView->setItemRecycling(true);
-
     LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initListWidget() " );
 }
 
@@ -432,7 +433,7 @@
 // -----------------------------------------------------------------------------
 //
 LogsDetailsViewItem::LogsDetailsViewItem()
-: HbListViewItem(0)    
+    : HbListViewItem(0), mLayout(0)    
 {
 }
 
@@ -470,7 +471,42 @@
 void LogsDetailsViewItem::updateChildItems()
 {  
     HbListViewItem::updateChildItems();
+
+    QVariant customData = modelIndex().data(LogsDetailsModel::RoleDuplicatesSeparator);
+    if (customData.isValid() && customData.toBool()) {
+        LOGS_QDEBUG( "logs [UI] -> LogsDetailsViewItem::updateChildItems(), groupbox" ); 
+        HbGroupBox* groupBox = new HbGroupBox(this);
+        groupBox->setHeading(modelIndex().data(Qt::DisplayRole).toString());
+        //groupBox->setCollapsable(true);
+
+        HbWidget* content = new HbWidget();
+        content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        content->setMaximumHeight(0);
+        groupBox->setContentWidget(content);
+        groupBox->setCollapsed(true);
+          
+        connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(groupBoxClicked(bool)));
+
+        if (!mLayout) {
+            mLayout = new QGraphicsLinearLayout(Qt::Horizontal, 0);
+            mLayout->setContentsMargins(0,0,0,0);        
+        }
+
+        mLayout->addItem(layout());
+        mLayout->addItem(groupBox);
+        mLayout->setItemSpacing(0,0);
+        setLayout(mLayout);             
+    }
 }
 
-
-
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsViewItem::groupBoxClicked(bool collapsed)
+{
+    LOGS_QDEBUG_2( "logs [UI] -> LogsDetailsViewItem::groupBoxClicked(): ", collapsed );    
+    QAbstractItemModel* model = const_cast <QAbstractItemModel*>(modelIndex().model());
+    model->setData(modelIndex(), QVariant(collapsed));
+    LOGS_QDEBUG( "logs [UI] <- LogsDetailsViewItem::groupBoxClicked()" );
+}
--- a/logsui/logsapp/src/logsmainwindow.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsmainwindow.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -31,6 +31,8 @@
 {
     qApp->installEventFilter(this);
     mKeyCapture = new XQKeyCapture;
+    connect( this, SIGNAL(obscured()), this, SLOT(obscuredCalled()) );
+    connect( this, SIGNAL(revealed()), this, SLOT(revealedCalled()) );
 }
 
 // -----------------------------------------------------------------------------
@@ -101,17 +103,9 @@
     if (event->type() == QEvent::ApplicationActivate) {
         LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationActivate" );
         startKeyCapture();
-        mForeground = true;
-        if (mLocaleChanged) {
-            LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" );
-            emit localeChanged();
-            mLocaleChanged = false;
-        }
-        emit appGainedForeground();
     } else if (event->type() == QEvent::ApplicationDeactivate ) {
         LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationDeactivate" );
         stopKeyCapture();
-        mForeground = false;
     } else if (event->type() == QEvent::LocaleChange) {
         if (mForeground) {
             emit localeChanged();
@@ -127,6 +121,33 @@
 //
 // -----------------------------------------------------------------------------
 //
+void LogsMainWindow::obscuredCalled()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::obscuredCalled" );
+    mForeground = false;
+    emit appLostForeground();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::revealedCalled()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::revealedCalled" );
+    mForeground = true;
+    if (mLocaleChanged) {
+        LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" );
+        emit localeChanged();
+        mLocaleChanged = false;
+    }
+    emit appGainedForeground();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void LogsMainWindow::startKeyCapture()
 {
     mKeyCapture->captureKey(Qt::Key_Yes);
--- a/logsui/logsapp/src/logsrecentcallsview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsrecentcallsview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -161,7 +161,6 @@
 void LogsRecentCallsView::handleExit()
 {
     markMissedCallsSeen();
-    LogsBaseView::handleExit();
 }
 
 // -----------------------------------------------------------------------------
@@ -405,7 +404,7 @@
 void  LogsRecentCallsView::handleBackSoftkey()
 {
     LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::handleBackSoftkey()" );
-    handleExit();
+    mViewManager.exitApplication();
     LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::handleBackSoftkey()" );
 }
 
--- a/logsui/logsapp/src/logsviewmanager.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsviewmanager.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -26,7 +26,8 @@
 #include "logsservicehandler.h"
 #include "logsservicehandlerold.h"
 #include "logsmainwindow.h"
-#include "logsapplication.h"
+#include "logsappsettings.h"
+#include "logsforegroundwatcher.h"
 
 //SYSTEM
 #include <hbmainwindow.h>
@@ -44,10 +45,12 @@
 //
 LogsViewManager::LogsViewManager( 
         LogsMainWindow& mainWindow, LogsServiceHandler& service,
-        LogsServiceHandlerOld& serviceOld ) : 
+        LogsServiceHandlerOld& serviceOld,
+        LogsAppSettings& settings) : 
     QObject( 0 ), mMainWindow( mainWindow ), 
-    mService( service ), mServiceOld( serviceOld ),
-    mFirstActivation(true), mViewActivationShowDialpad(false)
+    mService( service ), mServiceOld( serviceOld ), mSettings( settings ),
+    mFirstActivation(true), mViewActivationShowDialpad(false), 
+    mBackgroundStartupWatcher(0)
 {
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::LogsViewManager()" );
 
@@ -56,6 +59,7 @@
     connect( &mainWindow, SIGNAL(orientationChanged(Qt::Orientation)),
             this, SLOT(handleOrientationChanged()) );
     connect( &mainWindow, SIGNAL(appGainedForeground()), this, SLOT(appGainedForeground()) );
+    connect( &mainWindow, SIGNAL(appLostForeground()), this, SLOT(appLostForeground()) );
 
     mComponentsRepository = new LogsComponentRepository(*this);
     
@@ -88,6 +92,7 @@
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::~LogsViewManager()" );
      
     delete mComponentsRepository;
+    delete mBackgroundStartupWatcher;
     
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::~LogsViewManager()" );
 }
@@ -131,7 +136,7 @@
 {
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::proceedExit()" );
     
-    if ( static_cast<LogsApplication*>( qApp )->logsFeatureFakeExitEnabled() ){
+    if ( mSettings.logsFeatureFakeExitEnabled() ){
         doFakeExit();
     } else {
         qApp->quit();
@@ -177,27 +182,11 @@
 {
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::exitApplication()" );
     
-    LOGS_QDEBUG( "logs [UI] Exit delayed" );
-    
-    // Fake exit by sending app to background
+    // Send app immetiately to background as there might be some async stuff
+    // that needs to complete before the process can be terminated.
     mMainWindow.sendAppToBackground();
 
-    bool exitAllowed( true );
-    foreach ( LogsBaseView* view, mViewStack ){
-        if ( !view->isExitAllowed() ){
-            exitAllowed = false;
-            connect( view, SIGNAL(exitAllowed()),
-                     this, SLOT(proceedExit()), 
-                     Qt::UniqueConnection );
-        }
-    }
-    if ( exitAllowed ){
-        LOGS_QDEBUG( "logs [UI] Handle exit immediataly" );
-        proceedExit();
-    } else {
-        // Just wait for signal from view(s) that exiting can proceed
-        LOGS_QDEBUG( "logs [UI] Delayed exit handling" );
-    }
+    doExitApplication();
     
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::exitApplication()" );
 }
@@ -392,26 +381,33 @@
 void LogsViewManager::handleFirstActivation()
 {      
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::handleFirstActivation()" );
-    LogsApplication* app = static_cast<LogsApplication*>(qApp);
-    Hb::ActivationReason reason = app->activateReason();
-    bool isStartedByService( 
-        mService.isStartedUsingService() || mServiceOld.isStartedUsingService() );
-    if ( !app->logsFeaturePreloadingEnabled() || 
-         reason == Hb::ActivationReasonActivity || 
-         isStartedByService ){
+
+    if ( mSettings.logsFeaturePreloadingEnabled() ) {
+        delete mBackgroundStartupWatcher;
+        mBackgroundStartupWatcher = 0;
+        mBackgroundStartupWatcher = new LogsForegroundWatcher();
+        connect( mBackgroundStartupWatcher, SIGNAL(gainingForeground()), 
+                 this, SLOT(bgStartupForegroundGained()) );
+        setTaskSwitcherVisibility(false);
+
+    } else {
+        Hb::ActivationReason reason = static_cast<HbApplication*>(qApp)->activateReason();
+        bool isStartedByService( 
+            mService.isStartedUsingService() || mServiceOld.isStartedUsingService() );
+        
         // Start immediately using all possible resources
         mComponentsRepository->model()->refreshData();
+        
+        if ( reason == Hb::ActivationReasonActivity && loadActivity() ){
+            LOGS_QDEBUG( "logs [UI] loaded saved activity" );    
+            mMainWindow.bringAppToForeground();
+        } else if ( mFirstActivation && !isStartedByService ) {
+            activateDefaultView();
+            mMainWindow.bringAppToForeground();
+        }
+        
+        clearActivities();
     }
-    
-    if ( reason == Hb::ActivationReasonActivity && loadActivity() ){
-        LOGS_QDEBUG( "logs [UI] loaded saved activity" );    
-        mMainWindow.bringAppToForeground();
-    } else if ( mFirstActivation && !isStartedByService ) {
-        changeRecentView( XQService::LogsViewAll, false );
-        mMainWindow.bringAppToForeground();
-    }
-
-    clearActivities();
 
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::handleFirstActivation()" );
 }
@@ -461,11 +457,8 @@
         disconnect( view, SIGNAL(exitAllowed()), this, SLOT(proceedExit()) );
     }
     
-    if ( static_cast<LogsApplication*>( qApp )->logsFeatureFakeExitEnabled() || 
-         static_cast<LogsApplication*>( qApp )->logsFeaturePreloadingEnabled() ){
-        mComponentsRepository->model()->refreshData();
-        TsTaskSettings taskSettings;
-        taskSettings.setVisibility(true);
+    if ( mSettings.logsFeatureFakeExitEnabled() || mSettings.logsFeaturePreloadingEnabled() ){
+        endFakeExit();
     }
     
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appGainedForeground()" );
@@ -475,11 +468,28 @@
 //
 // -----------------------------------------------------------------------------
 //
+void LogsViewManager::appLostForeground()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsViewManager::appLostForeground()" );
+    
+    if ( mSettings.logsFeatureFakeExitEnabled() ){
+        doExitApplication(false); // Bypass view exit handling
+    }
+    // TODO: non-continuus app should also do exit at this point if 
+    // didn't loose foreground because of embedded app. However, no sensible
+    // way at the moment for handling embedded app foreground monitoring.
+    
+    LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appLostForeground()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void LogsViewManager::activityRequested(const QString &activityId)
 {
     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::activityRequested()" );
     if ( doLoadActivity(activityId) ){
-        clearActivities();
         mMainWindow.bringAppToForeground();
     }
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activityRequested()" );
@@ -489,6 +499,20 @@
 //
 // -----------------------------------------------------------------------------
 //
+void LogsViewManager::bgStartupForegroundGained()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsViewManager::bgStartupForegroundGained()" );
+    delete mBackgroundStartupWatcher;
+    mBackgroundStartupWatcher = 0;
+    endFakeExit();
+    mMainWindow.bringAppToForeground(); 
+    LOGS_QDEBUG( "logs [UI] <- LogsViewManager::bgStartupForegroundGained()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void LogsViewManager::doFakeExit()
 {
     saveActivity();
@@ -497,8 +521,21 @@
     connect( activityManager, SIGNAL(activityRequested(QString)), 
              this, SLOT(activityRequested(QString)), Qt::UniqueConnection );
     mComponentsRepository->model()->compressData();
-    TsTaskSettings taskSettings;
-    taskSettings.setVisibility(false);
+    setTaskSwitcherVisibility(false);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::endFakeExit()
+{
+    setTaskSwitcherVisibility(true);
+    mComponentsRepository->model()->refreshData();
+    if ( !mMainWindow.currentView() ){
+        activateDefaultView();
+    }
+    clearActivities();
 }
 
 // -----------------------------------------------------------------------------
@@ -546,7 +583,7 @@
         
         QVariant args = matchingView->loadActivity(activityId, stream, params);
         loaded = doActivateView( 
-            matchingView->viewId(), showDialpad, args, dialpadText, true );
+            matchingView->viewId(), showDialpad, args, dialpadText );
     }
     
     LOGS_QDEBUG_2( "logs [UI] <- LogsViewManager::doLoadActivity() loaded:", loaded );
@@ -579,12 +616,64 @@
     LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::activateViewViaService()", viewId );
     clearActivities();
     closeEmbeddedApplication();
-    mMainWindow.bringAppToForeground();
     Dialpad* dpad = mComponentsRepository->dialpad();
     if ( !showDialpad ){
         dpad->closeDialpad();
     }
     dpad->editor().setText(dialpadText);
-    doActivateView(viewId, showDialpad, args, QString(), true);
+    if ( doActivateView(viewId, showDialpad, args, QString(), true) ){
+        mMainWindow.bringAppToForeground();
+    }
     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activateViewViaService()" );
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::setTaskSwitcherVisibility(bool visible)
+{
+    LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::setTaskSwitcherVisibility()", visible );
+    TsTaskSettings taskSettings;
+    taskSettings.setVisibility(visible);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::doExitApplication(bool viewExitHandling)
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsViewManager::doExitApplication()" );
+    
+    bool exitAllowed( true );
+    foreach ( LogsBaseView* view, mViewStack ){
+        if ( viewExitHandling ){
+            view->handleExit();
+        }
+        if ( !view->isExitAllowed() ){
+            exitAllowed = false;
+            connect( view, SIGNAL(exitAllowed()),
+                     this, SLOT(proceedExit()), 
+                     Qt::UniqueConnection );
+        }
+    }
+    if ( exitAllowed ){
+        LOGS_QDEBUG( "logs [UI] Handle exit immediately" );
+        proceedExit();
+    } else {
+        // Just wait for signal from view(s) that exiting can proceed
+        LOGS_QDEBUG( "logs [UI] Delayed exit handling" );
+    }
+    
+    LOGS_QDEBUG( "logs [UI] <- LogsViewManager::doExitApplication()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::activateDefaultView()
+{
+    changeRecentView( XQService::LogsViewAll, false );
+}
--- a/logsui/logsapp/src/main.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/main.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 //USER
+#include "logsappsettings.h"
 #include "logsapplication.h"
 #include "logsmainwindow.h"
 #include "logsviewmanager.h"
@@ -40,7 +41,8 @@
 {
     LOGS_QDEBUG( "logs [UI] -> main()" )
 
-    LogsApplication app(argc, argv);
+    LogsAppSettings appSettings(argc, argv);
+    LogsApplication app(argc, argv, appSettings);
 
 #ifdef LOGS_USE_QTRANSLATOR
     QString lang = QLocale::system().name();
@@ -65,7 +67,8 @@
     
     LogsMainWindow window;
     //Application ready signal is emitted after startup when UI is fully loaded and functional
-    QObject::connect( &window, SIGNAL(viewReady()), &app, SLOT(testLogsHandleAppViewReady()) );    
+    QObject::connect( &window, SIGNAL(viewReady()), &app, SLOT(testLogsHandleAppViewReady()) );  
+    QObject::connect( &window, SIGNAL(appLostForeground()), &app, SLOT(testLogsResetAppReady()) );
     HbStyleLoader::registerFilePath(":/logslayouts");
     
     // Create service handler asap so that services are published fast.
@@ -74,7 +77,7 @@
     // HbApplication creation takes long time.
     LogsServiceHandler service;
     LogsServiceHandlerOld serviceOld;
-    LogsViewManager viewManager(window, service, serviceOld);
+    LogsViewManager viewManager(window, service, serviceOld, appSettings);
     
     // Don't show window yet as app might be started at background
     int err = app.exec();
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsapplication.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsapplication.h	Fri Sep 17 16:47:32 2010 +0300
@@ -22,6 +22,7 @@
 #include <QObject>
 
 class LogsApplication;
+class LogsAppSettings;
 
 class UT_LogsApplication : public QObject
 {
@@ -47,12 +48,15 @@
 
 private slots: //test methods
      
+    void testConstructor();
     void testtestLogsAppEngineReady();
     void testtestLogsHandleAppViewReady();
+    void testtestLogsResetAppReady();
     
 private:
  
     LogsApplication* mLogsApplication;
+    LogsAppSettings* mSettings;
 };
 
 #endif //UT_LOGSAPPLICATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsappsettings.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,58 @@
+
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef UT_LOGSAPPSETTINGS_H
+#define UT_LOGSAPPSETTINGS_H
+
+
+#include <QObject>
+
+class LogsAppSettings;
+
+class UT_LogsAppSettings : public QObject
+{
+    Q_OBJECT
+     
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions. 
+ * They will be executed by the testing framework and can be used to initialize and clean up 
+ * either the entire test or the current test function.
+ * 
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+    void initTestCase();
+    void cleanupTestCase();
+    void init();
+    void cleanup();
+
+
+private slots: //test methods
+     
+    void testLogsFeaturePreloadingEnabled();
+    void testLogsFeatureFakeExitEnabled();
+    
+private:
+ 
+    LogsAppSettings* mSettings;
+};
+
+#endif //UT_LOGSAPPSETTINGS_H
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h	Fri Sep 17 16:47:32 2010 +0300
@@ -69,6 +69,9 @@
     void testSaveActivity();
     void testLoadActivity();
     
+    //DetailsViewItem tests
+    void testUpdateChildItems();
+    
 private:
  
     LogsDetailsView* mDetailsView;
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmainwindow.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmainwindow.h	Fri Sep 17 16:47:32 2010 +0300
@@ -51,6 +51,8 @@
     void testSendAppToBackground();
     void testBringAppToForeground();
     void testEventFilter();
+    void testObscuredCalled();
+    void testRevealedCalled();
     
 private:
  
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsservicehandler.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsservicehandler.h	Fri Sep 17 16:47:32 2010 +0300
@@ -25,6 +25,7 @@
 
 class LogsViewManager;
 class LogsMainWindow;
+class LogsAppSettings;
 
 
 class UT_LogsServiceHandler : public QObject
@@ -65,6 +66,7 @@
     LogsServiceHandlerOld* mServiceOld;
     LogsMainWindow* mMainWindow;
     LogsViewManager* mLogsViewManager;
+    LogsAppSettings* mSettings;
 };
 
 #endif //UT_LOGSSERVICEHANDLER_H
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h	Fri Sep 17 16:47:32 2010 +0300
@@ -25,6 +25,7 @@
 class LogsMainWindow;
 class LogsServiceHandler;
 class LogsServiceHandlerOld;
+class LogsAppSettings;
 
 class UT_LogsViewManager : public QObject
 {
@@ -62,6 +63,7 @@
     void testLoadActivity();
     void testAppGainedForeground();
     void testActivityRequested();
+    void testBgStartupForegroundGained();
     
 private:
  
@@ -70,6 +72,8 @@
     
     LogsServiceHandler* mService;
     LogsServiceHandlerOld* mServiceOld;
+    
+    LogsAppSettings* mSettings;
 };
 
 #endif //UT_LOGSVIEWMANAGER_H
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -127,6 +127,9 @@
         LogsMessage* logsMessage = new LogsMessage();
         QVariant var = qVariantFromValue(logsMessage);
         return var;
+    } else if (role == RoleDuplicatesSeparator) {
+        bool separator  = index.row() == mSeparatorIndex;
+        return QVariant(separator);
     }
          
     return QVariant();
@@ -149,3 +152,17 @@
     
     return QVariant();
 }
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+bool LogsDetailsModel::setData(const QModelIndex &index, const QVariant &value, 
+                               int role)
+{
+    Q_UNUSED(role);
+    Q_UNUSED(index);
+    if (value.isValid() && value.toBool() != mSeparatorCollapsed) {
+        mSeparatorCollapsed = !mSeparatorCollapsed;
+    }
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h	Fri Sep 17 16:47:32 2010 +0300
@@ -31,12 +31,12 @@
  *
  */
 class LogsDetailsModel : public LogsAbstractModel
-{
-    
-
-
+{    
 public:
-    
+    enum LogsDetailsRole {
+        RoleDuplicatesSeparator = RoleBaseLast + 1 //used to check whether item is separator
+    };
+   
     explicit LogsDetailsModel();
     
 public: // The exported API
@@ -52,6 +52,10 @@
     virtual QVariant data(const QModelIndex &index, int role) const;
     virtual QVariant headerData(int section, Qt::Orientation orientation,
                                 int role = Qt::DisplayRole) const;
+    virtual bool setData(const QModelIndex &index, const QVariant &value, 
+                                int role = Qt::EditRole);
+    
+   
 private:
     
 private: //testing purpose data 
@@ -61,6 +65,9 @@
     QMap<int, HbIcon*> mDetailIcons;
     QMap<int, QStringList> mDetailTexts;
     static QString mLastCallName; //last called exported function name
+ 
+    int mSeparatorIndex;
+    bool mSeparatorCollapsed;
     
     friend class UT_LogsDetailsView;
     friend class UT_LogsBaseView;
--- a/logsui/logsapp/tsrc/ut_logsapp/src/main.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/main.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -26,6 +26,7 @@
 #include "ut_logsservicehandler.h"
 #include "ut_logspageindicator.h"
 #include "ut_logspageindicatoritem.h"
+#include "ut_logsappsettings.h"
 #include "testrunner.h"
 
 #include <QtTest/QtTest>
@@ -80,6 +81,9 @@
     UT_LogsPageIndicatorItem ut_logsPageIndicatorItem;
     testRunner.runTests(ut_logsPageIndicatorItem);
     
+    UT_LogsAppSettings ut_logsAppSettings;
+    testRunner.runTests(ut_logsAppSettings);
+        
     //qApp is deleted after this testcase is run
     //keep this testcase last
     UT_LogsApplication ut_logsApplication;
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsapplication.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsapplication.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -17,8 +17,8 @@
 
 //USER
 #include "ut_logsapplication.h"
-//#include "hbapplication.h"
 #include "logsapplication.h"
+#include "logsappsettings.h"
 #include "qthighway_stub_helper.h"
 #include "hbstubs_helper.h"
 //SYSTEM
@@ -39,8 +39,10 @@
 
 void UT_LogsApplication::init()
 {
-    int value = qApp->argc();
-    mLogsApplication = new LogsApplication(value,qApp->argv());
+    char* argv = 0;
+    int argc = 0;
+    mSettings = new LogsAppSettings(argc, &argv);
+    mLogsApplication = new LogsApplication(argc, &argv, *mSettings);
     
 }
 
@@ -48,6 +50,21 @@
 {
     delete mLogsApplication;
     mLogsApplication = 0;
+    delete mSettings;
+    mSettings = 0;
+}
+
+void UT_LogsApplication::testConstructor()
+{
+    QVERIFY( mLogsApplication->mTestFlags == Hb::DefaultApplicationFlags );
+    
+    delete mLogsApplication;
+    mLogsApplication = 0;
+    mSettings->mFeaturePreloadedEnabled = true;
+    char* argv = 0;
+    int argc = 0;
+    mLogsApplication = new LogsApplication(argc, &argv, *mSettings);
+    QVERIFY( mLogsApplication->mTestFlags == Hb::NoSplash );
 }
 
 void UT_LogsApplication::testtestLogsAppEngineReady()
@@ -113,3 +130,13 @@
     QVERIFY( spy.count() == 1 );
 }
 
+void UT_LogsApplication::testtestLogsResetAppReady()
+{
+    mLogsApplication->mViewReady = true;
+    mLogsApplication->mReadCompleted = true;
+    mLogsApplication->testLogsResetAppReady();
+    QVERIFY( mLogsApplication->mViewReady );
+    QVERIFY( !mLogsApplication->mReadCompleted );
+    
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsappsettings.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+//USER
+#include "ut_logsappsettings.h"
+#include "logsappsettings.h"
+#include <xqsettingsmanager.h>
+
+//SYSTEM
+#include <QtTest/QtTest>
+
+void UT_LogsAppSettings::initTestCase()
+{
+
+}
+
+void UT_LogsAppSettings::cleanupTestCase()
+{
+
+}
+
+
+void UT_LogsAppSettings::init()
+{
+    int argc = 0;
+    char* argv = 0;
+    mSettings = new LogsAppSettings(argc, &argv);
+}
+
+void UT_LogsAppSettings::cleanup()
+{
+    delete mSettings;
+    mSettings = 0;
+}
+
+void UT_LogsAppSettings::testLogsFeaturePreloadingEnabled()
+{
+    QVERIFY( !mSettings->logsFeaturePreloadingEnabled() );
+    delete mSettings;
+    mSettings = 0;
+    int argc = 2;
+    char* argv[] = {"-logsbootup", "B"};
+    mSettings = new LogsAppSettings(argc, argv);
+    QVERIFY( mSettings->logsFeaturePreloadingEnabled() );
+}
+
+void UT_LogsAppSettings::testLogsFeatureFakeExitEnabled()
+{
+    QVERIFY( mSettings->mFeatureFakeExitEnabledVal == -1 );
+    
+    // No such key
+    XQSettingsManager::mFailed = true;
+    QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
+    
+    // Verify that key is read only once
+    XQSettingsManager::mFailed = false;
+    XQSettingsManager::mCurrentVal = 1;
+    QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
+    
+    // First read when key is there and value means enabled
+    mSettings->mFeatureFakeExitEnabledVal = -1;
+    QVERIFY( mSettings->logsFeatureFakeExitEnabled() );
+    
+    // Value means disabled
+    XQSettingsManager::mCurrentVal = 0;
+    mSettings->mFeatureFakeExitEnabledVal = -1;
+    QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
+}
+
+
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -488,7 +488,7 @@
 {
     mViewManager->reset();
     mBaseView->handleExit();
-    QVERIFY( mViewManager->mExitCalled );
+    QVERIFY( !mViewManager->mExitCalled );
 }
 
 void UT_LogsBaseView::testIsExitAllowed()
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -37,6 +37,7 @@
 #include <hbgroupbox.h>
 #include <dialpad.h>
 #include <hbmessagebox.h>
+#include <QGraphicsLinearLayout>
 
 Q_DECLARE_METATYPE(LogsDetailsModel *)
 
@@ -412,3 +413,38 @@
     QVERIFY( model != 0 );
     delete model;
 }
+
+
+void UT_LogsDetailsView::testUpdateChildItems()
+{
+    HbListView list;
+    LogsDetailsModel* model = new LogsDetailsModel();
+    list.setModel( model, new LogsDetailsViewItem());
+
+    model->mDetailItemsCount = 5;
+    QEvent* event = new QEvent(QEvent::GraphicsSceneResize);
+    qApp->sendEvent(&list, event); //will create list items and call updateChildItems()
+    
+    // No separator item
+    LogsDetailsViewItem* item = static_cast<LogsDetailsViewItem*>(list.viewItem(0));    
+    QVERIFY(item);
+    QVERIFY( !item->mLayout );
+    
+    // Separator item updated OK
+    model->mSeparatorIndex = 0;
+    item->updateChildItems();
+    QVERIFY( item->mLayout );
+    QCOMPARE( item->mLayout->count(), 1 );
+    QGraphicsLayoutItem* layoutItem = item->mLayout->itemAt(0);
+    QVERIFY( static_cast<HbGroupBox*>(layoutItem) );
+
+    // Testing groupBoxClicked()
+    QVERIFY( model->mSeparatorCollapsed );
+    item->groupBoxClicked(false);
+    QVERIFY( !model->mSeparatorCollapsed );
+    
+    
+    list.setModel(0);
+    delete model;
+}
+  
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -92,34 +92,27 @@
 void UT_LogsMainWindow::testEventFilter()
 {    
     QSignalSpy spy( mMainWindow, SIGNAL(localeChanged()) );
-    QSignalSpy foregroundSpy( mMainWindow, SIGNAL(appGainedForeground()) );
     QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
 
     //Event we are not interested in
     QEvent event(QEvent::Show);
     QVERIFY( !mMainWindow->eventFilter(this, &event) );
-    QVERIFY( !mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
-    QCOMPARE( foregroundSpy.count(), 0 );
     QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
    
     //Coming foreground, locale not changed
     QEvent eventFg(QEvent::ApplicationActivate);
     QVERIFY( !mMainWindow->eventFilter(this, &eventFg) );
-    QVERIFY( mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
-    QCOMPARE( foregroundSpy.count(), 1 );
     QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
-    foregroundSpy.clear();
     
     //LocaleChange event on FG
+    mMainWindow->mForeground = true;
     QEvent eventLocale(QEvent::LocaleChange);
     QVERIFY( !mMainWindow->eventFilter(this, &eventLocale) );
-    QVERIFY( mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
     QVERIFY( spy.count() == 1 );
     QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
-    QCOMPARE( foregroundSpy.count(), 0 );
     spy.clear();
     
     //Going background partially, surface check is not reliable at the moment so 
@@ -127,30 +120,51 @@
     HbStubHelper::createWindowSurface();
     QEvent eventBg(QEvent::ApplicationDeactivate);
     QVERIFY( !mMainWindow->eventFilter(this, &eventBg) );
-    QVERIFY( !mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
     QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
-    QCOMPARE( foregroundSpy.count(), 0 );
     
     //Going background fully
     HbStubHelper::reset();
     QVERIFY( !mMainWindow->eventFilter(this, &eventBg) );
-    QVERIFY( !mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
     QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
-    QCOMPARE( foregroundSpy.count(), 0 );
         
     //LocaleChange event on BG
+    mMainWindow->mForeground = false;
     QVERIFY( !mMainWindow->eventFilter(this, &eventLocale) );
-    QVERIFY( !mMainWindow->isForeground() );
     QVERIFY( mMainWindow->mLocaleChanged );
     QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
     QVERIFY( spy.count() == 0 );
+}
 
-    //Coming foreground after locale cange event
-    QVERIFY( !mMainWindow->eventFilter(this, &eventFg) );
+void UT_LogsMainWindow::testObscuredCalled()
+{
+    QSignalSpy bgSpy( mMainWindow, SIGNAL(appLostForeground()) );
+    mMainWindow->mForeground = true;
+    mMainWindow->obscuredCalled();
+    QVERIFY( !mMainWindow->isForeground() );
+    QVERIFY( bgSpy.count() == 1 );
+}
+
+void UT_LogsMainWindow::testRevealedCalled()
+{
+    QSignalSpy localeSpy( mMainWindow, SIGNAL(localeChanged()) );
+    QSignalSpy fgSpy( mMainWindow, SIGNAL(appGainedForeground()) );
+    
+    mMainWindow->mForeground = false;
+    mMainWindow->revealedCalled();
     QVERIFY( mMainWindow->isForeground() );
     QVERIFY( !mMainWindow->mLocaleChanged );
-    QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
-    QVERIFY( spy.count() == 1 );
+    QVERIFY( localeSpy.count() == 0 );
+    QVERIFY( fgSpy.count() == 1 );
+    
+    //Coming foreground after locale change event
+    localeSpy.clear();
+    fgSpy.clear();
+    mMainWindow->mLocaleChanged = true;
+    mMainWindow->revealedCalled();
+    QVERIFY( mMainWindow->isForeground() );
+    QVERIFY( !mMainWindow->mLocaleChanged );
+    QVERIFY( localeSpy.count() == 1 );
+    QVERIFY( fgSpy.count() == 1 );
 }
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -26,6 +26,7 @@
 #include "logscomponentrepository.h"
 #include "logsmatchesview.h"
 #include "logsdefs.h"
+#include "logsappsettings.h"
 #include <xqaiwdecl.h>
 
 //SYSTEM
@@ -47,8 +48,10 @@
     mMainWindow =  new LogsMainWindow();
     mService = new LogsServiceHandler();
     mServiceOld = new LogsServiceHandlerOld();
-    
-    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld);
+    char* argv = 0;
+    int argc = 0;
+    mSettings = new LogsAppSettings(argc, &argv);
+    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld, *mSettings);
     
 }
 
@@ -62,6 +65,8 @@
     mMainWindow = 0;
     delete mLogsViewManager;
     mLogsViewManager = 0;
+    delete mSettings;
+    mSettings = 0;
     
     QtHighwayStubHelper::reset();
 }
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -28,7 +28,9 @@
 #include "hbstubs_helper.h"
 #include "logscontact.h"
 #include "qthighway_stub_helper.h"
-#include "logsapplication.h"
+#include "hbapplication.h"
+#include "logsappsettings.h"
+#include "logsforegroundwatcher.h"
 
 //SYSTEM
 #include <QtTest/QtTest>
@@ -50,8 +52,11 @@
 {
     mMainWindow =  new LogsMainWindow();
     mService = new LogsServiceHandler();
-    mServiceOld = new LogsServiceHandlerOld();
-    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld);
+    mServiceOld = new LogsServiceHandlerOld();  
+    int argc = 0;
+    char* argv = 0;
+    mSettings = new LogsAppSettings(argc, &argv);
+    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld, *mSettings);
 }
 
 void UT_LogsViewManager::cleanup()
@@ -64,9 +69,8 @@
     mServiceOld = 0;
     delete mMainWindow;
     mMainWindow = 0;
-    LogsApplication* app = static_cast<LogsApplication*>( qApp );
-    app->mFeatureFakeExitEnabled = false;
-    app->mFeaturePreloadedEnabled = false;
+    delete mSettings;
+    mSettings = 0;
     
 }
 
@@ -78,7 +82,7 @@
     QVERIFY( mLogsViewManager->mMainWindow.currentView() != 0 );
     QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
     QVERIFY( mLogsViewManager->mViewStack.count() == 1 );
-    QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+    QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
     
     delete mLogsViewManager;
     mLogsViewManager = 0;
@@ -88,7 +92,7 @@
     mMainWindow = 0;
     mMainWindow = new LogsMainWindow();
     HbStubHelper::setActivityReason(Hb::ActivationReasonActivity);
-    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld);
+    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld, *mSettings);
     QVERIFY( mLogsViewManager->mComponentsRepository );
     QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
     QVERIFY( mLogsViewManager->mViewStack.count() == 1 );
@@ -103,14 +107,32 @@
     QtHighwayStubHelper::setIsService(true);
     LogsServiceHandler* handler2 = new LogsServiceHandler();
     mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
-    mLogsViewManager = new LogsViewManager(*mMainWindow, *handler2, *mServiceOld);
+    mLogsViewManager = new LogsViewManager(*mMainWindow, *handler2, *mServiceOld, *mSettings);
     QVERIFY( mLogsViewManager->mComponentsRepository );
     QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
     QVERIFY( mLogsViewManager->mViewStack.count() == 0 ); // Waiting for signal
     QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+    QVERIFY( !mLogsViewManager->mBackgroundStartupWatcher );
     HbStubHelper::reset();
     QtHighwayStubHelper::reset();
     delete handler2;
+    
+    // Preloading startup
+    mSettings->mFeaturePreloadedEnabled = true;
+    delete mMainWindow;
+    mMainWindow = 0;
+    mMainWindow = new LogsMainWindow();
+    mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
+    mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld, *mSettings);
+    QVERIFY( mLogsViewManager->mComponentsRepository );
+    QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
+    QVERIFY( mLogsViewManager->mViewStack.count() == 0 ); // Waiting for coming to foreground
+    QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+    QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
+    QVERIFY( !HbStubHelper::tsTaskVisibility() );
+    QVERIFY( mLogsViewManager->mBackgroundStartupWatcher );
+    HbStubHelper::reset();
+    QtHighwayStubHelper::reset();
 }
 
 
@@ -247,11 +269,11 @@
     QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
     
     // Fake exit enabled, data is compressed, app hidden and activity saved
-    LogsApplication* app = static_cast<LogsApplication*>( qApp );
-    app->mFeatureFakeExitEnabled = true;
+    mSettings->mFeatureFakeExitEnabledVal = 1;
     HbStubHelper::reset();
     mLogsViewManager->mComponentsRepository->model()->mCompressCalled = false;
     QtHighwayStubHelper::reset();
+    HbApplication* app = static_cast<HbApplication*>( qApp );
     QCOMPARE( app->activityManager()->activities().count(), 0 );
     mLogsViewManager->exitApplication();
     QVERIFY( !HbStubHelper::quitCalled() );
@@ -272,7 +294,7 @@
     LogsServiceHandler service;
     LogsServiceHandlerOld serviceOld;
     service.mIsAppStartedUsingService = true;
-    LogsViewManager vm(window, service, serviceOld);
+    LogsViewManager vm(window, service, serviceOld, *mSettings);
     QVERIFY( vm.mComponentsRepository );
     QVERIFY( vm.mMainWindow.views().count() == 0 );
     QVERIFY( vm.mMainWindow.currentView() == 0 );
@@ -379,18 +401,22 @@
     QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
     
     // Gaining foreground causes data refresh if fake exit or preloading feature is enabled
+    // If no view activated yet, default view is activated
     HbStubHelper::reset();
-    LogsApplication* app = static_cast<LogsApplication*>( qApp );
-    app->mFeatureFakeExitEnabled = true;
+    mMainWindow->setCurrentView(0);
+    mLogsViewManager->mViewStack.clear();
+    mSettings->mFeatureFakeExitEnabledVal = 1;
     mLogsViewManager->appGainedForeground();
     QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
     QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
     QVERIFY( HbStubHelper::tsTaskVisibility() );
+    QVERIFY( mMainWindow->currentView() != 0 );
+    QCOMPARE( mLogsViewManager->mViewStack.count(), 1 );
     
     HbStubHelper::reset();
     mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
-    app->mFeatureFakeExitEnabled = false;
-    app->mFeaturePreloadedEnabled = true;
+    mSettings->mFeatureFakeExitEnabledVal = 0;
+    mSettings->mFeaturePreloadedEnabled = true;
     mLogsViewManager->appGainedForeground();
     QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
     QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
@@ -421,3 +447,18 @@
     QCOMPARE( mLogsViewManager->mComponentsRepository->dialpad()->mLineEdit->text(), QString("") );
     QVERIFY( HbStubHelper::isWidgetRaised() );
 }
+
+void UT_LogsViewManager::testBgStartupForegroundGained()
+{
+    if ( !mLogsViewManager->mBackgroundStartupWatcher ){
+        mLogsViewManager->mBackgroundStartupWatcher = new LogsForegroundWatcher();
+    }
+    HbStubHelper::reset();
+    mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
+    mSettings->mFeaturePreloadedEnabled = true;
+    mLogsViewManager->bgStartupForegroundGained();
+    QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+    QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
+    QVERIFY( HbStubHelper::tsTaskVisibility() );
+    QVERIFY( HbStubHelper::isWidgetRaised() );
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h	Fri Sep 17 16:47:32 2010 +0300
@@ -27,7 +27,7 @@
 class HbApplication : public QApplication
 {
 public:
-    HbApplication(int &/*argc*/, char */*argv*/[]);
+    HbApplication(int &/*argc*/, char */*argv*/[], Hb::ApplicationFlags flags = Hb::DefaultApplicationFlags);
     ~HbApplication();
     
     HbActivityManager *activityManager();
@@ -37,6 +37,9 @@
     QVariant activateData();    
     
     static void quit();
+
+public:
+    Hb::ApplicationFlags mTestFlags;
 };
 
 #endif//HBAPPLICATION_H
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -353,8 +353,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-HbApplication::HbApplication(int &argc, char *argv[]) :
-    QApplication(0, argc, argv, 0) 
+HbApplication::HbApplication(int &argc, char *argv[], Hb::ApplicationFlags flags) :
+    QApplication(0, argc, argv, 0), mTestFlags(flags)
 {
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingskey.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef XQSETTINGSITEM_H
+#define XQSETTINGSITEM_H
+
+
+// CLASS DECLARATION
+class XQSettingsKey
+{
+public:
+    enum Target
+    {
+        TargetCentralRepository = 0,
+        TargetPublishAndSubscribe
+    };
+
+    XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key);
+    ~XQSettingsKey();
+
+    XQSettingsKey::Target target() const;
+    long int uid() const;
+    unsigned long int key() const;
+
+protected:
+    XQSettingsKey::Target m_target;
+    long int m_uid;
+    unsigned long int m_key;
+};
+
+
+#endif //XQSETTINGSITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingsmanager.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef XQSETTINGSMANAGER_H
+#define XQSETTINGSMANAGER_H
+
+#include "xqsettingskey.h"
+
+// CLASS DECLARATION
+class XQSettingsManager
+{
+public:
+
+    enum Type
+    {
+        TypeVariant = 0,
+        TypeInt,
+        TypeDouble,
+        TypeString,
+        TypeByteArray
+    };
+
+    XQSettingsManager();
+    ~XQSettingsManager();
+
+    QVariant readItemValue(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+    bool writeItemValue(const XQSettingsKey& key, const QVariant& value);
+    
+public:
+    static bool mFailed;
+    static int mCurrentVal;
+};
+
+#endif // XQSETTINGSMANAGER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/xqsettingsmanager_stub.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <qglobal.h>
+#include <QVariant>
+#include <xqsettingsmanager.h>
+#include <xqsettingskey.h>
+
+bool XQSettingsManager::mFailed = false;
+int XQSettingsManager::mCurrentVal = 0;
+    
+//////////////////////////////////////////////////////////////////////////////////////////
+//  XQSettingsManager
+//////////////////////////////////////////////////////////////////////////////////////////
+
+XQSettingsManager::XQSettingsManager()
+{
+}
+
+XQSettingsManager::~XQSettingsManager()
+{
+    
+}
+
+QVariant XQSettingsManager::readItemValue(const XQSettingsKey& key, 
+                                          XQSettingsManager::Type type)
+{
+    Q_UNUSED(key);
+    Q_UNUSED(type);
+    if (mFailed)
+        return QVariant();
+    else
+        return QVariant(mCurrentVal);
+}
+
+bool XQSettingsManager::writeItemValue(const XQSettingsKey& key, const QVariant& value)
+{
+    Q_UNUSED(key);
+    if (mFailed) {
+        return false;        
+    }
+    else {
+        mCurrentVal = value.toInt();
+        return true;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//  XQSettingsKey
+//////////////////////////////////////////////////////////////////////////////////////////
+
+XQSettingsKey::XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key)
+{
+    m_target = target;
+    m_uid = uid;
+    m_key = key;
+}
+
+XQSettingsKey::~XQSettingsKey()
+{
+    
+}
+
+XQSettingsKey::Target XQSettingsKey::target() const
+{
+    return m_target;
+}
+
+long int XQSettingsKey::uid() const
+{
+    return m_uid;
+}
+    
+unsigned long int XQSettingsKey::key() const
+{
+    return m_key;
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -39,8 +39,10 @@
 
 # Input
 
-HEADERS += stubs/xqkeycapture.h
-HEADERS += stubs/tstasksettings.h
+HEADERS += ./stubs/xqkeycapture.h
+HEADERS += ./stubs/xqsettingskey.h
+HEADERS += ./stubs/xqsettingsmanager.h
+HEADERS += ./stubs/tstasksettings.h
 HEADERS += ./stubs/hbapplication.h
 HEADERS += inc/ut_logsmainwindow.h
 HEADERS += inc/ut_logscomponentrepository.h
@@ -54,8 +56,10 @@
 HEADERS += inc/ut_logspageindicatoritem.h
 HEADERS += inc/ut_logsservicehandler.h
 HEADERS += inc/ut_logsapplication.h
+HEADERS += inc/ut_logsappsettings.h
 HEADERS += ../../inc/logsmainwindow.h
 HEADERS += ../../inc/logsapplication.h
+HEADERS += ../../inc/logsappsettings.h
 HEADERS += ../../inc/logsviewmanager.h
 HEADERS += ../../inc/logscomponentrepository.h
 HEADERS += ../../inc/logsrecentcallsview.h
@@ -67,8 +71,8 @@
 HEADERS += ../../inc/logseffecthandler.h
 HEADERS += ../../inc/logspageindicator.h
 HEADERS += ../../inc/logspageindicatoritem.h
-#HEADERS += ../../../logsengine/inc/logscommondata.h
 HEADERS += ../../../logsengine/inc/logsconfigurationparams.h
+HEADERS += ../../../logsengine/logssymbianos/inc/logsforegroundwatcher.h
 HEADERS += logsengine_stub/logscontact.h
 HEADERS += ./stubs/dialpad.h
 HEADERS += ./stubs/dialpadkeyhandler.h
@@ -99,6 +103,7 @@
 SOURCES += src/ut_logspageindicator.cpp
 SOURCES += src/ut_logspageindicatoritem.cpp
 SOURCES += src/ut_logsapplication.cpp
+SOURCES += src/ut_logsappsettings.cpp
 SOURCES += ../../src/logsbaseview.cpp
 SOURCES += ../../src/logsrecentcallsview.cpp
 SOURCES += ../../src/logsdetailsview.cpp
@@ -109,18 +114,22 @@
 SOURCES += ../../src/logspageindicator.cpp
 SOURCES += ../../src/logspageindicatoritem.cpp
 SOURCES += ../../src/logsapplication.cpp
+SOURCES += ../../src/logsappsettings.cpp
+SOURCES += ../../../logsengine/logssymbianos/src/logsforegroundwatcher.cpp
 SOURCES += ../../../tsrc/qtestutils/src/testrunner.cpp
 SOURCES += ./stubs/hbstubs.cpp
 SOURCES += ./stubs/qthighway_stub.cpp
 SOURCES += ./stubs/dialpad_stub.cpp
 SOURCES += ./stubs/dialpadkeyhandler_stub.cpp
+SOURCES += ./stubs/xqsettingsmanager_stub.cpp
 
 symbian: {
     TARGET.UID2 = 0x100039CE
     TARGET.UID3 = 0xEb768cbc
     TARGET.CAPABILITY = ALL -TCB
     TARGET.EPOCALLOWDLLDATA = 1
-    LIBS += -lxqservice  -lxqserviceutil -lxqkeycapture 
+    LIBS += -lxqservice  -lxqserviceutil -lxqkeycapture -lapparc -lcone
+    MMP_RULES += SMPSAFE
 }
 
 DOCML += ../../resources/recentCallsView.docml
--- a/logsui/logscntfinder/logscntfinder.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logscntfinder/logscntfinder.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -66,4 +66,5 @@
         "DEFFILE eabi/logscntfinder.def" \
         "$${LITERAL_HASH}endif"
     MMP_RULES += defFiles
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -43,6 +43,6 @@
     TARGET.UID3 = 0x101F4CD6
     TARGET.CAPABILITY = CAP_APPLICATION
     LIBS += -llogscntfinder
-    
+    MMP_RULES += SMPSAFE
 }
 
--- a/logsui/logscntfinder/tsrc/pt_logscntfinder/pt_logscntfinder.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/pt_logscntfinder.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -51,4 +51,5 @@
         -lxqservice \
         -lQtContacts \
         -llogscntfinder
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logscntfinder/tsrc/st_logscntfinder/st_logscntfinder.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/st_logscntfinder.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -50,4 +50,5 @@
     TARGET.CAPABILITY = ALL -TCB
     TARGET.EPOCALLOWDLLDATA = 1
     LIBS += -lflogger -lqtcontacts -llogscntfinder
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -70,5 +70,5 @@
     TARGET.CAPABILITY = ALL -TCB
     TARGET.EPOCALLOWDLLDATA = 1
     LIBS += -lflogger -lqtcontacts
-    
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logsengine/inc/logsdetailsmodel.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/inc/logsdetailsmodel.h	Fri Sep 17 16:47:32 2010 +0300
@@ -37,6 +37,10 @@
 
 public:
     
+    enum LogsDetailsRole {
+        RoleDuplicatesSeparator = RoleBaseLast + 1 //used to check whether item is separator
+    };
+    
     explicit LogsDetailsModel( LogsDbConnector& dbConnector, LogsEvent& event );
     
 public: // The exported API
@@ -53,6 +57,8 @@
     virtual QVariant data(const QModelIndex &index, int role) const;
     virtual QVariant headerData(int section, Qt::Orientation orientation,
                                 int role = Qt::DisplayRole) const;
+    virtual bool setData(const QModelIndex &index, const QVariant &value, 
+                         int role = Qt::EditRole);
 
 protected: // From LogsAbstractModel
     
@@ -86,6 +92,9 @@
     QList<QStringList> mDetailTexts;
     QList<LogsEvent*> mDuplicates;
     
+    int mSeparatorIndex;
+    bool mSeparatorCollapsed;
+    
 private:
         
     friend class UT_LogsModel;
--- a/logsui/logsengine/logsengine.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/logsengine.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -105,4 +105,5 @@
         "DEFFILE eabi/logsengine.def" \
         "$${LITERAL_HASH}endif"
     MMP_RULES += defFiles
+    MMP_RULES += SMPSAFE
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsforegroundwatcher.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef LOGSFOREGROUNDWATCHER_H
+#define LOGSFOREGROUNDWATCHER_H
+
+
+#include <QObject>
+#include <coemain.h>
+
+class LogsForegroundWatcher : public QObject, public MCoeForegroundObserver
+{
+    Q_OBJECT
+    
+public:
+
+    LogsForegroundWatcher(QObject* parent = 0);
+    virtual ~LogsForegroundWatcher();
+    
+    static void ensureBackgroundStartup();
+    
+signals:
+    void gainingForeground();
+    void losingForeground();
+
+public: // from MCoeForegroundObserver
+    void HandleGainingForeground();
+    void HandleLosingForeground();
+    
+};
+
+#endif //LOGSFOREGROUNDWATCHER_H
--- a/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -356,6 +356,8 @@
     
     releaseDbConnections();
     
+    mFirstReadCompleted = false; // For testing
+    
     LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::compressData()" )
     return 0;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsforegroundwatcher.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "logsforegroundwatcher.h"
+#include "logslogger.h"
+#include <apacmdln.h>
+
+
+// -----------------------------------------------------------------------------
+// Currently no other way to monitor first app foreground switch in case
+// mainwindow is not made yet visible.
+// -----------------------------------------------------------------------------
+//
+LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent)
+{
+    CCoeEnv* env = CCoeEnv::Static();
+    if (env) {
+        TRAP_IGNORE(env->AddForegroundObserverL(*this));
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsForegroundWatcher::~LogsForegroundWatcher()
+{
+    CCoeEnv* env = CCoeEnv::Static();
+    if (env) {
+        env->RemoveForegroundObserver(*this);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::ensureBackgroundStartup()
+{
+    CApaCommandLine* commandLine = 0;
+    CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
+    if ( commandLine ){
+        TApaCommand command = commandLine->Command();
+        if (command != EApaCommandBackground) {
+            LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::ensureBackgroundStartup");
+            TRAPD( err, commandLine->SetCommandL( EApaCommandBackground ) );
+            if ( !err ){
+                RProcess thisProcess;
+                TRAP_IGNORE( commandLine->SetProcessEnvironmentL(thisProcess) )
+            }
+            LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::ensureBackgroundStartup");
+        }
+        delete commandLine;
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleGainingForeground()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleGainingForeground" );
+    emit gainingForeground();
+    LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleGainingForeground" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleLosingForeground()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleLosingForeground" );
+    emit losingForeground();
+    LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleLosingForeground" );
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsforegroundwatcher.h	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef UT_LOGSFOREGROUNDWATCHER_H
+#define UT_LOGSFOREGROUNDWATCHER_H
+
+#include <QObject>
+
+class LogsForegroundWatcher;
+
+class UT_LogsForegroundWatcher : public QObject        
+{
+     Q_OBJECT
+			
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions. 
+ * They will be executed by the testing framework and can be used to initialize and clean up 
+ * either the entire test or the current test function.
+ * 
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+    void initTestCase();
+    void cleanupTestCase();
+    void init();
+    void cleanup();
+    
+private slots: //test methods
+    void testConstructor();
+    void testHandleLosingForeground();
+    void testHandleGainingForeground();
+    void testEnsureBackgroundStartup();
+
+        
+private:
+
+    LogsForegroundWatcher* mWatcher;
+    
+};
+
+
+#endif //UT_LOGSFOREGROUNDWATCHER_H
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -26,6 +26,7 @@
 #include "testrunner.h"
 #include "ut_logsremove.h"
 #include "ut_logsremovestates.h"
+#include "ut_logsforegroundwatcher.h"
 
 
 int main(int argc, char *argv[]) 
@@ -66,6 +67,9 @@
     UT_LogsEventDataParser ut_logsEventData;
     testRunner.runTests(ut_logsEventData);
     
+    UT_LogsForegroundWatcher ut_logsForegroundWatcher;
+    testRunner.runTests(ut_logsForegroundWatcher);
+    
     testRunner.printResults();
     
     return 0;   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsforegroundwatcher.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsforegroundwatcher.h"
+#include "logsforegroundwatcher.h"
+
+#include <QtTest/QtTest>
+#include <coemain.h>
+#include <apacmdln.h>
+
+CCoeEnv* testEnv = 0;
+bool testCommandlineExists = false;
+bool testCommandLineCommandBg = false;
+bool testCommandLineSetForProcess = false;
+
+CCoeEnv* CCoeEnv::Static()
+{
+    if ( !testEnv ){
+        testEnv = new CCoeEnv();
+    }
+    return testEnv;
+}
+
+CCoeEnv::CCoeEnv() : CActive(EPriorityNormal)
+{
+    
+}
+
+CCoeEnv::~CCoeEnv()
+{
+}
+
+void CCoeEnv::AddForegroundObserverL(MCoeForegroundObserver& /*aForegroundObserver*/)
+{
+    
+}
+
+void CCoeEnv::RemoveForegroundObserver(MCoeForegroundObserver& /*aForegroundObserver*/)
+{
+    
+}
+
+TInt CApaCommandLine::GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine)
+{
+    if ( testCommandlineExists ){
+        aCommandLine = CApaCommandLine::NewL();
+        if ( testCommandLineCommandBg ){
+            TRAP_IGNORE( aCommandLine->SetCommandL(EApaCommandBackground) )
+        } else {
+            TRAP_IGNORE( aCommandLine->SetCommandL(EApaCommandRun) )
+        }
+    } else {
+        aCommandLine = 0;
+    }
+    return KErrNone;
+}
+
+void CApaCommandLine::SetProcessEnvironmentL(RProcess& /*aProcess*/) const
+{
+    if ( Command() == EApaCommandBackground ){
+        testCommandLineSetForProcess = true;
+    }
+}
+
+void UT_LogsForegroundWatcher::initTestCase()
+{
+}
+
+void UT_LogsForegroundWatcher::cleanupTestCase()
+{
+    delete testEnv;
+    testEnv = 0;
+}
+
+void UT_LogsForegroundWatcher::init()
+{
+    mWatcher = new LogsForegroundWatcher();
+}
+
+void UT_LogsForegroundWatcher::cleanup()
+{
+    delete mWatcher;
+}
+
+void UT_LogsForegroundWatcher::testConstructor()
+{
+    QVERIFY( mWatcher );
+}
+
+void UT_LogsForegroundWatcher::testHandleLosingForeground()
+{
+    QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) );
+    QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) );
+    mWatcher->HandleLosingForeground();
+    QVERIFY( spyGaining.count() == 0 );
+    QVERIFY( spyLosing.count() == 1 );
+}
+
+void UT_LogsForegroundWatcher::testHandleGainingForeground()
+{
+    QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) );
+    QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) );
+    mWatcher->HandleGainingForeground();
+    QVERIFY( spyGaining.count() == 1 );
+    QVERIFY( spyLosing.count() == 0 );
+}
+
+void UT_LogsForegroundWatcher::testEnsureBackgroundStartup()
+{
+    // No commandline
+    mWatcher->ensureBackgroundStartup();
+    QVERIFY( !testCommandLineSetForProcess );
+    
+    // Command line already has bg command
+    testCommandlineExists = true;
+    testCommandLineCommandBg = true;
+    mWatcher->ensureBackgroundStartup();
+    QVERIFY( !testCommandLineSetForProcess );
+    
+    // Command line does not have bg command
+    testCommandLineCommandBg = false;
+    mWatcher->ensureBackgroundStartup();
+    QVERIFY( testCommandLineSetForProcess );   
+}
+
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -36,6 +36,8 @@
 DEFINES += QT_NO_DEBUG_OUTPUT
 
 # Input
+HEADERS += ../stubs/xqsettingskey.h
+HEADERS += ../stubs/xqsettingsmanager.h
 HEADERS += inc/ut_logsdbconnector.h
 HEADERS += inc/ut_logsreader.h
 HEADERS += inc/ut_logsreaderstates.h
@@ -43,6 +45,7 @@
 HEADERS += inc/ut_logseventdataparser.h
 HEADERS += inc/ut_logsremove.h
 HEADERS += inc/ut_logsremovestates.h
+HEADERS += inc/ut_logsforegroundwatcher.h
 HEADERS += ../../inc/logsdbconnector.h
 HEADERS += ../../inc/logsworker.h
 HEADERS += ../../inc/logsreader.h
@@ -50,6 +53,7 @@
 HEADERS += ../../inc/logsreaderobserver.h
 HEADERS += ../../inc/logsremove.h
 HEADERS += ../../inc/logsremovestates.h
+HEADERS += ../../inc/logsforegroundwatcher.h
 HEADERS += ../../../../../recents_plat/logs_engine_api/inc/logsevent.h
 HEADERS += ../../../inc/logseventdata.h
 HEADERS += ../../../inc/logscommondata.h
@@ -65,6 +69,7 @@
 SOURCES += src/ut_logseventdataparser.cpp
 SOURCES += src/ut_logsremove.cpp
 SOURCES += src/ut_logsremovestates.cpp
+SOURCES += src/ut_logsforegroundwatcher.cpp
 SOURCES += ../../src/logsdbconnector.cpp
 SOURCES += ../../src/logsworker.cpp
 SOURCES += ../../src/logsreader.cpp
@@ -74,6 +79,7 @@
 SOURCES += ../../src/logseventdataparser.cpp
 SOURCES += ../../src/logsremove.cpp
 SOURCES += ../../src/logsremovestates.cpp
+SOURCES += ../../src/logsforegroundwatcher.cpp
 SOURCES += ../../../src/logsevent.cpp
 SOURCES += ../../../src/logseventdata.cpp
 SOURCES += ../../../src/logscommondata.cpp
@@ -89,6 +95,7 @@
     TARGET.UID2 = 0x100039CE
     TARGET.UID3 = 0xEfaaa9b2
     TARGET.CAPABILITY = ALL -TCB
-    LIBS += -lecom -lflogger -lws32 -lbafl -lqtcontacts -lefsrv
+    LIBS += -lecom -lflogger -lws32 -lbafl -lqtcontacts -lefsrv -lapparc -lcone
     TARGET.EPOCALLOWDLLDATA = 1
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logsengine/src/logsdetailsmodel.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/src/logsdetailsmodel.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -36,7 +36,9 @@
 //
 LogsDetailsModel::LogsDetailsModel( LogsDbConnector& dbConnector, LogsEvent& event ) 
     : LogsAbstractModel(),
-      mEvent( 0 )
+      mEvent( 0 ),
+      mSeparatorIndex(-1),
+      mSeparatorCollapsed(true)
 {
     LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::LogsDetailsModel()" )
     
@@ -90,7 +92,11 @@
 //
 int LogsDetailsModel::rowCount(const QModelIndex & /* parent */) const
 {
-    return mDetailTexts.count();
+    if (mSeparatorIndex >= 0 && mSeparatorCollapsed) {
+        return mSeparatorIndex + 1;
+    } else {
+        return mDetailTexts.count();
+    }
 }
 
 // -----------------------------------------------------------------------------
@@ -102,7 +108,6 @@
     if (!index.isValid() || index.row() >= mDetailTexts.count() || index.row() < 0 ) {
         return QVariant();
     }
-
     if (role == Qt::DisplayRole){
         QStringList text;
         getDisplayData(index.row(), text);
@@ -112,6 +117,10 @@
         getDecorationData(index.row(), icons);
         return QVariant(icons);
     } 
+    else if (role == RoleDuplicatesSeparator) {
+        bool separator  = index.row() == mSeparatorIndex;
+        return QVariant(separator);
+    }
     LogsModelItemContainer item(mEvent);
     return doGetData(role, item);
 }
@@ -134,6 +143,38 @@
 }
 
 // -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+bool LogsDetailsModel::setData(const QModelIndex &index, const QVariant &value, 
+                               int role)
+{
+    Q_UNUSED(role);
+    LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::setData()" )
+    bool dataSet( false );
+    if (index.row() == mSeparatorIndex 
+        && value.isValid()
+        && value.toBool() != mSeparatorCollapsed
+        && mSeparatorIndex < mDetailTexts.count()-1) {
+      
+        LOGS_QDEBUG( "logs [ENG]    separator state changed!" )
+        mSeparatorCollapsed = !mSeparatorCollapsed;
+        if (mSeparatorCollapsed) {
+            LOGS_QDEBUG( "logs [ENG]    collapsing separator" )
+            beginRemoveRows(QModelIndex(), mSeparatorIndex+1, mDetailTexts.count()-1);
+            endRemoveRows();
+        } else {
+            LOGS_QDEBUG( "logs [ENG]    expanding separator" )
+            beginInsertRows(QModelIndex(), mSeparatorIndex+1, mDetailTexts.count()-1);
+            endInsertRows();
+        }  
+        dataSet = true;              
+    }
+    LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::setData()" )
+    return dataSet;
+}
+
+// -----------------------------------------------------------------------------
 // From LogsAbstractModel
 // -----------------------------------------------------------------------------
 //
@@ -400,7 +441,13 @@
         callDurationRow << durationString(t);
         mDetailTexts.append(callDurationRow);
     }
-    
+    if (mDuplicates.count() > 0) {
+        QStringList separatorRow;
+        separatorRow << hbTrId("txt_dialer_pri_previous_calls").arg(mDuplicates.count());
+        mSeparatorIndex = mDetailTexts.count();
+        mDetailTexts.append(separatorRow);
+    }
+        
     foreach ( LogsEvent* event, mDuplicates ){
         addDateAndTimeTextRow(*event);
     }
@@ -431,6 +478,11 @@
         mDetailIcons.append(durationIcon);
     }
     
+    if (mDuplicates.count() > 0) { //put some dummy icon
+        HbIcon* separatorIcon = new HbIcon();
+        mDetailIcons.append(separatorIcon);
+    }
+
     foreach ( LogsEvent* event, mDuplicates ){
         // Having multiple date and time icon instances has no performance
         // penalty due resource sharing inside HbIcon impl
--- a/logsui/logsengine/src/logsmessage.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/src/logsmessage.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -20,6 +20,7 @@
 #include "logslogger.h"
 #include "logseventdata.h"
 #include <xqservicerequest.h>
+#include <xqaiwdecl.h>
 
 //SYSTEM
 
@@ -90,8 +91,9 @@
     
     delete mService;
     mService = 0;
-    mService = new XQServiceRequest("com.nokia.services.hbserviceprovider.conversationview", 
-                                    "send(QString,qint32,QString)", false);
+    QString serviceName("messaging.");     
+    serviceName.append(XQI_MESSAGE_SEND);
+    mService = new XQServiceRequest(serviceName, XQOP_MESSAGE_SEND_WITH_ID, false);
     bool sending = doSendMessageToNumber(*mService, mNumber, mDisplayName, mContactId);
     connect(mService, SIGNAL(requestCompleted(QVariant)), this, SLOT(requestCompleted(QVariant)));
     connect(mService, SIGNAL(requestError(int)), this, SLOT(requestError(int)));
@@ -106,9 +108,9 @@
         const QString& number, const QString& displayName, unsigned int contactId)
 {
     LOGS_QDEBUG( "logs [ENG] -> LogsMessage::sendMessageToNumber()" )
-    
-    XQServiceRequest req("com.nokia.services.hbserviceprovider.conversationview", 
-                         "send(QString,qint32,QString)", false);
+    QString serviceName("messaging.");     
+    serviceName.append(XQI_MESSAGE_SEND);
+    XQServiceRequest req(serviceName, XQOP_MESSAGE_SEND_WITH_ID, false);
     return doSendMessageToNumber(req, number, displayName, contactId);
 }
 
--- a/logsui/logsengine/tsrc/at_logsengine/at_logsengine.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/tsrc/at_logsengine/at_logsengine.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -35,7 +35,7 @@
 
 SOURCES += src/main.cpp
 SOURCES += src/at_logsengine.cpp
-SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testrunner.cpp
 
 symbian: {
     TARGET.UID2 = 0x100039CE
@@ -43,6 +43,7 @@
     TARGET.CAPABILITY = ALL -TCB
     TARGET.EPOCALLOWDLLDATA = 1
     LIBS += -llogsengine
+    MMP_RULES += SMPSAFE
 }
 
 BLD_INF_RULES.prj_mmpfiles = "../../../tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp"\
--- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsdetailsmodel.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsdetailsmodel.h	Fri Sep 17 16:47:32 2010 +0300
@@ -60,6 +60,7 @@
 	void testCreateContact();
 	void testContactActionCompleted();
 	void testUpdateConfiguration();
+	void testSetData();
     
 private:
  
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsdetailsmodel.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsdetailsmodel.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -81,10 +81,22 @@
 void UT_LogsDetailsModel::testConstructor()
 {
     QVERIFY( mModel );
+    QVERIFY( mModel->mSeparatorCollapsed );
+    QVERIFY( mModel->mSeparatorIndex == -1 );
 }
 
 void UT_LogsDetailsModel::testRowCount()
 {
+    // No expandable item for duplicate events
+    QVERIFY( mModel->mSeparatorIndex == -1 );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 5 );
+    
+    // Expandable item is collapsed
+    mModel->mSeparatorIndex = 1;
+    QVERIFY( mModel->rowCount(QModelIndex()) == 2 );
+    
+    // Expandable item is expanded
+    mModel->mSeparatorCollapsed = false;
     QVERIFY( mModel->rowCount(QModelIndex()) == 5 );
 }
 
@@ -202,9 +214,16 @@
     // Contact not supported
     mModel->mEvent->setNumber("");
     mModel->mEvent->setLogsEventData( 0 );
-    contactData = mModel->data(mModel->index(0), LogsModel::RoleContact);
+    contactData = mModel->data(mModel->index(0), LogsDetailsModel::RoleContact);
     contact = qVariantValue<LogsContact *>( contactData );
     QVERIFY( !contact );
+    
+    // Expandable separator item
+    mModel->mSeparatorIndex = 1;
+    QVariant groupbox = mModel->data(mModel->index(0), LogsDetailsModel::RoleDuplicatesSeparator);
+    QVERIFY( groupbox.isValid() && !groupbox.toBool() );
+    groupbox = mModel->data(mModel->index(1), LogsDetailsModel::RoleDuplicatesSeparator);
+    QVERIFY( groupbox.isValid() && groupbox.toBool() );
 }
 
 void UT_LogsDetailsModel::testHeaderData()
@@ -373,12 +392,13 @@
     model->mDbConnector->mDuplicatedEvents.append(dup1);
     LogsEvent* dup2 = new LogsEvent;
     model->mDbConnector->mDuplicatedEvents.append(dup2);
+    mModel->mSeparatorCollapsed = false;
     model->duplicatesRead();
-    QVERIFY(model->mDetailIcons.count() == 6);
-    QVERIFY(model->mDetailTexts.count() == 6);
+    QVERIFY(model->mDetailIcons.count() == 7);
+    QVERIFY(model->mDetailTexts.count() == 7);
     // When having multiple date and time items, first item has different heading than others
     QVERIFY( model->mDetailTexts.at(1).at(0) != dateAndTimeRowHeading );
-    QVERIFY( model->mDetailTexts.at(5).at(0) == dateAndTimeRowHeading );
+    QVERIFY( model->mDetailTexts.at(6).at(0) == dateAndTimeRowHeading );
     delete model;
     model = 0;
     
@@ -501,3 +521,36 @@
     QVERIFY( mModel->updateConfiguration(params) == 0 );
     QCOMPARE( mModel->mDetailTexts.count(), 4 );
 }
+
+void UT_LogsDetailsModel::testSetData()
+{
+    const int separatorIdx = 2;
+    mModel->mSeparatorCollapsed = false;
+    mModel->mSeparatorIndex = separatorIdx;
+    
+    // Collapsing duplicates ok
+    QVERIFY( mModel->rowCount(QModelIndex()) == 5 );
+    mModel->setData( mModel->index(separatorIdx), QVariant(true) );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 3 );
+    QVERIFY( mModel->mSeparatorCollapsed );
+    
+    // Expanding fails, wrong separator index 
+    mModel->setData( mModel->index(separatorIdx+2), QVariant(false) );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 3 );
+    QVERIFY( mModel->mSeparatorCollapsed );
+
+    // Expanding fails, invalid data 
+    mModel->setData( mModel->index(separatorIdx), QVariant() );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 3 );
+    QVERIFY( mModel->mSeparatorCollapsed );
+
+    // Collapsing fails, already collapsed
+    mModel->setData( mModel->index(separatorIdx), QVariant(true) );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 3 );
+    QVERIFY( mModel->mSeparatorCollapsed );
+        
+    // Expanding ok
+    mModel->setData( mModel->index(separatorIdx), QVariant(false) );
+    QVERIFY( mModel->rowCount(QModelIndex()) == 5 );
+    QVERIFY( !mModel->mSeparatorCollapsed );
+}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmessage.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmessage.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -79,7 +79,7 @@
 {
     QtHighwayStubHelper::reset();
     QVERIFY( mLogsMessage->sendMessage() );
-    QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+    QVERIFY( QtHighwayStubHelper::service() == "messaging.com.nokia.symbian.IMessageSend" );
     QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
     
 }
@@ -88,15 +88,15 @@
 {
     QtHighwayStubHelper::reset();
     QVERIFY( mLogsMessage->sendMessageToNumber( "1234567" ) );
-    QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+    QVERIFY( QtHighwayStubHelper::service() == "messaging.com.nokia.symbian.IMessageSend" );
     QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
     QtHighwayStubHelper::reset();
     QVERIFY( mLogsMessage->sendMessageToNumber( "1234567", "name" ) );
-    QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+    QVERIFY( QtHighwayStubHelper::service() == "messaging.com.nokia.symbian.IMessageSend" );
     QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
     QtHighwayStubHelper::reset();
     QVERIFY( mLogsMessage->sendMessageToNumber( "4234567", "namef", 3 ) );
-    QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+    QVERIFY( QtHighwayStubHelper::service() == "messaging.com.nokia.symbian.IMessageSend" );
     QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
 }
 
--- a/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -38,6 +38,8 @@
 # Input
 HEADERS += ../stubs/xqservicerequest.h
 HEADERS += ../stubs/xqaiwrequest.h
+HEADERS += ../../logssymbianos/tsrc/stubs/xqsettingskey.h
+HEADERS += ../../logssymbianos/tsrc/stubs/xqsettingsmanager.h
 
 HEADERS += inc/ut_logsmodel.h
 HEADERS += inc/ut_logsdetailsmodel.h
@@ -123,4 +125,5 @@
     TARGET.CAPABILITY = ALL -TCB
     TARGET.EPOCALLOWDLLDATA = 1
     LIBS +=  -lqtcontacts -lthumbnailmanagerqt -lxqservice -lxqserviceutil
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logsservices/logsservices.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsservices/logsservices.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -48,4 +48,5 @@
         "DEFFILE eabi/logsservices.def" \
         "$${LITERAL_HASH}endif"
     MMP_RULES += defFiles
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logsservices/tsrc/at_logsservices/at_logsservices.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsservices/tsrc/at_logsservices/at_logsservices.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -44,4 +44,5 @@
     TARGET.CAPABILITY = ALL -TCB
     LIBS += -lecom -lflogger -lws32 -lbafl -llogsservices
     TARGET.EPOCALLOWDLLDATA = 1
+    MMP_RULES += SMPSAFE
 }
--- a/logsui/logsui.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsui.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -36,9 +36,10 @@
     :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsfilter.h APP_LAYER_PLATFORM_EXPORT_PATH(logsfilter.h)"
     :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logscustomfilter.h APP_LAYER_PLATFORM_EXPORT_PATH(logscustomfilter.h)"
     :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsevent.h APP_LAYER_PLATFORM_EXPORT_PATH(logsevent.h)"
-	exists(confml/logsuda.confml) :BLD_INF_RULES.prj_exports += "confml/logsuda.confml CONFML_EXPORT_PATH(logsuda.confml,uda_content)"
-	exists(implml/logsuda.implml) :BLD_INF_RULES.prj_exports += "implml/logsuda.implml CRML_EXPORT_PATH(logsuda.implml,uda_content)"
-	exists(content/LOGDBU.zip) :BLD_INF_RULES.prj_exports += "content/LOGDBU.zip CRML_EXPORT_PATH(../content/zip/,uda_content)"
+    :BLD_INF_RULES.prj_exports += "logsapp/resources/logs.docml /epoc32/data/z/resource/hb/splashml/logs.docml"
+    :BLD_INF_RULES.prj_exports += "logsapp/resources/logs.splashml /epoc32/data/z/resource/hb/splashml/logs.splashml"
+    :BLD_INF_RULES.prj_exports += "logsapp/resources/logs.docml /epoc32/release/winscw/udeb/z/resource/hb/splashml/logs.docml"
+    :BLD_INF_RULES.prj_exports += "logsapp/resources/logs.splashml /epoc32/release/winscw/udeb/z/resource/hb/splashml/logs.splashml"
 
 }
 
--- a/logsui/tsrc/callservicesimulation/serviceapp.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/callservicesimulation/serviceapp.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -34,3 +34,4 @@
 libFiles.path = "!:\sys\bin"
 DEPLOYMENT += libFiles
 
+symbian:MMP_RULES += SMPSAFE
--- a/logsui/tsrc/callservicesimulation2/serviceapp2.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/callservicesimulation2/serviceapp2.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -39,3 +39,6 @@
 libFiles.path = "!:\sys\bin"
 DEPLOYMENT += libFiles
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/logsui/tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp	Fri Sep 17 16:47:32 2010 +0300
@@ -56,3 +56,6 @@
 VENDORID 0x101FB657
 
 CAPABILITY    ALL -TCB
+
+
+SMPSAFE
--- a/logsui/tsrc/logdbmodifier/clearlisttest/group/clearlisttest.mmp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/group/clearlisttest.mmp	Fri Sep 17 16:47:32 2010 +0300
@@ -55,3 +55,6 @@
 VENDORID 0x101FB657
 
 CAPABILITY    ALL -TCB
+
+
+SMPSAFE
--- a/logsui/tsrc/logscenrepeditor/install/logscenrepeditor.pkg	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logscenrepeditor/install/logscenrepeditor.pkg	Fri Sep 17 16:47:32 2010 +0300
@@ -20,19 +20,17 @@
 ; SIS header: name, uid, version
 #{"logscenrepeditor"},(0xE8316BDD),1,0,0
 
-; Localised Vendor name
-%{"Vendor"}
-
-; Unique Vendor name
-:"Vendor"
+; List of localised vendor names
+%{"Vendor-EN"}
 
-; Manual PKG pre-rules from PRO files
-; Default HW/platform dependencies
-[0x101F7961],0,0,0,{"S60ProductID"}
-[0x102032BE],0,0,0,{"S60ProductID"}
-[0x102752AE],0,0,0,{"S60ProductID"}
-[0x1028315F],0,0,0,{"S60ProductID"}
- 
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
 
 ; Executable and default resource files
 "\epoc32\release\armv5\urel\logscenrepeditor.exe"    - "!:\sys\bin\logscenrepeditor.exe"
--- a/logsui/tsrc/logscenrepeditor/logscenrepeditor.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logscenrepeditor/logscenrepeditor.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -34,3 +34,6 @@
     TARGET.CAPABILITY = CAP_APPLICATION
     LIBS += -lcentralrepository   
 }
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -31,9 +31,15 @@
         << "Temporarily Off"
         << "Not defined");
 
+const QStringList KFakeExitList = (QStringList() 
+        << "Disabled" 
+        << "Enabled" 
+        << "Not defined");
+
 LogsCenrepEditorView::LogsCenrepEditorView() 
     : HbView(0),
       mList(0),
+      mFakeExitList(0),
       mRepository(0)
 {
     qDebug() << "[LOGS_CENREP]-> LogsCenrepEditorView::LogsCenrepEditorView()";
@@ -62,9 +68,22 @@
 
     HbLabel* label = new HbLabel("Predictive search feature", this); 
     
+  
+    HbLabel* label2 = new HbLabel("Fake exit feature", this); 
+    TInt valueFakeExit(-1);
+    err = mRepository->Get( KLogsFakeExitEnabled, valueFakeExit );
+    qDebug() << "[LOGS_CENREP]-> mRepository->Get(KLogsFakeExitEnabled) value: " << valueFakeExit
+         << ", err: " << err;
+    mFakeExitList = new HbRadioButtonList(this);    
+    mFakeExitList->setItems(KFakeExitList);
+    listCurrentIndex = (err == 0) ? valueFakeExit : KFakeExitList.count()-1;
+    mFakeExitList->setSelected(listCurrentIndex);
+    
     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
     layout->addItem(label);
     layout->addItem(mList);
+    layout->addItem(label2);
+    layout->addItem(mFakeExitList);
     layout->addItem(buttonSave);
     layout->addItem(buttonExit);
     setLayout(layout);
@@ -81,13 +100,22 @@
 void LogsCenrepEditorView::saveSettings()
 {
     qDebug() << "[LOGS_CENREP]-> LogsCenrepEditorView::saveSettings()";
-    if (mList->selected() < KPredictiveSearchList.count()) {
-        int err = mRepository->Set( KLogsPredictiveSearch, mList->selected() );
-        qDebug() << "[LOGS_CENREP]-> mRepository->Set(KLogsPredictiveSearch), value:"
-                << mList->selected() << ", err: " << err;
+    
+    saveSettings( *mList, KPredictiveSearchList, KLogsPredictiveSearch );
+    saveSettings( *mFakeExitList, KFakeExitList, KLogsFakeExitEnabled );
+  
+    qDebug() << "[LOGS_CENREP]<- LogsCenrepEditorView::saveSettings()";
+}
+
+void LogsCenrepEditorView::saveSettings(
+    HbRadioButtonList& list, const QStringList& listSelections, unsigned int key )
+{
+    if (list.selected() < listSelections.count()) {
+        int err = mRepository->Set( key, list.selected() );
+        qDebug() << "[LOGS_CENREP]-> mRepository->Set(...), value:"
+          << list.selected() << ", err: " << err;
     } else {
         qDebug() << "[LOGS_CENREP]-> not saving!!";
     }
 
-    qDebug() << "[LOGS_CENREP]<- LogsCenrepEditorView::saveSettings()";
 }
--- a/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.h	Fri Sep 17 16:47:32 2010 +0300
@@ -37,9 +37,13 @@
     
 private:
     
-
+    void saveSettings(
+        HbRadioButtonList& list, 
+        const QStringList& listSelections, unsigned int key );
+    
 private:
     HbRadioButtonList* mList;
+    HbRadioButtonList* mFakeExitList;
     CRepository* mRepository;
 };
 
--- a/logsui/tsrc/logsengineapitester/logsengineapitester.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logsengineapitester/logsengineapitester.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -36,3 +36,6 @@
 libFiles.path = "!:\sys\bin"
 DEPLOYMENT += libFiles
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/logsui/tsrc/logsservicestester/logsservicestester.pro	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logsservicestester/logsservicestester.pro	Fri Sep 17 16:47:32 2010 +0300
@@ -36,5 +36,6 @@
     TARGET.UID3 = 0xEC209DCF
     TARGET.CAPABILITY = CAP_APPLICATION PowerMgmt
     LIBS += -llogsservices  -lxqservice -lapgrfx -lws32
+    MMP_RULES += SMPSAFE
 }
 
--- a/logsui/tsrc/logsservicestester/logsservicetesterappcloser.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logsservicestester/logsservicetesterappcloser.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -16,6 +16,7 @@
 */
 
 #include <QDebug>
+#include <QProcess>
 #include "logsservicetesterappcloser.h"
 
 // -----------------------------------------------------------------------------
@@ -85,28 +86,61 @@
 void LogsServiceTesterAppCloser::closeDialerApp()
 {
     qDebug() << "[LOGS_TESTER] -> LogsServiceTesterAppCloser::closeDialerApp()";
-    const TUid KUidDialer    = { 0x101F4CD5 };
+
+    if ( isDialerRunning(true) ){
+        qDebug() << "[LOGS_TESTER] dialer is running, killing";
+    } else {
+        qDebug() << "[LOGS_TESTER] dialer is not running";
+        emit closeError(ErrorAppNotRunning);
+    }
+
+    qDebug() << "[LOGS_TESTER] <- LogsServiceTesterAppCloser::closeDialerApp()";    
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsServiceTesterAppCloser::startDialerAtBg()
+{
+    qDebug() << "[LOGS_TESTER] -> LogsServiceTesterAppCloser::startDialerAtBg()";    
+    if ( isDialerRunning() ){
+        emit closeError(ErrorAppRunning);
+    } else {
+        QStringList arguments;
+        arguments << "-logsbootup";
+    
+        QProcess myProcess;
+        if ( !myProcess.startDetached("logs", arguments) ){
+            qDebug() << "[LOGS_TESTER]  Failed to start"; 
+            emit closeError(-1);
+        }
+    }
+    qDebug() << "[LOGS_TESTER] <- LogsServiceTesterAppCloser::startDialerAtBg()";    
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsServiceTesterAppCloser::isDialerRunning(bool close)
+{
+    const TUid KUidDialer = { 0x101F4CD5 };
+    bool running( false );
     RWsSession ws;
     TInt err = ws.Connect();
     if (err == KErrNone) {
         TApaTaskList tl( ws);
-        TApaTask dialerTask = (TApaTask)tl.FindApp( KUidDialer );        
-        if (dialerTask.Exists()) {
-            qDebug() << "[LOGS_TESTER] dialer is running, killing";
+        TApaTask dialerTask = (TApaTask)tl.FindApp( KUidDialer );   
+        running = dialerTask.Exists();
+        if ( close ){
             closeApp(dialerTask);
-        } else {
-            qDebug() << "[LOGS_TESTER] dialer is not running";
-            emit closeError(ErrorAppNotRunning);
         }
-        ws.Close();
-    } else {
-        emit closeError(err);
-    }
-    qDebug() << "[LOGS_TESTER] <- LogsServiceTesterAppCloser::closeDialerApp()";    
+    }    
+    ws.Close();
+    return running;
 }
 
-
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
--- a/logsui/tsrc/logsservicestester/logsservicetesterappcloser.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logsservicestester/logsservicetesterappcloser.h	Fri Sep 17 16:47:32 2010 +0300
@@ -49,13 +49,15 @@
     enum AppCloserErrors {
         ErrorAppNotRunning = 1,
         ErrorClosingOngoing,
-        ErrorClosingTimeout
+        ErrorClosingTimeout,
+        ErrorAppRunning
     };
     
 public slots:
 
     void closeApp(TApaTask& aTask);
     void closeDialerApp();
+    void startDialerAtBg();
 
 signals:
         
@@ -71,6 +73,8 @@
     // from MCloseOberver
     virtual void AppClosed(TInt aError);
     
+    bool isDialerRunning(bool close = false);
+    
 private:
     QTimer mTimer;
     CAppCloseWatcher* mAppCloseWatch;
--- a/logsui/tsrc/logsservicestester/logsservicetesterwidget.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/tsrc/logsservicestester/logsservicetesterwidget.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -77,6 +77,10 @@
     killDialer->setPreferredHeight(60);
     connect(killDialer, SIGNAL(clicked()), mAppCloser, SLOT(closeDialerApp()));
     
+    HbPushButton* startAtBg = new HbPushButton("Start Dialer at background");
+    startAtBg->setPreferredHeight(60);
+    connect(startAtBg, SIGNAL(clicked()), mAppCloser, SLOT(startDialerAtBg()));
+    
     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
     layout->addItem(comboLabel);
     layout->addItem(mComboBox);
@@ -86,6 +90,7 @@
     layout->addItem(newService);
     layout->addItem(oldService);
     layout->addItem(killDialer);
+    layout->addItem(startAtBg);
     setLayout(layout);
 }
 
@@ -179,8 +184,10 @@
         errorMsg = QString("Dialer closing is already ongoing");
     } else  if (error == LogsServiceTesterAppCloser::ErrorClosingTimeout) {
         errorMsg = QString("Dialer closing timeout");
+    } else  if (error == LogsServiceTesterAppCloser::ErrorAppRunning) {
+        errorMsg = QString("Dialer already running");
     } else {
-        errorMsg = QString("Dialer closing error: %1").arg(error);
+        errorMsg = QString("Dialer starting/closing error: %1").arg(error);
     } 
     HbMessageBox::warning(errorMsg);
 }
--- a/recents_plat/logs_timers_api/inc/LogsDomainCRKeys.h	Fri Sep 03 14:26:05 2010 +0300
+++ b/recents_plat/logs_timers_api/inc/LogsDomainCRKeys.h	Fri Sep 17 16:47:32 2010 +0300
@@ -138,6 +138,13 @@
 */
 const TUint32 KLogsPredictiveSearch = 0x0000000D;
 
+/**
+* KLogsFakeExitEnabled
+* Controls the fake exiting feature
+* 0 - Fake exit is disabled
+* 1 - Fake exit is enabled
+*/
+const TUint32 KLogsFakeExitEnabled = 0x0000000E;
 
 /**************************************************************************/