examples/QtQuick/qmlcontactslist/qml/qmlcontactslist/main.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 ApplicationWindow{
00045     id: mainWindow
00046 
00047 
00048 
00049     ToolBarLayout {
00050         id: contactsTools
00051         ToolButton {
00052             flat: true
00053             iconSource: "toolbar_back.svg"
00054             onClicked: Qt.quit()
00055         }
00056         ToolButton {
00057             flat: true
00058             iconSource: "toolbar_options.svg"
00059         }
00060     }
00061 
00062 
00063     Page {
00064         id: page
00065         tools: contactsTools
00066 
00067 
00068         Component {
00069             id: heading
00070 
00071             PageHeading {
00072                 id: headingText
00073                 width: parent.width
00074                 text: qsTr("Phone Contacts List")
00075             }
00076         }
00077 
00078         // ContactModel element, intialise it with Phone memory as manager.
00079         ContactModel{
00080             id: myContactModel
00081             manager: "symbian"
00082             autoUpdate: true
00083         }
00084 
00085         /*
00086           The graphics system is set to 'raster' in the main.cpp file.
00087           - raster paint engine is slower than the OpenVG.
00088           - It is observed, that the default OpenVG engine renders graphics at
00089             60Fps, whereas raster paint is observed to do it at 15Fps.
00090           The Qt application, graphics systems can only be changed before application
00091           starts.
00092 
00093           This is a list view of sim contacts, kinetic scrolling of the contacts should
00094           be showing a difference when raster paint is used in comparison to OpenVG
00095           */
00096         ListView{
00097             id: myContactList
00098             header: heading
00099             anchors.fill: parent
00100             model: myContactModel
00101             delegate:
00102                 Rectangle{
00103                 width: parent.width
00104                 height: 75
00105                 color: "black"
00106                 border.color: "grey"
00107                 Column{
00108                     anchors.top: parent.top
00109                     anchors.topMargin: 5
00110                     anchors.left: parent.left
00111                     anchors.leftMargin: 5
00112                     width: parent.width
00113                     height: parent.height
00114                     Text{
00115                         color: "white"
00116                         text: {(contact.name.firstName + contact.name.lastName == "")
00117                               ? contact.displayLabel : contact.name.firstName +
00118                                 contact.name.lastName }
00119 
00120                         font.pointSize: 9
00121                         font.bold: true
00122                     }
00123 
00124                     Text{
00125                         color: "white"
00126                         text: contact.phoneNumber.number
00127                         font.pointSize: 7
00128                     }
00129 
00130                 }
00131 
00132             }
00133 
00134 
00135             spacing: 5
00136             clip: true
00137             highlightMoveDuration: 500
00138 
00139 
00140             ScrollDecorator {
00141                 flickableItem: parent
00142             }
00143 
00144         }
00145     }
00146 
00147     Component.onCompleted: pageStack.push(page)
00148 }
00149 
00150 

Generated by  doxygen 1.6.2