25 #include <hbdocumentloader.h> |
25 #include <hbdocumentloader.h> |
26 #include <hbaction.h> |
26 #include <hbaction.h> |
27 #include <hblineedit.h> |
27 #include <hblineedit.h> |
28 #include <hbinputeditorinterface.h> |
28 #include <hbinputeditorinterface.h> |
29 #include <hbinputstandardfilters.h> |
29 #include <hbinputstandardfilters.h> |
|
30 #include <cntdebug.h> |
30 |
31 |
31 const char *CNT_DETAILEDITOR_XML = ":/xml/contacts_detail_editor.docml"; |
32 const char *CNT_DETAILEDITOR_XML = ":/xml/contacts_detail_editor.docml"; |
32 |
33 |
33 CntDetailEditor::CntDetailEditor( int aId ) : |
34 CntDetailEditor::CntDetailEditor( int aId ) : |
34 QObject(), |
35 QObject(), |
35 mDataFormModel(NULL), |
36 mDataFormModel(NULL), |
|
37 mHeader(NULL), |
36 mId(aId), |
38 mId(aId), |
37 mView(NULL), |
39 mView(NULL), |
38 mLoader(NULL), |
40 mLoader(NULL), |
39 mViewManager(NULL), |
41 mViewManager(NULL), |
40 mEditorFactory(NULL), |
42 mEditorFactory(NULL), |
71 mId = aId; |
73 mId = aId; |
72 } |
74 } |
73 |
75 |
74 void CntDetailEditor::setInsertAction( const QString aInsert ) |
76 void CntDetailEditor::setInsertAction( const QString aInsert ) |
75 { |
77 { |
76 HbAction* insert = new HbAction( aInsert ); |
78 HbAction* insert = new HbAction( aInsert, mView ); |
77 mView->menu()->insertAction(mCancel, insert); |
79 mView->menu()->insertAction(mCancel, insert); |
78 connect( insert, SIGNAL(triggered()), this, SLOT(insertField()) ); |
80 connect( insert, SIGNAL(triggered()), this, SLOT(insertField()) ); |
79 } |
81 } |
80 |
82 |
81 void CntDetailEditor::activate( CntAbstractViewManager* aMgr, const CntViewParameters aArgs ) |
83 void CntDetailEditor::activate( CntAbstractViewManager* aMgr, const CntViewParameters aArgs ) |
82 { |
84 { |
83 mViewManager = aMgr; |
85 mViewManager = aMgr; |
84 mArgs = aArgs; //don't loose the params while swiching between editview and editorviews. |
86 mArgs = aArgs; //don't loose the params while swiching between editview and editorviews. |
85 |
87 |
86 mCancel = static_cast<HbAction*>(document()->findObject("cnt:discardchanges")); |
88 mCancel = static_cast<HbAction*>(document()->findObject("cnt:discardchanges")); |
87 mView->menu()->addAction( mCancel ); |
89 mCancel->setParent(mView); |
|
90 mView->menu()->addAction(mCancel); |
88 connect( mCancel, SIGNAL(triggered()), this, SLOT(discardChanges()) ); |
91 connect( mCancel, SIGNAL(triggered()), this, SLOT(discardChanges()) ); |
89 |
92 |
90 if ( mView->navigationAction() != mSoftkey) { |
93 if ( mView->navigationAction() != mSoftkey) { |
91 mView->setNavigationAction(mSoftkey); |
94 mView->setNavigationAction(mSoftkey); |
92 } |
95 } |
94 QContact selectedContact; |
97 QContact selectedContact; |
95 if ( mId == groupEditorView ) |
98 if ( mId == groupEditorView ) |
96 { |
99 { |
97 selectedContact = aArgs.value(ESelectedGroupContact).value<QContact>(); |
100 selectedContact = aArgs.value(ESelectedGroupContact).value<QContact>(); |
98 connect( mDataForm, SIGNAL(itemShown(const QModelIndex&)), this, SLOT(handleItemShown(const QModelIndex&)) ); |
101 connect( mDataForm, SIGNAL(itemShown(const QModelIndex&)), this, SLOT(handleItemShown(const QModelIndex&)) ); |
99 |
|
100 } |
102 } |
101 else |
103 else |
102 { |
104 { |
103 selectedContact = aArgs.value(ESelectedContact).value<QContact>(); |
105 selectedContact = aArgs.value(ESelectedContact).value<QContact>(); |
|
106 connect( mDataForm, SIGNAL(itemShown(const QModelIndex&)), this, SLOT(handleItemShown(const QModelIndex&)) ); |
104 } |
107 } |
105 mEditorFactory->setupEditorView(*this, selectedContact); |
108 mEditorFactory->setupEditorView(*this, selectedContact); |
106 |
109 |
107 mDataForm->setItemRecycling(true); |
110 mDataForm->setItemRecycling(true); |
108 |
111 |
155 HbDataFormViewItem* viewItem = static_cast<HbDataFormViewItem*>(mDataForm->itemByIndex( aIndex )); |
158 HbDataFormViewItem* viewItem = static_cast<HbDataFormViewItem*>(mDataForm->itemByIndex( aIndex )); |
156 HbLineEdit* edit = static_cast<HbLineEdit*>( viewItem->dataItemContentWidget() ); |
159 HbLineEdit* edit = static_cast<HbLineEdit*>( viewItem->dataItemContentWidget() ); |
157 edit->setInputMethodHints( Qt::ImhDialableCharactersOnly ); |
160 edit->setInputMethodHints( Qt::ImhDialableCharactersOnly ); |
158 } |
161 } |
159 } |
162 } |
|
163 else |
|
164 { |
|
165 HbDataFormViewItem* viewItem = static_cast<HbDataFormViewItem*>(mDataForm->itemByIndex( aIndex )); |
|
166 HbLineEdit* edit = static_cast<HbLineEdit*>( viewItem->dataItemContentWidget() ); |
|
167 edit->setInputMethodHints( Qt::ImhNoPredictiveText ); |
|
168 } |
160 } |
169 } |
161 |
170 |
162 void CntDetailEditor::discardChanges() |
171 void CntDetailEditor::discardChanges() |
163 { |
172 { |
164 QContact selected( *mDataFormModel->contact() ); |
173 QContact selected( *mDataFormModel->contact() ); |