diff options
author | Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> | 2009-06-03 14:24:12 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-06-04 10:58:18 +0200 |
commit | b184c8c3472bdfaf5cc9f27d73f2cbc791caa274 (patch) | |
tree | 3ce4bba1d7df83d3c7bcc0ce4a2817e3bb46605a /doc/addressbook-sdk.qdoc | |
parent | 3104e4c121f3209890823db69a7c09d644b90951 (diff) | |
download | qt-creator-b184c8c3472bdfaf5cc9f27d73f2cbc791caa274.tar.gz |
Fixes: Doc - finishing part 2, yay ;)
RevBy: TrustMe
Diffstat (limited to 'doc/addressbook-sdk.qdoc')
-rw-r--r-- | doc/addressbook-sdk.qdoc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc index 3d97237e57..643f6d0b7e 100644 --- a/doc/addressbook-sdk.qdoc +++ b/doc/addressbook-sdk.qdoc @@ -364,4 +364,57 @@ \c submitButton and \c cancelButton; but we disable \c addButton. \snippet examples/addressbook-sdk/part2/addressbook.cpp addContact + + \section2 The \c{submitContact()} Function + + This function can be divided into three parts: + + \list 1 + \o We extract the contact's detail from \c nameLine and \c addressText + and store them in QString objects. We also validate to ensure that + the user did not click \gui Submit with empty input fields; + otherwise, a QMessageBox is displayed to remind the user for a name + and address. + + \snippet examples/addressbook-sdk/part2/addressbook.cpp submitContact part1 + + \o We then proceed to check if the contact already exists. If it does + not exist, we add the contact to \c contacts and we display a + QMessageBox to inform the user about this, preventing the user from + adding duplicate contacts. Our \c contacts object is based on + key-value pairs or name and address, hence, we want to ensure that + \e key is unique. + + \snippet examples/addressbook-sdk/part2/addressbook.cpp submitContact part2 + + \o Once we have handled both cases mentioned above, we restore the + push buttons to their normal state with the following code: + + \snippet examples/addressbook-sdk/part2/addressbook.cpp submitContact part3 + \endlist + + The screenshot below shows the QMessageBox object we use to display + information messages to the user. + + # image + + \section2 The \c{cancel()} Function + + This function restores the last displayed contact details and enables + \c addButton, as well as hides \c submitButton and \c cancelButton. + + \snippet examples/addressbook-sdk/part2/addressbook.cpp cancel + + The general idea behind adding a contact is to give the user the + flexibility to click \gui Submit or \gui Cancel at any time. The flowchart + below further explains this concept: + + \image addressbook-tutorial-part2-add-flowchart.png + + + \section1 Running the Application + + Run your application now. You will be able to add as many unique contacts + as you like. + */ |