bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp
author hgs
Mon, 03 May 2010 14:36:07 +0300
changeset 29 48ae3789ce00
child 31 a0ea99b6fa53
permissions -rw-r--r--
201017_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     1
/*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     3
 * All rights reserved.
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0""
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     8
 *
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     9
 * Initial Contributors:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    11
 *
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    12
 * Contributors:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    13
 *
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    14
 * Description:  
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    15
 *   
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    16
 */
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    17
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    18
#include "btcpuisettingitem.h"
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    19
#include <cpitemdatahelper.h>
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    20
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    21
#include <HbInstance>
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    22
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    23
BtCpUiSettingItem::BtCpUiSettingItem(CpItemDataHelper &itemDataHelper,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    24
													   const QString &text /*= QString()*/,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    25
													   const QString &description /*= QString()*/,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    26
													   const HbIcon &icon /*= HbIcon()*/,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    27
													   const HbDataFormModelItem *parent /*= 0*/)
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    28
													   : CpSettingFormEntryItemData(itemDataHelper,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    29
													   text,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    30
													   description,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    31
													   icon,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    32
													   parent)
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    33
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    34
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    35
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    36
BtCpUiSettingItem::~BtCpUiSettingItem()
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    37
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    38
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    39
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    40
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    41
void BtCpUiSettingItem::onLaunchView()
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    42
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    43
    mModel = new BtuiModel();
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    44
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    45
    mMainWindow = hbInstance->allMainWindows().first();
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    46
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    47
    mBtMainView = new BtCpUiMainView(*mModel);
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    48
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    49
    mCpView = mMainWindow->currentView();
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    50
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    51
    mMainWindow->addView(mBtMainView);
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    52
    mMainWindow->setCurrentView(mBtMainView);
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    53
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    54
    connect(mBtMainView, SIGNAL(aboutToClose()), this, SLOT(handleCloseView()));
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    55
    
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    56
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    57
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    58
void BtCpUiSettingItem::handleCloseView()
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    59
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    60
    mBtMainView->deactivateView();
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    61
    mMainWindow->setCurrentView(mCpView);
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    62
    delete mBtMainView;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    63
    delete mModel;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    64
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    65
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    66
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    67
CpBaseSettingView *BtCpUiSettingItem::createSettingView() const
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    68
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    69
	return 0;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    70
}