bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp
changeset 47 9e2a905b887f
parent 42 b72428996822
child 57 5ebadcda06cb
equal deleted inserted replaced
45:b0aebde9b1fb 47:9e2a905b887f
    18 
    18 
    19 #include "btdevicesearchdialogwidget.h"
    19 #include "btdevicesearchdialogwidget.h"
    20 
    20 
    21 #include <hblistview.h>
    21 #include <hblistview.h>
    22 #include <hbtoolbar.h>
    22 #include <hbtoolbar.h>
    23 #include <hbselectiondialog.h>
    23 
    24 
    24 
    25 #include <qstandarditemmodel.h>
    25 #include <qstandarditemmodel.h>
    26 #include <hbaction.h>
    26 #include <hbaction.h>
    27 #include <xqconversions.h>
    27 #include <xqconversions.h>
    28 #include <qtranslator.h>
    28 #include <qtranslator.h>
    29 #include <qcoreapplication.h>
    29 #include <qcoreapplication.h>
       
    30 #include <bluetoothdevicedialogs.h>
       
    31 #include <btuidevtypemap.h>
       
    32 #include <btuiiconutil.h>
    30 
    33 
    31 const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml";
    34 const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml";
    32 
    35 
    33 
    36 
    34 #define LOC_SEARCHING_DEVICE hbTrId("txt_bt_subhead_searching")
    37 #define LOC_SEARCHING_DEVICE hbTrId("txt_bt_subhead_searching")
    37 #define LOC_SEARCH_RETRY hbTrId("txt_common_button_retry")
    40 #define LOC_SEARCH_RETRY hbTrId("txt_common_button_retry")
    38 
    41 
    39 
    42 
    40 BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap &parameters)
    43 BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap &parameters)
    41     {
    44     {
    42     mDeviceLstIdx = 0;
    45 //    mDeviceLstIdx = 0;
    43     mViewByChosen = false;
    46 //    mViewByChosen = false;
    44     mSelectedType = 0;
    47     mSelectedDeviceType = 0;
    45     mDeviceDialogData = 0;
    48  //   mDeviceDialogData = 0;
    46     mLoader = 0;
    49     mLoader = 0;
    47     mContentItemModel = 0;
    50     mContentItemModel = 0;
    48     mStopRetryFlag = 0; // Stop 
    51     mStopRetryFlag = 0; // Stop 
       
    52     mQuery = 0;
       
    53     mSelectedDeviceType |= (BtuiDevProperty::AVDev | BtuiDevProperty::Computer |
       
    54             BtuiDevProperty::Phone | BtuiDevProperty::Peripheral |
       
    55             BtuiDevProperty::LANAccessDev | BtuiDevProperty::Toy |
       
    56             BtuiDevProperty::WearableDev | BtuiDevProperty::ImagingDev |
       
    57             BtuiDevProperty::HealthDev | BtuiDevProperty::UncategorizedDev);       
    49     constructDialog(parameters);
    58     constructDialog(parameters);
    50     }
    59     }
    51 
    60 
    52 BTDeviceSearchDialogWidget::~BTDeviceSearchDialogWidget()
    61 BTDeviceSearchDialogWidget::~BTDeviceSearchDialogWidget()
    53     {
    62     {
    54     delete mLoader;
    63     delete mLoader;
    55     delete mContentItemModel;
    64     delete mContentItemModel;
       
    65     if ( mQuery ) {
       
    66         delete mQuery;
       
    67     }
    56     
    68     
    57  //   delete mRbl;
    69  //   delete mRbl;
    58  //   delete mViewByDialog;
    70  //   delete mViewByDialog;
    59     }
    71     }
    60 
    72 
    61 bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
    73 bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
    62     {
    74     {
    63     if(parameters.keys().at(0).compare("Search Completed")==0)
    75     if(parameters.keys().at(0).compare("Search Completed")==0)
    64         {
    76         {
       
    77         mStopRetryFlag = 1; // Retry 
    65         mSearchLabel->hide();
    78         mSearchLabel->hide();
    66         
    79         
    67         mSearchIconLabel->hide();
    80         mSearchIconLabel->hide();
    68         
    81         
    69         mSearchDoneLabel->show();
    82         mSearchDoneLabel->show();
    73         
    86         
    74         mStopRetryAction->setText(LOC_SEARCH_RETRY);
    87         mStopRetryAction->setText(LOC_SEARCH_RETRY);
    75         }
    88         }
    76     else
    89     else
    77         {
    90         {
    78         device newDevice;
    91         double cod  = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble();
    79     
    92         int uiMajorDevice;
    80        // newDevice.mDeviceName = parameters.value("deviceName").toString();
    93         int uiMinorDevice;
    81         newDevice.mDeviceName = parameters.value(parameters.keys().at(0)).toString();
    94     
    82         
    95         BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod);
    83      //   newDevice.mDeviceType = parameters.value("deviceType").toString();
    96 
    84         newDevice.mDeviceIdx = mDeviceLstIdx;
    97         BtSendDataItem devData;
    85         
    98         devData[NameAliasRole] = QVariant(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString());
    86         mDeviceList.append(newDevice);
    99         devData[ReadableBdaddrRole] = QVariant(parameters.value(QString::number(TBluetoothDialogParams::EAddress)).toString());
    87         mDeviceLstIdx++;
   100         devData[CoDRole] = QVariant(cod);
    88     
   101         devData[DeviceTypeRole] = QVariant(uiMajorDevice);
    89         QStringList info;
   102         setMajorProperty(devData,BtuiDevProperty::Bonded,
    90      //   if(!mViewByChosen)
   103                 parameters.value("Bonded").toBool());
       
   104         setMajorProperty(devData,BtuiDevProperty::Blocked,
       
   105                 parameters.value("Blocked").toBool());
       
   106         setMajorProperty(devData,BtuiDevProperty::Trusted,
       
   107                 parameters.value("Trusted").toBool());
       
   108         setMajorProperty(devData,BtuiDevProperty::Connected,
       
   109                 parameters.value("Connected").toBool());
       
   110         mData.append(devData);
       
   111         
       
   112         if(mSelectedDeviceType & devData[DeviceTypeRole].toInt())
    91             {
   113             {
    92             info.append(newDevice.mDeviceName);
       
    93        //     info.append(newDevice.mDeviceType);
       
    94             QStandardItem* listitem = new QStandardItem();
   114             QStandardItem* listitem = new QStandardItem();
       
   115             QStringList info;
       
   116             info.append(devData[NameAliasRole].toString());
    95             listitem->setData(info, Qt::DisplayRole);
   117             listitem->setData(info, Qt::DisplayRole);
    96         
   118             HbIcon icon =  getBadgedDeviceTypeIcon(devData[CoDRole].toDouble(),
    97             listitem->setIcon(icon());
   119                     devData[MajorPropertyRole].toInt(),
    98         
   120                     BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
    99             mContentItemModel->appendRow(listitem);
   121             listitem->setIcon(icon.qicon());
       
   122             mContentItemModel->appendRow(listitem);    
       
   123             mSelectedData.append(devData);
   100             }
   124             }
   101      /*   else
       
   102             {
       
   103             if(mDeviceTypeList[mSelectedType] == newDevice.mDeviceType)
       
   104                 {
       
   105                 info.append(newDevice.mDeviceName);
       
   106                 info.append(newDevice.mDeviceType);
       
   107                 QStandardItem* listitem = new QStandardItem();
       
   108                 listitem->setData(info, Qt::DisplayRole);
       
   109     
       
   110                 listitem->setIcon(icon(newDevice.mDeviceType));
       
   111     
       
   112                 mContentItemModel->appendRow(listitem);
       
   113                 }
       
   114             }*/
       
   115         }
   125         }
   116                 
   126                 
   117     return true;
   127     return true;
   118     }
   128     }
   119 
   129 
   166         mSearchLabel->setTextWrapping(Hb::TextWordWrap);
   176         mSearchLabel->setTextWrapping(Hb::TextWordWrap);
   167         mSearchLabel->setAlignment(Qt::AlignHCenter);
   177         mSearchLabel->setAlignment(Qt::AlignHCenter);
   168         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
   178         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
   169  
   179  
   170         mSearchIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("iconLabel"));
   180         mSearchIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("iconLabel"));
   171         mSearchIconLabel->setIcon(icon());
   181         mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg")));
   172 
   182 
   173         mSearchDoneLabel = qobject_cast<HbLabel*>(mLoader->findWidget("searchDoneLabel"));
   183         mSearchDoneLabel = qobject_cast<HbLabel*>(mLoader->findWidget("searchDoneLabel"));
   174         mSearchDoneLabel->hide();
   184         mSearchDoneLabel->hide();
   175         
   185         
   176         
   186         
   188 
   198 
   189         connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex)));
   199         connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex)));
   190  //       connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked()));
   200  //       connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked()));
   191  //       connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked()));
   201  //       connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked()));
   192         
   202         
   193         mViewByAction = static_cast<HbAction*>( mLoader->findObject( "viewaction" ) );
   203         mShowAction = static_cast<HbAction*>( mLoader->findObject( "viewaction" ) );
   194         mViewByAction->disconnect(mSearchDevicesDialog);
   204         mShowAction->disconnect(mSearchDevicesDialog);
   195         
   205         
   196         mStopRetryAction = static_cast<HbAction*>( mLoader->findObject( "stopretryaction" ) );
   206         mStopRetryAction = static_cast<HbAction*>( mLoader->findObject( "stopretryaction" ) );
   197         mStopRetryAction->disconnect(mSearchDevicesDialog);
   207         mStopRetryAction->disconnect(mSearchDevicesDialog);
   198         
   208         
   199         connect(mViewByAction, SIGNAL(triggered()), this, SLOT(viewByClicked()));
   209 //        mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelaction" ) );
       
   210 //        mCancelAction->disconnect(mSearchDevicesDialog);
       
   211         
       
   212         connect(mShowAction, SIGNAL(triggered()), this, SLOT(viewByClicked()));
   200         connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked()));
   213         connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked()));
   201 
   214 
   202         connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed()));
   215         connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed()));
   203         
   216         
   204 //        QGraphicsWidget *widget = mLoader->findWidget(QString("container"));
   217 //        QGraphicsWidget *widget = mLoader->findWidget(QString("container"));
   205         //setContentWidget(widget);
   218         //setContentWidget(widget);
   206         }
   219         }
   207     mSearchDevicesDialog->setBackgroundFaded(false);
   220     mSearchDevicesDialog->setBackgroundFaded(false);
   208     mSearchDevicesDialog->setDismissPolicy(HbPopup::TapOutside);
   221     mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss);
   209     mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout);
   222     mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout);
   210     mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose);
   223     mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose);
       
   224     
       
   225     mDevTypeList << hbTrId("txt_bt_list_audio_devices")
       
   226             << hbTrId("txt_bt_list_computers") 
       
   227             << hbTrId("txt_bt_list_input_devices") 
       
   228             << hbTrId("txt_bt_list_phones") 
       
   229             << hbTrId("txt_bt_list_other_devices");
   211     
   230     
   212  /*   mViewByDialog = new HbDialog();
   231  /*   mViewByDialog = new HbDialog();
   213     mRbl = new HbRadioButtonList(mViewByDialog);
   232     mRbl = new HbRadioButtonList(mViewByDialog);
   214     connect(mRbl, SIGNAL(itemSelected(int)), this, SLOT(viewByItemSelected(int)));*/
   233     connect(mRbl, SIGNAL(itemSelected(int)), this, SLOT(viewByItemSelected(int)));*/
   215     
   234     
   216     return true;
   235     return true;
   217     }
   236     }
   218 
   237 
   219 /*void BTDeviceSearchDialogWidget::hideEvent(QHideEvent *event)
       
   220     {
       
   221  //   HbDialog::hideEvent(event);
       
   222     QVariantMap val;
       
   223     QVariant index(-1);
       
   224     val.insert("selectedindex",index);
       
   225     emit deviceDialogData(val);    
       
   226     emit deviceDialogClosed();
       
   227     }
       
   228 
       
   229 void BTDeviceSearchDialogWidget::showEvent(QShowEvent *event)
       
   230     {
       
   231  //   HbDialog::showEvent(event);
       
   232     }*/
       
   233 
   238 
   234 void BTDeviceSearchDialogWidget::stopRetryClicked()
   239 void BTDeviceSearchDialogWidget::stopRetryClicked()
   235     {
   240     {
   236     QVariantMap val;
   241     QVariantMap val;
   237     if(mStopRetryFlag == 1)//mStopRetryAction->text().compare(LOC_SEARCH_RETRY)==0
   242     if(mStopRetryFlag == 1)//mStopRetryAction->text().compare(LOC_SEARCH_RETRY)==0
   247         
   252         
   248         mSearchLabel->setTextWrapping(Hb::TextWordWrap);
   253         mSearchLabel->setTextWrapping(Hb::TextWordWrap);
   249         mSearchLabel->setAlignment(Qt::AlignHCenter);
   254         mSearchLabel->setAlignment(Qt::AlignHCenter);
   250         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
   255         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
   251         
   256         
   252         mSearchIconLabel->setIcon(icon());     
   257         mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg")));     
   253         mSearchLabel->show();
   258         mSearchLabel->show();
   254         
   259         
   255         mSearchIconLabel->show();
   260         mSearchIconLabel->show();
   256         
   261         
   257         mSearchDoneLabel->hide();
   262         mSearchDoneLabel->hide();
   290 
   295 
   291     }
   296     }
   292 
   297 
   293 void BTDeviceSearchDialogWidget::viewByClicked()
   298 void BTDeviceSearchDialogWidget::viewByClicked()
   294     {
   299     {
   295     QStringList list;
   300     
   296     list << "Select all" << "Audio devices" << "Computers" << "Input devices" << "Phones" << "Other devices";
   301     if ( !mQuery ) {
   297 
   302         mQuery = new HbSelectionDialog;
   298     HbSelectionDialog *query = new HbSelectionDialog;
   303         mQuery->setStringItems(mDevTypeList, 0);
   299     query->setStringItems(list);
   304         mQuery->setSelectionMode(HbAbstractItemView::MultiSelection);
   300     query->setSelectionMode(HbAbstractItemView::MultiSelection);
   305     
   301 
   306         QList<QVariant> current;
   302     QList<QVariant> current;
   307         current.append(QVariant(0));
   303     current.append(QVariant(0));
   308         mQuery->setSelectedItems(current);
   304     query->setSelectedItems(current);
   309  
   305 
   310         //todo need to check whether the dialog is destroyed without setting this flag
   306     query->setAttribute(Qt::WA_DeleteOnClose);
   311         //if not destoryed then set this flag in the destructor and then delete it
   307 
   312         
   308     query->open(this,SLOT(selectionDialogClosed(HbAction*)));
   313 //        mQuery->setAttribute(Qt::WA_DeleteOnClose);
   309     
   314         // Set the heading for the dialog.
   310     //connect(query, SIGNAL(finished(HbAction*)), this, SLOT(selectionDialogClosed(HbAction*)));
   315         HbLabel *headingLabel = new HbLabel(hbTrId("txt_bt_title_show"), mQuery);
   311     
   316         mQuery->setHeadingWidget(headingLabel);
   312 /*    mViewByDialog->setDismissPolicy(HbPopup::NoDismiss);
   317     }
   313     mViewByDialog->setTimeout(HbPopup::NoTimeout);
   318     mQuery->open(this,SLOT(selectionDialogClosed(HbAction*)));
   314 
   319 
   315     bool foundEntry = false;
   320      
   316     QStringList st;
       
   317     st << "All";
       
   318     mDeviceTypeList.clear();
       
   319     for(int i = 0; i < mDeviceList.count(); i++)
       
   320         {
       
   321         for(int j = 0; j < mDeviceTypeList.count(); j++)
       
   322             {
       
   323             if(mDeviceTypeList[j] == mDeviceList[i].mDeviceType)
       
   324                 {
       
   325                 foundEntry = true;
       
   326                 break;
       
   327                 }
       
   328             }
       
   329         if(!foundEntry)
       
   330             {
       
   331             mDeviceTypeList.append(mDeviceList[i].mDeviceType);
       
   332             }
       
   333         foundEntry = false;
       
   334         }
       
   335     
       
   336     for(int k = 0; k < mDeviceTypeList.count(); k++)
       
   337         {
       
   338         st << mDeviceTypeList[k];
       
   339         }
       
   340     
       
   341     mRbl->setItems(st);
       
   342     mViewByDialog->setContentWidget(mRbl);
       
   343     mViewByDialog->setMaximumHeight(300);
       
   344     mViewByDialog->setMaximumWidth(500);
       
   345 
       
   346     mViewByDialog->show();*/
       
   347     }
   321     }
   348 
   322 
   349 void BTDeviceSearchDialogWidget::searchDialogClosed() 
   323 void BTDeviceSearchDialogWidget::searchDialogClosed() 
   350     {
   324     {
   351     QVariantMap val;
   325     QVariantMap val;
   356     }
   330     }
   357 
   331 
   358 void BTDeviceSearchDialogWidget::selectionDialogClosed(HbAction* action)
   332 void BTDeviceSearchDialogWidget::selectionDialogClosed(HbAction* action)
   359     {
   333     {
   360     Q_UNUSED(action);
   334     Q_UNUSED(action);
       
   335     
       
   336     disconnect( mQuery ); 
       
   337     int devTypesWanted = 0;
       
   338 
       
   339     if (action == mQuery->actions().first()) {  // user pressed "Ok"
       
   340         // Get selected items.
       
   341         QList<QVariant> selections;
       
   342         selections = mQuery->selectedItems();
       
   343         
       
   344         for (int i=0; i < selections.count(); i++) {
       
   345             switch (selections.at(i).toInt()) {
       
   346             case BtUiDevAudioDevice:
       
   347                 devTypesWanted |= BtuiDevProperty::AVDev;
       
   348                 break;
       
   349             case BtUiDevComputer:
       
   350                 devTypesWanted |= BtuiDevProperty::Computer;
       
   351                 break;
       
   352             case BtUiDevInputDevice:
       
   353                 devTypesWanted |= BtuiDevProperty::Peripheral;
       
   354                 break;
       
   355             case BtUiDevPhone:
       
   356                 devTypesWanted |= BtuiDevProperty::Phone;
       
   357                 break;
       
   358             case BtUiDevOtherDevice:
       
   359                 devTypesWanted |= (BtuiDevProperty::LANAccessDev |
       
   360                         BtuiDevProperty::Toy |
       
   361                         BtuiDevProperty::WearableDev |
       
   362                         BtuiDevProperty::ImagingDev |
       
   363                         BtuiDevProperty::HealthDev |
       
   364                         BtuiDevProperty::UncategorizedDev);
       
   365                 break;
       
   366             default:
       
   367                 // should never get here
       
   368                 break;
       
   369             }
       
   370         }
       
   371     }
       
   372     else
       
   373         {
       
   374         devTypesWanted = mSelectedDeviceType;
       
   375         }
       
   376         
       
   377     
   361 
   378 
   362  /*   HbSelectionDialog *dlg = (HbSelectionDialog*)(sender());
   379  /*   HbSelectionDialog *dlg = (HbSelectionDialog*)(sender());
   363     if(dlg->actions().first() == action) {
   380     if(dlg->actions().first() == action) {
   364 
   381 
   365      } 
   382      } 
   366     else if(dlg->actions().at(1) == action) {
   383     else if(dlg->actions().at(1) == action) {
   367      }*/
   384      }*/
       
   385     
       
   386     if((devTypesWanted != mSelectedDeviceType) &&(devTypesWanted !=0))
       
   387         {
       
   388         mSelectedDeviceType = devTypesWanted;
       
   389 //        mViewByChosen = true;
       
   390         delete mContentItemModel;
       
   391         mContentItemModel = new QStandardItemModel(this);
       
   392         mListView->setModel(mContentItemModel);
       
   393         mSelectedData.clear();
       
   394         for(int i=0;i<mData.count();i++)
       
   395             {
       
   396             const BtSendDataItem& qtdev = mData[i];
       
   397             if(devTypesWanted & qtdev[DeviceTypeRole].toInt() )
       
   398                 {
       
   399                 QStandardItem* listitem = new QStandardItem();
       
   400                 QStringList info;
       
   401                 info.append(qtdev[NameAliasRole].toString());
       
   402     
       
   403                 listitem->setData(info, Qt::DisplayRole);
       
   404                 HbIcon icon =  getBadgedDeviceTypeIcon(qtdev[CoDRole].toDouble(),
       
   405                         qtdev[MajorPropertyRole].toInt(),
       
   406                          BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
       
   407                 listitem->setIcon(icon.qicon());
       
   408                 mContentItemModel->appendRow(listitem);        
       
   409                 mSelectedData.append(qtdev);
       
   410                 }
       
   411             }
       
   412         }
   368     }
   413     }
   369 
   414 
   370 void BTDeviceSearchDialogWidget::deviceSelected(const QModelIndex& modelIndex)
   415 void BTDeviceSearchDialogWidget::deviceSelected(const QModelIndex& modelIndex)
   371     {
   416     {
   372     int row = 0;
   417     int row = 0;
   380         {
   425         {
   381         row = modelIndex.row();
   426         row = modelIndex.row();
   382         }
   427         }
   383     
   428     
   384     QVariantMap val;
   429     QVariantMap val;
   385     QVariant index(row);
   430 //    QVariant index(row);
   386     val.insert("selectedindex",index);
   431 //    val.insert("selectedindex",index);
       
   432     
       
   433     const BtSendDataItem& qtdev = mSelectedData.at(row);
       
   434     val.insert("selectedindex",QVariant(row));
       
   435     val.insert("devicename",QVariant(qtdev[NameAliasRole]));
       
   436     val.insert("deviceaddress",QVariant(qtdev[ReadableBdaddrRole]));
       
   437     val.insert("deviceclass",QVariant(qtdev[CoDRole]));
       
   438 
   387     emit deviceDialogData(val);
   439     emit deviceDialogData(val);
   388 //    mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog
   440 //    mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog
   389     //emit deviceDialogClosed();
   441     //emit deviceDialogClosed();
   390   //  this->close();
   442   //  this->close();
   391     }
   443     }
   392 
   444 
   393 //void BTDeviceSearchDialogWidget::viewByItemSelected(int index)
   445 
   394   //  {
       
   395     //  (void) index;
       
   396  /*   if(index == 0)
       
   397         {
       
   398         //Option 'All' selected    
       
   399         mViewByDialog->close();
       
   400         delete mContentItemModel;
       
   401         mContentItemModel = new QStandardItemModel(this);
       
   402         mListView->setModel(mContentItemModel);
       
   403         mViewByChosen = false;
       
   404 
       
   405         for(int i = 0; i < mDeviceList.count(); i++)
       
   406             {        
       
   407             QStandardItem* listitem = new QStandardItem();
       
   408                 
       
   409             QStringList info;
       
   410             info << mDeviceList[i].mDeviceName << mDeviceList[i].mDeviceType ;
       
   411             listitem->setData(info, Qt::DisplayRole);
       
   412     
       
   413             //listitem->setIcon(icon(mDeviceList[i].mDeviceType));
       
   414     
       
   415             mContentItemModel->appendRow(listitem);
       
   416             }
       
   417         }
       
   418     else
       
   419         {
       
   420         index--;
       
   421         mSelectedType = index;
       
   422         mViewByDialog->close();
       
   423         
       
   424         delete mContentItemModel;
       
   425         mContentItemModel = new QStandardItemModel(this);
       
   426         mListView->setModel(mContentItemModel);
       
   427     
       
   428         mDeviceLstOfType.clear();
       
   429         for(int i = 0; i < mDeviceList.count(); i++)
       
   430             {
       
   431             if(mDeviceList[i].mDeviceType == mDeviceTypeList[index])
       
   432                 {
       
   433                 mDeviceLstOfType.append(mDeviceList[i]);
       
   434             
       
   435                 QStandardItem* listitem = new QStandardItem();
       
   436                 
       
   437                 QStringList info;
       
   438                 info << mDeviceList[i].mDeviceName << mDeviceTypeList[index];
       
   439                 listitem->setData(info, Qt::DisplayRole);
       
   440         
       
   441                 //listitem->setIcon(icon(mDeviceTypeList[index]));
       
   442         
       
   443                 mContentItemModel->appendRow(listitem);
       
   444                 }
       
   445             }
       
   446         mViewByChosen = true;
       
   447         }*/
       
   448  //   }
       
   449 
       
   450 QIcon BTDeviceSearchDialogWidget::icon()
       
   451     {
       
   452  /*   if(deviceType == "Audio")
       
   453         {
       
   454         return (QIcon(QString(":/icons/qgn_prop_bt_audio.svg")));
       
   455         }
       
   456     else if(deviceType == "Car-kit")
       
   457         {
       
   458         return (QIcon(QString(":/icons/qgn_prop_bt_car_kit.svg")));
       
   459         }
       
   460     else if(deviceType == "Computer")
       
   461         {
       
   462         return (QIcon(QString(":/icons/qgn_prop_bt_computer.svg")));
       
   463         }
       
   464     else if(deviceType == "Headset")
       
   465         {
       
   466         return (QIcon(QString(":/icons/qgn_prop_bt_headset.svg")));
       
   467         }
       
   468     else if(deviceType == "Keyboard")
       
   469         {
       
   470         return (QIcon(QString(":/icons/qgn_prop_bt_keyboard.svg")));
       
   471         }
       
   472     else if(deviceType == "Mouse")
       
   473         {
       
   474         return (QIcon(QString(":/icons/qgn_prop_bt_mouse.svg")));
       
   475         }
       
   476     else if(deviceType == "Phone")
       
   477         {
       
   478         return (QIcon(QString(":/icons/qgn_prop_bt_phone.svg")));
       
   479         }
       
   480     else if(deviceType == "Printer")
       
   481         {
       
   482         return (QIcon(QString(":/icons/qgn_prop_bt_printer.svg")));
       
   483         }
       
   484     else
       
   485         {
       
   486         return (QIcon(QString(":/icons/qgn_prop_bt_unknown.svg")));
       
   487         }*/
       
   488     return QIcon(QString(":/icons/qtg_large_bluetooth.svg"));
       
   489     }
       
   490