examples/QtQuick/nfcshareappqml/qml/nfcshareappqml/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.1
00041 import com.nokia.symbian 1.1
00042 
00043 // Main window of the example.
00044 PageStackWindow {
00045     id: mainWindow
00046     showStatusBar: true
00047     ToolBarLayout {
00048         id: commonTools
00049         ToolButton {
00050             flat: true
00051             iconSource: "toolbar_back.svg"           
00052             onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
00053         }
00054         ToolButton {
00055             flat: true
00056             iconSource: "toolbar_options.svg"
00057             onClicked: pageStack.depth <= 1 ? pageMenu.open() : pageStack.pop()
00058         }
00059     }
00060 
00061     Page {
00062          id: helppage
00063          tools: commonTools
00064         
00065          // Page heading
00066          PageHeading {
00067                 id: help
00068             anchors.top: parent.top
00069             width: parent.width
00070             text: qsTr("Help")
00071          }
00072           
00073         TextArea {
00074             anchors.top: help.bottom
00075             width: parent.width
00076             height: parent.height - 5
00077                 text: "Select Start Easy Setup menu option, \n" +
00078                   "holding the NFC enabled devices close, to communicate over NFC channel.\n\n" + 
00079                   "It will detect the device and will display the device info.\n\n" +
00080                   "Select Start EasySetupAndPair menu option to" +
00081                   "detect the device and pair with it.\n\n" +
00082                   "Select Share menu option, \n" +
00083                   "to prepare the device for sharing files.\n" +
00084                   "Share request is not dependent on Easy setup requests,\n" +
00085                   "they can be used directly.\n\n" +
00086                   "Select Cancel request menu option, \n" +
00087                   "to cancel any of the NFC requests \n Eg: Easy setup, Easy SetupAndPair and Share.\n\n" +
00088                   "Once sharing is started, you can\n use the menu options to share files.\n\n" +
00089                   "Select Share File menu option, to share a file.\n\n" +
00090                   "Select Share Files menu option, to share multiple files.\n"  
00091             readOnly: true   
00092         }
00093     }
00094     
00095     Page {
00096         id: aboutpage
00097         tools: commonTools
00098         
00099         // Page heading
00100         PageHeading{
00101                 id: about
00102             anchors.top: parent.top
00103             width: parent.width
00104             text: qsTr("About")
00105         }
00106         
00107         
00108         Text {
00109             anchors.top: about.bottom
00110             width: parent.width
00111             height: parent.height
00112                 text: " NFC Sharing application, Ver 1.0" + 
00113             "\n\n Copyright (c) 2010 Nokia.\n All rights reserved"  
00114             color: "white"          
00115         }
00116     }
00117     
00118     Page {
00119         id: mainpage
00120         tools: commonTools
00121         
00122         // Page heading
00123         PageHeading{
00124                 id: heading
00125             anchors.top: parent.top
00126             width: parent.width
00127             text: qsTr("Nfc share Example")
00128         }
00129         
00130         
00131         TextArea {
00132             id: displayInfo
00133             anchors.top: heading.bottom
00134             anchors.topMargin: 10
00135             font.pointSize: 8
00136             anchors.left: parent.left
00137             anchors.leftMargin: 10
00138             anchors.right: parent.right
00139             anchors.rightMargin: 10
00140             width: parent.width
00141             anchors.bottomMargin: 10
00142             anchors.bottom: parent.bottom
00143             readOnly: true
00144             text: "Click the menu option."
00145         }
00146 
00147         // Menu for the example.
00148         Menu {
00149             id: pageMenu
00150 
00151             content:
00152             Column {
00153                 width: pageMenu.width
00154 
00155                 MenuItem {
00156                     id: menu1
00157                     text: qsTr("Start Easy Setup")
00158                     onClicked:{
00159                         nfcshareex.startEasySetup();
00160                         pageMenu.close();
00161                     }
00162                 }
00163 
00164                 MenuItem {
00165                     id: menu2
00166                     text: qsTr("Start Easy SetupAndPair")
00167                     onClicked:{
00168                         nfcshareex.startEasySetupAndPair();
00169                         pageMenu.close();
00170                     }
00171                 }
00172 
00173                 MenuItem {
00174                     id: menu3
00175                     text: qsTr("Share File")
00176                     onClicked:{
00177                         nfcshareex.shareFile();
00178                         pageMenu.close();
00179                     }
00180                 }
00181 
00182                 MenuItem {
00183                     id: menu4
00184                     text: qsTr("Share Files")
00185                     onClicked:{
00186                         nfcshareex.shareFiles();
00187                         pageMenu.close();
00188                     }
00189                 } 
00190                 
00191                 MenuItem {
00192                     id: menu5
00193                     text: qsTr("Cancel")
00194                     onClicked:{
00195                         nfcshareex.cancel();
00196                         pageMenu.close();
00197                     }
00198                 }   
00199                                    
00200                 MenuItem {
00201                     id: menu6
00202                     text: qsTr("Clear text")
00203                     onClicked:{
00204                         displayInfo.text = ""
00205                         nfcshareex.clear();
00206                         pageMenu.close();
00207                     }
00208                 }
00209                 
00210                 MenuItem {
00211                     id: menu7
00212                     text: qsTr("Help")
00213                     onClicked:{
00214                         pageStack.push(helppage)
00215                         pageMenu.close();
00216                     }
00217                 }
00218                 
00219                 MenuItem {
00220                     id: menu8
00221                     text: qsTr("About")
00222                     onClicked:{
00223                         pageStack.push(aboutpage);
00224                         pageMenu.close();
00225                     }
00226                 }
00227 
00228                 }
00229         }
00230 
00231 
00232         // Listen to connections, update the display text.
00233         Connections {
00234             target: nfcshareex
00235             onDisplayText: {
00236                 displayInfo.text = aText;
00237             }
00238         }
00239     }
00240 
00241     
00242     Component.onCompleted: {
00243         pageStack.push(mainpage)
00244     }
00245 
00246 }
00247 

Generated by  doxygen 1.6.2