bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp
changeset 57 5ebadcda06cb
parent 47 9e2a905b887f
child 70 f5508c13dfe0
equal deleted inserted replaced
51:625f43ae9362 57:5ebadcda06cb
    30 #include "btdevicesearchdialogwidget.h"
    30 #include "btdevicesearchdialogwidget.h"
    31 #include "btmoredevicesdialogwidget.h"
    31 #include "btmoredevicesdialogwidget.h"
    32 #include "btsenddialogwidget.h"
    32 #include "btsenddialogwidget.h"
    33 #include "btdevicedialogrecvquerywidget.h"
    33 #include "btdevicedialogrecvquerywidget.h"
    34 #include "btrecvcompleteddialogwidget.h"
    34 #include "btrecvcompleteddialogwidget.h"
       
    35 #include "btdeviceinfowidget.h"
    35 #include <hbtranslator.h>
    36 #include <hbtranslator.h>
    36 
    37 
    37 Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin)
    38 Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin)
    38 
    39 
    39 const char* BTDIALOG_TRANSLATION = "btdialogs";
    40 const char* BTDIALOG_TRANSLATION = "btdialogs";
    40 const char* BTVIEW_TRANSLATION = "btviews";        
    41 const char* BTVIEW_TRANSLATION = "btviews";
       
    42 const char* COMMON_ERRORS_TRANSLATION = "common_errors";
    41 
    43 
    42 // This plugin implements one device dialog type
    44 // This plugin implements one device dialog type
    43 static const struct {
    45 static const struct {
    44     const char *mTypeString;
    46     const char *mTypeString;
    45 } noteInfos[] = {
    47 } noteInfos[] = {
    63 
    65 
    64 /*! 
    66 /*! 
    65     BtDeviceDialogPlugin Constructor
    67     BtDeviceDialogPlugin Constructor
    66  */
    68  */
    67 BtDeviceDialogPlugin::BtDeviceDialogPlugin():
    69 BtDeviceDialogPlugin::BtDeviceDialogPlugin():
    68  mDialogTranslator(0),mViewTranslator(0)
    70  mDialogTranslator(0),mViewTranslator(0),mCommonErrorsTranslator(0)
    69 {
    71 {
    70     d = new BtDeviceDialogPluginPrivate;
    72     d = new BtDeviceDialogPluginPrivate;
    71 }
    73 }
    72 
    74 
    73 /*!
    75 /*!
    76 BtDeviceDialogPlugin::~BtDeviceDialogPlugin()
    78 BtDeviceDialogPlugin::~BtDeviceDialogPlugin()
    77 {
    79 {
    78     delete d;
    80     delete d;
    79     delete mDialogTranslator;
    81     delete mDialogTranslator;
    80     delete mViewTranslator;
    82     delete mViewTranslator;
       
    83     delete mCommonErrorsTranslator;
    81 }
    84 }
    82 
    85 
    83 /*! 
    86 /*! 
    84     Check if client is allowed to use device dialog widget
    87     Check if client is allowed to use device dialog widget
    85  */
    88  */
   112         }
   115         }
   113     if(!mViewTranslator)
   116     if(!mViewTranslator)
   114         {
   117         {
   115         mViewTranslator = new HbTranslator(BTVIEW_TRANSLATION);
   118         mViewTranslator = new HbTranslator(BTVIEW_TRANSLATION);
   116         }
   119         }
       
   120     if(!mCommonErrorsTranslator)
       
   121         {
       
   122         mCommonErrorsTranslator = new HbTranslator(COMMON_ERRORS_TRANSLATION);
       
   123         }
       
   124     
   117     // verify that requested dialog type is supported
   125     // verify that requested dialog type is supported
   118     const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]);
   126     const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]);
   119     for(i = 0; i < numTypes; i++) {
   127     for(i = 0; i < numTypes; i++) {
   120         if (noteInfos[i].mTypeString == deviceDialogType) {
   128         if (noteInfos[i].mTypeString == deviceDialogType) {
   121             break;
   129             break;
   231             deviceDialog = new BTRecvPrgrsDialogWidget(parameters);
   239             deviceDialog = new BTRecvPrgrsDialogWidget(parameters);
   232             break;
   240             break;
   233         case TBluetoothDialogParams::EReceiveDone:
   241         case TBluetoothDialogParams::EReceiveDone:
   234             deviceDialog = new BTRecvcompletedDialogWidget(parameters);
   242             deviceDialog = new BTRecvcompletedDialogWidget(parameters);
   235             break;
   243             break;
       
   244         case TBluetoothDialogParams::EInformationDialog:
       
   245             deviceDialog = new BtDeviceInfoWidget(parameters);
       
   246             break;
   236         default:
   247         default:
   237             d->mError = UnknownDeviceDialogError;
   248             d->mError = UnknownDeviceDialogError;
   238             break;
   249             break;
   239     }
   250     }
   240     if ( deviceDialog ) {
   251     if ( deviceDialog ) {