examples/QtQuick/telephonysuppleservices/qml/telephonysuppleservices/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 Qt 4.7
00041 
00042 import QtQuick 1.0
00043 import com.nokia.symbian 1.0
00044 
00045 //main application window
00046 ApplicationWindow {
00047     id: window
00048 
00049     function setStateIfFound(target, name) {
00050         for (var i = 0; i < target.states.length; i++) {
00051             var curState = target.states[i];
00052             if(curState.name == name) {
00053                 target.state = name
00054                 break
00055             }
00056         }
00057     }
00058 
00059 
00060     ToolBarLayout {
00061         id: commonTools
00062 
00063         ToolButton {
00064             flat: true
00065             iconSource: "qrc:/qtg_toolbar_back.svg"
00066             onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
00067         }
00068 
00069         ToolButton {
00070             flat: true
00071             iconSource: "qrc:/qtg_toolbar_options.svg"
00072             onClicked:
00073             {
00074                  viewMenu.open()
00075             }
00076         }
00077     }
00078 
00079     Page {
00080         id: page
00081         anchors.fill: parent
00082         tools: commonTools
00083 
00084         Component.onCompleted: {
00085             if(screen.currentOrientation == Screen.Portrait) {
00086                 setStateIfFound(page, "PortraitState")
00087             } else if(screen.currentOrientation == Screen.Landscape) {
00088                 setStateIfFound(page, "LandscapeState")
00089             }
00090         }
00091 
00092         Rectangle{
00093             id:rect
00094             anchors.fill: parent
00095             color:"grey"
00096         }
00097         PageHeading{
00098             id: heading
00099             anchors.top: parent.top
00100             width: parent.width
00101             text: qsTr("Telephony SupServices")
00102             fontItalic:true
00103         }
00104         //Text to display the status of recorder.
00105         Text {
00106                 id:displayStatus
00107                 text: ""
00108                 font.family: "Helvetica"
00109                 font.pointSize: 8
00110                 color: "black"
00111                 font.italic :true
00112                 width: 80
00113                 height: 40
00114                 y:(window.height/2- 100)
00115                 anchors.rightMargin: parent.right
00116                }
00117 
00118         Menu{
00119             id: viewMenu
00120 
00121                 content:
00122                 Column{
00123                 MenuItem {
00124                     text: "Call bar status"
00125 
00126                     onClicked:
00127                     {
00128 
00129                         supservices.getCallBarringStatus();
00130                         viewMenu.close()
00131                     }
00132                 }
00133                 MenuItem { text: "Call forward status"
00134                     onClicked:
00135                     {
00136                         supservices.getCallForwardingStatus();
00137                         viewMenu.close()
00138                     }
00139                 }
00140                 MenuItem { text: "Caller identity status"
00141                     onClicked:
00142                     {
00143                         supservices.getCallerIdentityStatus();
00144                         viewMenu.close()
00145                     }
00146                 }
00147                 MenuItem { text: "Call wait status"
00148                     onClicked:
00149                     {
00150                         supservices.getCallWaitingStatus();
00151                         viewMenu.close()
00152                     }
00153                 }
00154 
00155             }
00156 
00157         }
00158 
00159 
00160         Connections {
00161             target: supservices
00162             onPrintMessage:
00163             {
00164                 displayStatus.text = supservices.showResponse();
00165 
00166             }
00167 
00168         }
00169 
00170     }
00171 
00172     Component.onCompleted: pageStack.push(page)
00173 }

Generated by  doxygen 1.6.2