summaryrefslogtreecommitdiff
path: root/doc/addressbook-sdk.qdoc
diff options
context:
space:
mode:
authorKavindra Devi Palaraja <kavindra.palaraja@nokia.com>2009-07-07 13:37:33 +0200
committerKavindra Devi Palaraja <kavindra.palaraja@nokia.com>2009-07-07 13:37:50 +0200
commit6bb6f5168dc895baa6352a8e86363c9a83682bc5 (patch)
tree261c54a8c70940755de0d82d7cf43de92f93ee05 /doc/addressbook-sdk.qdoc
parent42adcb9116ed72a28cdc7d726f6ed32e182881c3 (diff)
downloadqt-creator-6bb6f5168dc895baa6352a8e86363c9a83682bc5.tar.gz
Doc - More of Part 6
Reviewed-By: TrustMe
Diffstat (limited to 'doc/addressbook-sdk.qdoc')
-rw-r--r--doc/addressbook-sdk.qdoc18
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc
index 3846643867..c7cb3814f3 100644
--- a/doc/addressbook-sdk.qdoc
+++ b/doc/addressbook-sdk.qdoc
@@ -971,11 +971,27 @@
If \c fileName is not empty, again, we use a QFile object, \c file, and
attempt to open it in \l{QIODevice::}{ReadOnly} mode. Similar to our
- implementation
+ implementation of \c saveToFile(), if this attempt is unsuccessful, we
+ display a QMessageBox to inform the user.
\snippet examples/addressbook-sdk/part6/addressbook.cpp loadFromFile part2
+
+ Otherwise, we instantiate a QDataStream object, \c in, set its version as
+ above and read the serialized data into hte \c contacts data structure. The
+ \c contacs object is emptied before data is read into it to simplify the
+ file reading process. A more advanced method would be to read the contacts
+ into a temporary QMap object, and copy over non-duplicate contacts into
+ \c contacts.
+
\snippet examples/addressbook-sdk/part6/addressbook.cpp loadFromFile part3
+ To display the contacts that have been read from the file, we must first
+ validate the data obtained to ensure that the file we read from actually
+ contains address book contacts. If it does, we display the first contact;
+ otherwise, we display a QMessageBox to inform the user about the problem.
+ Lastly, we update the interface to enable and disable the push buttons
+ accordingly.
+
*/