40 Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin) |
40 Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin) |
41 |
41 |
42 const char* BTDIALOG_TRANSLATION = "btdialogs"; |
42 const char* BTDIALOG_TRANSLATION = "btdialogs"; |
43 const char* BTVIEW_TRANSLATION = "btviews"; |
43 const char* BTVIEW_TRANSLATION = "btviews"; |
44 const char* COMMON_ERRORS_TRANSLATION = "common_errors"; |
44 const char* COMMON_ERRORS_TRANSLATION = "common_errors"; |
|
45 const char* COMMON_TRANSLATION = "common"; |
45 |
46 |
46 // This plugin implements one device dialog type |
47 // This plugin implements one device dialog type |
47 static const struct { |
48 static const struct { |
48 const char *mTypeString; |
49 const char *mTypeString; |
49 } noteInfos[] = { |
50 } noteInfos[] = { |
67 |
68 |
68 /*! |
69 /*! |
69 BtDeviceDialogPlugin Constructor |
70 BtDeviceDialogPlugin Constructor |
70 */ |
71 */ |
71 BtDeviceDialogPlugin::BtDeviceDialogPlugin(): |
72 BtDeviceDialogPlugin::BtDeviceDialogPlugin(): |
72 mDialogTranslator(0),mViewTranslator(0),mCommonErrorsTranslator(0) |
73 mDialogTranslator(0),mViewTranslator(0),mCommonErrorsTranslator(0), mCommonTranslator(0) |
73 { |
74 { |
74 d = new BtDeviceDialogPluginPrivate; |
75 d = new BtDeviceDialogPluginPrivate; |
75 } |
76 } |
76 |
77 |
77 /*! |
78 /*! |
120 mViewTranslator = new HbTranslator(BTVIEW_TRANSLATION); |
122 mViewTranslator = new HbTranslator(BTVIEW_TRANSLATION); |
121 } |
123 } |
122 if(!mCommonErrorsTranslator) |
124 if(!mCommonErrorsTranslator) |
123 { |
125 { |
124 mCommonErrorsTranslator = new HbTranslator(COMMON_ERRORS_TRANSLATION); |
126 mCommonErrorsTranslator = new HbTranslator(COMMON_ERRORS_TRANSLATION); |
|
127 } |
|
128 if(!mCommonTranslator) |
|
129 { |
|
130 mCommonTranslator = new HbTranslator(COMMON_TRANSLATION); |
125 } |
131 } |
126 |
132 |
127 // verify that requested dialog type is supported |
133 // verify that requested dialog type is supported |
128 const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]); |
134 const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]); |
129 for(i = 0; i < numTypes; i++) { |
135 for(i = 0; i < numTypes; i++) { |
147 Currently only supporting 1 device dialog type, so no need to check the type. |
153 Currently only supporting 1 device dialog type, so no need to check the type. |
148 */ |
154 */ |
149 bool BtDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, |
155 bool BtDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, |
150 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
156 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
151 { |
157 { |
152 Q_UNUSED(parameters) |
158 |
153 Q_UNUSED(deviceDialogType) |
159 Q_UNUSED(deviceDialogType) |
154 // set return values |
160 // set return values |
155 info->group = GenericDeviceDialogGroup; |
161 // Construct the key of EDialogType |
|
162 QString keyStr; |
|
163 keyStr.setNum( TBluetoothDialogParams::EDialogType ); |
|
164 // Find the const iterator with key EDialogType |
|
165 QVariantMap::const_iterator i = parameters.constFind( keyStr ); |
|
166 |
|
167 // item with key EDialogType is not found |
|
168 if ( i == parameters.constEnd() ) { |
|
169 d->mError = UnknownDeviceDialogError; |
|
170 return false; |
|
171 } |
|
172 int type = i.value().toInt(); |
|
173 if(type == TBluetoothDialogParams::EGlobalNotif || |
|
174 type == TBluetoothDialogParams::ENote || |
|
175 type == TBluetoothDialogParams::bt_054_d_entered_popup) |
|
176 { |
|
177 info->group = DeviceNotificationDialogGroup; |
|
178 } |
|
179 else |
|
180 { |
|
181 info->group = GenericDeviceDialogGroup; |
|
182 } |
156 info->flags = NoDeviceDialogFlags; |
183 info->flags = NoDeviceDialogFlags; |
157 info->priority = DefaultPriority; |
184 info->priority = DefaultPriority; |
158 return true; |
185 return true; |
159 } |
186 } |
160 |
187 |