--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * 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""
@@ -16,17 +16,11 @@
*/
#include "btmoredevicesdialogwidget.h"
-#include <hblabel.h>
#include <hblistview.h>
-#include <hbtoolbar.h>
-#include <hbpushbutton.h>
-#include <hblistwidget.h>
-#include <qstandarditemmodel.h>
#include <btuidevtypemap.h>
#include <btuiiconutil.h>
#include <bluetoothdevicedialogs.h>
-
-
+#include "btdevicedialogpluginerrors.h"
const char* DOCML_BT_MORE_DEV_DIALOG = ":/docml/bt-more-devices-dialog.docml";
@@ -35,18 +29,8 @@
{
mLoader = 0;
mContentItemModel = 0;
+ mLastError = NoError;
constructDialog(parameters);
-/* try
- {
- //May throws badAlloc on exception
- constructDialog(parameters);
- }
- catch(std::bad_alloc &badAlloc)
- {
- //Failure to allocate memory
- Q_UNUSED(badAlloc);
- // = UnknownDeviceDialogError;
- }*/
}
BTMoreDevicesDialogWidget::~BTMoreDevicesDialogWidget()
@@ -61,38 +45,45 @@
int uiMajorDevice;
int uiMinorDevice;
- BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod);
- if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) )
+ if(!mLastError)
{
- BtSendDataItem devData;
- //todo Need to create string constant for name as enum EDeviceName has an issue
- devData[NameAliasRole] = parameters.value("Name");
- devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress));
- devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass));
-
- setMajorProperty(devData,BtuiDevProperty::Bonded,
- parameters.value("Bonded").toBool());
- setMajorProperty(devData,BtuiDevProperty::Blocked,
- parameters.value("Blocked").toBool());
- setMajorProperty(devData,BtuiDevProperty::Trusted,
- parameters.value("Trusted").toBool());
- setMajorProperty(devData,BtuiDevProperty::Connected,
- parameters.value("Connected").toBool());
- mData.append(devData);
-
- QStandardItem* listitem = new QStandardItem();
- QStringList info;
- info.append(devData[NameAliasRole].toString());
-
- listitem->setData(info, Qt::DisplayRole);
- HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(),
- devData[MajorPropertyRole].toInt(),
- BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
- listitem->setIcon(icon.qicon());
-
- mContentItemModel->appendRow(listitem);
+ BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod);
+ if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) )
+ {
+ BtSendDataItem devData;
+ //todo Need to create string constant for name as enum EDeviceName has an issue
+ devData[NameAliasRole] = parameters.value("Name");
+ devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress));
+ devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass));
+
+ setMajorProperty(devData,BtuiDevProperty::Bonded,
+ parameters.value("Bonded").toBool());
+ setMajorProperty(devData,BtuiDevProperty::Blocked,
+ parameters.value("Blocked").toBool());
+ setMajorProperty(devData,BtuiDevProperty::Trusted,
+ parameters.value("Trusted").toBool());
+ setMajorProperty(devData,BtuiDevProperty::Connected,
+ parameters.value("Connected").toBool());
+ mData.append(devData);
+
+ QStandardItem* listitem = new QStandardItem();
+ QStringList info;
+ info.append(devData[NameAliasRole].toString());
+
+ listitem->setData(info, Qt::DisplayRole);
+ HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(),
+ devData[MajorPropertyRole].toInt(),
+ BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
+ listitem->setIcon(icon.qicon());
+
+ mContentItemModel->appendRow(listitem);
+ }
+ return true;
}
- return true;
+ else
+ {
+ return false;
+ }
}
@@ -100,7 +91,7 @@
int BTMoreDevicesDialogWidget::deviceDialogError() const
{
- return 0;
+ return mLastError;
}
void BTMoreDevicesDialogWidget::closeDeviceDialog(bool byClient)
@@ -126,7 +117,7 @@
return const_cast<BTMoreDevicesDialogWidget*>(this);
}
-bool BTMoreDevicesDialogWidget::constructDialog(const QVariantMap ¶meters)
+void BTMoreDevicesDialogWidget::constructDialog(const QVariantMap ¶meters)
{
Q_UNUSED(parameters);
mLoader = new HbDocumentLoader();
@@ -137,7 +128,6 @@
{
mLastUsedDeviceDialog = qobject_cast<HbDialog*>(mLoader->findWidget("lastUsedDevicesDialog"));
-
HbListView* deviceList = qobject_cast<HbListView*>(mLoader->findWidget("deviceList"));
deviceList->setSelectionMode(HbAbstractItemView::SingleSelection);
@@ -152,13 +142,15 @@
connect(mMoreAction, SIGNAL(triggered()), this, SLOT(moreDevicesClicked()));
connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked()));
-
+ mLastUsedDeviceDialog->setBackgroundFaded(false);
+ mLastUsedDeviceDialog->setDismissPolicy(HbPopup::NoDismiss);
+ mLastUsedDeviceDialog->setTimeout(HbPopup::NoTimeout);
+ mLastUsedDeviceDialog->setAttribute(Qt::WA_DeleteOnClose);
}
- mLastUsedDeviceDialog->setBackgroundFaded(false);
- mLastUsedDeviceDialog->setDismissPolicy(HbPopup::NoDismiss);
- mLastUsedDeviceDialog->setTimeout(HbPopup::NoTimeout);
- mLastUsedDeviceDialog->setAttribute(Qt::WA_DeleteOnClose);
- return true;
+ else
+ {
+ mLastError = DocMLLoadingError;
+ }
}