33 #include <HbMessageBox> |
33 #include <HbMessageBox> |
34 #include <HbAction> |
34 #include <HbAction> |
35 #include <wlanmgmtcommon.h> |
35 #include <wlanmgmtcommon.h> |
36 #include <cpitemdatahelper.h> |
36 #include <cpitemdatahelper.h> |
37 #include <cpsettingformitemdata.h> |
37 #include <cpsettingformitemdata.h> |
|
38 #include <cppluginutility.h> |
38 #include <cmconnectionmethod_shim.h> |
39 #include <cmconnectionmethod_shim.h> |
39 #include <cpwlansecurityplugininterface.h> |
40 #include <cpwlansecurityplugininterface.h> |
40 |
41 |
41 // User includes |
42 // User includes |
42 #include "cpwlanapplugin.h" |
43 #include "cpwlanapplugin.h" |
97 this, |
98 this, |
98 SLOT(menuActionTriggered(HbAction*))); |
99 SLOT(menuActionTriggered(HbAction*))); |
99 Q_ASSERT(status); |
100 Q_ASSERT(status); |
100 |
101 |
101 // Construct WLAN AP settings UI |
102 // Construct WLAN AP settings UI |
102 mForm = settingForm(); |
103 mForm = new HbDataForm(); |
103 if (mForm) { |
104 this->setWidget(mForm); |
104 mModel = new HbDataFormModel(mForm); |
105 CpPluginUtility::addCpItemPrototype(mForm); |
105 |
106 mModel = new HbDataFormModel(mForm); |
106 // The parameter given as 0 is a HbDataForm pointer, not parent |
107 |
107 mItemDataHelper = new CpItemDataHelper(0); |
108 // The parameter given as 0 is a HbDataForm pointer, not parent |
108 mItemDataHelper->setParent(this); |
109 mItemDataHelper = new CpItemDataHelper(0); |
109 |
110 mItemDataHelper->setParent(this); |
110 // Add access point settings group |
111 |
111 createAccessPointSettingsGroup(); |
112 // Add access point settings group |
|
113 createAccessPointSettingsGroup(); |
112 |
114 |
113 mItemDataHelper->bindToForm(mForm); |
115 mItemDataHelper->bindToForm(mForm); |
114 mForm->setModel(mModel); |
116 mForm->setModel(mModel); |
115 |
117 |
116 status = connect( |
118 status = connect( |
117 mForm, |
119 mForm, |
118 SIGNAL(itemShown(const QModelIndex)), |
120 SIGNAL(itemShown(const QModelIndex)), |
119 this, |
121 this, |
120 SLOT(setEditorPreferences(const QModelIndex))); |
122 SLOT(setEditorPreferences(const QModelIndex))); |
121 Q_ASSERT(status); |
123 Q_ASSERT(status); |
122 |
124 |
123 // Expand access point settings group |
125 // Expand access point settings group |
124 mForm->setExpanded(mModel->indexFromItem(mApSettingsGroupItem), TRUE); |
126 mForm->setExpanded(mModel->indexFromItem(mApSettingsGroupItem), TRUE); |
125 |
127 |
126 // Add security settings group if necessary |
128 // Add security settings group if necessary |
127 updateSecurityGroup( |
129 updateSecurityGroup( |
128 mSecurityModeItem->contentWidgetData("currentIndex").toInt()); |
130 mSecurityModeItem->contentWidgetData("currentIndex").toInt()); |
129 } |
|
130 |
131 |
131 OstTraceFunctionExit0(CPWLANAPVIEW_CPWLANAPVIEW_EXIT); |
132 OstTraceFunctionExit0(CPWLANAPVIEW_CPWLANAPVIEW_EXIT); |
132 } |
133 } |
133 |
134 |
134 /*! |
135 /*! |
665 */ |
666 */ |
666 void CpWlanApView::setEditorPreferences(const QModelIndex modelIndex) |
667 void CpWlanApView::setEditorPreferences(const QModelIndex modelIndex) |
667 { |
668 { |
668 OstTraceFunctionEntry0(CPWLANAPVIEW_SETEDITORPREFERENCES_ENTRY); |
669 OstTraceFunctionEntry0(CPWLANAPVIEW_SETEDITORPREFERENCES_ENTRY); |
669 |
670 |
670 HbDataFormViewItem *viewItem = mForm->dataFormViewItem(modelIndex); |
671 HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *> |
|
672 (mForm->itemByIndex(modelIndex)); |
671 HbDataFormModelItem *modelItem = mModel->itemFromIndex(modelIndex); |
673 HbDataFormModelItem *modelItem = mModel->itemFromIndex(modelIndex); |
672 |
674 |
673 if (modelItem == mConnectionNameItem |
675 if (modelItem == mConnectionNameItem |
674 || modelItem == mWlanNetworkNameItem |
676 || modelItem == mWlanNetworkNameItem |
675 || modelItem == mHomepageItem ) { |
677 || modelItem == mHomepageItem ) { |
678 (viewItem->dataItemContentWidget()); |
680 (viewItem->dataItemContentWidget()); |
679 HbEditorInterface editInterface(edit); |
681 HbEditorInterface editInterface(edit); |
680 |
682 |
681 if (modelItem == mConnectionNameItem) { |
683 if (modelItem == mConnectionNameItem) { |
682 // Setup editor for connection name |
684 // Setup editor for connection name |
683 editInterface.setConstraints(HbEditorConstraintLatinAlphabetOnly); |
685 editInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); |
684 edit->setInputMethodHints(Qt::ImhNoPredictiveText); |
686 edit->setInputMethodHints(Qt::ImhNoPredictiveText); |
685 edit->setMaxLength(CMManagerShim::CmNameLength); |
687 edit->setMaxLength(CMManagerShim::CmNameLength); |
686 } else if (modelItem == mWlanNetworkNameItem) { |
688 } else if (modelItem == mWlanNetworkNameItem) { |
687 // Setup editor for WLAN SSID |
689 // Setup editor for WLAN SSID |
688 editInterface.setInputMode(HbInputModeNone); |
690 editInterface.setMode(HbInputModeNone); |
689 editInterface.setConstraints(HbEditorConstraintLatinAlphabetOnly); |
691 editInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); |
690 // TODO: Remove comment, should be in w12 |
692 editInterface.setEditorClass(HbInputEditorClassNetworkName); |
691 //editInterface.setEditorClass(HbInputEditorClassNetworkName); |
693 editInterface.setDigitType(HbDigitTypeNone); |
692 editInterface.setLocalDigitType(HbDigitTypeNone); |
|
693 edit->setInputMethodHints( |
694 edit->setInputMethodHints( |
694 Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); |
695 Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); |
695 edit->setMaxLength(CMManagerShim::WlanSSIDLength); |
696 edit->setMaxLength(CMManagerShim::WlanSSIDLength); |
696 } else { /* mHomepageItem */ |
697 } else { /* mHomepageItem */ |
697 // Setup editor for URL |
698 // Setup editor for URL |
698 editInterface.setInputMode(HbInputModeNone); |
699 editInterface.setMode(HbInputModeNone); |
699 editInterface.setConstraints(HbEditorConstraintLatinAlphabetOnly); |
700 editInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); |
700 editInterface.setFilter(HbUrlFilter::instance()); |
701 editInterface.setFilter(HbUrlFilter::instance()); |
701 editInterface.setEditorClass(HbInputEditorClassUrl); |
702 editInterface.setEditorClass(HbInputEditorClassUrl); |
702 editInterface.setLocalDigitType(HbDigitTypeNone); |
703 editInterface.setDigitType(HbDigitTypeNone); |
703 edit->setInputMethodHints( |
704 edit->setInputMethodHints( |
704 Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); |
705 Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); |
705 edit->setMaxLength(CMManagerShim::CmStartPageLength); |
706 edit->setMaxLength(CMManagerShim::CmStartPageLength); |
706 } |
707 } |
707 } |
708 } |