bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:23:52 +0300
changeset 40 997690c3397a
parent 33 837dcc42fd6a
child 57 5ebadcda06cb
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* Copyright (c) 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 "btabstractdelegate.h"
#include "btqtconstants.h"

#include <btsettingmodel.h>
#include <btdevicemodel.h>

/*!
    Constructor.
 */
BtAbstractDelegate::BtAbstractDelegate( BtSettingModel *settingModel, 
        BtDeviceModel *deviceModel, QObject *parent )
    : QObject( parent ), mSettingModel(settingModel),mDeviceModel(deviceModel)
{
}

/*!
    Destructor.
 */
BtAbstractDelegate::~BtAbstractDelegate()
{
}

BtSettingModel *BtAbstractDelegate::getSettingModel()
{
    return mSettingModel;
}

BtDeviceModel *BtAbstractDelegate::getDeviceModel()
{
    return mDeviceModel;
}

void BtAbstractDelegate::cancel()
{
    
}

bool BtAbstractDelegate::isBtPowerOn()
{
    QModelIndex powerIndex = getSettingModel()->index(BtSettingModel::PowerStateRow, 0);
    PowerStateQtValue powerState = (PowerStateQtValue)getSettingModel()->data(powerIndex, BtSettingModel::SettingValueRole).toInt();
    
    return (BtPowerOn == powerState);
}