1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import QtQuick 1.0
- import com.nokia.symbian 1.0
- // use the NfcSettings class (/nfcsettings/nfcsettings.h)
- import NfcSettings 1.0
- // for InfoBanner
- import com.nokia.extras 1.0
- Window {
- id: window
- NfcSettings {
- id: nfcSettings
- onNfcErrorOccurred: {
- // hadle settings reading errors
- banner.text = "NFC error " + error.toString() + " occured on " + nfcError.toString()
- banner.open();
- console.log(banner.text);
- }
- onNfcModeChanged: {
- // react to NFC mode changes
- // e.g. disable NFC features when the radio is turned off
- if(nfcSettings.nfcMode == NfcSettings.NfcModeOn)
- banner.text = "NFC mode: on"
- else if (nfcSettings.nfcMode == NfcSettings.NfcModeOff)
- banner.text = "NFC mode: off"
- banner.open();
- console.log(banner.text);
- }
- }
- InfoBanner {
- id: banner
- }
- StatusBar {
- id: statusBar
- anchors.top: window.top
- }
- Text {
- id: mainText
- text: "Hello World!"
- width: parent.width-40;
- anchors.centerIn: parent
- color: platformStyle.colorNormalLight
- font.pixelSize: 20
- wrapMode: Text.Wrap
- }
- ToolBar {
- id: toolBar
- anchors.bottom: window.bottom
- tools: ToolBarLayout {
- id: toolBarLayout
- ToolButton {
- flat: true
- iconSource: "toolbar-back"
- onClicked: Qt.quit()
- }
- }
- }
- Component.onCompleted: {
- if(nfcSettings.nfcFeature == NfcSettings.NfcFeatureSupportedViaFirmwareUpdate)
- {
- // if your app depends on having NFC support, show message then exit
- mainText.text = qsTr("FirmwareUpdateMandatory");
- // Qt.quit();
- // if your application can work even without NFC support, show message then continue
- mainText.text = qsTr("FirmwareUpdateRecommended");
- }
- }
- }
|