logsui/logsapp/src/logsviewmanager.cpp
changeset 14 f27aebe284bb
parent 11 64a47b97e1e1
child 16 c5af8598d22c
equal deleted inserted replaced
11:64a47b97e1e1 14:f27aebe284bb
    95 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
    96 //
    96 //
    97 void LogsViewManager::changeRecentViewViaService(
    97 void LogsViewManager::changeRecentViewViaService(
    98     LogsServices::LogsView view, bool showDialpad, QString dialpadText)
    98     LogsServices::LogsView view, bool showDialpad, QString dialpadText)
    99 {
    99 {
       
   100     closeEmbeddedApplication();
       
   101     mMainWindow.bringAppToForeground();
   100     mComponentsRepository->dialpad()->editor().setText(dialpadText);
   102     mComponentsRepository->dialpad()->editor().setText(dialpadText);
   101     changeRecentView(view, showDialpad);
   103     changeRecentView(view, showDialpad);
   102 }
   104 }
   103 
   105 
   104 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   108 // -----------------------------------------------------------------------------
   107 //
   109 //
   108 void LogsViewManager::changeMatchesViewViaService(QString dialpadText)
   110 void LogsViewManager::changeMatchesViewViaService(QString dialpadText)
   109 {
   111 {
   110     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" );
   112     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" );
       
   113     closeEmbeddedApplication();
       
   114     mMainWindow.bringAppToForeground();
   111     mComponentsRepository->dialpad()->editor().setText(dialpadText);
   115     mComponentsRepository->dialpad()->editor().setText(dialpadText);
   112     doActivateView(LogsMatchesViewId, true, QVariant());
   116     doActivateView(LogsMatchesViewId, true, QVariant());
   113     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" );
   117     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" );
   114 }
   118 }
   115 
   119 
   309     foreach ( LogsBaseView* view, mViewStack ){
   313     foreach ( LogsBaseView* view, mViewStack ){
   310         view->clearActivity(*activityManager);
   314         view->clearActivity(*activityManager);
   311     }
   315     }
   312     
   316     
   313     QVariantHash metaData;
   317     QVariantHash metaData;
   314     
       
   315     LOGS_QDEBUG( "logs [UI] Start taking screenshot" );
   318     LOGS_QDEBUG( "logs [UI] Start taking screenshot" );
   316     QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied);
   319     QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied);
   317     QPainter p( img );
   320     QPainter p( img );
   318     // Use render instead of QPixmap::grabWidget as otherwise screenshot
   321     // Use render instead of QPixmap::grabWidget as otherwise screenshot
   319     // may become empty.
   322     // may become empty.
   458         newView = mComponentsRepository->detailsView();
   461         newView = mComponentsRepository->detailsView();
   459         mMainWindow.addView(newView);
   462         mMainWindow.addView(newView);
   460     }
   463     }
   461     return newView;
   464     return newView;
   462 }
   465 }
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 //
       
   469 // -----------------------------------------------------------------------------
       
   470 //
       
   471 void LogsViewManager::closeEmbeddedApplication()
       
   472 {
       
   473     LOGS_QDEBUG( "logs [UI] -> LogsViewManager::closeEmbeddedApplication()" );
       
   474     if (mViewStack.count()) {
       
   475         mViewStack.at(0)->cancelServiceRequest();
       
   476     }
       
   477     LOGS_QDEBUG( "logs [UI] <- LogsViewManager::closeEmbeddedApplication()" );
       
   478 }