bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp
changeset 47 9e2a905b887f
parent 42 b72428996822
child 57 5ebadcda06cb
equal deleted inserted replaced
45:b0aebde9b1fb 47:9e2a905b887f
    33     TRACE_ENTRY
    33     TRACE_ENTRY
    34     // set properties
    34     // set properties
    35     mLastError = NoError;
    35     mLastError = NoError;
    36     mShowEventReceived = false;
    36     mShowEventReceived = false;
    37     mMessageBox = new HbMessageBox(type);
    37     mMessageBox = new HbMessageBox(type);
    38     
       
    39     resetProperties();
    38     resetProperties();
    40     constructQueryDialog(parameters);
    39     constructQueryDialog(parameters);
    41     TRACE_EXIT
    40     TRACE_EXIT
    42 }
    41 }
    43 
    42 
   127     // item of ResourceId is not found, can't continue.
   126     // item of ResourceId is not found, can't continue.
   128     if ( i == parameters.constEnd() ) {
   127     if ( i == parameters.constEnd() ) {
   129         mLastError = UnknownDeviceDialogError;
   128         mLastError = UnknownDeviceDialogError;
   130         return;
   129         return;
   131     }
   130     }
   132     title = QString(hbTrId("txt_bt_title_pairing_with_1"));
   131 
   133     param = parameters.value( keyStr );
   132     param = parameters.value( keyStr );
   134     int key = param.toInt();
   133     int key = param.toInt();
   135     switch ( key ) {
   134     switch ( key ) {
   136         case ENumericComparison:
   135         case ENumericComparison:
   137             prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) );
   136             prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) );
   138             break;
   137             break;
   139         case EPasskeyDisplay:
   138         case EPasskeyDisplay:
   140             prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) );
   139             prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) );
   141             break;
   140             break;
   142         // Note dialogs, but not Notification dialogs
   141         case EPairingFailureRetry:
       
   142             prompt = QString( hbTrId( "txt_bt_info_pairing_with_1_failed_either_the_pas" ) );
       
   143             break;
       
   144         case EPairingFailureOk:
       
   145             prompt = QString( hbTrId( "txt_bt_info_unable_to_pair_with_1" ) );
       
   146             break;
   143         // Input dialogs
   147         // Input dialogs
   144         case EPinInput:
   148         case EPinInput:
   145         case EObexPasskeyInput:
   149         case EObexPasskeyInput:
   146         // NULL parameters
   150         // NULL parameters
   147         case ENoResource:
   151         case ENoResource:
   152     }
   156     }
   153     int repls = prompt.count( QString( "%" ) );
   157     int repls = prompt.count( QString( "%" ) );
   154     if ( repls > 0 ) {
   158     if ( repls > 0 ) {
   155         name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
   159         name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
   156         prompt = prompt.arg( name.toString() );
   160         prompt = prompt.arg( name.toString() );
   157         addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) );
   161         if(key != EPairingFailureRetry && key != EPairingFailureOk)
   158         // todo: Formating the prompt need to be discussed with UI designer
   162             {
   159         // The passcode could be displayed on a separate row if it the label did support
   163             addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) );
   160         // the use of newline escape character.
   164             // todo: Formating the prompt need to be discussed with UI designer
   161         prompt.append(tr(" "));
   165             // The passcode could be displayed on a separate row if it the label did support
   162         prompt.append(addval.toString());
   166             // the use of newline escape character.
   163     }
   167             prompt.append(tr("\n\n")); // insert 2 newlines for clarity
   164     title = title.arg(name.toString());
   168             prompt.append(addval.toString());
       
   169             if(key == EPasskeyDisplay)
       
   170                 {
       
   171                 prompt.append("\n");   
       
   172                 }
       
   173             }
       
   174     }
   165     // set property value to this dialog widget
   175     // set property value to this dialog widget
   166     mMessageBox->setHeadingWidget(new HbLabel(title));
   176     if(key != EPairingFailureRetry && key != EPairingFailureOk)
       
   177         {
       
   178         title = QString(hbTrId("txt_bt_title_pairing_with_1"));
       
   179         title = title.arg(name.toString());
       
   180         mMessageBox->setHeadingWidget(new HbLabel(title));
       
   181         mMessageBox->setIconVisible(false);
       
   182         mMessageBox->setStandardButtons( HbMessageBox::Yes | HbMessageBox::No);
       
   183         }
       
   184     else
       
   185         {
       
   186         if(key == EPairingFailureRetry)
       
   187             {
       
   188             mMessageBox->setStandardButtons( HbMessageBox::Retry | HbMessageBox::Cancel);
       
   189             }
       
   190         else
       
   191             {
       
   192             mMessageBox->setStandardButtons( HbMessageBox::Ok);
       
   193             }
       
   194         }
   167     mMessageBox->setText( prompt );
   195     mMessageBox->setText( prompt );
   168     mMessageBox->setIconVisible(false);
       
   169     TRACE_EXIT
   196     TRACE_EXIT
   170 }
   197 }
   171 
   198 
   172 /*!
   199 /*!
   173     Reset properties to default values
   200     Reset properties to default values