17 */ |
17 */ |
18 #include <hbnamespace.h> |
18 #include <hbnamespace.h> |
19 #include "dmadvancedview.h" |
19 #include "dmadvancedview.h" |
20 #include "dmfotaview.h" |
20 #include "dmfotaview.h" |
21 #include "serversettingsview.h" |
21 #include "serversettingsview.h" |
|
22 #include "customviewitem.h" |
22 |
23 |
23 DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow,DMFotaView *mainView, DmInfo *info, QGraphicsItem *parent):HbView(parent), |
24 DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow,DMFotaView *mainView, DmInfo *info, QGraphicsItem *parent):HbView(parent), |
24 bluetooth(":/icons/qgn_prop_sml_bt.svg"), |
25 bluetooth(":/icons/qgn_prop_sml_bt.svg"), |
25 internet(":/icons/qgn_prop_sml_http.svg"), |
26 internet(":/icons/qgn_prop_sml_http.svg"), |
26 defaultprofileicon(":/icons/qtg_large_avatar.svg") |
27 defaultprofileicon(":/icons/qtg_large_avatar.svg") |
60 return; |
61 return; |
61 if (item) |
62 if (item) |
62 { |
63 { |
63 modelItem = model->itemFromIndex(item->modelIndex()); |
64 modelItem = model->itemFromIndex(item->modelIndex()); |
64 currentselecteditem = modelItem->row(); |
65 currentselecteditem = modelItem->row(); |
65 |
66 if(currentselecteditem == dminfo->profilescount())//Button item pressed |
|
67 return; |
66 HbMenu *csmenu = new HbMenu(); |
68 HbMenu *csmenu = new HbMenu(); |
67 csmenu->setAttribute( Qt::WA_DeleteOnClose); |
69 csmenu->setAttribute( Qt::WA_DeleteOnClose); |
68 HbAction *defaultprofileAction = 0; |
70 HbAction *defaultprofileAction = 0; |
69 HbAction *deleteaction = 0; |
71 HbAction *deleteaction = 0; |
70 HbAction *connectaction = 0; |
72 HbAction *connectaction = 0; |
97 void DmAdvancedView::handleClicked(QModelIndex index) |
99 void DmAdvancedView::handleClicked(QModelIndex index) |
98 { |
100 { |
99 qDebug("omadm DeviceManagerUi::handleClicked >>"); |
101 qDebug("omadm DeviceManagerUi::handleClicked >>"); |
100 if(connectionRequested) |
102 if(connectionRequested) |
101 return; |
103 return; |
102 //Stop listening DB events for profile addition |
104 int itemnum = 0; |
103 dminfo->DisableDbNotifications(true); |
|
104 //If profile is not locked then take to edit server view |
|
105 int itemnum = 0; |
|
106 QStandardItem *selectedItem = model->itemFromIndex(index); |
105 QStandardItem *selectedItem = model->itemFromIndex(index); |
107 itemnum = selectedItem->row(); |
106 itemnum = selectedItem->row(); |
|
107 if(itemnum == dminfo->profilescount())//Button item pressed |
|
108 { |
|
109 qDebug("omadm create new server profile button clicked"); |
|
110 return; |
|
111 } |
|
112 //Stop listening DB events for profile addition |
|
113 dminfo->DisableDbNotifications(true); |
108 if(itemnum >= 0 && !dminfo->Isprofilelocked(itemnum)) |
114 if(itemnum >= 0 && !dminfo->Isprofilelocked(itemnum)) |
109 { |
115 { |
110 //read profile items |
116 //read profile items |
111 QStringList itemdata; |
117 QStringList itemdata; |
112 bool sessmode = 0; |
118 bool sessmode = 0; |
169 connect(otherDetailsGroup, SIGNAL(toggled(bool)), this, SLOT(otherDetailsGroupClicked(bool))); |
175 connect(otherDetailsGroup, SIGNAL(toggled(bool)), this, SLOT(otherDetailsGroupClicked(bool))); |
170 otherDetailsGroup->setHeading(hbTrId("txt_device_update_setlabel_other_details")); |
176 otherDetailsGroup->setHeading(hbTrId("txt_device_update_setlabel_other_details")); |
171 otherDetailsGroup->setCollapsable( true ); |
177 otherDetailsGroup->setCollapsable( true ); |
172 otherDetailsGroup->setCollapsed( true ); |
178 otherDetailsGroup->setCollapsed( true ); |
173 list = qobject_cast<HbListView *>(docmlLoader->findWidget( LIST_NAME ) ); |
179 list = qobject_cast<HbListView *>(docmlLoader->findWidget( LIST_NAME ) ); |
174 HbListViewItem *prototype = list->listItemPrototype(); |
180 |
175 prototype->setGraphicsSize(HbListViewItem::LargeIcon); |
181 list->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon); |
176 prototype->setSecondaryTextRowCount(1,2); |
182 list->listItemPrototype()->setSecondaryTextRowCount(1,2); |
177 prototype->setStretchingStyle(HbListViewItem::StretchLandscape); |
183 list->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape); |
|
184 |
178 dminfo->refreshProfileList(); |
185 dminfo->refreshProfileList(); |
179 int IndicatorCount =dminfo->profilescount(); |
186 int IndicatorCount =dminfo->profilescount(); |
180 model = new QStandardItemModel(); |
187 model = new QStandardItemModel(); |
181 for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) { |
188 QList<HbAbstractViewItem *> prototypes ; |
|
189 prototypes.append(list->listItemPrototype()); |
|
190 CustomViewItem *prototype2 = new CustomViewItem(this,list); |
|
191 prototypes.append(prototype2); |
|
192 list->setItemPrototypes(prototypes); |
|
193 list->setModel(model); |
|
194 int i; |
|
195 for (i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) { |
182 QStringList liststr; |
196 QStringList liststr; |
183 bool lock = false; |
197 bool lock = false; |
184 int icon = 0; |
198 int icon = 0; |
185 int ret = dminfo->profileinfo(i,liststr,icon, lock); |
199 int ret = dminfo->profileinfo(i,liststr,icon, lock); |
186 if(ret <= 0) |
200 if(ret <= 0) |
217 iconlist.setValue(Iconl); |
231 iconlist.setValue(Iconl); |
218 item->setData(liststr , Qt::DisplayRole); |
232 item->setData(liststr , Qt::DisplayRole); |
219 item->setData(iconlist , Qt::DecorationRole); |
233 item->setData(iconlist , Qt::DecorationRole); |
220 model->setItem(i, item); |
234 model->setItem(i, item); |
221 } |
235 } |
222 list->setModel(model,prototype); |
236 list->setItemRecycling(false); |
223 list->setItemRecycling(false); |
237 QStandardItem* customitem = new QStandardItem(); |
|
238 customitem->setData(Hb::ItemType_Last + 1001,Hb::ItemTypeRole); |
|
239 model->setItem(i, customitem); |
224 connect(list, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), |
240 connect(list, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), |
225 this, SLOT(handleLongPress(HbAbstractViewItem*,QPointF))); |
241 this, SLOT(handleLongPress(HbAbstractViewItem*,QPointF))); |
226 |
242 |
227 connect(list, SIGNAL(activated(QModelIndex)), this, SLOT(handleClicked(QModelIndex))); |
243 connect(list, SIGNAL(activated(QModelIndex)), this, SLOT(handleClicked(QModelIndex))); |
228 |
244 |
229 qDebug("omadm launching other details list"); |
245 qDebug("omadm launching other details list"); |
230 otherdetailslist = qobject_cast<HbListView *>(docmlLoader->findWidget( LISTOTHERDETAILS ) ); |
246 otherdetailslist = qobject_cast<HbListView *>(docmlLoader->findWidget( LISTOTHERDETAILS ) ); |
231 otherdetailslist->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape); |
247 otherdetailslist->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape); |
232 otherdetailslist->setLongPressEnabled(EFalse); |
248 otherdetailslist->setLongPressEnabled(EFalse); |
233 qDebug("omadm launching other details list done"); |
249 qDebug("omadm launching other details list done"); |
234 mainCalltoUpdateView(); |
250 mainCalltoUpdateView(); |
235 |
|
236 |
|
237 newserverprofile = qobject_cast<HbPushButton *>(docmlLoader->findWidget(NEWSERVERBUTTON)); |
|
238 newserverprofile->setText(hbTrId("txt_device_update_button_new_server_profile")); |
|
239 connect(newserverprofile, SIGNAL(clicked()),this, SLOT(createNewProfile())); |
|
240 |
|
241 label = qobject_cast<HbLabel *>(docmlLoader->findWidget(LABEL)); |
251 label = qobject_cast<HbLabel *>(docmlLoader->findWidget(LABEL)); |
242 label->setPlainText(hbTrId("txt_device_update_subhead_advanced_device_updates")); |
252 label->setPlainText(hbTrId("txt_device_update_subhead_advanced_device_updates")); |
243 |
253 |
244 setWidget(viewwidget); |
254 setWidget(viewwidget); |
245 } |
255 } |
320 void DmAdvancedView::updateListview() |
330 void DmAdvancedView::updateListview() |
321 { |
331 { |
322 qDebug("omadm DeviceManagerUi::updateListview >>"); |
332 qDebug("omadm DeviceManagerUi::updateListview >>"); |
323 model->clear(); |
333 model->clear(); |
324 int IndicatorCount =dminfo->profilescount(); |
334 int IndicatorCount =dminfo->profilescount(); |
325 for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) { |
335 int i; |
|
336 for ( i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) { |
326 QStringList liststr; |
337 QStringList liststr; |
327 bool lock = false; |
338 bool lock = false; |
328 int icon = 0; |
339 int icon = 0; |
329 int ret = dminfo->profileinfo(i,liststr,icon, lock); |
340 int ret = dminfo->profileinfo(i,liststr,icon, lock); |
330 if(ret <= 0) |
341 if(ret <= 0) |
361 iconlist.setValue(Iconl); |
372 iconlist.setValue(Iconl); |
362 item->setData(liststr , Qt::DisplayRole); |
373 item->setData(liststr , Qt::DisplayRole); |
363 item->setData(iconlist , Qt::DecorationRole); |
374 item->setData(iconlist , Qt::DecorationRole); |
364 model->setItem(i, item); |
375 model->setItem(i, item); |
365 } |
376 } |
366 model->sort(0); |
377 QStandardItem* item = new QStandardItem(); |
367 qDebug("omadm DeviceManagerUi::updateListview >>"); |
378 item->setData(Hb::ItemType_Last + 1001,Hb::ItemTypeRole); |
|
379 model->setItem(i, item); |
368 } |
380 } |
369 |
381 |
370 void DmAdvancedView::serversListGroupClicked(bool state) |
382 void DmAdvancedView::serversListGroupClicked(bool state) |
371 { |
383 { |
372 qDebug("omadm DeviceManagerUi::serversListGroupClicked >>"); |
384 qDebug("omadm DeviceManagerUi::serversListGroupClicked >>"); |