logsui/logsapp/src/logsviewmanager.cpp
changeset 21 2f0af9ba7665
parent 18 acd4e87b24b4
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
    22 #include "logsdetailsview.h"
    22 #include "logsdetailsview.h"
    23 #include "logsfilter.h"
    23 #include "logsfilter.h"
    24 #include "logsdefs.h"
    24 #include "logsdefs.h"
    25 #include "logslogger.h"
    25 #include "logslogger.h"
    26 #include "logsservicehandler.h"
    26 #include "logsservicehandler.h"
    27 #include "logsservicehandlerold.h"
       
    28 #include "logsmainwindow.h"
    27 #include "logsmainwindow.h"
    29 #include "logsappsettings.h"
    28 #include "logsappsettings.h"
    30 #include "logsforegroundwatcher.h"
    29 #include "logsforegroundwatcher.h"
    31 
    30 
    32 //SYSTEM
    31 //SYSTEM
    33 #include <hbmainwindow.h>
    32 #include <hbmainwindow.h>
    34 #include <hbview.h>
    33 #include <hbview.h>
    35 #include <QApplication>
    34 #include <QApplication>
    36 #include <hblineedit.h>
    35 #include <hblineedit.h>
    37 #include <dialpad.h>
    36 #include <dialpad.h>
    38 #include <hbactivitymanager.h>
       
    39 #include <hbapplication.h>
    37 #include <hbapplication.h>
    40 #include <tstasksettings.h>
    38 #include <tstasksettings.h>
       
    39 #include <afactivation.h>
       
    40 #include <afactivitystorage.h>
    41 
    41 
    42 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    43 // LogsViewManager::LogsViewManager
    43 // LogsViewManager::LogsViewManager
    44 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    45 //
    45 //
    46 LogsViewManager::LogsViewManager( 
    46 LogsViewManager::LogsViewManager( 
    47         LogsMainWindow& mainWindow, LogsServiceHandler& service,
    47         LogsMainWindow& mainWindow, LogsServiceHandler& service,
    48         LogsServiceHandlerOld& serviceOld,
       
    49         LogsAppSettings& settings) : 
    48         LogsAppSettings& settings) : 
    50     QObject( 0 ), mMainWindow( mainWindow ), 
    49     QObject( 0 ), mMainWindow( mainWindow ), 
    51     mService( service ), mServiceOld( serviceOld ), mSettings( settings ),
    50     mService( service ), mSettings( settings ),
    52     mFirstActivation(true), mViewActivationShowDialpad(false), 
    51     mFirstActivation(true), mViewActivationShowDialpad(false), 
    53     mBackgroundStartupWatcher(0)
    52     mBackgroundStartupWatcher(0), mDialpadText(QString())
    54 {
    53 {
    55     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::LogsViewManager()" );
    54     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::LogsViewManager()" );
    56 
    55 
    57     //It is important that we always handle orientation change first, before
    56     //It is important that we always handle orientation change first, before
    58     //dialpad widget. If connection is moved to a view, then it's not guarantied.
    57     //dialpad widget. If connection is moved to a view, then it's not guarantied.
    67              this, SLOT( changeRecentViewViaService(XQService::LogsViewIndex, bool, QString) ) );
    66              this, SLOT( changeRecentViewViaService(XQService::LogsViewIndex, bool, QString) ) );
    68 
    67 
    69     connect( &mService, SIGNAL( activateView(QString) ), 
    68     connect( &mService, SIGNAL( activateView(QString) ), 
    70              this, SLOT( changeMatchesViewViaService(QString) ));
    69              this, SLOT( changeMatchesViewViaService(QString) ));
    71 
    70 
    72     connect( &mServiceOld, SIGNAL( activateView(XQService::LogsViewIndex, bool, QString) ), 
       
    73              this, SLOT( changeRecentViewViaService(XQService::LogsViewIndex, bool, QString) ) );
       
    74 
       
    75     connect( &mServiceOld, SIGNAL( activateView(QString) ), 
       
    76              this, SLOT( changeMatchesViewViaService(QString) ));
       
    77     
       
    78     QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
    71     QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
    79 
    72 
       
    73     mActivityManager = new AfActivityStorage;
       
    74     mActivation = new AfActivation;
       
    75     
    80     handleFirstActivation();
    76     handleFirstActivation();
    81     
    77     
    82     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::LogsViewManager()" );
    78     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::LogsViewManager()" );
    83 }
    79 }
    84 
    80 
    88 // -----------------------------------------------------------------------------
    84 // -----------------------------------------------------------------------------
    89 //
    85 //
    90 LogsViewManager::~LogsViewManager()
    86 LogsViewManager::~LogsViewManager()
    91 {
    87 {
    92     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::~LogsViewManager()" );
    88     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::~LogsViewManager()" );
    93      
    89     
       
    90     delete mActivation;
       
    91     delete mActivityManager;
    94     delete mComponentsRepository;
    92     delete mComponentsRepository;
    95     delete mBackgroundStartupWatcher;
    93     delete mBackgroundStartupWatcher;
    96     
    94     
    97     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::~LogsViewManager()" );
    95     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::~LogsViewManager()" );
    98 }
    96 }
   158 // -----------------------------------------------------------------------------
   156 // -----------------------------------------------------------------------------
   159 // LogsViewManager::activateView
   157 // LogsViewManager::activateView
   160 // -----------------------------------------------------------------------------
   158 // -----------------------------------------------------------------------------
   161 //
   159 //
   162 bool LogsViewManager::activateView(
   160 bool LogsViewManager::activateView(
   163         LogsAppViewId viewId, bool showDialpad, QVariant args)
   161         LogsAppViewId viewId, bool showDialpad, QVariant args, const QString& dialpadText)
   164 {
   162 {
   165     return doActivateView(viewId, showDialpad, args);
   163     return doActivateView(viewId, showDialpad, args, dialpadText );  
   166 }
   164 }
   167 
   165 
   168 // -----------------------------------------------------------------------------
   166 // -----------------------------------------------------------------------------
   169 // LogsViewManager::mainWindow
   167 // LogsViewManager::mainWindow
   170 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   194 // -----------------------------------------------------------------------------
   192 // -----------------------------------------------------------------------------
   195 // LogsViewManager::activatePreviousView
   193 // LogsViewManager::activatePreviousView
   196 // Previously activated view is at slot 1 of view stack
   194 // Previously activated view is at slot 1 of view stack
   197 // -----------------------------------------------------------------------------
   195 // -----------------------------------------------------------------------------
   198 //
   196 //
   199 bool LogsViewManager::activatePreviousView()
   197 bool LogsViewManager::activatePreviousView(bool showDialpad,  const QString& dialpadText)
   200 {
   198 {
   201     LogsAppViewId viewId = ( mViewStack.count() > 1 ) ? 
   199     LogsAppViewId viewId = ( mViewStack.count() > 1 ) ? 
   202         mViewStack.at(1)->viewId() : LogsRecentViewId;
   200         mViewStack.at(1)->viewId() : LogsRecentViewId;
   203     return doActivateView(viewId, false, QVariant());
   201     return doActivateView(viewId, showDialpad, QVariant(), dialpadText);
   204 }
   202 }
   205 
   203 
   206 // -----------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   207 // LogsViewManager::doActivateView
   205 // LogsViewManager::doActivateView
   208 // Currently activated view is always at beginning of view stack. Deactivates
   206 // Currently activated view is always at beginning of view stack. Deactivates
   247         //Setting mainwindow interactive to enable user input during
   245         //Setting mainwindow interactive to enable user input during
   248         //view switching animation.
   246         //view switching animation.
   249         mMainWindow.setInteractive(true);
   247         mMainWindow.setInteractive(true);
   250         mViewActivationArgs = args;
   248         mViewActivationArgs = args;
   251         mViewActivationShowDialpad = showDialpad;
   249         mViewActivationShowDialpad = showDialpad;
       
   250         mDialpadText = dialpadText;
   252         completeViewActivation();
   251         completeViewActivation();
   253         activated = true;
   252         activated = true;
   254     }
   253     }
   255 
   254 
   256     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::doActivateView()" );
   255     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::doActivateView()" );
   272                  this, SLOT(completeViewActivation()), 
   271                  this, SLOT(completeViewActivation()), 
   273                  Qt::UniqueConnection );
   272                  Qt::UniqueConnection );
   274     } else {
   273     } else {
   275         disconnect( &mMainWindow, SIGNAL(viewReady()), this, SLOT(completeViewActivation()) );
   274         disconnect( &mMainWindow, SIGNAL(viewReady()), this, SLOT(completeViewActivation()) );
   276         LogsBaseView* newView = mViewStack.at(0);
   275         LogsBaseView* newView = mViewStack.at(0);
   277         newView->activated(mViewActivationShowDialpad, mViewActivationArgs);
   276         newView->activated(mViewActivationShowDialpad, mViewActivationArgs, mDialpadText);
   278         connect( &mMainWindow, SIGNAL(callKeyPressed()), 
   277         connect( &mMainWindow, SIGNAL(callKeyPressed()), 
   279                  newView, SLOT(callKeyPressed()),
   278                  newView, SLOT(callKeyPressed()),
   280                  Qt::UniqueConnection );
   279                  Qt::UniqueConnection );
   281         connect( &mMainWindow, SIGNAL(localeChanged()), 
   280         connect( &mMainWindow, SIGNAL(localeChanged()), 
   282                  newView, SLOT(localeChanged()),
   281                  newView, SLOT(localeChanged()),
   307     if ( mViewStack.count() == 0 ){
   306     if ( mViewStack.count() == 0 ){
   308         return;
   307         return;
   309     }
   308     }
   310     
   309     
   311     clearActivities();
   310     clearActivities();
   312     
   311 
   313     HbActivityManager* activityManager = static_cast<HbApplication*>(qApp)->activityManager();
       
   314     QVariantHash metaData;
   312     QVariantHash metaData;
   315     LOGS_QDEBUG( "logs [UI] Start taking screenshot" );
   313     LOGS_QDEBUG( "logs [UI] Start taking screenshot" );
   316     QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied);
   314     QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied);
   317     QPainter p( img );
   315     QPainter p( img );
   318     // Use render instead of QPixmap::grabWidget as otherwise screenshot
   316     // Use render instead of QPixmap::grabWidget as otherwise screenshot
   319     // may become empty.
   317     // may become empty.
   320     mMainWindow.render( &p, mMainWindow.rect(), mMainWindow.rect() );
   318     mMainWindow.render( &p, mMainWindow.rect(), mMainWindow.rect() );
   321     metaData.insert("screenshot", QPixmap::fromImage(*img));
   319     metaData.insert(QString("screenshot"), QPixmap::fromImage(*img));
   322     delete img;
   320     delete img;
   323     LOGS_QDEBUG( "logs [UI] End taking screenshot" );
   321     LOGS_QDEBUG( "logs [UI] End taking screenshot" );
   324     
   322     
   325     QByteArray serializedActivity;
   323     QByteArray serializedActivity;
   326     QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append);
   324     QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append);
   332     metaData.insert( 
   330     metaData.insert( 
   333         logsActivityParamDialpadText, mComponentsRepository->dialpad()->editor().text() );
   331         logsActivityParamDialpadText, mComponentsRepository->dialpad()->editor().text() );
   334     QString activityId = mViewStack.at(0)->saveActivity(stream, metaData);
   332     QString activityId = mViewStack.at(0)->saveActivity(stream, metaData);
   335     
   333     
   336     // add the activity to the activity manager
   334     // add the activity to the activity manager
   337     bool ok = activityManager->addActivity(activityId, serializedActivity, metaData);
   335     bool ok = mActivityManager->saveActivity(activityId, serializedActivity, metaData);
   338     if ( !ok ){
   336     if ( !ok ){
   339         LOGS_QDEBUG( "logs [UI] activity adding failed" );
   337         LOGS_QDEBUG( "logs [UI] activity adding failed" );
   340     }
   338     }
   341     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::saveActivity()" );
   339     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::saveActivity()" );
   342 }
   340 }
   346 // -----------------------------------------------------------------------------
   344 // -----------------------------------------------------------------------------
   347 //
   345 //
   348 bool LogsViewManager::loadActivity()
   346 bool LogsViewManager::loadActivity()
   349 {
   347 {
   350     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::loadActivity()" );
   348     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::loadActivity()" );
   351     HbApplication* hbApp = static_cast<HbApplication*>(qApp);
   349     bool loaded = false;
   352     QString activityId = hbApp->activateId();
   350     if ( mActivation->reason() == Af::ActivationReasonActivity ){
   353     return doLoadActivity(activityId);
   351         loaded = doLoadActivity(mActivation->name());
       
   352     }
       
   353     return loaded;
   354 }
   354 }
   355 
   355 
   356 // -----------------------------------------------------------------------------
   356 // -----------------------------------------------------------------------------
   357 //
   357 //
   358 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   359 //
   359 //
   360 LogsAppViewId LogsViewManager::checkMatchesViewTransition(
   360 LogsAppViewId LogsViewManager::checkMatchesViewTransition(
   361     LogsAppViewId viewId, const QString& dialpadText)
   361     LogsAppViewId viewId, const QString& dialpadText)
   362 {
   362 {Q_UNUSED( dialpadText );
   363     if ( !dialpadText.isEmpty() ){
       
   364         mComponentsRepository->dialpad()->editor().setText(dialpadText);
       
   365     }
       
   366     
       
   367     if ( viewId == LogsMatchesViewId ){
   363     if ( viewId == LogsMatchesViewId ){
   368         LogsModel* model = mComponentsRepository->model();
   364         LogsModel* model = mComponentsRepository->model();
   369         if ( model && model->predictiveSearchStatus() != logsContactSearchEnabled ){
   365         if ( model && model->predictiveSearchStatus() != logsContactSearchEnabled ){
   370             LOGS_QDEBUG( "logs [UI]     contact search disabled, go to recent view" );
   366             LOGS_QDEBUG( "logs [UI]     contact search disabled, go to recent view" );
   371             viewId = LogsRecentViewId;
   367             viewId = LogsRecentViewId;
   389         connect( mBackgroundStartupWatcher, SIGNAL(gainingForeground()), 
   385         connect( mBackgroundStartupWatcher, SIGNAL(gainingForeground()), 
   390                  this, SLOT(bgStartupForegroundGained()) );
   386                  this, SLOT(bgStartupForegroundGained()) );
   391         setTaskSwitcherVisibility(false);
   387         setTaskSwitcherVisibility(false);
   392 
   388 
   393     } else {
   389     } else {
   394         Hb::ActivationReason reason = static_cast<HbApplication*>(qApp)->activateReason();
       
   395         bool isStartedByService( 
       
   396             mService.isStartedUsingService() || mServiceOld.isStartedUsingService() );
       
   397         
       
   398         // Start immediately using all possible resources
   390         // Start immediately using all possible resources
   399         mComponentsRepository->model()->refreshData();
   391         mComponentsRepository->model()->refreshData();
   400         
   392         
   401         if ( reason == Hb::ActivationReasonActivity && loadActivity() ){
   393         if ( loadActivity() ){
   402             LOGS_QDEBUG( "logs [UI] loaded saved activity" );    
   394             LOGS_QDEBUG( "logs [UI] loaded saved activity" );    
   403             mMainWindow.bringAppToForeground();
   395             mMainWindow.bringAppToForeground();
   404         } else if ( mFirstActivation && !isStartedByService ) {
   396         } else if ( mFirstActivation && !mService.isStartedUsingService() ) {
   405             activateDefaultView();
   397             activateDefaultView();
   406             mMainWindow.bringAppToForeground();
   398             mMainWindow.bringAppToForeground();
   407         }
   399         }
   408         
   400         
   409         clearActivities();
   401         clearActivities();
   484 
   476 
   485 // -----------------------------------------------------------------------------
   477 // -----------------------------------------------------------------------------
   486 //
   478 //
   487 // -----------------------------------------------------------------------------
   479 // -----------------------------------------------------------------------------
   488 //
   480 //
   489 void LogsViewManager::activityRequested(const QString &activityId)
   481 void LogsViewManager::activityRequested(
       
   482         Af::ActivationReason reason, QString name, QVariantHash parameters)
   490 {
   483 {
   491     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::activityRequested()" );
   484     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::activityRequested()" );
   492     if ( doLoadActivity(activityId) ){
   485     Q_UNUSED(reason);
       
   486     Q_UNUSED(parameters);
       
   487     if ( doLoadActivity(name) ){
   493         mMainWindow.bringAppToForeground();
   488         mMainWindow.bringAppToForeground();
   494     }
   489     }
   495     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activityRequested()" );
   490     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activityRequested()" );
   496 }
   491 }
   497 
   492 
   500 // -----------------------------------------------------------------------------
   495 // -----------------------------------------------------------------------------
   501 //
   496 //
   502 void LogsViewManager::bgStartupForegroundGained()
   497 void LogsViewManager::bgStartupForegroundGained()
   503 {
   498 {
   504     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::bgStartupForegroundGained()" );
   499     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::bgStartupForegroundGained()" );
   505     delete mBackgroundStartupWatcher;
       
   506     mBackgroundStartupWatcher = 0;
       
   507     endFakeExit();
   500     endFakeExit();
   508     mMainWindow.bringAppToForeground(); 
   501     mMainWindow.bringAppToForeground(); 
   509     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::bgStartupForegroundGained()" );
   502     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::bgStartupForegroundGained()" );
   510 }
   503 }
   511 
   504 
   514 // -----------------------------------------------------------------------------
   507 // -----------------------------------------------------------------------------
   515 //
   508 //
   516 void LogsViewManager::doFakeExit()
   509 void LogsViewManager::doFakeExit()
   517 {
   510 {
   518     saveActivity();
   511     saveActivity();
   519     HbActivityManager* activityManager = 
   512     connect( mActivation, SIGNAL(activated(Af::ActivationReason,QString,QVariantHash)), 
   520         static_cast<HbApplication*>(qApp)->activityManager();
   513              this, SLOT(activityRequested(Af::ActivationReason,QString,QVariantHash)), 
   521     connect( activityManager, SIGNAL(activityRequested(QString)), 
   514              Qt::UniqueConnection );
   522              this, SLOT(activityRequested(QString)), Qt::UniqueConnection );
       
   523     mComponentsRepository->model()->compressData();
   515     mComponentsRepository->model()->compressData();
   524     setTaskSwitcherVisibility(false);
   516     setTaskSwitcherVisibility(false);
   525 }
   517 }
   526 
   518 
   527 // -----------------------------------------------------------------------------
   519 // -----------------------------------------------------------------------------
   528 //
   520 //
   529 // -----------------------------------------------------------------------------
   521 // -----------------------------------------------------------------------------
   530 //
   522 //
   531 void LogsViewManager::endFakeExit()
   523 void LogsViewManager::endFakeExit()
   532 {
   524 {
       
   525     delete mBackgroundStartupWatcher;
       
   526     mBackgroundStartupWatcher = 0;
   533     setTaskSwitcherVisibility(true);
   527     setTaskSwitcherVisibility(true);
   534     mComponentsRepository->model()->refreshData();
   528     mComponentsRepository->model()->refreshData();
   535     if ( !mMainWindow.currentView() ){
   529     if ( !mMainWindow.currentView() ){
   536         activateDefaultView();
   530         activateDefaultView();
   537     }
   531     }
   542 //
   536 //
   543 // -----------------------------------------------------------------------------
   537 // -----------------------------------------------------------------------------
   544 //
   538 //
   545 bool LogsViewManager::doLoadActivity(const QString& activityId)
   539 bool LogsViewManager::doLoadActivity(const QString& activityId)
   546 {
   540 {
   547     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::doLoadActivity()" );
   541     LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::doLoadActivity():", activityId );
   548     bool loaded = false;
   542     bool loaded = false;
   549     HbApplication* hbApp = static_cast<HbApplication*>(qApp);
       
   550     LOGS_QDEBUG_2( "logs [UI] activity id:", activityId );
       
   551     bool ok = hbApp->activityManager()->waitActivity();
       
   552     if ( !ok ){
       
   553         LOGS_QDEBUG( "logs [UI] Activity reschedule failed" );
       
   554     }
       
   555     
   543     
   556     LogsBaseView* matchingView = 0;
   544     LogsBaseView* matchingView = 0;
   557     for ( int i = 0; i < mViewStack.count() && !matchingView; i++ ){
   545     for ( int i = 0; i < mViewStack.count() && !matchingView; i++ ){
   558         if ( mViewStack.at(i)->matchWithActivityId(activityId) ){
   546         if ( mViewStack.at(i)->matchWithActivityId(activityId) ){
   559             matchingView =  mViewStack.at(i);
   547             matchingView =  mViewStack.at(i);
   560         }
   548         }
   561     }
   549     }
   562     
   550     
   563     QList<QVariantHash> allParams = hbApp->activityManager()->activities();  
   551     QVariantHash params = mActivityManager->activityMetaData(activityId);
   564     QVariantHash params = allParams.isEmpty() ? QVariantHash() : allParams.at(0);
       
   565     LOGS_QDEBUG_2( "logs [UI] Activity params", params );
   552     LOGS_QDEBUG_2( "logs [UI] Activity params", params );
   566             
   553             
   567     if ( !matchingView ){
   554     if ( !matchingView ){
   568         // Try if creating such view is possible
   555         // Try if creating such view is possible
   569         int viewId = params.value(logsActivityParamInternalViewId).toInt();
   556         int viewId = params.value(logsActivityParamInternalViewId).toInt();
   570         matchingView = createView(static_cast<LogsAppViewId>(viewId));
   557         matchingView = createView(static_cast<LogsAppViewId>(viewId));
   571     }
   558     }
   572     
   559     
   573     if ( matchingView ){
   560     if ( matchingView ){
   574         // Should have only one param hash in the list, use first always
       
   575         QList<QVariantHash> allParams = hbApp->activityManager()->activities();  
       
   576         QVariantHash params = allParams.isEmpty() ? QVariantHash() : allParams.at(0);
       
   577         LOGS_QDEBUG_2( "logs [UI] Activity params", params );
       
   578         bool showDialpad = params.value(logsActivityParamShowDialpad).toBool();
   561         bool showDialpad = params.value(logsActivityParamShowDialpad).toBool();
   579         QString dialpadText = params.value(logsActivityParamDialpadText).toString();
   562         QString dialpadText = params.value(logsActivityParamDialpadText).toString();
   580         
   563         
   581         QByteArray serializedActivity = hbApp->activateData().toByteArray();
   564         QByteArray serializedActivity = 
       
   565                 mActivityManager->activityData(activityId).toByteArray();
   582         QDataStream stream(&serializedActivity, QIODevice::ReadOnly);
   566         QDataStream stream(&serializedActivity, QIODevice::ReadOnly);
   583         
   567         
   584         QVariant args = matchingView->loadActivity(activityId, stream, params);
   568         QVariant args = matchingView->loadActivity(activityId, stream, params);
   585         loaded = doActivateView( 
   569         loaded = doActivateView( 
   586             matchingView->viewId(), showDialpad, args, dialpadText );
   570             matchingView->viewId(), showDialpad, args, dialpadText );
   594 //
   578 //
   595 // -----------------------------------------------------------------------------
   579 // -----------------------------------------------------------------------------
   596 //
   580 //
   597 void LogsViewManager::clearActivities()
   581 void LogsViewManager::clearActivities()
   598 {
   582 {
   599     HbApplication* hbApp = static_cast<HbApplication*>(qApp);
       
   600     HbActivityManager* activityManager = hbApp->activityManager();
       
   601     foreach ( LogsBaseView* view, mViewStack ){
   583     foreach ( LogsBaseView* view, mViewStack ){
   602         view->clearActivity(*activityManager);
   584         view->clearActivity(*mActivityManager);
   603     }
   585     }
   604     disconnect( activityManager, SIGNAL(activityRequested(QString)), 
   586     disconnect( mActivation, SIGNAL(activated(Af::ActivationReason,QString,QVariantHash)), 
   605                 this, SLOT(activityRequested(QString)) );
   587                 this, SLOT(activityRequested(Af::ActivationReason,QString,QVariantHash)) );
   606 }
   588 }
   607 
   589 
   608 // -----------------------------------------------------------------------------
   590 // -----------------------------------------------------------------------------
   609 //
   591 //
   610 // -----------------------------------------------------------------------------
   592 // -----------------------------------------------------------------------------
   614     const QString& dialpadText, const QVariant& args)
   596     const QString& dialpadText, const QVariant& args)
   615 {
   597 {
   616     LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::activateViewViaService()", viewId );
   598     LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::activateViewViaService()", viewId );
   617     clearActivities();
   599     clearActivities();
   618     closeEmbeddedApplication();
   600     closeEmbeddedApplication();
   619     Dialpad* dpad = mComponentsRepository->dialpad();
   601     if ( doActivateView(viewId, showDialpad, args, dialpadText, true) ){  
   620     if ( !showDialpad ){
       
   621         dpad->closeDialpad();
       
   622     }
       
   623     dpad->editor().setText(dialpadText);
       
   624     if ( doActivateView(viewId, showDialpad, args, QString(), true) ){
       
   625         mMainWindow.bringAppToForeground();
   602         mMainWindow.bringAppToForeground();
   626     }
   603     }
   627     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activateViewViaService()" );
   604     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activateViewViaService()" );
   628 }
   605 }
   629 
   606