66 } |
68 } |
67 } |
69 } |
68 |
70 |
69 bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
71 bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
70 { |
72 { |
71 if(parameters.keys().contains("Search Completed")) |
73 if(!mLastError) |
72 { |
74 { |
73 mStopRetryFlag = 1; // Retry |
75 if(parameters.keys().contains("Search Completed")) |
74 mSearchLabel->hide(); |
76 { |
75 |
77 mStopRetryFlag = 1; // Retry |
76 mSearchIconLabel->hide(); |
78 mSearchLabel->hide(); |
77 |
79 |
78 mSearchDoneLabel->show(); |
80 mSearchIconLabel->hide(); |
79 mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); |
81 |
80 mSearchDoneLabel->setAlignment(Qt::AlignLeft); |
82 mSearchDoneLabel->show(); |
81 mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); |
83 mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); |
82 |
84 mSearchDoneLabel->setAlignment(Qt::AlignLeft); |
83 mStopRetryAction->setText(LOC_SEARCH_RETRY); |
85 mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); |
|
86 |
|
87 mStopRetryAction->setText(LOC_SEARCH_RETRY); |
|
88 } |
|
89 else |
|
90 { |
|
91 int cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toInt(); |
|
92 int uiMajorDevice; |
|
93 int uiMinorDevice; |
|
94 |
|
95 BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); |
|
96 |
|
97 BtSendDataItem devData; |
|
98 //TODO Need to create string constant for Name as enum EDeviceName is not working for this |
|
99 devData[NameAliasRole] =parameters.value("Name").toString(); |
|
100 devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); |
|
101 devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); |
|
102 devData[DeviceTypeRole] = QVariant(uiMajorDevice); |
|
103 setMajorProperty(devData,BtuiDevProperty::Bonded, |
|
104 parameters.value("Bonded").toBool()); |
|
105 setMajorProperty(devData,BtuiDevProperty::Blocked, |
|
106 parameters.value("Blocked").toBool()); |
|
107 setMajorProperty(devData,BtuiDevProperty::Trusted, |
|
108 parameters.value("Trusted").toBool()); |
|
109 setMajorProperty(devData,BtuiDevProperty::Connected, |
|
110 parameters.value("Connected").toBool()); |
|
111 mData.append(devData); |
|
112 |
|
113 if(mSelectedDeviceType & devData[DeviceTypeRole].toInt()) |
|
114 { |
|
115 QStandardItem* listitem = new QStandardItem(); |
|
116 QStringList info; |
|
117 info.append(devData[NameAliasRole].toString()); |
|
118 listitem->setData(info, Qt::DisplayRole); |
|
119 HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), |
|
120 devData[MajorPropertyRole].toInt(), |
|
121 BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); |
|
122 listitem->setIcon(icon.qicon()); |
|
123 mContentItemModel->appendRow(listitem); |
|
124 mSelectedData.append(devData); |
|
125 } |
|
126 } |
|
127 return true; |
84 } |
128 } |
85 else |
129 else |
86 { |
130 { |
87 int cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toInt(); |
131 return false; |
88 int uiMajorDevice; |
132 } |
89 int uiMinorDevice; |
|
90 |
|
91 BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); |
|
92 |
|
93 BtSendDataItem devData; |
|
94 //TODO Need to create string constant for Name as enum EDeviceName is not working for this |
|
95 devData[NameAliasRole] =parameters.value("Name").toString(); |
|
96 devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); |
|
97 devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); |
|
98 devData[DeviceTypeRole] = QVariant(uiMajorDevice); |
|
99 setMajorProperty(devData,BtuiDevProperty::Bonded, |
|
100 parameters.value("Bonded").toBool()); |
|
101 setMajorProperty(devData,BtuiDevProperty::Blocked, |
|
102 parameters.value("Blocked").toBool()); |
|
103 setMajorProperty(devData,BtuiDevProperty::Trusted, |
|
104 parameters.value("Trusted").toBool()); |
|
105 setMajorProperty(devData,BtuiDevProperty::Connected, |
|
106 parameters.value("Connected").toBool()); |
|
107 mData.append(devData); |
|
108 |
|
109 if(mSelectedDeviceType & devData[DeviceTypeRole].toInt()) |
|
110 { |
|
111 QStandardItem* listitem = new QStandardItem(); |
|
112 QStringList info; |
|
113 info.append(devData[NameAliasRole].toString()); |
|
114 listitem->setData(info, Qt::DisplayRole); |
|
115 HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), |
|
116 devData[MajorPropertyRole].toInt(), |
|
117 BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); |
|
118 listitem->setIcon(icon.qicon()); |
|
119 mContentItemModel->appendRow(listitem); |
|
120 mSelectedData.append(devData); |
|
121 } |
|
122 } |
|
123 |
|
124 return true; |
|
125 } |
133 } |
126 |
134 |
127 int BTDeviceSearchDialogWidget::deviceDialogError() const |
135 int BTDeviceSearchDialogWidget::deviceDialogError() const |
128 { |
136 { |
129 return 0; |
137 return mLastError; |
130 } |
138 } |
131 |
139 |
132 void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient) |
140 void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient) |
133 { |
141 { |
134 Q_UNUSED(byClient); |
142 Q_UNUSED(byClient); |
194 |
202 |
195 connect(mShowAction, SIGNAL(triggered()), this, SLOT(viewByClicked())); |
203 connect(mShowAction, SIGNAL(triggered()), this, SLOT(viewByClicked())); |
196 connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked())); |
204 connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked())); |
197 |
205 |
198 connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed())); |
206 connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed())); |
199 } |
207 mSearchDevicesDialog->setBackgroundFaded(false); |
200 mSearchDevicesDialog->setBackgroundFaded(false); |
208 mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss); |
201 mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss); |
209 mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); |
202 mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); |
210 mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose); |
203 mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose); |
211 |
204 |
212 mDevTypeList << hbTrId("txt_bt_list_audio_devices") |
205 mDevTypeList << hbTrId("txt_bt_list_audio_devices") |
213 << hbTrId("txt_bt_list_computers") |
206 << hbTrId("txt_bt_list_computers") |
214 << hbTrId("txt_bt_list_input_devices") |
207 << hbTrId("txt_bt_list_input_devices") |
215 << hbTrId("txt_bt_list_phones") |
208 << hbTrId("txt_bt_list_phones") |
216 << hbTrId("txt_bt_list_other_devices"); |
209 << hbTrId("txt_bt_list_other_devices"); |
217 } |
210 |
218 else |
211 return true; |
219 { |
|
220 mLastError = DocMLLoadingError; |
|
221 } |
|
222 |
212 } |
223 } |
213 |
224 |
214 |
225 |
215 void BTDeviceSearchDialogWidget::stopRetryClicked() |
226 void BTDeviceSearchDialogWidget::stopRetryClicked() |
216 { |
227 { |