examples/QtQuick/qmlnotifyfriends/qml/qmlnotifyfriends/AddContactPage.qml

00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation
00006 **
00007 **
00008 ** $QT_BEGIN_LICENSE:BSD$
00009 ** You may use this file under the terms of the BSD license as follows:
00010 **
00011 ** "Redistribution and use in source and binary forms, with or without
00012 ** modification, are permitted provided that the following conditions are
00013 ** met:
00014 **   * Redistributions of source code must retain the above copyright
00015 **     notice, this list of conditions and the following disclaimer.
00016 **   * Redistributions in binary form must reproduce the above copyright
00017 **     notice, this list of conditions and the following disclaimer in
00018 **     the documentation and/or other materials provided with the
00019 **     distribution.
00020 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
00021 **     the names of its contributors may be used to endorse or promote
00022 **     products derived from this software without specific prior written
00023 **     permission.
00024 **
00025 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00026 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00027 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00028 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00029 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00030 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00031 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00032 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00033 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00034 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00035 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00036 ** $QT_END_LICENSE$
00037 **
00038 ****************************************************************************/
00039 
00040 import QtQuick 1.0
00041 import com.nokia.symbian 1.0
00042 import QtMobility.contacts 1.1
00043 
00044 
00045 Page {
00046     tools: addContactTools
00047 
00048     // Contact details.
00049     Contact{
00050         id: myContact
00051 
00052          // Name of the contact.
00053          Name {
00054              firstName: contactName.text
00055              lastName: ""
00056          }
00057 
00058          // Phone number of the contact.
00059          PhoneNumber {
00060              number: contactNumber.text
00061              subTypes:[PhoneNumber.Mobile]
00062          }
00063     }
00064 
00065     // Enter the contact details.
00066     Column{
00067         id: contactDetails
00068         width:  parent.width
00069         anchors.top: parent.top
00070         anchors.topMargin: 10
00071         //height: parent.height
00072         spacing: 10
00073 
00074         Row{
00075             id: nameDetails
00076             spacing: 5
00077             Text{
00078                 text: "Name : "
00079                 color: "white"
00080                 width: 100
00081                 font.pointSize: 8
00082             }
00083 
00084             // Enter contact name.
00085             TextField{
00086                 id: contactName
00087                 width: 200
00088                 font.pointSize: 8
00089                 text:""
00090             }
00091         }
00092 
00093         Row{
00094             id: phoneDetails
00095             spacing: 5
00096             Text{
00097                 text: "Phone: "
00098                 color: "white"
00099                 width: 100
00100                 font.pointSize: 8
00101 
00102             }
00103 
00104             // Enter contact phone number.
00105             TextField{
00106                 id: contactNumber
00107                 text:""
00108                 width: 200
00109                 font.pointSize: 8
00110             }
00111         }
00112 
00113 
00114         Row{
00115             id: emailDetails
00116             spacing: 5
00117             Text{
00118                 text: "Email ID: "
00119                 color: "white"
00120                 width: 100
00121                 font.pointSize: 8
00122             }
00123 
00124             // Enter email id of the contact.
00125             TextField{
00126                 id: contactEmail
00127                 text:""
00128                 width: 200
00129                 font.pointSize: 9
00130             }
00131         }
00132 
00133        // This option adds the new user to the contacts database.
00134        Button{
00135            id: doneOption
00136            width: parent.width
00137            height: 60
00138            text: "Done"
00139            onClicked: {
00140                if(!((contactName.text == "") && (contactNumber.text == "")) )
00141                contactsPage.myContacts.saveContact(myContact);
00142                pageStack.pop();
00143            }
00144        }
00145     }
00146 
00147     ToolBarLayout {
00148         id: addContactTools
00149         ToolButton {
00150             flat: true
00151             iconSource: "toolbar_back.svg"
00152             onClicked: pageStack.pop()
00153         }
00154         ToolButton {
00155             flat: true
00156             iconSource: "toolbar_options.svg"
00157         }
00158     }
00159 
00160 }
00161 
00162 

Generated by  doxygen 1.6.2