14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <QVariant> |
18 #include <QVariant> |
|
19 #include <QIntValidator> |
|
20 #include <QStringList> |
|
21 |
19 #include <HbAction> |
22 #include <HbAction> |
20 #include <HbGlobal> |
23 #include <HbGlobal> |
21 #include <HbMessageBox> |
24 #include <HbMessageBox> |
22 #include <HbProgressDialog> |
25 #include <HbProgressDialog> |
23 #include <HbInputDialog> |
26 #include <HbInputDialog> |
24 #include <cpsettingformitemdata.h> |
27 #include <HbDataFormModel> |
25 #include <hbdataformmodel.h> |
28 #include <HbExtendedLocale> |
26 #include <qstringlist.h> |
29 #include <HbLineEdit> |
27 #include <hbextendedlocale.h> |
|
28 #include <hblineedit.h> |
|
29 #include <HbValidator> |
30 #include <HbValidator> |
30 #include <QIntValidator> |
|
31 #include <HbStringUtil> |
31 #include <HbStringUtil> |
32 #include <HbDataForm> |
32 #include <HbDataForm> |
|
33 |
|
34 #include <cpsettingformitemdata.h> |
|
35 |
|
36 #include <cmapplsettingsui.h> |
|
37 #include <cmmanagerdefines_shim.h> |
|
38 #include <qnetworkconfigmanager.h> |
|
39 #include <qnetworkconfiguration.h> |
|
40 |
33 |
41 |
34 #include "nmipssettingshelper.h" |
42 #include "nmipssettingshelper.h" |
35 #include "nmipssettingsmanagerbase.h" |
43 #include "nmipssettingsmanagerbase.h" |
36 #include "nmipssettingscustomitem.h" |
44 #include "nmipssettingscustomitem.h" |
37 #include "nmipsextendedsettingsmanager.h" |
45 #include "nmipsextendedsettingsmanager.h" |
38 |
46 |
39 // CONSTANTS |
47 // CONSTANTS |
40 |
48 |
41 // Dynamic receiving schedule group items |
49 // Dynamic receiving schedule group items. |
42 const IpsServices::SettingItem NmIpsSettingsReceivingSchedule[] = { |
50 const IpsServices::SettingItem NmIpsSettingsReceivingSchedule[] = { |
43 IpsServices::ReceptionInboxSyncWindow, |
51 IpsServices::ReceptionInboxSyncWindow, |
44 IpsServices::ReceptionWeekDays, |
52 IpsServices::ReceptionWeekDays, |
45 IpsServices::ReceptionDayStartTime, |
53 IpsServices::ReceptionDayStartTime, |
46 IpsServices::ReceptionDayEndTime, |
54 IpsServices::ReceptionDayEndTime, |
47 IpsServices::ReceptionRefreshPeriodDayTime}; |
55 IpsServices::ReceptionRefreshPeriodDayTime}; |
|
56 |
|
57 QTM_USE_NAMESPACE |
|
58 |
48 |
59 |
49 /*! |
60 /*! |
50 \class NmIpsSettingsHelper |
61 \class NmIpsSettingsHelper |
51 \brief Helper class to save data into database when user has made changes. |
62 \brief Helper class to save data into database when user has made changes. |
52 |
63 |
70 mIncomingPortInputDialog(0), |
81 mIncomingPortInputDialog(0), |
71 mIncomingPortInputValidator(0), |
82 mIncomingPortInputValidator(0), |
72 mFolderPathInputDialog(0), |
83 mFolderPathInputDialog(0), |
73 mOutgoingPortInputDialog(0), |
84 mOutgoingPortInputDialog(0), |
74 mOutgoingPortInputValidator(0), |
85 mOutgoingPortInputValidator(0), |
|
86 mDestinationDialog(0), |
75 mServerInfoDynamicItemsVisible(false), |
87 mServerInfoDynamicItemsVisible(false), |
76 mRadioButtonPreviousIndex(0) |
88 mRadioButtonPreviousIndex(0) |
|
89 |
77 { |
90 { |
78 } |
91 } |
79 |
92 |
80 /*! |
93 /*! |
81 Destructor of NmIpsSettingsHelper. |
94 Destructor of NmIpsSettingsHelper. |
271 HbDataFormModelItem::RadioButtonListItem, |
284 HbDataFormModelItem::RadioButtonListItem, |
272 hbTrId("txt_mailips_setlabel_refresh_mail")); |
285 hbTrId("txt_mailips_setlabel_refresh_mail")); |
273 |
286 |
274 mReceivingScheduleGroupItem->appendChild(formItemData); |
287 mReceivingScheduleGroupItem->appendChild(formItemData); |
275 insertContentItem(IpsServices::ReceptionRefreshPeriodDayTime, formItemData); |
288 insertContentItem(IpsServices::ReceptionRefreshPeriodDayTime, formItemData); |
|
289 |
|
290 // If changes are made to refreshMailItems, conversion table in |
|
291 // refreshPeriodModified method needs to be updated also. |
276 QStringList refreshMailItems; |
292 QStringList refreshMailItems; |
277 refreshMailItems << hbTrId("txt_mailips_setlabel_val_keep_uptodate") |
293 refreshMailItems << hbTrId("txt_mailips_setlabel_val_keep_uptodate") |
278 << hbTrId("txt_mailips_setlabel_val_every_15_minutes") |
294 << hbTrId("txt_mailips_setlabel_val_every_15_minutes") |
279 << hbTrId("txt_mailips_setlabel_val_every_1_hour") |
295 << hbTrId("txt_mailips_setlabel_val_every_1_hour") |
280 << hbTrId("txt_mailips_setlabel_val_every_4_hours"); |
296 << hbTrId("txt_mailips_setlabel_val_every_4_hours"); |
281 formItemData->setContentWidgetData(QString("items"), refreshMailItems); |
297 formItemData->setContentWidgetData(QString("items"), refreshMailItems); |
282 |
298 mDataForm.addConnection( |
283 QList<QVariant> refreshMailItemValues; |
299 formItemData, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)), |
284 refreshMailItemValues << 5 |
300 this, SLOT(refreshPeriodModified(QPersistentModelIndex, QVariant))); |
285 << 15 |
|
286 << 60 |
|
287 << 240; |
|
288 QVariant value(refreshMailItemValues); |
|
289 formItemData->setData(HbDataFormModelItem::DescriptionRole + 1, value); |
|
290 |
|
291 mDataForm.addConnection(formItemData, SIGNAL(itemSelected(int)), |
|
292 this, SLOT(refreshPeriodModified(int))); |
|
293 } |
301 } |
294 |
302 |
295 // Update data |
303 // Update data |
296 QVariant interval; |
304 QVariant interval; |
297 mSettingsManager.readSetting(item, interval); |
305 mSettingsManager.readSetting(item, interval); |
575 /*! |
581 /*! |
576 Deletes mailbox and displays the proper notes. |
582 Deletes mailbox and displays the proper notes. |
577 */ |
583 */ |
578 void NmIpsSettingsHelper::handleMailboxDelete(HbAction *action) |
584 void NmIpsSettingsHelper::handleMailboxDelete(HbAction *action) |
579 { |
585 { |
580 if (action == mDeleteConfirmationDialog->primaryAction()) { |
586 if (action == mDeleteConfirmationDialog->actions().at(0)) { |
581 |
|
582 emit goOffline(mSettingsManager.mailboxId()); |
587 emit goOffline(mSettingsManager.mailboxId()); |
583 mEmitOnline = false; |
588 mEmitOnline = false; |
584 |
589 |
585 QVariant mailboxName; |
590 QVariant mailboxName; |
586 mSettingsManager.readSetting(IpsServices::MailboxName, mailboxName); |
591 mSettingsManager.readSetting(IpsServices::MailboxName, mailboxName); |
587 |
592 |
588 // Display the progress note. Before display the note, remove the cancel |
593 // Display the progress note. Before display the note, remove the cancel |
589 // button. |
594 // button. |
590 HbProgressDialog progressNote(HbProgressDialog::WaitDialog); |
595 HbProgressDialog progressNote(HbProgressDialog::WaitDialog); |
591 progressNote.setText(hbTrId("txt_common_info_deleting")); |
596 progressNote.setText(hbTrId("txt_common_info_deleting")); |
592 action = progressNote.primaryAction(); |
597 progressNote.removeAction(progressNote.actions().at(0)); |
593 progressNote.removeAction(action); |
|
594 progressNote.delayedShow(); |
598 progressNote.delayedShow(); |
595 |
599 |
596 if (!mSettingsManager.deleteMailbox()) { |
600 if (!mSettingsManager.deleteMailbox()) { |
597 // The mailbox was deleted successfully. Hide the progress note and |
601 // The mailbox was deleted successfully. Hide the progress note and |
598 // display the "mailbox deleted" dialog. |
602 // display the "mailbox deleted" dialog. |
826 |
827 |
827 mIncomingPortInputDialog->open(this, SLOT(handleUserDefinedIncomingPortInput(HbAction *))); |
828 mIncomingPortInputDialog->open(this, SLOT(handleUserDefinedIncomingPortInput(HbAction *))); |
828 } |
829 } |
829 |
830 |
830 /*! |
831 /*! |
831 Handels the saving of the port new value. |
832 Handles the saving of the port new value. |
832 */ |
833 */ |
833 void NmIpsSettingsHelper::handleUserDefinedIncomingPortInput(HbAction *action) |
834 void NmIpsSettingsHelper::handleUserDefinedIncomingPortInput(HbAction *action) |
834 { |
835 { |
835 if (action == mIncomingPortInputDialog->primaryAction()) { |
836 if (action == mIncomingPortInputDialog->actions().at(0)) { |
836 QVariant newPort = mIncomingPortInputDialog->value(); |
837 QVariant newPort = mIncomingPortInputDialog->value(); |
837 emit goOffline(mSettingsManager.mailboxId()); |
838 emit goOffline(mSettingsManager.mailboxId()); |
838 mEmitOnline = true; |
839 mEmitOnline = true; |
839 mSettingsManager.writeSetting(IpsServices::IncomingPort, newPort); |
840 mSettingsManager.writeSetting(IpsServices::IncomingPort, newPort); |
840 } else { |
841 } else { |
987 */ |
984 */ |
988 void NmIpsSettingsHelper::handleUserDefinedFolderPathInput(HbAction *action) |
985 void NmIpsSettingsHelper::handleUserDefinedFolderPathInput(HbAction *action) |
989 { |
986 { |
990 HbDataFormModelItem *item = mContentItems.value(IpsServices::FolderPath); |
987 HbDataFormModelItem *item = mContentItems.value(IpsServices::FolderPath); |
991 |
988 |
992 if (action == mFolderPathInputDialog->primaryAction()) { |
989 if (action == mFolderPathInputDialog->actions().at(0)) { |
993 QVariant newFolderPath = mFolderPathInputDialog->value(); |
990 QVariant newFolderPath = mFolderPathInputDialog->value(); |
994 mSettingsManager.writeSetting(IpsServices::FolderPath, newFolderPath); |
991 mSettingsManager.writeSetting(IpsServices::FolderPath, newFolderPath); |
995 //set selected index to default if user inputed empty string. |
992 //set selected index to default if user inputed empty string. |
996 if (newFolderPath.toString().isEmpty()) { |
993 if (newFolderPath.toString().isEmpty()) { |
997 item->setContentWidgetData(QString("selected"), IpsServices::NmIpsSettingsDefault); |
994 item->setContentWidgetData(QString("selected"), IpsServices::NmIpsSettingsDefault); |
1029 int days(0); |
1026 int days(0); |
1030 foreach (QVariant selectedIndex, selectedIndexes) { |
1027 foreach (QVariant selectedIndex, selectedIndexes) { |
1031 days |= itemValues.at(selectedIndex.toInt()).toInt(); |
1028 days |= itemValues.at(selectedIndex.toInt()).toInt(); |
1032 } |
1029 } |
1033 |
1030 |
1034 handleReceivingScheduleSettingChange(IpsServices::ReceptionWeekDays, days); |
1031 QVariant previouslySelectedValue; |
1035 |
1032 mSettingsManager.readSetting(IpsServices::ReceptionWeekDays, previouslySelectedValue); |
|
1033 if (days != previouslySelectedValue.toInt()) { |
|
1034 handleReceivingScheduleSettingChange(IpsServices::ReceptionWeekDays, days); |
|
1035 } |
|
1036 |
|
1037 // Although the mode might not be changed we need to still update the button text. |
1036 // Every weekday selected. |
1038 // Every weekday selected. |
1037 if (days == 0x7f) { |
1039 if (days == 0x7f) { |
1038 item->setContentWidgetData(QString("text"), |
1040 item->setContentWidgetData(QString("text"), |
1039 hbTrId("txt_mailips_setlabel_download_images_val_every_day")); |
1041 hbTrId("txt_mailips_setlabel_download_images_val_every_day")); |
1040 } |
1042 } |
1041 } |
1043 } |
1042 |
1044 |
1043 /*! |
1045 /*! |
1044 Handles start time modifications. |
1046 Handles start time modifications. |
1045 |
|
1046 \param time Modified start time. |
1047 \param time Modified start time. |
1047 */ |
1048 */ |
1048 void NmIpsSettingsHelper::startTimeModified(QTime time) |
1049 void NmIpsSettingsHelper::startTimeModified(QTime time) |
1049 { |
1050 { |
1050 int startTime(time.hour()*60 + time.minute()); |
1051 int startTime(time.hour()*60 + time.minute()); |
1051 handleReceivingScheduleSettingChange(IpsServices::ReceptionDayStartTime, startTime); |
1052 QVariant previouslySelectedStartTime; |
|
1053 mSettingsManager.readSetting(IpsServices::ReceptionDayStartTime, previouslySelectedStartTime); |
|
1054 if (startTime != previouslySelectedStartTime.toInt()) { |
|
1055 handleReceivingScheduleSettingChange(IpsServices::ReceptionDayStartTime, startTime); |
|
1056 } |
1052 } |
1057 } |
1053 |
1058 |
1054 /*! |
1059 /*! |
1055 Handles refresh period modifications. |
1060 Handles refresh period modifications. |
1056 |
1061 \param value Selected value as a text. |
1057 \param index selected item index. |
1062 */ |
1058 */ |
1063 void NmIpsSettingsHelper::refreshPeriodModified(QPersistentModelIndex, QVariant value) |
1059 void NmIpsSettingsHelper::refreshPeriodModified(int index) |
1064 { |
1060 { |
1065 QMap<QString, int> conversionTable; |
1061 HbDataFormModelItem* item = mContentItems.value(IpsServices::ReceptionRefreshPeriodDayTime); |
1066 conversionTable[hbTrId("txt_mailips_setlabel_val_keep_uptodate")] = 5; |
1062 QVariant itemData = item->data(HbDataFormModelItem::DescriptionRole + 1); |
1067 conversionTable[hbTrId("txt_mailips_setlabel_val_every_15_minutes")] = 15; |
1063 int selectedValue = itemData.value< QList< QVariant > >().at(index).toInt(); |
1068 conversionTable[hbTrId("txt_mailips_setlabel_val_every_1_hour")] = 60; |
1064 handleReceivingScheduleSettingChange(IpsServices::ReceptionRefreshPeriodDayTime, selectedValue); |
1069 conversionTable[hbTrId("txt_mailips_setlabel_val_every_4_hours")] = 240; |
|
1070 |
|
1071 int selectedValue(conversionTable.value(value.toString())); |
|
1072 QVariant previouslySelectedValue; |
|
1073 mSettingsManager.readSetting(IpsServices::ReceptionRefreshPeriodDayTime, |
|
1074 previouslySelectedValue); |
|
1075 if (selectedValue != previouslySelectedValue.toInt()) { |
|
1076 handleReceivingScheduleSettingChange(IpsServices::ReceptionRefreshPeriodDayTime, |
|
1077 selectedValue); |
|
1078 } |
1065 } |
1079 } |
1066 |
1080 |
1067 /*! |
1081 /*! |
1068 Handles end time modifications. |
1082 Handles end time modifications. |
1069 |
|
1070 \param time Modified start time. |
1083 \param time Modified start time. |
1071 */ |
1084 */ |
1072 void NmIpsSettingsHelper::endTimeModified(QTime time) |
1085 void NmIpsSettingsHelper::endTimeModified(QTime time) |
1073 { |
1086 { |
1074 int endTime(time.hour()*60 + time.minute()); |
1087 int endTime(time.hour()*60 + time.minute()); |
1075 handleReceivingScheduleSettingChange(IpsServices::ReceptionDayEndTime, endTime); |
1088 QVariant previouslySelectedEndTime; |
|
1089 mSettingsManager.readSetting(IpsServices::ReceptionDayEndTime, previouslySelectedEndTime); |
|
1090 if (endTime != previouslySelectedEndTime) { |
|
1091 handleReceivingScheduleSettingChange(IpsServices::ReceptionDayEndTime, endTime); |
|
1092 } |
1076 } |
1093 } |
1077 |
1094 |
1078 /*! |
1095 /*! |
1079 Used for getting the index to display in the inbox path radio button list |
1096 Used for getting the index to display in the inbox path radio button list |
1080 |
|
1081 \return index Used to set the selected value |
1097 \return index Used to set the selected value |
1082 */ |
1098 */ |
1083 int NmIpsSettingsHelper::getCorrectInboxPathRadioButtonIndex(QVariant folderPath) |
1099 int NmIpsSettingsHelper::getCorrectInboxPathRadioButtonIndex(QVariant folderPath) |
1084 { |
1100 { |
1085 int index(0); |
1101 int index(0); |
1093 |
1109 |
1094 /*! |
1110 /*! |
1095 Handles receiving schedule item value modifications. |
1111 Handles receiving schedule item value modifications. |
1096 Takes care of creating 'user defined' mode, coping values from active profile to |
1112 Takes care of creating 'user defined' mode, coping values from active profile to |
1097 user defined mode, storing changed value and selecting 'user defined' mode. |
1113 user defined mode, storing changed value and selecting 'user defined' mode. |
1098 |
|
1099 \param settingItem Changed setting item. |
1114 \param settingItem Changed setting item. |
1100 \param settingValue Setting item's value. |
1115 \param settingValue Setting item's value. |
1101 */ |
1116 */ |
1102 void NmIpsSettingsHelper::handleReceivingScheduleSettingChange( |
1117 void NmIpsSettingsHelper::handleReceivingScheduleSettingChange( |
1103 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
1118 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
1126 HbDataFormModelItem *syncProfile = contentItem(IpsServices::ReceptionActiveProfile); |
1141 HbDataFormModelItem *syncProfile = contentItem(IpsServices::ReceptionActiveProfile); |
1127 syncProfile->setContentWidgetData(QString("currentIndex"), 3); |
1142 syncProfile->setContentWidgetData(QString("currentIndex"), 3); |
1128 } |
1143 } |
1129 |
1144 |
1130 /*! |
1145 /*! |
|
1146 Return the localized name for network destination with id of \a identifier. |
|
1147 \param identifier Network destination identifier. |
|
1148 \return Name of the network destination. |
|
1149 */ |
|
1150 QString NmIpsSettingsHelper::destinationNameFromIdentifier(uint identifier) |
|
1151 { |
|
1152 const QString snapPrefix("S_"); |
|
1153 |
|
1154 QNetworkConfigurationManager netMan; |
|
1155 QNetworkConfiguration conf = netMan.configurationFromIdentifier( snapPrefix + |
|
1156 QString::number(identifier)); |
|
1157 return conf.name(); |
|
1158 } |
|
1159 |
|
1160 /*! |
1131 Copies receiving schedule settings from currently active profile to given profile. |
1161 Copies receiving schedule settings from currently active profile to given profile. |
1132 |
|
1133 \param profileMode Mode where receiving schedule settings from active profile are copied to. |
1162 \param profileMode Mode where receiving schedule settings from active profile are copied to. |
1134 */ |
1163 */ |
1135 void NmIpsSettingsHelper::copyReceivingScheduleSettingsFromActiveProfile(int profileMode) |
1164 void NmIpsSettingsHelper::copyReceivingScheduleSettingsFromActiveProfile(int profileMode) |
1136 { |
1165 { |
1137 // Read receiving schedule dynamic group item values and |
1166 // Read receiving schedule dynamic group item values and |
1195 |
1222 |
1196 mOutgoingPortInputDialog->open(this, SLOT(handleUserDefinedOutgoingPortInput(HbAction *))); |
1223 mOutgoingPortInputDialog->open(this, SLOT(handleUserDefinedOutgoingPortInput(HbAction *))); |
1197 } |
1224 } |
1198 |
1225 |
1199 /*! |
1226 /*! |
1200 Handels the saving of the port new value. |
1227 Handles the saving of the port new value. |
|
1228 \action Selected action. |
1201 */ |
1229 */ |
1202 void NmIpsSettingsHelper::handleUserDefinedOutgoingPortInput(HbAction *action) |
1230 void NmIpsSettingsHelper::handleUserDefinedOutgoingPortInput(HbAction *action) |
1203 { |
1231 { |
1204 if (action == mOutgoingPortInputDialog->primaryAction()) { |
1232 if (action == mOutgoingPortInputDialog->actions().at(0)) { |
1205 QVariant newPort = mOutgoingPortInputDialog->value(); |
1233 QVariant newPort = mOutgoingPortInputDialog->value(); |
1206 emit goOffline(mSettingsManager.mailboxId()); |
1234 emit goOffline(mSettingsManager.mailboxId()); |
1207 mEmitOnline = true; |
1235 mEmitOnline = true; |
1208 mSettingsManager.writeSetting(IpsServices::OutgoingPort, newPort); |
1236 mSettingsManager.writeSetting(IpsServices::OutgoingPort, newPort); |
1209 } else { |
1237 } else { |
1212 item->setContentWidgetData(QString("selected"), mRadioButtonPreviousIndex); |
1240 item->setContentWidgetData(QString("selected"), mRadioButtonPreviousIndex); |
1213 } |
1241 } |
1214 } |
1242 } |
1215 |
1243 |
1216 /*! |
1244 /*! |
1217 Sets the previous index value to indicate that user has edited the field |
1245 Handles the saving of the selected network connection. |
1218 |
1246 \param status Dialog exit status \sa CmApplSettingsUi::ApplSettingsError. |
|
1247 */ |
|
1248 void NmIpsSettingsHelper::handleConnectionSelected(uint status) |
|
1249 { |
|
1250 if (status == CmApplSettingsUi::ApplSettingsErrorNone) { |
|
1251 CmApplSettingsUi::SettingSelection selection = mDestinationDialog->selection(); |
|
1252 uint destId(selection.id); |
|
1253 if (mSettingsManager.writeSetting(IpsServices::Connection, QVariant(destId))) { |
|
1254 QString destName(destinationNameFromIdentifier(destId)); |
|
1255 HbDataFormModelItem *item = mContentItems.value(IpsServices::Connection); |
|
1256 item->setContentWidgetData(QString("text"), destName); |
|
1257 } |
|
1258 } |
|
1259 } |
|
1260 |
|
1261 /*! |
|
1262 Sets the previous index value to indicate that user has edited the field. |
1219 \param index Reference to the item in the radio button list. |
1263 \param index Reference to the item in the radio button list. |
1220 */ |
1264 */ |
1221 void NmIpsSettingsHelper::outgoingPortPress(const QModelIndex &index) |
1265 void NmIpsSettingsHelper::outgoingPortPress(const QModelIndex &index) |
1222 { |
1266 { |
1223 Q_UNUSED(index); |
1267 Q_UNUSED(index); |
1367 } |
1410 } |
1368 } |
1411 } |
1369 } |
1412 } |
1370 |
1413 |
1371 /*! |
1414 /*! |
1372 Sets the previous index value to indicate that user has edited the field |
1415 Sets the previous index value to indicate that user has edited the field. |
1373 |
1416 \param index Reference to the item in the radio button list. |
1374 \param text Reference to the item in the radio button list. |
|
1375 */ |
1417 */ |
1376 void NmIpsSettingsHelper::outgoingAuthenticationPress(const QModelIndex &index) |
1418 void NmIpsSettingsHelper::outgoingAuthenticationPress(const QModelIndex &index) |
1377 { |
1419 { |
1378 Q_UNUSED(index); |
1420 Q_UNUSED(index); |
1379 HbDataFormModelItem *item = mContentItems.value(IpsServices::SMTPAuthentication); |
1421 HbDataFormModelItem *item = mContentItems.value(IpsServices::SMTPAuthentication); |
1380 QVariant data = item->contentWidgetData(QString("selected")); |
1422 QVariant data = item->contentWidgetData(QString("selected")); |
1381 mRadioButtonPreviousIndex = data.toInt(); |
1423 mRadioButtonPreviousIndex = data.toInt(); |
1382 } |
1424 } |
1383 |
1425 |
|
1426 /*! |
|
1427 Launches the connection selection dialog. |
|
1428 */ |
|
1429 void NmIpsSettingsHelper::connectionButtonPress() |
|
1430 { |
|
1431 if (!mDestinationDialog) { |
|
1432 // Create the dialog and configure it. |
|
1433 mDestinationDialog = new CmApplSettingsUi(this); |
|
1434 |
|
1435 mDestinationDialog->setOptions( |
|
1436 QFlags<CmApplSettingsUi::SelectionDialogItems>(CmApplSettingsUi::ShowDestinations), |
|
1437 QSet<CmApplSettingsUi::BearerTypeFilter>()); |
|
1438 connect(mDestinationDialog, SIGNAL(finished(uint)), |
|
1439 this, SLOT(handleConnectionSelected(uint))); |
|
1440 } |
|
1441 |
|
1442 // Set currently active destination as selected. |
|
1443 QVariant destId; |
|
1444 if (mSettingsManager.readSetting(IpsServices::Connection, destId)) { |
|
1445 CmApplSettingsUi::SettingSelection selection; |
|
1446 selection.result = CmApplSettingsUi::SelectionTypeDestination; |
|
1447 selection.id = destId.toUInt(); |
|
1448 mDestinationDialog->setSelection(selection); |
|
1449 } |
|
1450 |
|
1451 // Open the dialog. |
|
1452 mDestinationDialog->open(); |
|
1453 } |