controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp
branchRCL_3
changeset 13 90fe62538f66
equal deleted inserted replaced
12:3fec62e6e7fc 13:90fe62538f66
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cpservicemainwindow.h"
       
    19 #include <QCoreApplication>
       
    20 #include <cpbasesettingview.h>
       
    21 #include "cplauncherservice.h"
       
    22 #include "cpsplogger.h"
       
    23 
       
    24 CpServiceMainWindow::CpServiceMainWindow(QWidget *parent /* = 0*/)
       
    25 : HbMainWindow(parent), mLauncherService(0), mPreviousView(0)
       
    26 {
       
    27     CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::CpServiceMainWindow")
       
    28         
       
    29     mLauncherService = new CpLauncherService(this);
       
    30 }
       
    31 
       
    32 CpServiceMainWindow::~CpServiceMainWindow()
       
    33 {
       
    34     CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::~CpServiceMainWindow")
       
    35 }
       
    36 
       
    37 void CpServiceMainWindow::setSettingView(CpBaseSettingView *settingView)
       
    38 {
       
    39     CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::setSettingView")
       
    40     
       
    41     mSettingViewPointer = settingView;
       
    42     
       
    43     mPreviousView = currentView();
       
    44     
       
    45     connect(settingView, SIGNAL(aboutToClose()), this, SLOT(quit()));    
       
    46     addView(settingView);
       
    47     setCurrentView(settingView);
       
    48 }
       
    49 
       
    50 void CpServiceMainWindow::quit()
       
    51 {
       
    52     CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::quit");
       
    53     
       
    54     closeSettingView();
       
    55     
       
    56     connect(mLauncherService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
       
    57     mLauncherService->complete();
       
    58   
       
    59     /*
       
    60     hide();
       
    61     mLauncherService->complete();
       
    62     if (mSettingViewPointer) {
       
    63         removeView(mSettingViewPointer);
       
    64         mSettingViewPointer->deleteLater();
       
    65     }  
       
    66     */
       
    67 }
       
    68 
       
    69 void CpServiceMainWindow::closeSettingView()
       
    70 {
       
    71     CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::closeSettingView")
       
    72     
       
    73     if (mSettingViewPointer) {
       
    74         removeView(mSettingViewPointer);
       
    75         mSettingViewPointer->deleteLater();
       
    76     }
       
    77     
       
    78     setCurrentView(mPreviousView);
       
    79 }
       
    80 
       
    81 //End of File