--- /dev/null
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Symbian and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemsources = $${item}.sources
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+symbian {
+ isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg
+ isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ android {
+ installPrefix = /assets
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !android: !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ !android {
+ target.path = $${installPrefix}/bin
+ } else {
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+ }
+ export(target.path)
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (TARGET.EPOCHEAPSIZE)
+export (TARGET.CAPABILITY)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+QtObject {
+ id: root
+ property bool checked: false
+ property variant value: null
+ property QtObject exclusiveGroup: null
+ property bool enabled: false
+
+ onEnabledChanged: {
+ if (!enabled) {
+ exclusiveGroup = null;
+ checked = false;
+ }
+ }
+
+ function toggle() {
+ if (!enabled)
+ return;
+ if (!exclusiveGroup) {
+ checked = !checked;
+ } else {
+ // In an exclusive group, there is no 'checked = false'. The invariant
+ // of the group doesn't allow to "uncheck" the checked item. Note that
+ // the group watches for changes in the checked variable of its items.
+ checked = true;
+ }
+ }
+
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup) {
+ enabled = true;
+ // Note that we don't need to remove the previous group,
+ // since it is watching the 'exclusiveGroup' property changes
+ // in this item and will automatically remove us.
+ exclusiveGroup.__add(root);
+ }
+ }
+
+ Component.onDestruction: {
+ // If there's a previous group, it will be watching for
+ // this change and will remove this item.
+ exclusiveGroup = null;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This file contains the implementation of CheckableGroup.qml functionality,
+// and CheckableGroup root element is identified by 'root'.
+
+var items = [];
+var selectedItem = null;
+var completed = false;
+
+
+function add(item) {
+ // Add the item, and if it's the case, check it as well.
+ items.push(item);
+ if (item.checked) {
+ check(item);
+ } else if (items.length == 1 && completed) {
+ // If we are already completed, this enforces the invariant of
+ // having always one item checked in the group. For exception
+ // case see onCompleted() function.
+ check(item);
+ }
+
+ // Connect so we know when items left the group or are requesting
+ // a different state (check or uncheck). Note that we register
+ // passing the item to be the 'this' value when the function
+ // is called.
+ item.exclusiveGroupChanged.connect(item, onItemExclusiveGroupChange);
+ item.checkedChanged.connect(item, onItemCheckedChange);
+}
+
+function onItemExclusiveGroupChange() {
+ var item = this;
+ if (item.checkGroup !== root) {
+ remove(item);
+ }
+}
+
+function onItemCheckedChange() {
+ var item = this;
+
+ // In those two cases we know the change was caused by the group, so we can ignore it.
+ if ((item === selectedItem && item.checked) ||
+ (item !== selectedItem && !item.checked)) {
+ return;
+ }
+
+ if (item.checked) {
+ // A non-selected item was checked, so we do the real check.
+ check(item);
+ } else if (items.length == 1) {
+ // Only one item, and it was unchecked. We have to rollback
+ // because it would break the group invariant.
+ //
+ // NOTE: This cause a glitch in the item.checked variable that
+ // goes false then true, however the CheckableGroup.selectedValue
+ // remains unchanged. We could avoid this with a custom setter
+ // in the 'checked' property of an item.
+ item.checked = true;
+ } else {
+ // The selected item was unchecked, choose another one to check.
+ var idx = (items.indexOf(item) + 1) % items.length
+ check(items[idx]);
+ }
+}
+
+function remove(item) {
+ // Remove the item from the list
+ var idx = items.indexOf(item);
+ if (idx == -1) {
+ console.log("Error: removing an invalid item.");
+ return;
+ }
+ items.splice(idx, 1);
+
+ item.exclusiveGroupChanged.disconnect(item, onItemExclusiveGroupChange);
+ item.checkedChanged.disconnect(item, onItemCheckedChange);
+
+ // If we are removing the selected item, we need to find a
+ // replacement to be selected...
+ if (selectedItem === item) {
+ selectedItem = null;
+ if (items.length > 0) {
+ var otherIdx = idx % items.length;
+ check(items[otherIdx]);
+ } else {
+ // ...or simply having no selectedValue.
+ root.selectedValue = null;
+ }
+ }
+}
+
+/// Select one item, setting the selectedValue in the group
+function check(item) {
+ // It is important to have the right item in the 'selectedItem'
+ // before the changes since we use that to identify that the change
+ // was made by us.
+ var oldSelectedItem = selectedItem
+ selectedItem = item;
+ if (oldSelectedItem)
+ oldSelectedItem.checked = false;
+ item.checked = true;
+ root.selectedValue = item.value;
+}
+
+function onCompleted() {
+ completed = true;
+
+ // When the QML file is loaded, and no items on it had 'checkable: true' (which
+ // would be considered in the add() function), then we simply select one of them
+ // to enforce the rule of having one item selected.
+ //
+ // The delayed selection is useful because it allow to declare in the QML file
+ // one item as 'checked' and don't see a "glitch" in the selectedValue because
+ // another item was added before to the group (and could be selected if this was
+ // not delayed).
+ if (!selectedItem && items.length > 0) {
+ check(items[0]);
+ }
+}
+
+function clear() {
+ var itemsLength = items.length;
+ for (var i = 0; i < itemsLength; i++) {
+ var item = items[i];
+ item.exclusiveGroupChanged.disconnect(item, onItemExclusiveGroupChange);
+ item.checkedChanged.disconnect(item, onItemCheckedChange);
+ item.exclusiveGroup = null;
+ }
+
+ items = [];
+ selectedItem = null;
+ root.selectedValue = null;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+import "CheckableGroup.js" as Private
+
+QtObject {
+ id: root
+ property variant selectedValue
+
+ // This is equivalent to setting the group of all the items
+ // to null, but without causing glitches in the selectedValue.
+ function clear() { Private.clear(); }
+
+ function __add(item) { Private.add(item); }
+
+ Component.onCompleted: {
+ Private.onCompleted();
+ }
+}
--- /dev/null
+plugin qtcomponentsplugin_1_1
+Checkable 1.1 Checkable.qml
+CheckableGroup 1.1 CheckableGroup.qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+
+ // Common API
+ default property alias content: contentField.children
+
+ // Common API inherited from Popup:
+ /*
+ function open()
+ function close()
+
+ property QDeclarativeItem* visualParent
+ property int status
+ */
+
+ // platformStyle API
+ property Style platformStyle: MenuStyle{}
+ property alias style: root.platformStyle // Deprecated
+ property alias platformTitle: titleBar.children
+ property alias title: titleBar.children // Deprecated
+ property alias __footer: footerBar.children
+
+ // private api
+ property int __statusBarDelta: visualParent ? 0 :
+ __findItem( "appWindowContent") != null ? 0 :
+ __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").showStatusBar ? 36 : 0
+
+ property string __animationChief: "abstractMenu"
+ property int __pressDelay: platformStyle.pressDelay
+ property alias __statesWrapper: statesWrapper
+ property alias __menuPane: menuPane
+
+ // This item will find the object with the given objectName ... or will return
+ function __findItem( objectName ) {
+ var next = parent;
+
+ if (next != null) {
+ while (next) {
+ if(next.objectName == objectName){
+ return next;
+ }
+
+ next = next.parent;
+ }
+ }
+
+ return null;
+ }
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+ __faderBackground: platformStyle.faderBackground
+ __fadeInEasingType: platformStyle.fadeInEasingType
+ __fadeOutEasingType: platformStyle.fadeOutEasingType
+
+ anchors.fill: parent
+
+ // When application is minimized menu is closed.
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ if(!platformWindow.active)
+ close()
+ }
+ }
+
+ // This is needed for menus which are not instantiated inside the
+ // content window of the PageStackWindow:
+ Item {
+ id: roundedCorners
+ visible: root.status != DialogStatus.Closed && !visualParent
+ && __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").platformStyle.cornersVisible
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: parent.height - __statusBarDelta - 2
+ z: 10001
+
+ // compensate for the widening of the edges of the fader (which avoids artefacts during rotation)
+ anchors.topMargin: +1
+ anchors.rightMargin: +1
+ anchors.bottomMargin: +1
+ anchors.leftMargin: +1
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ // Shadows:
+ Image {
+ anchors.top : menuPane.top
+ anchors.right: menuPane.left
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.bottom : menuPane.top
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.top
+ anchors.left: menuPane.right
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.bottom
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ visible: root.status != DialogStatus.Closed
+ }
+
+ Item {
+ id: menuPane
+ //ToDo: add support for layoutDirection Qt::RightToLeft
+ x: platformStyle.leftMargin
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: (screen.currentOrientation == 1) || (screen.currentOrientation == 4) ?
+ /* Portrait */ titleBar.height + flickableContent.height + footerBar.height :
+ /* Landscape */ parent.height - platformStyle.topMargin - platformStyle.bottomMargin - __statusBarDelta
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+
+ state: __statesWrapper.state
+
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ root.platformStyle.background
+ anchors.fill : parent
+ border { left: 22; top: theme.inverted ? 124 : 22;
+ right: 22; bottom: theme.inverted ? 2 : 22 }
+ }
+
+ // this item contains the whole menu (content rectangle)
+ Item {
+ id: backgroundRect
+ anchors.fill: parent
+
+ Item {
+ id: titleBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: childrenRect.height
+ }
+
+ Item {
+ // Required to have the ScrollDecorator+Flickable handled
+ // by the column as a single item while keeping the
+ // ScrollDecorator working
+ id: flickableContent
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height
+ property int maxHeight : visualParent
+ ? visualParent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : root.parent
+ ? root.parent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : 350
+
+ height: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding < maxHeight
+ ? contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ : maxHeight
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentWidth: parent.width
+ contentHeight: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ interactive: contentHeight > flickable.height
+ flickableDirection: Flickable.VerticalFlick
+ pressDelay: __pressDelay
+ clip: true
+
+ Item {
+ id: contentRect
+ height: contentField.childrenRect.height
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.topMargin: platformStyle.topPadding
+ anchors.bottomMargin: platformStyle.bottomPadding
+ anchors.leftMargin: platformStyle.leftPadding
+ anchors.rightMargin: platformStyle.rightPadding
+
+ Item {
+ id: contentField
+ anchors.fill: contentRect
+
+ function closeMenu() { root.close(); }
+ }
+ }
+ }
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: flickable
+ }
+ }
+
+ Item {
+ id: footerBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height + flickableContent.height
+ height: childrenRect.height
+ }
+
+ }
+ }
+
+ onPrivateClicked: close() // "reject()"
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 0.0
+ }
+ }
+ ]
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+PageStackWindow {
+
+ Component.onCompleted: {
+ print("Warning: ApplicationWindow is deprecated, use PageStackWindow instead");
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: "image://theme/meegotouch-applicationpage-background"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var children = []
+
+function cleanup()
+{
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ item.widthChanged.disconnect(relayout);
+ item.heightChanged.disconnect(relayout);
+ item.visibleChanged.disconnect(relayout);
+ }
+
+ children = [];
+}
+
+function updateChildren()
+{
+ cleanup();
+
+ var length = row.children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = row.children[i];
+
+ item.widthChanged.connect(relayout);
+ item.heightChanged.connect(relayout);
+ item.visibleChanged.connect(relayout);
+
+ children.push(item);
+ }
+
+ relayout();
+}
+
+function relayout()
+{
+ var ix = 0;
+ var ih = 0;
+
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ if (!item.visible)
+ continue;
+
+ item.x = ix;
+ item.y = 0;
+ ih = Math.max(ih, item.height);
+ ix += item.width;
+ }
+
+ row.width = ix;
+ row.height = ih;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "BasicRow.js" as Private
+
+/*
+ This element should be used in place of the Row element to
+ avoid visual artifacts during the relayout operation.
+
+ The QML Row element updates its children position using a
+ singleShot, so a paint operation could happen before the items
+ are positioned in the right place.
+
+ This element reposition its children immediately to avoid this,
+ so it's recommended to be used with just a few elements, since
+ it's not optimized.
+
+ This element can be removed when the following bug is solved:
+ http://bugreports.qt.nokia.com/browse/QTBUG-18919
+*/
+
+Item {
+ id: row
+
+ onChildrenChanged: Private.updateChildren();
+ Component.onCompleted: Private.updateChildren();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+import "UIConstants.js" as UI
+import "TextAreaHelper.js" as AreaHelper
+
+// ### Display Entered / Exited! Pause animation when not "on display".
+// ### LayoutDirection
+
+ImplicitSizeItem {
+ id: root
+
+ property bool running: false
+
+ property Style platformStyle: BusyIndicatorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.size == "small" ? 24 : platformStyle.size == "medium" ? 32 : 96;
+ implicitHeight: implicitWidth
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ Image {
+ id: spinner
+ property int index: 1
+ source: root.platformStyle.spinnerFrames + "_" + root.implicitWidth + "_" + index
+ smooth: true
+
+ NumberAnimation on index {
+ from: 1; to: root.platformStyle.numberOfFrames
+ duration: root.platformStyle.period
+ running: root.running && root.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ }
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + root.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + root.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property string size: "medium"
+ property int period: 1000
+
+ property int numberOfFrames: 10
+
+ __invertedString: inverted? "inverted" : "" // The spinner frames do not follow the common inverted file naming :(
+
+ property url spinnerFrames: "image://theme/spinner"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: button
+
+ // Common public API
+ property bool checked: false
+ property bool checkable: false
+ property alias pressed: mouseArea.pressed
+ property alias text: label.text
+ property url iconSource
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ signal clicked
+
+ // Used in ButtonGroup.js to set the segmented look on the buttons.
+ property string __buttonType
+
+ // Styling for the Button
+ property Style platformStyle: ButtonStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: button.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+ width: implicitWidth
+
+ property alias font: label.font
+
+ //private property
+ property bool __dialogButton: false
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+ right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+
+ source: __dialogButton ? (pressed ? button.platformStyle.pressedDialog : button.platformStyle.dialog) :
+ !enabled ?
+ (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+ pressed ?
+ button.platformStyle.pressedBackground :
+ checked ?
+ button.platformStyle.checkedBackground :
+ button.platformStyle.background;
+ }
+
+ Image {
+ id: icon
+ anchors.left: label.visible ? parent.left : undefined
+ anchors.leftMargin: label.visible ? UI.MARGIN_XLARGE : 0
+ anchors.centerIn: label.visible ? undefined : parent
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -1
+
+ source: button.iconSource
+
+ visible: source != ""
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: icon.visible ? icon.right : parent.left
+ anchors.leftMargin: icon.visible ? UI.PADDING_XLARGE : UI.BUTTON_LABEL_MARGIN
+ anchors.right: parent.right
+ anchors.rightMargin: UI.BUTTON_LABEL_MARGIN
+
+ horizontalAlignment: icon.visible ? Text.AlignLeft : button.platformStyle.horizontalAlignment
+ elide: Text.ElideRight
+
+ font.family: button.platformStyle.fontFamily
+ font.weight: checked ? button.platformStyle.checkedFontWeight : button.platformStyle.fontWeight
+ font.pixelSize: button.platformStyle.fontPixelSize
+ font.capitalization: button.platformStyle.fontCapitalization
+ color: !enabled ? button.platformStyle.disabledTextColor :
+ pressed ? button.platformStyle.pressedTextColor :
+ checked ? button.platformStyle.checkedTextColor :
+ button.platformStyle.textColor;
+ text: ""
+ visible: text != ""
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors {
+ fill: parent
+ rightMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-left") ? platformStyle.mouseMarginRight : 0
+ leftMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-right") ? platformStyle.mouseMarginLeft : 0
+ topMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-bottom") ? platformStyle.mouseMarginTop : 0
+ bottomMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-top") ? platformStyle.mouseMarginBottom : 0
+ }
+ onClicked: if (button.checkable) button.checked = !button.checked
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Column {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ width: UI.BUTTON_WIDTH
+
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Vertical,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "vertical-top",
+ "middlePos": "vertical-center",
+ "lastPos": "vertical-bottom",
+ "resizeChildren": function(self) {
+ Private.buttons.forEach(function(item, i) {
+ if (Private.isButton(item) && item.visible) {
+ item.anchors.left = self.left;
+ item.anchors.right = self.right;
+ }
+ });
+ }
+ });
+ }
+
+ Component.onDestruction: {
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is shared between ButtonRow.qml and ButtonColumn.qml.
+
+var self = undefined;
+var checkedButton = null;
+var buttons = [];
+var firstVisible = -1;
+var lastVisible = -1;
+var visibleButtons = 0;
+var buttonHandlers = [];
+var styleComponent = undefined;
+var params = undefined;
+
+function isButton(item) {
+ return (item && item.hasOwnProperty("__buttonType"));
+}
+
+function hasChecked(item) {
+ return (item && item.hasOwnProperty("checked"));
+}
+
+function cleanup() {
+ buttons.forEach(function(button, i) {
+ if (button.visible && params.exclusive) {
+ button.checkedChanged.disconnect(buttonHandlers[i]);
+ }
+ if (isButton(button))
+ button.visibleChanged.disconnect(buttonVisibleChanged);
+ });
+ buttons = [];
+ buttonHandlers = [];
+}
+
+function updateButtons() {
+ cleanup();
+
+ params.exclusive = self.exclusive;
+
+ checkedButton = null;
+ var length = self.children.length;
+ for (var i = 0; i < length; i++) {
+ var item = self.children[i];
+ if (!hasChecked(item))
+ continue;
+ buttons.push(item);
+
+ item.visibleChanged.connect(buttonVisibleChanged);
+
+ if (item.checked) {
+ if (!checkedButton && (self.checkedButton === item || self.checkedButton == undefined))
+ checkedButton = item;
+ else if (params.exclusive && self.checkedButton != item)
+ item.checked = false;
+ } else if (self.checkedButton === item) {
+ if (checkedButton && params.exclusive)
+ checkedButton.checked = false;
+ checkedButton = item;
+ item.checked = true;
+ }
+
+ if (isButton(item)) {
+ if (styleComponent)
+ item.platformStyle = styleComponent.createObject(item)
+
+ // Only ButtonRow supports tab buttons and care about screen orientation
+ if (params.orientation == Qt.Horizontal && item.platformStyle.hasOwnProperty("screenOrientation"))
+ switch (screen.currentOrientation) {
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ item.platformStyle.screenOrientation = "portrait";
+ break;
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ item.platformStyle.screenOrientation = "landscape";
+ break;
+ }
+ }
+ if (params.exclusive) {
+ if (item["checkable"] !== undefined)
+ item.checkable = true;
+ var last = buttonHandlers.push(checkExclusive(item));
+ item.checkedChanged.connect(buttonHandlers[last - 1]);
+ }
+ }
+
+ if (!checkedButton && buttons.length > 0 && params.exclusive) {
+ checkedButton = buttons[0];
+ checkedButton.checked = true;
+ }
+ self.checkedButton = checkedButton;
+
+ buttonVisibleChanged();
+}
+
+var blockCheckedChanged = false;
+
+function checkExclusive(item) {
+ var button = item;
+ return function() {
+ if (blockCheckedChanged)
+ return;
+ if (!button.checked) {
+ if (self.checkedButton === button) {
+ blockCheckedChanged = true;
+ button.checked = true;
+ blockCheckedChanged = false;
+ }
+ return;
+ }
+ if (self.checkedButton === button)
+ return;
+ if (self.checkedButton) {
+ blockCheckedChanged = true;
+ self.checkedButton.checked = false;
+ blockCheckedChanged = false;
+ }
+ checkedButton = button;
+ self.checkedButton = button;
+ }
+}
+
+function checkedButtonChanged() {
+ if (checkedButton === self.checkedButton)
+ return;
+ blockCheckedChanged = true;
+ if (params.exclusive && checkedButton)
+ checkedButton.checked = false;
+ if (self.checkedButton)
+ self.checkedButton.checked = true;
+ blockCheckedChanged = false;
+ checkedButton = self.checkedButton;
+}
+
+function buttonVisibleChanged() {
+ visibleButtons = 0;
+ firstVisible = -1;
+ lastVisible = -1;
+ buttons.forEach(function (button, i) {
+ if (button.visible) {
+ if (firstVisible === -1)
+ firstVisible = i;
+ lastVisible = i;
+ visibleButtons++;
+ }
+ });
+
+ updateGroupPosition();
+ resizeChildren();
+}
+
+function updateGroupPosition() {
+ if (visibleButtons === 0)
+ return;
+
+ // Fix the children group position
+ if (visibleButtons == 1) {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.singlePos;
+ } else {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.firstPos;
+ for (var i = firstVisible + 1; i < lastVisible; i++) {
+ if (buttons[i].visible && isButton(buttons[i]))
+ buttons[i].platformStyle.position = params.middlePos;
+ }
+ if (isButton(buttons[lastVisible]))
+ buttons[lastVisible].platformStyle.position = params.lastPos;
+ }
+}
+
+var resizing = false; // resizeChildren() may trigger reentrant calls
+
+function resizeChildren() {
+ if (resizing || visibleButtons === 0)
+ return;
+
+ if (typeof params.resizeChildren === "function") {
+ resizing = true;
+ params.resizeChildren(self);
+ resizing = false;
+ }
+}
+
+function create(s, p) {
+ if (!s) {
+ console.log("Error creating ButtonGroup: invalid owner.");
+ return;
+ }
+ if (!s.hasOwnProperty("checkedButton")) {
+ console.log("Error creating ButtonGroup: owner has no 'checkedButton' property.");
+ return;
+ }
+
+ self = s;
+ params = p;
+
+ styleComponent = params.styleComponent;
+
+ if (styleComponent && styleComponent.status != Component.Ready) {
+ console.log("Error loading style:", styleComponent.errorString());
+ return
+ }
+
+ updateButtons();
+ self.checkedButtonChanged.connect(checkedButtonChanged);
+ self.childrenChanged.connect(updateButtons);
+ self.exclusiveChanged.connect(Private.updateButtons);
+ self.widthChanged.connect(resizeChildren);
+}
+
+function destroy() {
+ if (self) {
+ self.checkedButtonChanged.disconnect(checkedButtonChanged);
+ self.childrenChanged.disconnect(updateButtons);
+ self.widthChanged.disconnect(resizeChildren);
+ self = undefined;
+ }
+ if (styleComponent) {
+ styleComponent.destroy();
+ styleComponent = undefined;
+ }
+ cleanup();
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Row {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ property int __screenWidth: (screen.rotation === 0 || screen.rotation === 180 ? screen.displayWidth : screen.displayHeight) - 2 * UI.MARGIN_XLARGE
+ property int __visibleButtons
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __maxButtonSize: UI.BUTTON_WIDTH
+
+ width: Math.min(__visibleButtons * UI.BUTTON_WIDTH, __screenWidth)
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Horizontal,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "horizontal-left",
+ "middlePos": "horizontal-center",
+ "lastPos": "horizontal-right",
+ "resizeChildren": function(self) {
+ self.__visibleButtons = Private.visibleButtons;
+ var extraPixels = self.width % Private.visibleButtons;
+ var buttonSize = Math.min(__maxButtonSize, (self.width - extraPixels) / Private.visibleButtons);
+ Private.buttons.forEach(function(item, i) {
+ if (!item || !item.visible || !Private.isButton(item))
+ return;
+ if (extraPixels > 0) {
+ item.width = buttonSize + 1;
+ extraPixels--;
+ } else {
+ item.width = buttonSize;
+ }
+ });
+ }
+ });
+ screen.currentOrientationChanged.connect(Private.updateButtons);
+ }
+
+ Component.onDestruction: {
+ screen.currentOrientationChanged.disconnect(Private.updateButtons);
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int checkedFontWeight: Font.Bold
+ property int horizontalAlignment: Text.AlignHCenter
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ property color disabledTextColor: UI.COLOR_BUTTON_DISABLED_FOREGROUND
+ property color checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Dimensions
+ property int buttonWidth: UI.BUTTON_WIDTH
+ property int buttonHeight: UI.BUTTON_HEIGHT
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+
+ // Background
+ property int backgroundMarginRight: 22
+ property int backgroundMarginLeft: 22
+ property int backgroundMarginTop: 22
+ property int backgroundMarginBottom: 22
+
+ /* The position property can take one of the following values:
+
+ [horizontal-left] [horizontal-center] [horizontal-right]
+
+ [vertical-top]
+ [vertical-center]
+ [vertical-bottom]
+ */
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-button" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ property url disabledBackground: "image://theme/meegotouch-button" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+ property url checkedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ property url checkedDisabledBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-disabled-selected" + (position ? "-" + position : "")
+ property url dialog: "image://theme/meegotouch-dialog-button-negative"
+ property url pressedDialog: "image://theme/meegotouch-dialog-button-negative-pressed"
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: checkbox
+
+ property Style platformStyle: CheckBoxStyle{}
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: checkbox.platformStyle
+
+ property string text
+ property bool checked: false
+ property bool pressed
+ signal clicked
+
+ implicitWidth: image.width + body.spacing + label.implicitWidth
+ implicitHeight: body.height
+
+ onWidthChanged: if (width > 0 && width != implicitWidth)
+ label.width = checkbox.width - body.spacing - image.width
+
+ Binding {
+ target: checkbox
+ property: "pressed"
+ value: mouseArea.pressed && mouseArea.containsMouse
+ }
+
+ property alias __imageSource: image.source
+
+ function __handleChecked() {
+ checkbox.checked = !checkbox.checked;
+ }
+
+ Row {
+ id: body
+ spacing: 15
+
+ BorderImage {
+ id: image
+ smooth: true
+
+ width: 42; height: 42
+
+ source: !checkbox.enabled ? platformStyle.backgroundDisabled :
+ checkbox.pressed ? platformStyle.backgroundPressed :
+ checkbox.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: image.verticalCenter
+ text: checkbox.text
+ elide: checkbox.platformStyle.elideMode
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: body
+ anchors.topMargin: platformStyle.mouseMarginTop
+ anchors.leftMargin: platformStyle.mouseMarginLeft
+ anchors.rightMargin: platformStyle.mouseMarginRight
+ anchors.bottomMargin: platformStyle.mouseMarginBottom
+
+ onPressed: {
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("pressOnFeedback");
+ // else
+ // meegostyle.feedback("pressOffFeedback");
+ }
+
+ onClicked: {
+ __handleChecked();
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("releaseOnFeedback");
+ // else
+ // meegostyle.feedback("releaseOffFeedback");
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-checkbox"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Dialog {
+ id: genericDialog
+
+ property string titleText: ""
+
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: genericDialog.platformStyle
+
+ //private
+ property bool __drawFooterLine: false
+
+ title: Item {
+ id: header
+ height: genericDialog.platformStyle.titleBarHeight
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ Item {
+ id: labelField
+
+ anchors.fill: parent
+
+ Item {
+ id: labelWrapper
+ anchors.left: labelField.left
+ anchors.right: closeButton.left
+
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin
+
+ //anchors.verticalCenter: labelField.verticalCenter
+
+ height: titleLabel.height
+
+ Label {
+ id: titleLabel
+ x: genericDialog.platformStyle.titleBarIndent
+ width: parent.width - closeButton.width
+ //anchors.baseline: parent.bottom
+ font: genericDialog.platformStyle.titleBarFont
+ color: genericDialog.platformStyle.commonLabelColor
+ elide: genericDialog.platformStyle.titleElideMode
+ text: genericDialog.titleText
+ }
+
+ }
+
+ Image {
+ id: closeButton
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin-6
+ //anchors.verticalCenter: labelField.verticalCenter
+ anchors.right: labelField.right
+
+ opacity: closeButtonArea.pressed ? 0.5 : 1.0
+
+ source: "image://theme/icon-m-common-dialog-close"
+
+ MouseArea {
+ id: closeButtonArea
+ anchors.fill: parent
+ onClicked: {genericDialog.reject();}
+ }
+
+ }
+
+ }
+
+ Rectangle {
+ id: headerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.bottom: header.bottom
+
+ height: 1
+
+ color: "#4D4D4D"
+ }
+
+ }
+
+ content: Item {id: contentField}
+
+ buttons: Item {
+ id: footer
+
+ width: parent.width
+ height: childrenRect.height
+
+ //hack to make sure, we're evaluating the correct height
+ Item {
+ id: lineWrapper
+ width: parent.width
+ height: childrenRect.height
+ y: 10
+
+ Rectangle {
+ id: footerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ height: genericDialog.__drawFooterLine ? 1 : 0
+
+ color: "#4D4D4D"
+ }
+ }
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ Item {id: dummy; anchors.fill: parent}
+
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+
+ // API
+ property string platformTitleText
+ property string titleText
+ property url platformIcon
+ property url icon
+
+ // platformStyle API
+ property Style platformStyle: ContextMenuStyle{}
+ property Style style: ContextMenuStyle{}
+
+ onPlatformTitleTextChanged: logDeprecatedMsg("platformTitleText")
+ onTitleTextChanged: logDeprecatedMsg("titleText")
+ onPlatformIconChanged: logDeprecatedMsg("platformIcon")
+ onIconChanged: logDeprecatedMsg("iconChanged")
+ onPlatformStyleChanged: logDeprecatedMsg("platformStyle")
+ onStyleChanged: logDeprecatedMsg("style")
+
+ function logDeprecatedMsg(name) {
+ console.log("Warning: " + name + " is deprecated");
+ }
+
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+MenuStyle {
+ id: root
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_SMALL
+ property int titleFontCapitalization: Font.MixedCase
+ property color titleTextColor: "white"
+
+ property int titleBarHeight: 56
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.OutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property string faderBackground: "image://theme/meegotouch-menu-dimmer"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+ objectName: "baseDialog"
+
+ // API
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+
+ signal accepted
+ signal rejected
+
+ property Style platformStyle: DialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property string __animationChief: "baseDialog"
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ // true: center of the content field is center of the background rect
+ // false: the whole dialog is centered
+ property bool __centerContentField: false
+
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: titleBar.height + contentField.height + buttonRow.height
+
+ anchors.centerIn: parent
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ // this item contains the whole dialog (title bar + content rectangle, button row)
+ Item {
+ id: backgroundRect
+
+ height: root.height
+ width: root.width
+
+ anchors.centerIn: root
+
+ // center the whole dialog, not just the content field
+ transform: Translate {
+ id: contentTranslation
+ y: root.__centerContentField ? 0 : (titleBar.height - buttonRow.height) / 2
+ }
+
+
+ // title bar
+ Item {
+ id: titleBar
+
+ width: root.width
+ height: childrenRect.height
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: contentField.top
+
+ // animate over bottomMargin (i.e. the distance between the content field)
+ anchors.bottomMargin: 0
+
+ }
+
+ //content area
+ Item {
+ id: contentField
+
+ anchors.left: parent.left
+ //anchors.right: parent.right
+
+ anchors.horizontalCenter: backgroundRect.horizontalCenter
+ anchors.verticalCenter: backgroundRect.verticalCenter
+
+ height: childrenRect.height
+
+ transform: Scale {
+ id: contentScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(root, root.width / 2, root.height / 2).x
+ origin.y: mapFromItem(root, root.width / 2, root.height / 2).y
+
+ }
+
+ }
+
+ //button row
+ Item {
+ id: buttonRow
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: contentField.bottom
+
+ // animate over topMargin (i.e. the distance between the content field)
+ anchors.topMargin: 0
+
+ height: childrenRect.height
+ }
+
+ }
+
+ onPrivateClicked: reject()
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ // needed for button and title bar animation
+ // without resetting the button row's/title bar's coordinate system would be translated
+ property int __buttonSaver: buttonRow.y
+ property int __titleSaver: titleBar.y
+
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Opening || status == DialogStatus.Open)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Closing || status == DialogStatus.Closed)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ backgroundRect.opacity = 1.0;
+ root.opacity = 1.0
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ // With a 100ms delay the background fades to alpha 0% (500ms, quint ease out).
+ // --> done in the fader
+
+ PropertyAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+ PropertyAnimation { target: backgroundRect; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // The closing transition starts with the title and both lines dimming to
+ // alpha 0% and moving 100 pixels in Y axis towards the center (125ms,
+ // quint ease in). With no delay the list fades to alpha 0% and scales to
+ // 80% (anchorpoint in the middle of the list, 100ms, quint ease in).
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint }
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: buttonRow
+ properties: "anchors.topMargin"
+ from: 0
+ to: -100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ PropertyAnimation {target: titleBar
+ properties: "anchors.topMargin"
+ from: 0
+ to: 100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+ // make sure, root isn't visible:
+ backgroundRect = 0.0;
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0;
+ titleBar.opacity = 0.0;
+ contentField.opacity = 0.0;
+ buttonRow.opacity = 0.0;
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in). --> Done inside the fader
+
+ ParallelAnimation {
+ SequentialAnimation {
+ // a 250ms delay from the beginning
+ PauseAnimation { duration: 250 }
+ // the list scales from 80% to 100% and alpha 0%
+ // to 100% (anchorpoint in the middle of the list, 250ms, expo ease out)
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 0.0; to: 1.0; duration: 250}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 250; easing.type: Easing.OutExpo}
+ }
+ }
+ SequentialAnimation {
+ // a 200ms delay from the beginning
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ //the title and both lines come from alpha 0%
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ // and move towards the edges (40 pixels in Y axis
+ // away from their final destination, 450ms, custom ease).
+ PropertyAnimation {target: buttonRow; properties: "anchors.topMargin"
+ from: -40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+ PropertyAnimation {target: titleBar; properties: "anchors.bottomMargin"
+ from: 40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property real leftMargin: 88
+ property real rightMargin: 88
+ property real topMargin: 45
+ property real bottomMargin: 16
+ property bool centered: false
+
+ property int titleBarHeight: 56
+ property color titleBarColor: "white"
+ property int titleElideMode: Text.ElideRight
+
+ property int buttonsTopMargin: 10
+ property int buttonsBottomMargin: 0
+ property int buttonsColumnSpacing: 10
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // m
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+Qt.include("UIConstants.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("EditBubble.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared edit bubble for a given input item.
+
+ All operations and changes will be binded to the
+ given item.
+*/
+function open(input,position)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ // Position when text not selected.
+ popup.position = position;
+
+ // need to set before checking capabilities
+ popup.textInput = input;
+
+ if (popup.valid)
+ popup.state = "opened";
+ else
+ popup.textInput = null;
+
+ return popup.textInput != null;
+}
+
+/*
+ Close the shared edit bubble for a given input item.
+*/
+function close(input)
+{
+ if (!popup || !input || popup.textInput != input)
+ return false;
+
+ return closePopup(popup);
+}
+
+/*
+ Check if the shared edit bubble is opened for the
+ given input item.
+*/
+function isOpened(input)
+{
+ return (popup && popup.textInput == input);
+}
+
+/*
+ Check if the bubble is in the middle of a text
+ change operation.
+*/
+function isChangingInput()
+{
+ return (popup && popup.privateRect.changingText);
+}
+
+/*
+ Close a given edit bubble.
+*/
+function closePopup(bubble)
+{
+ if (bubble == null || bubble.textInput == null)
+ return false;
+
+ bubble.state = "closed";
+ bubble.textInput = null;
+ return true;
+}
+
+/*
+ Adjust EditBubble position to fit in the visible area.
+
+ If no argument is passed, it will adjust the shared
+ bubble position if already initialized.
+*/
+function adjustPosition(bubble)
+{
+ if (bubble === undefined)
+ bubble = popup;
+
+ if (bubble == null)
+ return;
+
+ var input = bubble.textInput;
+ var rect = bubble.privateRect;
+ var viewport = rect.parent;
+
+ if (viewport == null || input == null)
+ return;
+
+ var irect = input.positionToRectangle(input.selectionStart);
+ var frect = input.positionToRectangle(input.selectionEnd);
+ var mid = rect.width / 2;
+
+ if (input.selectionStart == input.selectionEnd) {
+ irect.x = popup.position.x;
+ irect.y = popup.position.y;
+ frect.x = popup.position.x;
+ frect.y = popup.position.y;
+ }
+
+ var ipoint = viewport.mapFromItem(input, irect.x, irect.y);
+ var fpoint = viewport.mapFromItem(input, frect.x, frect.y);
+
+ var px = ipoint.x + (fpoint.x - ipoint.x) / 2 - mid;
+ var py = ipoint.y - rect.height;
+
+ var SHADOW_SIZE = 6
+
+ rect.x = Math.min(Math.max(px, MARGIN_XLARGE - SHADOW_SIZE), viewport.width - rect.width);
+
+ if (py > SHADOW_SIZE) {
+ rect.y = py - SHADOW_SIZE;
+ rect.arrowDown = true;
+ } else {
+ rect.y = Math.min(Math.max(ipoint.y + irect.height, 0),
+ fpoint.y + frect.height);
+ rect.arrowDown = false;
+ }
+
+ var boundX = mid - rect.arrowBorder;
+ rect.arrowOffset = Math.min(Math.max(-boundX, px - rect.x), boundX);
+}
+
+function updateButtons(row)
+{
+ var children = row.children;
+ var visibleItems = new Array();
+
+ for (var i = 0, j = 0; i < children.length; i++) {
+ var child = children[i];
+
+ if (child.visible)
+ visibleItems[j++] = child;
+ }
+
+ for (var i = 0; i < visibleItems.length; i++) {
+ if (visibleItems.length == 1)
+ visibleItems[i].platformStyle.position = "";
+ else {
+ if (i == 0)
+ visibleItems[i].platformStyle.position = "horizontal-left";
+ else if (i == visibleItems.length - 1)
+ visibleItems[i].platformStyle.position = "horizontal-right";
+ else
+ visibleItems[i].platformStyle.position = "horizontal-center";
+ }
+ }
+}
+
+function geometry()
+{
+ if (popup == null)
+ return;
+
+ var bubbleContent = popup.privateRect;
+ var rect = {"left": bubbleContent.pos.x,
+ "right": bubbleContent.pos.x + bubbleContent.width,
+ "top": bubbleContent.pos.y,
+ "bottom": bubbleContent.pos.y + bubbleContent.height};
+
+ return rect;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "Utils.js" as Utils
+import "EditBubble.js" as Private
+
+Item {
+ id: bubble
+
+ property Item textInput: null
+ property bool valid: rect.canCut || rect.canCopy || rect.canPaste
+
+ property alias privateRect: rect
+
+ property Style platformStyle: EditBubbleStyle {}
+
+ property variant position: Qt.point(0,0)
+
+ anchors.fill: parent
+
+ Item {
+ id: rect
+ visible: false
+ width: row.width
+ height: row.height
+
+ property int arrowOffset: 0
+ property int arrowBorder: platformStyle.arrowMargin
+ property bool arrowDown: true
+ property bool changingText: false
+ property bool pastingText: false
+
+ property bool validInput: textInput != null
+ property bool canCut: rect.canCopy && !textInput.readOnly
+
+ // TextEdit will have echoMode == null
+ property bool canCopy: textSelected && (textInput.echoMode == null || textInput.echoMode == TextInput.Normal)
+ property bool canPaste: validInput && (textInput.canPaste && !textInput.readOnly)
+ property bool textSelected: validInput && (textInput.selectedText != "")
+
+ z: 1020
+
+ onWidthChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ onHeightChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ BasicRow {
+ id: row
+ Component.onCompleted: Private.updateButtons(row);
+
+ EditBubbleButton {
+ id: buttonCut
+ text: textTranslator.translate("qtn_comm_cut");
+ visible: rect.canCut
+ onClicked: {
+ rect.changingText = true;
+ textInput.cut();
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonCopy
+ text: textTranslator.translate("qtn_comm_copy");
+ visible: rect.canCopy
+ onClicked: {
+ textInput.copy();
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonPaste
+ text: textTranslator.translate("qtn_comm_paste");
+ visible: rect.canPaste
+ onClicked: {
+ rect.changingText = true;
+ if (textInput.inputMethodComposing) {
+ var cursorAdjust = textInput.preedit.length - textInput.preeditCursorPosition;
+ inputContext.reset();
+ textInput.cursorPosition -= cursorAdjust;
+ }
+ rect.pastingText = true;
+ var text = textInput.text;
+ textInput.paste();
+ // PastingText is set to false and clipboard is cleared if we catch onTextChanged
+ if (rect.pastingText && text == textInput.text) {
+ var root = Utils.findRootItemNotificationBanner(textInput);
+
+ // create notification banner
+ var bannerInstance = notificationBanner.createObject(root);
+ bannerInstance.show();
+ bannerInstance.timerEnabled = true;
+ rect.pastingText = false;
+ }
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ Component {
+ id : notificationBanner
+ NotificationBanner{
+ id: errorBannerPrivate
+ text: textTranslator.translate("qtn_comm_cantpaste");
+ timerShowTime: 5*1000
+ topMargin: 8
+ leftMargin: 8
+ }
+ }
+ }
+
+ Image {
+ source: platformStyle.bottomTailBackground
+ visible: rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.bottom
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+
+ Image {
+ source: platformStyle.topTailBackground
+ visible: !rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.top
+ anchors.bottomMargin: -platformStyle.backgroundMarginBottom - 2
+
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+ }
+
+ state: "closed"
+
+ states: [
+ State {
+ name: "opened"
+ ParentChange { target: rect; parent: Utils.findRootItem(textInput); }
+ PropertyChanges { target: rect; visible: true; }
+ },
+ State {
+ name: "closed"
+ ParentChange { target: rect; parent: bubble; }
+ PropertyChanges { target: rect; visible: false; }
+ }
+ ]
+
+ Connections {
+ target: Utils.findFlickable(textInput)
+ onContentYChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: screen
+ onCurrentOrientationChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: textInput
+ onTextChanged: {
+ if (rect.pastingText) {
+ inputContext.clearClipboard();
+ rect.pastingText = false;
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+BorderImage {
+ id: button
+
+ signal clicked()
+ property alias text: label.text
+ property bool selected: false
+
+ property Style platformStyle: EditBubbleButtonStyle {}
+
+ width: label.width + platformStyle.buttonPaddingLeft +
+ platformStyle.buttonPaddingRight +
+ platformStyle.backgroundMarginLeft +
+ platformStyle.backgroundMarginRight
+ height: platformStyle.buttonHeight +
+ platformStyle.backgroundMarginTop +
+ platformStyle.backgroundMarginBottom
+
+ source: {
+ if (mouseArea.pressed)
+ return platformStyle.pressedBackground;
+
+ // XXX: meegotouch-text-editor-selected image is missing
+ if (selected && platformStyle.position != "")
+ return platformStyle.checkedBackground;
+ else
+ return platformStyle.background;
+ }
+
+ border {
+ left: platformStyle.backgroundMarginLeft
+ top: platformStyle.backgroundMarginTop
+ right: platformStyle.backgroundMarginRight
+ bottom: platformStyle.backgroundMarginBottom
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+
+ color: platformStyle.textColor
+
+ font.family: platformStyle.fontFamily
+ font.weight: platformStyle.fontWeight
+ font.pixelSize: platformStyle.fontPixelSize
+ font.capitalization: platformStyle.fontCapitalization
+
+ style: platformStyle.textStyle
+ styleColor: platformStyle.textStyleColor
+ }
+
+ MouseArea {
+ id: mouseArea
+ enabled: button.enabled
+ anchors {
+ fill: parent
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ rightMargin: platformStyle.mouseMarginRight
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Normal
+
+ // Text
+ property color textColor: "black"
+ property int textStyle: Text.Sunken
+ property color textStyleColor: "#111111"
+
+ // Dimensions
+ property int buttonWidth: 40 // DEPRECATED
+ property int buttonPaddingLeft: 8
+ property int buttonPaddingRight: 8
+ property int buttonHeight: 56
+
+ // Mouse
+ property real mouseMarginLeft: (position == "horizontal-left") ? 6 : 0
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: (position == "horizontal-right") ? 6 : 0
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 19
+ property int backgroundMarginTop: 15
+ property int backgroundMarginRight: 19
+ property int backgroundMarginBottom: 15
+
+ // Position can take one of the following values:
+ // [horizontal-left] [horizontal-center] [horizontal-right]
+ property string position: ""
+
+ property string __suffix: (position ? "-" + position : "")
+
+ property url background: "image://theme/meegotouch-text-editor" + __suffix
+ property url pressedBackground: "image://theme/meegotouch-text-editor-pressed" + __suffix
+ property url checkedBackground: "image://theme/meegotouch-text-editor-selected" + __suffix
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Mouse
+ property real mouseMarginLeft: 6
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: 6
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 0
+ property int backgroundMarginTop: 0
+ property int backgroundMarginRight: 0
+ property int backgroundMarginBottom: 14 // XXX: need to crop images
+
+ property int arrowMargin: 16 // XXX: need to crop images
+
+ // Images
+ property url topTailBackground: "image://theme/meegotouch-text-editor-top-tail"
+ property url bottomTailBackground: "image://theme/meegotouch-text-editor-bottom-tail"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+// Background dimming
+Rectangle {
+ id: faderBackground
+
+ property double dim: 0.9
+ property int fadeInDuration: 250
+ property int fadeOutDuration: 250
+
+ property int fadeInDelay: 0
+ property int fadeOutDelay: 0
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+ property url background: ""
+
+ property Item visualParent: null
+ property Item originalParent: parent
+
+ // widen the edges to avoid artefacts during rotation
+ anchors.topMargin: -1
+ anchors.rightMargin: -1
+ anchors.bottomMargin: -1
+ anchors.leftMargin: -1
+
+ // opacity is passed to child elements - that is not, what we want
+ // so we need to use alpha value here
+ property double alpha: dim
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ // we need the possibility to fetch the red, green, blue components from a color
+ // see http://bugreports.qt.nokia.com/browse/QTBUG-14731
+ color: background != "" ? "transparent" : Qt.rgba(0.0, 0.0, 0.0, alpha)
+ state: 'hidden'
+
+ anchors.fill: parent
+
+ // eat mouse events
+ MouseArea {
+ id: mouseEventEater
+ anchors.fill: parent
+ enabled: faderBackground.alpha != 0.0
+ onClicked: { parent.privateClicked() }
+ }
+
+ Component {
+ id: backgroundComponent
+ BorderImage {
+ id: backgroundImage
+ source: background
+
+ width: faderBackground.width
+ height: faderBackground.height
+
+ opacity: faderBackground.alpha
+ }
+ }
+ Loader {id: backgroundLoader}
+
+ onAlphaChanged: {
+ if (background && faderBackground.alpha && backgroundLoader.sourceComponent == undefined) {
+ backgroundLoader.sourceComponent = backgroundComponent;
+ }
+ if (!faderBackground.alpha) {
+ backgroundLoader.sourceComponent = undefined;
+ }
+ }
+
+ function findRoot() {
+ var next = parent;
+
+ if (next != null) {
+ while (next.parent) {
+ if(next.objectName == "appWindowContent" || next.objectName == "windowContent"){
+ break
+ }
+
+ next = next.parent;
+ }
+ }
+ return next;
+ }
+
+
+ states: [
+ State {
+ name: "visible"
+ PropertyChanges {
+ target: faderBackground
+ alpha: dim
+ }
+ },
+ State {
+ name: "hidden"
+ PropertyChanges {
+ target: faderBackground
+ alpha: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "hidden"; to: "visible"
+ //reparent fader whenever it is going to be visible
+ SequentialAnimation {
+ ScriptAction {script: {
+ //console.log("=============00=============");
+ // the algorithm works in the following way:
+ // First: Check if visualParent property is set; if yes, center the fader in visualParent
+ // Second: If not, center inside window content element
+ // Third: If no window was found, use root window
+ originalParent = faderBackground.parent;
+ if (visualParent != null) {
+ faderBackground.parent = visualParent
+ } else {
+ var root = findRoot();
+ if (root != null) {
+ faderBackground.parent = root;
+ } else {
+ // console.log("Error: Cannot find root");
+ }
+ }
+ }
+ }
+ PauseAnimation { duration: fadeInDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeInDuration
+ easing.type: faderBackground.fadeInEasingType;
+ }
+ }
+ },
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ PauseAnimation { duration: fadeOutDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeOutDuration
+ easing.type: faderBackground.fadeOutEasingType;
+ }
+ ScriptAction {script: {
+ faderBackground.parent = originalParent;
+ }
+ }
+ }
+ }
+ ]
+}
+
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ // This style is deprecated and will be removed
+ Component.onCompleted: print("GroupButtonStyle has been deprecated, please use ButtonStyle instead.")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Text {
+ id: root
+
+ // Styling for the Button
+ property Style platformStyle: LabelStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ font.family: platformStyle.fontFamily
+ font.pixelSize: platformStyle.fontPixelSize
+ color: platformStyle.textColor
+
+ wrapMode: Text.Wrap
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Color
+ property color textColor: inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("Magnifier.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared magnifier for a given input item.
+
+ input item will be used as a sourceItem for the shader
+ effect
+*/
+function open(input)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ popup.sourceItem = input;
+ popup.active = true;
+ return true;
+}
+
+/*
+ Check if the shared magnifier is opened
+*/
+function isOpened()
+{
+ return (popup && popup.active);
+}
+
+/*
+ Close and destroy the magnifier.
+*/
+function close()
+{
+ if (popup){
+ popup.active = false;
+ popup.destroy();
+ popup = null;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias sourceItem: effectSource.sourceItem
+ property real xCenter: 0 // in source item coordinates
+ property real yCenter: 0 // in source item coordinates
+
+ // Source rect is not as small as it can be as there is drawing problems
+ // with small source rect/texture size.
+ property real _realScaleFactor: 1.25
+ property real _sourceRectMultiplier: 2
+
+ property bool active: false
+
+ visible: active
+ width: 182
+ height: 211
+ z: Number.MAX_VALUE
+
+ function __rootElement() {
+ var ret = parent
+ while (ret.parent) {
+ ret = ret.parent
+ }
+ return ret
+ }
+
+ Component.onCompleted: {
+ sourceItem = parent;
+ declarativeView.setFullViewportMode(root);
+ }
+
+ ShaderEffectSource {
+ id: effectSource
+ sourceRect: Qt.rect(root.xCenter - textureSize.width / 2,
+ root.yCenter - textureSize.height / 2,
+ textureSize.width,
+ textureSize.height);
+ textureSize: Qt.size(root._sourceRectMultiplier * root.width,
+ root._sourceRectMultiplier * root.height);
+
+ hideSource: false
+ smooth: true
+
+ property real scaleFactor: root._sourceRectMultiplier * root._realScaleFactor
+ }
+
+ Image {
+ id: magnifierFrameImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierFrame
+ sourceItem: magnifierFrameImage
+ hideSource: true
+ live: false
+ }
+
+ Image {
+ id: magnifierMaskImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame-mask.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierMask
+ sourceItem: magnifierMaskImage
+ hideSource: true
+ live: false
+ }
+
+ ShaderEffectItem {
+ id: magnifier
+ anchors.fill:parent
+ visible: root.visible
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float scaleFactor;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ void main() {
+ qt_TexCoord0.x = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.x / scaleFactor;
+ qt_TexCoord0.y = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.y / scaleFactor;
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
+ }";
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D frame;
+ uniform lowp sampler2D mask;
+ void main() {
+ lowp vec4 frame_c = texture2D(frame, qt_TexCoord1);
+ lowp vec4 mask_c = texture2D(mask, qt_TexCoord1);
+ lowp vec4 color_c = texture2D(source, qt_TexCoord0);
+ bool outsideElement=(qt_TexCoord0.s<0. || qt_TexCoord0.s>1. || qt_TexCoord0.t<0. || qt_TexCoord0.t>1.);
+ bool onGlass=(mask_c.a==1.);
+
+ if (outsideElement) {
+ // make white outside the element
+ color_c=vec4(1.,1.,1.,1.);
+ } else if (onGlass) {
+ // blend premultiplied texture with pure white (background)
+ color_c = color_c + vec4(1.,1.,1.,1.) * (1.-color_c.a);
+ }
+
+ if ( qt_TexCoord1.y >= 0.98 ) {
+ // Top part of item above visible magnifier frame is made
+ // transparent explicitly to prevent showing of wrongly
+ // colored pixels, which would otherwise appear sometimes
+ // when using sourceRect functionality.
+ gl_FragColor = vec4(0.,0.,0.,0.);
+ } else {
+ gl_FragColor = onGlass ? color_c : frame_c;
+ }
+ }";
+
+ property variant source: effectSource
+ property variant frame: magnifierFrame
+ property variant mask: magnifierMask
+ property real scaleFactor: effectSource.scaleFactor;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+/*
+ platformTitle: BorderImage {
+ id: topDivider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 2
+ source: "" // "image://theme/meegotouch-button-objectmenu-background-vertical-top"
+ border { top: 2; bottom: 1; left: 1; right: 1 }
+ }
+*/
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// MenuItem is a component that is used in menus.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ // Common API
+ property string text
+ signal clicked
+ property alias pressed: mouseArea.pressed
+
+ // platformStyle API
+ property Style platformStyle: MenuItemStyle{
+ position: root.parent.children.length == 1 ? ""
+ : root.parent.children[0] == root ? "vertical-top"
+ : root.parent.children[root.parent.children.length-1] == root ? "vertical-bottom"
+ : "vertical-center"
+ }
+ property alias style: root.platformStyle // Deprecated
+
+ width: parent ? parent.width: 0
+ height: ( root.platformStyle.height == 0 ) ?
+ root.platformStyle.topMargin + menuText.paintedHeight + root.platformStyle.bottomMargin :
+ root.platformStyle.topMargin + root.platformStyle.height + root.platformStyle.bottomMargin
+/*
+ Rectangle {
+ id: backgroundRec
+ // ToDo: remove hardcoded values
+ color: pressed ? "darkgray" : "transparent"
+ anchors.fill : root
+ opacity : 0.5
+ }
+*/
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ pressed ? root.platformStyle.pressedBackground
+ : root.platformStyle.background
+ anchors.fill : root
+ border { left: 22; top: 22;
+ right: 22; bottom: 22 }
+ }
+
+ Text {
+ id: menuText
+ text: parent.text
+ elide: Text.ElideRight
+ font.family : root.platformStyle.fontFamily
+ font.pixelSize : root.platformStyle.fontPixelSize
+ font.weight: root.platformStyle.fontWeight
+ color: !root.enabled ? root.platformStyle.disabledTextColor :
+ root.pressed ? root.platformStyle.pressedTextColor :
+ root.platformStyle.textColor
+
+ anchors.topMargin : root.platformStyle.topMargin
+ anchors.bottomMargin : root.platformStyle.bottomMargin
+ anchors.leftMargin : root.platformStyle.leftMargin
+ anchors.rightMargin : root.platformStyle.rightMargin
+
+ anchors.top : root.platformStyle.centered ? undefined : root.top
+ anchors.bottom : root.platformStyle.centered ? undefined : root.bottom
+ anchors.left : root.left
+ anchors.right : root.right
+// anchors.centerIn : parent.centerIn
+ anchors.verticalCenter : root.platformStyle.centered ? parent.verticalCenter : undefined
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: { if (parent.enabled) parent.clicked();}
+ }
+
+ onClicked: if (parent) parent.closeLayout();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ id: root
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: 26 // UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int height: 80
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color disabledTextColor: "#797979"
+ property color checkedTextColor: UI.COLOR_INVERTED_FOREGROUND
+
+ property real leftMargin: 24
+ property real rightMargin: 24
+ property real topMargin: 0
+ property real bottomMargin: 0
+ property bool centered: true
+
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-list" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/meegotouch-list" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+// TODO: Add disabled state once the graphics are available
+// property url disabledBackground: "image://theme/meegotouch-list" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "."
+
+Item {
+ id: root
+ anchors.left: parent!==undefined?parent.left:undefined
+ anchors.right: parent!==undefined?parent.right:undefined
+ height: menuItemColumn.height
+
+ default property alias menuChildren: menuItemColumn.children
+
+ Column {
+ id: menuItemColumn
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: childrenRect.height
+
+ function closeLayout() {
+ root.parent.closeMenu();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+
+Style {
+ id: root
+
+ property real leftMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 427
+ property real rightMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 0
+ property real topMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 246 : 0
+
+ property real bottomMargin: 0
+
+ property real leftPadding: 16
+ property real rightPadding: 16
+ property real topPadding: 16
+ property real bottomPadding: 16
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 350 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.InOutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property url faderBackground: "image://theme/meegotouch-menu-dimmer"
+
+ property int pressDelay: 0 // ms
+
+ property url background: "image://theme/meegotouch-menu-background" + __invertedString
+// property url pressedBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-pressed"
+// property url disabledBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ color: "#FCBD00"
+ opacity: 0.5
+ anchors {
+ fill: parent
+ topMargin: parent.platformMouseAnchors.topMargin
+ bottomMargin: parent.platformMouseAnchors.bottomMargin
+ leftMargin: parent.platformMouseAnchors.leftMargin
+ rightMargin: parent.platformMouseAnchors.rightMargin
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function __isSelected( index ){
+ return __selectedIndexesHash[index]==true;
+}
+
+function __syncHash(){
+ var selectedIndexesHash = new Array()
+ var il = selectedIndexes.length;
+ for( var it = 0; it < il; ++it ){
+ selectedIndexesHash[selectedIndexes[it]]=true;
+ }
+ __selectedIndexesHash = selectedIndexesHash
+}
+
+function __toggleIndex( index ){
+ // A QML list can not be modified, so let's create a new array
+ var selectedArray = new Array;
+
+ var il = selectedIndexes.length;
+
+ // If selectedIndexes is empty then add the index and return.
+ if ( il == 0 ){
+ selectedArray.push(index);
+ selectedIndexes = selectedArray;
+ return;
+ }
+
+ // Check whether the list is sorted.
+ var isSorted = true;
+ var previousIndex = -1;
+
+ for( var it = 0; it < il; ++it ){
+ if ( previousIndex > selectedIndexes[it] ){
+ isSorted = false;
+ break;
+ }
+ previousIndex = selectedIndexes[it];
+ }
+
+ if (!isSorted){
+ // For unsorted selectedIndexes just append the index if it's not present yet.
+ var indexAvailable = false;
+ for( var it = 0; it < il; ++it ) {
+ if ( index == selectedIndexes[it] ){
+ indexAvailable = true;
+ }
+ else {
+ selectedArray.push(selectedIndexes[it]);
+ }
+ }
+ if (!indexAvailable){
+ selectedArray.push(index);
+ }
+ }
+ else{
+ previousIndex = -1;
+ // insert the index in a sorted way in between the existing indexes
+ for( var it = 0; it < il; ++it ) {
+ if ( previousIndex < index && index < selectedIndexes[it] ) {
+ selectedArray.push(index);
+ }
+ if ( index != selectedIndexes[it] ) {
+ selectedArray.push(selectedIndexes[it]);
+ }
+
+ previousIndex = selectedIndexes[it];
+ }
+ // If the index is the highest one append it
+ if (index > selectedIndexes[selectedIndexes.length - 1]){
+ selectedArray.push(index);
+ }
+ }
+ // Assign the new built array to selectedIndexes
+ selectedIndexes = selectedArray;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "MultiSelectionDialog.js" as MultiSelectionDialog
+
+CommonDialog {
+ id: root
+
+ property alias model: selectionListView.model
+ // Common API: property list<int> selectedIndexes (currently not possible due to QTBUG-10822)
+ property variant selectedIndexes: [] // read & write, variant is supposed to be list<int>
+ property alias acceptButtonText: acceptButton.text //Convenience wrapper on top of the buttons
+ property alias rejectButtonText: rejectButton.text //Convenience wrapper on top of the buttons
+ //property alias titleText: titleLabel.text
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: MultiSelectionDialog.__toggleIndex(index);
+ }
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+ property variant __selectedIndexesHash: []
+
+ QtObject {
+ id: backup
+ property variant oldSelectedIndexes: []
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ selectionListView.positionViewAtIndex(selectedIndexes[0], ListView.Center)
+ }
+ if (status == DialogStatus.Open)
+ backup.oldSelectedIndexes = selectedIndexes
+ }
+ onRejected: { selectedIndexes = backup.oldSelectedIndexes }
+
+ onSelectedIndexesChanged: {
+ MultiSelectionDialog.__syncHash();
+ }
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText: "Multi-Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : root.parent
+ ? root.parent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+
+ buttons: Item {
+ id: buttonRowFiller
+ width: parent.width
+ height: childrenRect.height //+ root.platformStyle.buttonsTopMargin
+ y: root.platformStyle.buttonsTopMargin
+
+ onWidthChanged: {
+ if (acceptButton.width + rejectButton.width > width) {
+ acceptButton.width = width / 2
+ rejectButton.width = width / 2
+ } else {
+ acceptButton.width = acceptButton.implicitWidth
+ rejectButton.width = rejectButton.implicitWidth
+ }
+ }
+
+ Row {
+ id: buttonRow
+ height: childrenRect.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ Button {
+ id: acceptButton
+ height: implicitHeight
+ objectName: "acceptButton"
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ height: implicitHeight
+ objectName: "rejectButton"
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+//import com.nokia.meego 1.0
+
+/*
+ Class: InfoBanner
+ The InfoBanner component is used to display information to the user. The number of lines of text
+ shouldn't exceed 3.
+*/
+
+Item {
+ id: root
+
+ /*
+ * Property: iconSource
+ * [url] The path to the icon image
+ */
+ property url iconSource: ""
+
+ /*
+ * Property: text
+ * [string] Text to be displayed in InfoBanner
+ */
+ property alias text: text.text
+
+ /*
+ * Property: timerEnabled
+ * [bool=true] Enable/disable timer that dismisses InfoBanner
+ */
+ property bool timerEnabled: true
+
+ /*
+ * Property: timerShowTime
+ * [int=3000ms] For setting how long InfoBanner stays visible to user before being dismissed
+ */
+ property alias timerShowTime: sysBannerTimer.interval
+
+ /*
+ * Property: topMargin
+ * [int=8 pix] Allows user to customize top margin if needed
+ */
+ property alias topMargin: root.y
+
+ /*
+ * Property: leftMargin
+ * [int=8 pix] Allows user to customize left margin if needed
+ */
+ property alias leftMargin: root.x
+
+ /*
+ * Function: show
+ * Show InfoBanner
+ */
+ function show() {
+ parent = __findParent();
+ animationShow.running = true;
+ if (root.timerEnabled)
+ sysBannerTimer.restart();
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent && next.objectName != "appWindowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ /*
+ * Function: hide
+ * Hide InfoBanner
+ */
+ function hide() {
+ animationHide.running = true;
+ }
+
+ implicitHeight: internal.getBannerHeight()
+ implicitWidth: internal.getBannerWidth()
+ x:8; y:8
+ scale: 0
+
+ BorderImage {
+ source: "image://theme/meegotouch-notification-system-background"
+ anchors.fill: root
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ opacity: 1
+ }
+
+ Image {
+ id: image
+ anchors { left: parent.left; leftMargin: 16; top: parent.top; topMargin: 16 }
+ source: root.iconSource
+ visible: root.iconSource != ""
+ }
+
+ Text {
+ id: text
+ width: internal.getTextWidth()
+ anchors { left: (image.visible ? image.right : parent.left); leftMargin: (image.visible ? 14:16);
+ top: parent.top; topMargin: internal.getTopMargin(); bottom: parent.bottom }
+ color: "white"
+ wrapMode: Text.Wrap
+ verticalAlignment: Text.AlignHCenter
+ font.pixelSize: 24
+ font.family: "Nokia Pure"
+ font.letterSpacing: -1.2
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ }
+
+ QtObject {
+ id: internal
+
+ function getBannerHeight() {
+ if (image.visible) {
+ if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ } else {
+ if (text.lineCount <= 1)
+ return 80; //64
+ else if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ }
+ }
+
+ function getBannerWidth() {
+ if ( screen.currentOrientation==Screen.Portrait || screen.currentOrientation==Screen.PortraitInverted ) {
+ // In portrait mode, the width of the banner is equal to the width of parent minus left
+ // and right margins in-between banner and parent.
+ return parent.width-root.x*2;
+ } else {
+ if (image.visible) {
+ // If an icon image is specified...
+ if ((image.width+text.paintedWidth+46) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 46 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of icon, text, and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width*0.54;
+ } else {
+ return parent.width-root.x*2;
+ }
+ } else {
+ // If no icon image specified...
+ if ((text.paintedWidth+32) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 32 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of text and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width-root.x*2;
+ } else {
+ return parent.width-root.x*2;
+ }
+ }
+ }
+ }
+
+ function getTopMargin() {
+ if (text.lineCount <= 1 && !image.visible) {
+ // If there's only one line of text and no icon image, top and bottom margins are equal.
+ return (root.height-text.paintedHeight)/2;
+ } else {
+ // In all other cases, top margin is 4 px more than bottom margin.
+ return (root.height-text.paintedHeight)/2 + 2;
+ }
+ }
+
+ function getTextWidth() {
+ // 46(32 when there's no icon) is sum of all margins within banner. root.x*2 is sum of margins outside banner.
+ // Text element width is dertermined by substracting parent width(screen width) by all the margins and
+ // icon width(if applicable).
+ return image.visible ? (parent.width-root.x*2-46-image.width) : (parent.width-root.x*2-32);
+ }
+
+ function getScaleValue() {
+ // When banner is displayed, as part of transition effect, it'll first be enlarged to the point where its width
+ // is equal to screen width. root.x*2/root.width calculates the amount of expanding required, where root.x*2 is
+ // equal to screen.displayWidth minus banner.width
+ return root.x*2/root.width + 1;
+ }
+ }
+
+ Timer {
+ id: sysBannerTimer
+ repeat: false
+ running: false
+ interval: 3000
+ onTriggered: hide()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide()
+ }
+
+ SequentialAnimation {
+ id: animationShow
+ NumberAnimation { target: root; property: "scale"; from: 0; to: internal.getScaleValue(); duration: 200; easing.type: Easing.OutQuad}
+ NumberAnimation { target: root; property: "scale"; from: internal.getScaleValue(); to: 1; duration: 200 }
+ }
+
+ NumberAnimation {
+ id: animationHide
+ target: root; property: "scale"; to: 0; duration: 200; easing.type: Easing.InExpo
+ }
+
+ Component.onCompleted: {
+ //__owner = parent;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The Page item is intended for use as a root item in QML items that make
+// up pages to use with the PageStack.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ visible: false
+
+ // Note we do not use anchor fill here because it will force us to relayout
+ // hidden children when rotating the screen as well
+ width: visible && parent ? parent.width - anchors.leftMargin - anchors.rightMargin : __prevWidth
+ height: visible && parent ? parent.height - anchors.topMargin - anchors.bottomMargin : __prevHeight
+ x: parent ? anchors.leftMargin : 0
+ y: parent ? anchors.topMargin : 0
+
+ onWidthChanged: __prevWidth = visible ? width : __prevWidth
+ onHeightChanged: __prevHeight = visible ? height : __prevHeight
+
+ property int __prevWidth: 0
+ property int __prevHeight: 0
+
+ property bool __isPage: true
+
+ anchors.margins: 0 // Page margins should generally be 16 pixels as defined by UI.MARGIN_XLARGE
+
+ // The status of the page. One of the following:
+ // PageStatus.Inactive - the page is not visible
+ // PageStatus.Activating - the page is transitioning into becoming the active page
+ // PageStatus.Active - the page is the current active page
+ // PageStatus.Deactivating - the page is transitioning into becoming inactive
+ property int status: PageStatus.Inactive
+
+ // Defines the tools for the page; null for none.
+ property Item tools: null
+
+ // The page stack that the page is in.
+ property PageStack pageStack
+
+ // Defines if page is locked in landscape.
+ property bool lockInLandscape: false // Deprecated
+ onLockInLandscapeChanged: console.log("warning: Page.lockInLandscape is deprecated, use Page.orientationLock")
+
+ // Defines if page is locked in portrait.
+ property bool lockInPortrait: false // Deprecated
+ onLockInPortraitChanged: console.log("warning: Page.lockInPortrait is deprecated, use Page.orientationLock")
+
+ // Defines orientation lock for a page
+ property int orientationLock: PageOrientation.Automatic
+
+ onStatusChanged: {
+ if (status == PageStatus.Activating) {
+ __updateOrientationLock()
+ }
+ }
+
+ onOrientationLockChanged: {
+ __updateOrientationLock()
+ }
+
+ function __updateOrientationLock() {
+ switch (orientationLock) {
+ case PageOrientation.Automatic:
+ screen.setAllowedOrientations(Screen.Portrait | Screen.Landscape);
+ break
+ case PageOrientation.LockPortrait:
+ screen.setAllowedOrientations(Screen.Portrait);
+ break
+ case PageOrientation.LockLandscape:
+ screen.setAllowedOrientations(Screen.Landscape);
+ break
+ case PageOrientation.LockPrevious:
+ // Allowed orientation should be changed to current
+ // if previously it was locked, it will remain locked
+ // if previously it was not locked, it will be locked to current
+ screen.setAllowedOrientations(screen.currentOrientation);
+ break
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Page stack. Items are page containers.
+var pageStack = [];
+
+// Page component cache map. Key is page url, value is page component.
+var componentCache = {};
+
+// Returns the page stack depth.
+function getDepth() {
+ return pageStack.length;
+}
+
+// Pushes a page on the stack.
+function push(page, properties, replace, immediate) {
+ // page order sanity check
+ if ((!replace && page == currentPage) ||
+ (replace && pageStack.length > 1 && page == pageStack[pageStack.length - 2].page)) {
+ throw new Error("Cannot navigate so that the resulting page stack has two consecutive entries of the same page instance.");
+ }
+
+ // figure out if more than one page is being pushed
+ var pages;
+ if (page instanceof Array) {
+ pages = page;
+ page = pages.pop();
+ if (page.createObject === undefined && page.parent === undefined && typeof page != "string") {
+ properties = properties || page.properties;
+ page = page.page;
+ }
+ }
+
+ // get the current container
+ var oldContainer = pageStack[pageStack.length - 1];
+
+ // pop the old container off the stack if this is a replace
+ if (oldContainer && replace) {
+ pageStack.pop();
+ }
+
+ // push any extra defined pages onto the stack
+ if (pages) {
+ var i;
+ for (i = 0; i < pages.length; i++) {
+ var tPage = pages[i];
+ var tProps;
+ if (tPage.createObject === undefined && tPage.parent === undefined && typeof tPage != "string") {
+ tProps = tPage.properties;
+ tPage = tPage.page;
+ }
+ pageStack.push(initPage(tPage, tProps));
+ }
+ }
+
+ // initialize the page
+ var container = initPage(page, properties);
+
+ // push the page container onto the stack
+ pageStack.push(container);
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ immediate = immediate || !oldContainer;
+ if (oldContainer) {
+ oldContainer.pushExit(replace, immediate);
+ }
+ container.pushEnter(replace, immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : replace ? "replace" : "push");
+ }
+
+ return container.page;
+}
+
+// Initializes a page and its container.
+function initPage(page, properties) {
+ var container = containerComponent.createObject(root);
+
+ var pageComp;
+ if (page.createObject) {
+ // page defined as component
+ pageComp = page;
+ } else if (typeof page == "string") {
+ // page defined as string (a url)
+ pageComp = componentCache[page];
+ if (!pageComp) {
+ pageComp = componentCache[page] = Qt.createComponent(page);
+ }
+ }
+ if (pageComp) {
+ if (pageComp.status == Component.Error) {
+ throw new Error("Error while loading page: " + pageComp.errorString());
+ } else {
+ // instantiate page from component
+ page = pageComp.createObject(container, properties || {});
+ }
+ } else {
+ // copy properties to the page
+ for (var prop in properties) {
+ if (properties.hasOwnProperty(prop)) {
+ page[prop] = properties[prop];
+ }
+ }
+ }
+
+ container.page = page;
+ container.owner = page.parent;
+
+ // the page has to be reparented if
+ if (page.parent != container) {
+ page.parent = container;
+ }
+
+ if (page.pageStack !== undefined) {
+ page.pageStack = root;
+ }
+
+ return container;
+}
+
+// Pops a page off the stack.
+function pop(page, immediate) {
+ // make sure there are enough pages in the stack to pop
+ if (pageStack.length > 1) {
+ // pop the current container off the stack and get the next container
+ var oldContainer = pageStack.pop();
+ var container = pageStack[pageStack.length - 1];
+ if (page !== undefined) {
+ // an unwind target has been specified - pop until we find it
+ while (page != container.page && pageStack.length > 1) {
+ container.cleanup();
+ pageStack.pop();
+ container = pageStack[pageStack.length - 1];
+ }
+ }
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ oldContainer.popExit(immediate);
+ container.popEnter(immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : "pop");
+ }
+
+ return oldContainer.page;
+ } else {
+ return null;
+ }
+}
+
+// Clears the page stack.
+function clear() {
+ var container;
+ while (container = pageStack.pop()) {
+ container.cleanup();
+ }
+ depth = 0;
+ currentPage = null;
+}
+
+// Iterates through all pages in the stack (top to bottom) to find a page.
+function find(func) {
+ for (var i = pageStack.length - 1; i >= 0; i--) {
+ var page = pageStack[i].page;
+ if (func(page)) {
+ return page;
+ }
+ }
+ return null;
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The PageStack item defines a container for pages and a stack-based
+// navigation model. Pages can be defined as QML items or components.
+
+import QtQuick 1.1
+import "." 1.0
+import "PageStack.js" as Engine
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // Page stack depth.
+ property int depth: Engine.getDepth()
+
+ // The currently active page.
+ property Item currentPage: null
+
+ // The application tool bar.
+ property ToolBar toolBar
+
+ // Indicates whether there is an ongoing page transition.
+ property bool busy: __ongoingTransitionCount > 0
+
+ // The number of ongoing transitions.
+ property int __ongoingTransitionCount: 0
+
+ // Pushes a page on the stack.
+ // The page can be defined as a component, item or string.
+ // If an item is used then the page will get re-parented.
+ // If a string is used then it is interpreted as a url that is used to load a page component.
+ //
+ // The page can also be given as an array of pages. In this case all those pages will be pushed
+ // onto the stack. The items in the stack can be components, items or strings just like for single
+ // pages. Additionally an object can be used, which specifies a page and an optional properties
+ // property. This can be used to push multiple pages while still giving each of them properties.
+ // When an array is used the transition animation will only be to the last page.
+ //
+ // The properties argument is optional and allows defining a map of properties to set on the page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance.
+ function push(page, properties, immediate) {
+ return Engine.push(page, properties, false, immediate);
+ }
+
+ // Pops a page off the stack.
+ // If page is specified then the stack is unwound to that page; null to unwind the to first page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance that was popped off the stack.
+ function pop(page, immediate) {
+ return Engine.pop(page, immediate);
+ }
+
+ // Replaces a page on the stack.
+ // See push() for details.
+ function replace(page, properties, immediate) {
+ return Engine.push(page, properties, true, immediate);
+ }
+
+ // Clears the page stack.
+ function clear() {
+ return Engine.clear();
+ }
+
+ // Iterates through all pages (top to bottom) and invokes the specified function.
+ // If the specified function returns true the search stops and the find function
+ // returns the page that the iteration stopped at. If the search doesn't result
+ // in any page being found then null is returned.
+ function find(func) {
+ return Engine.find(func);
+ }
+
+ // Called when the page stack visibility changes.
+ onVisibleChanged: {
+ if (currentPage) {
+ __setPageStatus(currentPage, visible ? PageStatus.Active : PageStatus.Inactive);
+ if (visible) {
+ currentPage.visible = currentPage.parent.visible = true;
+ }
+ }
+ }
+
+ // Sets the page status.
+ function __setPageStatus(page, status) {
+ if (page.status !== undefined) {
+ if (status == PageStatus.Active && page.status == PageStatus.Inactive) {
+ page.status = PageStatus.Activating;
+ } else if (status == PageStatus.Inactive && page.status == PageStatus.Active) {
+ page.status = PageStatus.Deactivating;
+ }
+ page.status = status;
+ }
+ }
+
+ // Component for page containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The page held by this container.
+ property Item page: null
+
+ // The owner of the page.
+ property Item owner: null
+
+ // Duration of transition animation (in ms)
+ property int transitionDuration: 500
+
+ // Flag that indicates the container should be cleaned up after the transition has ended.
+ property bool cleanupAfterTransition: false
+
+ // Performs a push enter transition.
+ function pushEnter(replace, immediate) {
+ if (!immediate) {
+ state = replace ? "front" : "right";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a push exit transition.
+ function pushExit(replace, immediate) {
+ state = immediate ? "hidden" : (replace ? "back" : "left");
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (replace) {
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+ }
+
+ // Performs a pop enter transition.
+ function popEnter(immediate) {
+ if (!immediate) {
+ state = "left";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a pop exit transition.
+ function popExit(immediate) {
+ state = immediate ? "hidden" : "right";
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+
+ // Called when a transition has started.
+ function transitionStarted() {
+ __ongoingTransitionCount++;
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Activating : PageStatus.Deactivating);
+ }
+ }
+
+ // Called when a transition has ended.
+ function transitionEnded() {
+ if (state != "") {
+ state = "hidden";
+ }
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Active : PageStatus.Inactive);
+ }
+ __ongoingTransitionCount--;
+ if (cleanupAfterTransition) {
+ cleanup();
+ }
+ }
+
+ states: [
+ // Explicit properties for default state.
+ State {
+ name: ""
+ PropertyChanges { target: container; visible: true }
+ },
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -width }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: width }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.5; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.5; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "left") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "left") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "right") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "right") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Replace entry transition.
+ Transition {
+ from: "front"; to: "";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ },
+ // Replace exit transition.
+ Transition {
+ from: ""; to: "back";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ }
+ ]
+
+ // Cleans up the container and then destroys it.
+ function cleanup() {
+ if (page.status == PageStatus.Active) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (owner != container) {
+ // container is not the owner of the page - re-parent back to original owner
+ page.visible = false;
+ page.parent = owner;
+ }
+ container.destroy();
+ }
+
+ }
+ }
+
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import "." 1.0
+
+Window {
+ id: window
+
+ property bool showStatusBar: true
+ property bool showToolBar: true
+ property bool toolBarOnTop: false
+ property variant initialPage
+ property alias pageStack: stack
+ property Style platformStyle: PageStackWindowStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: window.platformStyle
+
+ //private api
+ property int __statusBarHeight: showStatusBar ? statusBar.height : 0
+
+ objectName: "pageStackWindow"
+
+ StatusBar {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+ showStatusBar: window.showStatusBar
+ }
+
+ onOrientationChangeStarted: {
+ statusBar.orientation = screen.currentOrientation
+ }
+
+ Rectangle {
+ id: background
+ visible: platformStyle.background == ""
+ color: platformStyle.backgroundColor
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Image {
+ id: backgroundImage
+ visible: platformStyle.background != ""
+ source: window.inPortrait ? platformStyle.portraitBackground : platformStyle.landscapeBackground
+ fillMode: platformStyle.backgroundFillMode
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Item {
+ objectName: "appWindowContent"
+ width: parent.width
+ anchors.top: statusBar.bottom
+ anchors.bottom: parent.bottom
+
+ // content area
+ Item {
+ id: contentArea
+ anchors { top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; }
+ anchors.bottomMargin: !toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ anchors.topMargin: toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ PageStack {
+ id: stack
+ anchors.fill: parent
+ toolBar: toolBar
+ }
+ }
+
+ Item {
+ id: roundedCorners
+ visible: platformStyle.cornersVisible
+ anchors.fill: parent
+ z: 10001
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ ToolBar {
+ id: toolBar
+ anchors.top: toolBarOnTop ? parent.top: undefined
+ anchors.bottom: !toolBarOnTop ? parent.bottom: undefined
+ privateVisibility: (inputContext.softwareInputPanelVisible==true || inputContext.customSoftwareInputPanelVisible == true)
+ ? ToolBarVisibility.HiddenImmediately : (window.showToolBar ? ToolBarVisibility.Visible : ToolBarVisibility.Hidden)
+ }
+ }
+
+ // event preventer when page transition is active
+ MouseArea {
+ anchors.fill: parent
+ enabled: pageStack.busy
+ }
+
+ Component.onCompleted: {
+ if (initialPage) pageStack.push(initialPage);
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: ""
+
+ // Background color is used when no background is set.
+ property color backgroundColor: theme.inverted ? "#000000" : "#E0E1E2"
+
+ property url landscapeBackground: background
+ property url portraitBackground: background
+ property url portraiteBackground: background
+
+ property int backgroundFillMode: Image.Tile
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ // api
+ property alias visualParent: fader.visualParent
+
+ // possible states: Opening, Open, Closing, Closed
+ // Opening and Closing are used during animation (when the dialog fades/moves/pops/whatever in)
+ property int status: DialogStatus.Closed
+
+ // private api
+ property double __dim: 0.9
+ property int __fadeInDuration
+ property int __fadeOutDuration
+ property int __fadeInDelay
+ property int __fadeOutDelay
+ property int __fadeInEasingType
+ property int __fadeOutEasingType
+ property string __faderBackground
+
+ function open() {
+ if (status == DialogStatus.Closed)
+ status = DialogStatus.Opening;
+ }
+
+ function close() {
+ if (status == DialogStatus.Open)
+ status = DialogStatus.Closing;
+ }
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ QtObject {
+ id: parentCache
+ property QtObject oldParent: null
+ }
+
+ Component.onCompleted: {
+ parentCache.oldParent = parent;
+ fader.parent = parent;
+ parent = fader;
+ }
+
+ //if this is not given, application may crash in some cases
+ Component.onDestruction: {
+ if (parentCache.oldParent != null) {
+ parent = parentCache.oldParent
+ fader.parent = root
+ }
+ }
+
+ Fader {
+ id: fader
+ dim: root.__dim
+ fadeInDuration: root.__fadeInDuration
+ fadeOutDuration: root.__fadeOutDuration
+ fadeInDelay: root.__fadeInDelay
+ fadeOutDelay: root.__fadeOutDelay
+ fadeInEasingType: root.__fadeInEasingType
+ fadeOutEasingType: root.__fadeOutEasingType
+
+
+ background: root.__faderBackground
+ onPrivateClicked: root.privateClicked();
+
+ MouseArea {
+ anchors.fill: parent
+ enabled: root.status == DialogStatus.Opening || root.status == DialogStatus.Closing
+ z: Number.MAX_VALUE
+ }
+ }
+
+ function __fader() {
+ return fader;
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+import "TextAreaHelper.js" as AreaHelper
+
+ImplicitSizeItem {
+ id: container
+
+ property alias minimumValue: progressModel.minimumValue
+ property alias maximumValue: progressModel.maximumValue
+ property alias value: progressModel.value
+ property bool indeterminate: false
+
+ // Styling for the ProgressBar
+ property Style platformStyle: ProgressBarStyle{}
+
+ //Deprecated, can be removed on W13
+ property alias style: container.platformStyle
+
+ implicitWidth: platformStyle.sizeButton
+ implicitHeight: background.height
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ BorderImage {
+ id: background
+ width: parent.width
+ horizontalTileMode: BorderImage.Repeat
+ source: platformStyle.barBackground
+
+ border {
+ left: 6
+ top: 4
+ right: 6
+ bottom: 4
+ }
+ }
+
+ MaskedItem {
+ id: foreground
+ width: parent.width
+ height: parent.height
+
+ mask: BorderImage {
+ width: indeterminate ? container.width : progressModel.position
+ height: foreground.height
+ source: platformStyle.barMask
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Image {
+ id: texture
+ width: foreground.width + sourceSize.width + 25
+ height: foreground.height
+ fillMode: Image.Tile
+
+ property real xTemp;
+
+ source: indeterminate ? platformStyle.unknownTexture : platformStyle.knownTexture
+
+ onXTempChanged: {
+ // Control the animation speed with this multiplier and the NumberAnimation duration divider
+ texture.x = Math.round(texture.xTemp) * 4;
+ }
+
+ NumberAnimation on xTemp {
+ running: indeterminate && container.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ from: -texture.sourceSize.width
+ to: 0
+ // time = distance / speed, where speed = 10 from the platformStyle
+ duration: (1000 * texture.sourceSize.width / 10)
+ }
+ }
+ }
+
+ RangeModel {
+ id: progressModel
+ positionAtMinimum: 0
+ positionAtMaximum: background.width
+
+ // Defaults from Common API specification
+ minimumValue: 0
+ maximumValue: 1.0
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + container.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + container.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int sizeButton: UI.SIZE_BUTTON
+
+ // Images
+ property url barBackground: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-background"
+ property url barMask: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-mask"
+ property url unknownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-unknown-texture"
+ property url knownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-known-texture"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Dialog {
+ id: root
+ objectName: "queryDialog"
+
+ property string titleText
+ property string message
+
+ //are they necessary?
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ //ToDo
+ property alias icon: iconImage.source
+
+ property Style platformStyle: QueryDialogStyle {}
+
+ //__centerContentField: true
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ __animationChief: "queryDialog"
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ title: Item {
+ id: titleField
+ width: parent.width
+ height: titleText == "" ? titleBarIconField.height :
+ titleBarIconField.height + titleLabel.height + root.platformStyle.titleColumnSpacing
+ Column {
+ id: titleFieldCol
+ spacing: root.platformStyle.titleColumnSpacing
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ width: root.width
+
+ Item {
+ id: titleBarIconField
+ height: iconImage.height
+ width: parent.width
+ Image {
+ id: iconImage
+ anchors.horizontalCenter: titleBarIconField.horizontalCenter
+ source: ""
+ }
+
+ }
+
+
+ Item {
+ id: titleBarTextField
+ height: titleLabel.height
+ width: parent.width
+
+ Text {
+ id: titleLabel
+ width: parent.width
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: root.platformStyle.titleFontFamily
+ font.pixelSize: root.platformStyle.titleFontPixelSize
+ font.bold: root.platformStyle.titleFontBold
+ font.capitalization: root.platformStyle.titleFontCapitalization
+ elide: root.platformStyle.titleElideMode
+ wrapMode: elide == Text.ElideNone ? Text.Wrap : Text.NoWrap
+ color: root.platformStyle.titleTextColor
+ text: root.titleText
+
+ }
+ }
+
+ // needed for animation
+ transform: Scale {
+ id: titleScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).x
+ origin.y: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).y
+ }
+
+ }
+ }
+
+ // the content field which contains the message text
+ content: Item {
+ id: queryContentWrapper
+
+ property int upperBound: visualParent ? visualParent.height - titleField.height - buttonColFiller.height - 64
+ : root.parent.height - titleField.height - buttonColFiller.height - 64
+ property int __sizeHint: Math.min(Math.max(root.platformStyle.contentFieldMinSize, queryText.height), upperBound)
+
+ height: __sizeHint + root.platformStyle.contentTopMargin
+ width: root.width
+
+ Item {
+ id: queryContent
+ width: parent.width
+
+ y: root.platformStyle.contentTopMargin
+
+ Flickable {
+ id: queryFlickable
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ //anchors.bottom: parent.bottom
+ height: queryContentWrapper.__sizeHint
+
+ contentHeight: queryText.height
+ flickableDirection: Flickable.VerticalFlick
+ clip: true
+
+ interactive: queryText.height > queryContentWrapper.__sizeHint
+
+ Text {
+ id: queryText
+ width: queryFlickable.width
+ horizontalAlignment: Text.AlignHCenter
+ font.family: root.platformStyle.messageFontFamily
+ font.pixelSize: root.platformStyle.messageFontPixelSize
+ color: root.platformStyle.messageTextColor
+ wrapMode: Text.WordWrap
+ text: root.message
+ }
+
+ }
+
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: queryFlickable
+ anchors.rightMargin: - UI.SCROLLDECORATOR_LONG_MARGIN - 10 //ToDo: Don't use a hard-coded gap
+ }
+
+ }
+ }
+
+
+ buttons: Item {
+ id: buttonColFiller
+ width: parent.width
+ height: childrenRect.height
+
+ anchors.top: parent.top
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ //otherwise the topMargin wouldn't be considered
+ Item {id: dummy; anchors.fill: parent}
+
+ Column {
+ id: buttonCol
+ anchors.top: parent.top
+ anchors.topMargin: root.platformStyle.buttonTopMargin
+ spacing: root.platformStyle.buttonsColumnSpacing
+
+ height: (acceptButton.text == "" ? 0 : acceptButton.height)
+ + (rejectButton.text == "" ? 0 : rejectButton.height)
+ + anchors.buttonTopMargin + spacing
+
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Button {
+ id: acceptButton
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "__query__hidden"
+
+ // needed for button animation
+ // without resetting the button row's coordinate system would be translated
+ property int __buttonSaver: buttonColFiller.y
+
+ states: [
+ State {
+ name: "__query__visible"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: root
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "__query__hidden"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: root
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "__query__visible"; to: "__query__hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+ root.status = DialogStatus.Closing;
+
+ }
+ }
+
+ NumberAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // With a 100ms delay the background
+ // fades to alpha 0% (500ms, quint ease out).
+ // ---> done in the fader
+
+ ParallelAnimation {
+ // The closing transition starts with the message dimming to alpha 0% and
+ // scaling to 80% (anchorpoint in the middle of the message, 100ms, quint
+ // ease in).
+
+ // With no delay the buttons fade to alpha 0% and translate 30
+ // pixels upwards (100ms, quint ease in).
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: queryContent; property: "scale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y
+ to: buttonColFiller.y-30
+ duration: 100
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ // make sure, root isn't visible:
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+
+ }
+ },
+ Transition {
+ from: "__query__hidden"; to: "__query__visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0
+ titleField.opacity = 0.0
+ queryContent.opacity = 0.0
+ buttonColFiller.opacity = 0.0
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in).
+ // ---> done in the fader
+ ParallelAnimation {
+ SequentialAnimation {
+
+ // With a 200ms delay from the beginning the message fades
+ // from alpha 0% to 100% and scales from 80% to 100% (anchorpoint in the
+ // middle of the message, 550ms, custom ease).
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ NumberAnimation {target: queryContent; property: "scale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ }
+ }
+ SequentialAnimation {
+ // With a 250ms delay from the
+ // beginning the buttons fade from alpha 0% to 100% and translate 25 pixels
+ // in Y axis away from their final destination (400ms, custom ease).
+ PauseAnimation { duration: 250 }
+ ParallelAnimation {
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 0.0; to: 1.0; duration: 400; }
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y-25
+ to: buttonColFiller.y
+ duration: 400
+ easing.type: Easing.OutBack
+ }
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_XLARGE
+ property int titleFontCapitalization: Font.MixedCase
+ property bool titleFontBold: true
+ property color titleTextColor: "white"
+
+ property int contentFieldMinSize: 24
+
+ //spacing
+ property int contentTopMargin: 21
+ property int buttonTopMargin: 38
+
+ property int titleColumnSpacing: 17
+
+ //properties inherited by DialogStyle
+ buttonsColumnSpacing: 16
+ leftMargin: 33
+ rightMargin: 33
+ titleElideMode: Text.ElideNone
+
+ property string messageFontFamily: UI.FONT_FAMILY
+ property int messageFontPixelSize: UI.FONT_DEFAULT
+ property color messageTextColor: "#ffffff"
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // ms
+
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+CheckBox {
+ id: radioButton
+
+ property Style platformStyle: RadioButtonStyle{}
+ property alias style: radioButton.platformStyle
+
+ __imageSource: !radioButton.enabled ? platformStyle.backgroundDisabled :
+ radioButton.pressed ? platformStyle.backgroundPressed :
+ radioButton.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ function __handleChecked() {
+ if (!radioButton.checked)
+ radioButton.checked = true;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-radiobutton"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+/**
+ * Class: ScrollDecorator
+ * A ScrollDecorator shows the current position in a scrollable area.
+ */
+Item {
+ id: root
+
+ /**
+ * Property: flickableItem
+ * [Flickable] The Item that should show the ScrollDecorator
+ */
+ property Flickable flickableItem
+
+ property int __topPageMargin: 0
+ property int __bottomPageMargin: 0
+ property int __leftPageMargin: 0
+ property int __rightPageMargin: 0
+ property bool __hasPageWidth : false
+ property bool __hasPageHeight: false
+
+ // These can also be modified (but probably shouldn't)
+ property int __minIndicatorSize: 20
+ property int __hideTimeout: 500
+
+ property bool __alwaysShowIndicator: true
+
+ property Style platformStyle: ScrollDecoratorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // This function ensures that we allways anchor the decorator correctly according
+ // to the page margins.
+ function __updatePageMargin() {
+ if (!flickableItem)
+ return
+ var p = flickableItem.parent
+ while (p) {
+ if (p.hasOwnProperty("__isPage")) {
+ __hasPageHeight = function() { return p.height == flickableItem.height }
+ __hasPageWidth = function() { return p.width == flickableItem.width }
+ __topPageMargin = function() { return p.anchors.topMargin }
+ __bottomPageMargin = function() { return p.anchors.bottomMargin }
+ __leftPageMargin = function() { return p.anchors.leftMargin }
+ __rightPageMargin = function() { return p.anchors.rightMargin }
+ return;
+ } else {
+ p = p.parent;
+ }
+ }
+ }
+
+ onFlickableItemChanged: { __updatePageMargin() }
+
+ QtObject {
+ id: privateApi
+ function canFlick(direction) {
+ return flickableItem.flickableDirection === direction
+ || flickableItem.flickableDirection === Flickable.HorizontalAndVerticalFlick
+ || flickableItem.flickableDirection === Flickable.AutoFlickDirection;
+ }
+ }
+
+ // Private stuff
+ anchors.fill: flickableItem
+
+ Timer {
+ // Hack to have the indicators flash when the view is shown the first time.
+ // Ideally we would wait until the Flickable is complete, but it doesn't look
+ // possible given the current limitations of QML.
+ interval: 100
+ running: true
+ repeat: false
+ onTriggered: {
+ if (verticalIndicator.shouldShow) {
+ verticalIndicator.state = "visible";
+ verticalIndicator.state = "";
+ }
+ if (horizontalIndicator.shouldShow) {
+ horizontalIndicator.state = "visible";
+ horizontalIndicator.state = "";
+ }
+ }
+ }
+
+ Component {
+ id: verticalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: verticalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.yPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.heightRatio : 0
+ maxPosition: flickableItem ? flickableItem.height : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Component {
+ id: horizontalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: horizontalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.xPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.widthRatio : 0
+ maxPosition: flickableItem ? flickableItem.width : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Loader {id: verticalSizerLoader}
+ Loader {id: horizontalSizerLoader}
+
+ Item {
+ id: verticalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.VerticalFlick)) && (flickableItem.height > 0 && flickableItem.contentHeight > flickableItem.height))
+ opacity: 0
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageWidth ? __rightPageMargin : 0)
+ anchors.top: parent.top
+ anchors.topMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __topPageMargin : 0)
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __bottomPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ verticalSizerLoader.sourceComponent = verticalSizerWrapper;
+ else
+ verticalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.background
+ height: parent.height
+ anchors.right: parent.right
+ }
+ BorderImage {
+ source: platformStyle.indicator
+ border { left: 2; top: 4; right: 2; bottom: 4 }
+ anchors.right: parent.right
+ y: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ? verticalSizerLoader.item.position : 0
+ height: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ?
+ verticalSizerLoader.item.size - parent.anchors.topMargin - parent.anchors.bottomMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: verticalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: verticalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+
+ Item {
+ id: horizontalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.HorizontalFlick)) && (flickableItem.width > 0 && flickableItem.contentWidth > flickableItem.width))
+ opacity: 0
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageHeight ? __bottomPageMargin : 0)
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __rightPageMargin : 0)
+ anchors.left: parent.left
+ anchors.leftMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __leftPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ horizontalSizerLoader.sourceComponent = horizontalSizerWrapper;
+ else
+ horizontalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.backgroundHorizontal
+ width: parent.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+ BorderImage {
+ source: platformStyle.indicatorHorizontal
+ border { left: 4; top: 2; right: 4; bottom: 2 }
+ anchors.bottom: parent.bottom
+ x: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ? horizontalSizerLoader.item.position : 0
+ width: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ?
+ horizontalSizerLoader.item.size - parent.anchors.leftMargin - parent.anchors.rightMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: horizontalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: horizontalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ // relative (0..1) position of top and bottom
+ property real positionRatio
+ property real sizeRatio
+
+ // max position and min size
+ property real maxPosition
+ property real minSize
+
+ // size underflow
+ property real sizeUnderflow: (sizeRatio * maxPosition) < minSize ? minSize - (sizeRatio * maxPosition) : 0
+
+ // raw start and end position considering minimum size
+ property real rawStartPos: positionRatio * (maxPosition - sizeUnderflow)
+ property real rawEndPos: (positionRatio + sizeRatio) * (maxPosition - sizeUnderflow) + sizeUnderflow
+
+ // overshoot amount at start and end
+ property real overshootStart: rawStartPos < 0 ? -rawStartPos : 0
+ property real overshootEnd: rawEndPos > maxPosition ? rawEndPos - maxPosition : 0
+
+ // overshoot adjusted start and end
+ property real adjStartPos: rawStartPos + overshootStart
+ property real adjEndPos: rawEndPos - overshootStart - overshootEnd
+
+ // final position and size of thumb
+ property int position: 0.5 + (adjStartPos + minSize > maxPosition ? maxPosition - minSize : adjStartPos)
+ property int size: 0.5 + ((adjEndPos - position) < minSize ? minSize : (adjEndPos - position))
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-positionindicator"+__invertedString+"-background"
+ property url indicator: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator"
+ property url backgroundHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-background-horizontal"
+ property url indicatorHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator-horizontal"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var sectionData = [];
+var _sections = [];
+
+function initialize(list) {
+ initSectionData(list);
+}
+
+function initSectionData(list) {
+ if (!list || !list.model) return;
+ sectionData = [];
+ _sections = [];
+ var current = "",
+ prop = list.section.property,
+ item;
+
+ for (var i = 0, count = list.model.count; i < count; i++) {
+ item = list.model.get(i);
+ if (item[prop] !== current) {
+ current = item[prop];
+ _sections.push(current);
+ sectionData.push({ index: i, header: current });
+ }
+ }
+}
+
+function getSectionPositionString(name) {
+ var val = _sections.indexOf(name);
+ return val === 0 ? "first" :
+ val === _sections.length - 1 ? "last" : false;
+}
+
+function getAt(pos) {
+ return _sections[pos] ? _sections[pos] : "";
+}
+
+function getRelativeSections(current) {
+ var val = _sections.indexOf(current),
+ sect = [],
+ sl = _sections.length;
+
+ val = val < 1 ? 1 : val >= sl-1 ? sl-2 : val;
+ sect = [getAt(val - 1), getAt(val), getAt(val + 1)];
+
+ return sect;
+}
+
+function getClosestSection(pos, down) {
+ var tmp = (_sections.length) * pos;
+ var val = Math.ceil(tmp) // TODO: better algorithm
+ val = val < 2 ? 1 : val;
+ return _sections[val-1];
+}
+
+function getNextSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val < _sections.length - 1 ? val + 1 : val)] : _sections[0]) || "";
+}
+
+function getPreviousSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val > 0 ? val - 1 : val)] : _sections[0]) || "";
+}
+
+function getIndexFor(sectionName) {
+ var val = sectionData[_sections.indexOf(sectionName)].index;
+ return val === 0 || val > 0 ? val : -1;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "SectionScroller.js" as Sections
+
+Item {
+ id: root
+
+ property ListView listView
+
+ onListViewChanged: {
+ if (listView && listView.model) {
+ internal.initDirtyObserver();
+ } else if (listView) {
+ listView.modelChanged.connect(function() {
+ if (listView.model) {
+ internal.initDirtyObserver();
+ }
+ });
+ }
+ }
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Rectangle {
+ id: container
+ color: "transparent"
+ width: 35
+ height: listView.height
+ x: listView.x + listView.width - width
+ property bool dragging: false
+
+ MouseArea {
+ id: dragArea
+ objectName: "dragArea"
+ anchors.fill: parent
+ drag.target: tooltip
+ drag.axis: Drag.YAxis
+ drag.minimumY: listView.y
+ drag.maximumY: listView.y + listView.height - tooltip.height
+
+ onPressed: {
+ mouseDownTimer.restart()
+ }
+
+ onReleased: {
+ container.dragging = false;
+ mouseDownTimer.stop()
+ }
+
+ onPositionChanged: {
+ internal.adjustContentPosition(dragArea.mouseY);
+ }
+
+ Timer {
+ id: mouseDownTimer
+ interval: 150
+
+ onTriggered: {
+ container.dragging = true;
+ internal.adjustContentPosition(dragArea.mouseY);
+ tooltip.positionAtY(dragArea.mouseY);
+ }
+ }
+ }
+ Item {
+ id: tooltip
+ objectName: "popup"
+ opacity: container.dragging ? 1 : 0
+ anchors.right: parent.right
+ anchors.rightMargin: 50
+ width: childrenRect.width
+ height: childrenRect.height
+
+ function positionAtY(yCoord) {
+ tooltip.y = Math.max(dragArea.drag.minimumY, Math.min(yCoord - tooltip.height/2, dragArea.drag.maximumY));
+ }
+
+ BorderImage {
+ id: background
+ width: childrenRect.width// + 20
+ height: childrenRect.height// + 20
+ anchors.left: parent.left
+ source: platformStyle.backgroundImage
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+
+ Column {
+ width: Math.max(previousSectionLabel.width, currentSectionLabel.width, nextSectionLabel.width)
+ height: childrenRect.height
+
+ SectionScrollerLabel {
+ id: previousSectionLabel
+ objectName: "previousSectionLabel"
+ text: internal.prevSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider1"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: currentSectionLabel
+ objectName: "currentSectionLabel"
+ text: internal.currentSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider2"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: nextSectionLabel
+ objectName: "nextSectionLabel"
+ text: internal.nextSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+ }
+ }
+
+ Image {
+ id: arrow
+ objectName: "arrow"
+ width: 8
+ height: 16
+ anchors.left: background.right
+ property int threshold: currentSectionLabel.height
+ property int yInitial: background.y + background.height/2 - height/2
+ y: getYPosition()
+ source: platformStyle.arrowImage
+
+ function getYPosition() {
+ var v = internal.curPos;
+ var adjust = v === "first" ? -threshold :
+ v === "last" ? threshold : 0;
+
+ return yInitial + adjust;
+ }
+
+ states: [
+ State {
+ when: root.dragging && dragArea.mouseY < (root.listView.y + threshold)
+ PropertyChanges {
+ target: arrow
+ y: yInitial - threshold
+ }
+ }
+ ]
+
+ Behavior on y {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "visible"
+ when: container.dragging
+ },
+
+ State {
+ extend: "visible"
+ name: "atTop"
+ when: internal.curPos === "first"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: internal.currentSection
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.nextSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: Sections.getNextSection(internal.nextSection)
+ }
+ },
+
+ State {
+ extend: "visible"
+ name: "atBottom"
+ when: internal.curPos === "last"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: Sections.getPreviousSection(internal.prevSection)
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.prevSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: internal.currentSection
+ }
+ }
+ ]
+
+ Behavior on opacity {
+ NumberAnimation { duration: 100 }
+ }
+ }
+ }
+
+ Timer {
+ id: dirtyTimer
+ interval: 100
+ running: false
+ onTriggered: {
+ Sections.initSectionData(listView);
+ internal.modelDirty = false;
+ }
+ }
+
+ Connections {
+ target: root.listView
+ onCurrentSectionChanged: internal.curSect = container.dragging ? internal.curSect : ""
+ }
+
+ QtObject {
+ id: internal
+
+ property string prevSection: ""
+ property string currentSection: listView.currentSection
+ property string nextSection: ""
+ property string curSect: ""
+ property string curPos: "first"
+ property int oldY: 0
+ property bool modelDirty: false
+ property bool down: true
+
+ function initDirtyObserver() {
+ Sections.initialize(listView);
+ function dirtyObserver() {
+ if (!internal.modelDirty) {
+ internal.modelDirty = true;
+ dirtyTimer.running = true;
+ }
+ }
+
+ if (listView.model.countChanged)
+ listView.model.countChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsChanged)
+ listView.model.itemsChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsInserted)
+ listView.model.itemsInserted.connect(dirtyObserver);
+
+ if (listView.model.itemsMoved)
+ listView.model.itemsMoved.connect(dirtyObserver);
+
+ if (listView.model.itemsRemoved)
+ listView.model.itemsRemoved.connect(dirtyObserver);
+ }
+
+ function adjustContentPosition(y) {
+ if (y < 0 || y > dragArea.height) return;
+
+ internal.down = (y > internal.oldY);
+ var sect = Sections.getClosestSection((y / dragArea.height), internal.down);
+ internal.oldY = y;
+ if (internal.curSect != sect) {
+ internal.curSect = sect;
+ internal.curPos = Sections.getSectionPositionString(internal.curSect);
+ var sec = Sections.getRelativeSections(internal.curSect);
+ internal.prevSection = sec[0];
+ internal.currentSection = sec[1];
+ internal.nextSection = sec[2];
+ var idx = Sections.getIndexFor(sect);
+ listView.positionViewAtIndex(idx, ListView.Beginning);
+ }
+ }
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias text: label.current
+ property alias up: label.up
+ property bool highlighted: false
+
+ width: wrapper.width
+ height: wrapper.height
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Item {
+ id: wrapper
+
+ clip: true
+ height: label.height
+
+ Text {
+ id: label
+
+ property string current: ""
+ property bool up: true
+ property int shift: 30
+
+ height: 60
+ width: parent.width - 40
+ text: ""
+ x: 20
+ color: root.highlighted ? root.platformStyle.textColorHighlighted : root.platformStyle.textColor
+ font {
+ bold: root.platformStyle.fontBoldProperty
+ pixelSize: root.platformStyle.fontPixelSize
+ }
+ verticalAlignment: Text.AlignVCenter
+ onCurrentChanged: {
+ text = current;
+ }
+ onTextChanged: {
+ var w = paintedWidth
+ parent.width = w + 40;
+ }
+
+ Behavior on current {
+ SequentialAnimation {
+ NumberAnimation { target: label; property: "y"; to: label.up ? label.shift : -label.shift; duration: 50 }
+ PropertyAction { target: label; property: "y"; value: label.up ? -label.shift : label.shift }
+ NumberAnimation { target: label; property: "y"; to: 0; duration: 50 }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+
+ // Font
+ property int fontPixelSize: UI.FONT_XXSMALL
+ property bool fontBoldProperty: true
+
+ // Color
+ property color textColorHighlighted: "#fff"
+ property color textColor: "#888"
+
+ property url dividerImage: "image://theme/meegotouch-scroll-bubble-divider"+__invertedString
+ property url backgroundImage: "image://theme/meegotouch-scroll-bubble-background"+__invertedString
+ property url arrowImage: "image://theme/meegotouch-scroll-bubble-arrow"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+CommonDialog {
+ id: root
+
+ // Common API
+ property alias model: selectionListView.model
+ property int selectedIndex: -1 // read & write
+ //property string titleText: "Selection Dialog"
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+ property bool selected: index == selectedIndex;
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: selectedIndex = index;
+ onClicked: accept();
+ }
+
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: delegateItem.selected ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ delegateItem.selected ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: delegateItem.selected ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ text: modelData
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ onStatusChanged: {
+ if (status == DialogStatus.Opening && selectedIndex >= 0) {
+ selectionListView.positionViewAtIndex(selectedIndex, ListView.Center)
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText:"Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : root.parent
+ ? root.parent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+}
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property alias titleBarFont: titleText.font
+ property int titleBarHeight: 44
+ property color titleBarColor: "white"
+ property int titleBarIndent: 17
+ property int titleBarLineMargin: 10
+
+ property bool __portrait: (screen.currentOrientation == 1) || (screen.currentOrientation == 4)
+
+ property int leftMargin: __portrait ? 11 : 160
+ property int rightMargin: __portrait ? 11 : 160
+
+ property alias itemFont: itemText.font
+ property int fontXLarge: 32
+ property int fontLarge: 28
+ property int fontDefault: 24
+ property int fontSmall: 20
+ property int fontXSmall: 18
+ property int fontXXSmall: 16
+
+ property color colorForeground: "#191919"
+ property color colorSecondaryForeground: "#8c8c8c"
+ property color colorBackground: "#ffffff"
+ property color colorSelect: "#7fb133"
+
+ property color commonLabelColor: "white"
+
+ property int itemHeight: 64
+ property color itemTextColor: "white"
+ property color itemSelectedTextColor: "white"
+ property int itemLeftMargin: 16
+ property int itemRightMargin: 16
+
+ property int contentSpacing: 10
+
+ property int pressDelay: 350 // ms
+
+ // Background
+ property url itemBackground: ""
+ property color itemBackgroundColor: "transparent"
+ property color itemSelectedBackgroundColor: "#3D3D3D"
+ property url itemSelectedBackground: "" // "image://theme/" + __colorString + "meegotouch-list-fullwidth-background-selected"
+ property url itemPressedBackground: "image://theme/" + __colorString + "meegotouch-panel-inverted-background-pressed"
+
+ property int buttonsTopMargin: 30 // ToDo: evaluate correct value
+
+ Text {
+ id: titleText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_XLARGE
+ font.capitalization: Font.MixedCase
+ font.bold: false
+ }
+
+ Text {
+ id: itemText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_DEFAULT_SIZE
+ font.capitalization: Font.MixedCase
+ font.bold: true
+ }
+ }
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+ property Item visualParent
+ property int status: DialogStatus.Closed
+
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ property alias acceptButton: acceptButton
+ property alias rejectButton: rejectButton
+
+ signal accepted
+ signal rejected
+
+ property QtObject platformStyle: SheetStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ visible: status != DialogStatus.Closed;
+
+ function open() {
+ parent = visualParent || __findParent();
+ sheet.state = "";
+ }
+
+ function close() {
+ sheet.state = "closed";
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent
+ && next.objectName != "appWindowContent"
+ && next.objectName != "windowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ function getButton(name) {
+ for (var i=0; i<buttons.length; ++i) {
+ if (buttons[i].objectName == name)
+ return buttons[i];
+ }
+ return undefined;
+ }
+
+ MouseArea {
+ id: blockMouseInput
+ anchors.fill: parent
+ }
+
+ Item {
+ id: sheet
+
+ //when the sheet is part of a page do nothing
+ //when the sheet is a direct child of a PageStackWindow, consider the status bar
+ property int statusBarOffset: (typeof __isPage != "undefined") ? 0
+ : (typeof __statusBarHeight == "undefined") ? 0
+ : __statusBarHeight
+
+ width: parent.width
+ height: parent.height - statusBarOffset
+
+ y: statusBarOffset
+
+ clip: true
+
+ property int transitionDurationIn: 300
+ property int transitionDurationOut: 450
+
+ state: "closed"
+
+ function transitionStarted() {
+ status = (state == "closed") ? DialogStatus.Closing : DialogStatus.Opening;
+ }
+
+ function transitionEnded() {
+ status = (state == "closed") ? DialogStatus.Closed : DialogStatus.Open;
+ }
+
+ states: [
+ // Closed state.
+ State {
+ name: "closed"
+ PropertyChanges { target: sheet; y: height; }
+ }
+ ]
+
+ transitions: [
+ // Transition between open and closed states.
+ Transition {
+ from: ""; to: "closed"; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.InOutQuint; duration: sheet.transitionDurationOut }
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ },
+ Transition {
+ from: "closed"; to: ""; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.OutQuint; duration: sheet.transitionDurationIn }
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ }
+ ]
+
+ BorderImage {
+ source: platformStyle.background
+ width: parent.width
+ anchors.top: header.bottom
+ anchors.bottom: parent.bottom
+ Item {
+ id: contentField
+ anchors.fill: parent
+ }
+ }
+
+ Item {
+ id: header
+ width: parent.width
+ height: headerBackground.height
+ BorderImage {
+ id: headerBackground
+ border {
+ left: platformStyle.headerBackgroundMarginLeft
+ right: platformStyle.headerBackgroundMarginRight
+ top: platformStyle.headerBackgroundMarginTop
+ bottom: platformStyle.headerBackgroundMarginBottom
+ }
+ source: platformStyle.headerBackground
+ width: header.width
+ }
+ Item {
+ id: buttonRow
+ anchors.fill: parent
+ SheetButton {
+ id: rejectButton
+ objectName: "rejectButton"
+ anchors.left: parent.left
+ anchors.leftMargin: root.platformStyle.rejectButtonLeftMargin
+ anchors.verticalCenter: parent.verticalCenter
+ visible: text != ""
+ onClicked: close()
+ }
+ SheetButton {
+ id: acceptButton
+ objectName: "acceptButton"
+ anchors.right: parent.right
+ anchors.rightMargin: root.platformStyle.acceptButtonRightMargin
+ anchors.verticalCenter: parent.verticalCenter
+ platformStyle: SheetButtonAccentStyle { }
+ visible: text != ""
+ onClicked: close()
+ }
+ Component.onCompleted: {
+ acceptButton.clicked.connect(accepted)
+ rejectButton.clicked.connect(rejected)
+ }
+ }
+ Item {
+ id: titleBar
+ anchors.fill: parent
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: root
+
+ property Style platformStyle: SheetButtonStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ property color textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background"
+ pressedBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/meegotouch-sheet-button"+__invertedString+"-background"
+ pressedBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int acceptButtonRightMargin: 15
+ property int rejectButtonLeftMargin: 15
+
+ property url background: "image://theme/meegotouch-applicationpage-background" + __invertedString;
+ property url headerBackground: "image://theme/meegotouch-sheet-header" + __invertedString + "-background";
+
+ property int headerBackgroundMarginLeft: 10
+ property int headerBackgroundMarginRight: 10
+ property int headerBackgroundMarginTop: 10
+ property int headerBackgroundMarginBottom: 2
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ id: root
+ width: parent ? parent.width : 0
+ height: 250
+ color: "black"
+ opacity: 0.9
+
+ Text {
+ id: label
+ font.pixelSize: 43
+ text: "Software Input Panel"
+ anchors.centerIn: parent
+ color: "white"
+ opacity: 0.0
+ }
+
+ MouseArea {
+ // Block clicks from falling through the simulator
+ anchors.fill: parent
+ onClicked: {
+ root.parent.focus = true;
+ inputContext.simulateSipClose();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+
+SliderTemplate {
+ id: slider
+
+ property Style platformStyle: SliderStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: slider.platformStyle
+
+ opacity: enabled ? UI.OPACITY_ENABLED : UI.OPACITY_DISABLED
+
+ __handleItem: Image {
+ source: pressed? platformStyle.handleBackgroundPressed : platformStyle.handleBackground;
+ }
+
+ __grooveItem: BorderImage {
+ source: platformStyle.grooveItemBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueTrackItem: BorderImage {
+ source: platformStyle.grooveItemElapsedBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueIndicatorItem: BorderImage {
+ id: indicatorBackground
+ source: platformStyle.valueBackground
+ border { left: 12; top: 12; right: 12; bottom: 12 }
+
+ width: label.width + 28
+ height: 40
+
+ Image {
+ id: arrow
+ }
+
+ state: slider.valueIndicatorPosition
+ states: [
+ State {
+ name: "Top"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowDown
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.top: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowUp
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.bottom: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ AnchorChanges {
+ target: indicatorBackground
+// anchors.
+ }
+ },
+ State {
+ name: "Left"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowLeft
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.left: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ },
+ State {
+ name: "Right"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowRight
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.right: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ ]
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: slider.valueIndicatorText
+ color: slider.platformStyle.textColor
+ font.pixelSize: slider.platformStyle.fontPixelSize
+ font.family: slider.platformStyle.fontFamily
+ }
+
+ // Native libmeegotouch slider value indicator pops up 100ms after pressing
+ // the handle... but hiding happens without delay.
+ visible: slider.valueIndicatorVisible && slider.pressed
+ Behavior on visible {
+ enabled: !indicatorBackground.visible
+ PropertyAnimation {
+ duration: 100
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+
+ // Color
+ property color textColor: !inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Background
+ property url valueBackground: "image://theme/meegotouch-slider-handle-value"+__invertedString+"-background"
+ property url labelArrowDown: "image://theme/meegotouch-slider-handle-label-arrow-down"+__invertedString
+ property url labelArrowUp: "image://theme/meegotouch-slider-handle-label-arrow-up"+__invertedString
+ property url labelArrowLeft: "image://theme/meegotouch-slider-handle-label-arrow-left"+__invertedString
+ property url labelArrowRight: "image://theme/meegotouch-slider-handle-label-arrow-right"+__invertedString
+ property url handleBackground: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-horizontal"
+ property url handleBackgroundPressed: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-pressed-horizontal"
+ property url grooveItemBackground: "image://theme/meegotouch-slider"+__invertedString+"-background-horizontal"
+ property url grooveItemElapsedBackground: "image://theme/" + __colorString + "meegotouch-slider-elapsed"+__invertedString+"-background-horizontal"
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+Item {
+ id: slider
+
+ //
+ // Common API
+ //
+ property int orientation: Qt.Horizontal
+ property alias minimumValue: range.minimumValue
+ property alias maximumValue: range.maximumValue
+ property alias pressed: mouseArea.pressed
+ property alias stepSize: range.stepSize
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ // NOTE: this property is in/out, the user can set it, create bindings to it, and
+ // at the same time the slider wants to update. There's no way in QML to do this kind
+ // of updates AND allow the user bind it (without a Binding object). That's the
+ // reason this is an alias to a C++ property in range model.
+ property alias value: range.value
+
+ //
+ // Public extensions
+ //
+ property alias inverted: range.inverted
+
+ // Value indicator displays the current value near the slider
+ // if valueIndicatorText == "", a default formating will be applied
+ property string valueIndicatorText: formatValue(range.value)
+ property bool valueIndicatorVisible: false
+
+ property int valueIndicatorMargin: 1
+ property string valueIndicatorPosition: __isVertical ? "Left" : "Top"
+
+ // The default implementation for label hides decimals until it hits a
+ // floating point value at which point it keeps decimals
+ property bool __useDecimals: false
+ function formatValue(v) {
+ return __useDecimals ? (v.toFixed(2)) : v;
+ }
+
+ //
+ // "Protected" properties
+ //
+
+ // Hooks for customizing the pieces of the slider
+ property Item __grooveItem
+ property Item __valueTrackItem
+ property Item __handleItem
+ property Item __valueIndicatorItem
+
+ property bool __isVertical: orientation == Qt.Vertical
+
+ implicitWidth: 400
+ implicitHeight: handle.height
+
+ width: __isVertical ? implicitHeight : implicitWidth
+ height: __isVertical ? implicitWidth : implicitHeight
+
+ // This is a template slider, so every piece can be modified by passing a
+ // different Component. The main elements in the implementation are
+ //
+ // - the 'range' does the calculations to map position to/from value,
+ // it also serves as a data storage for both properties;
+ //
+ // - the 'fakeHandle' is what the mouse area drags on the screen, it feeds
+ // the 'range' position and also reads it when convenient;
+ //
+ // - the real 'handle' it is the visual representation of the handle, that
+ // just follows the 'fakeHandle' position.
+ //
+ // Everything is encapsulated in a contents Item, so for the
+ // vertical slider, we just swap the height/width, make it
+ // horizontal, and then use rotation to make it vertical again.
+
+ Component.onCompleted: {
+ __grooveItem.parent = groove;
+ __valueTrackItem.parent = valueTrack;
+ __handleItem.parent = handle;
+ __valueIndicatorItem.parent = valueIndicator;
+ }
+
+ Item {
+ id: contents
+
+ width: __isVertical ? slider.height : slider.width
+ height: __isVertical ? slider.width : slider.height
+ rotation: __isVertical ? -90 : 0
+
+ anchors.centerIn: slider
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ onValueChanged: {
+ // XXX: Moved that outside formatValue to get rid of binding loop warnings
+ var v = range.value
+ if (parseInt(v) != v)
+ __useDecimals = true;
+ }
+ positionAtMinimum: handle.width / 2
+ positionAtMaximum: contents.width - handle.width / 2
+ onMaximumChanged: __useDecimals = false;
+ onMinimumChanged: __useDecimals = false;
+ onStepSizeChanged: __useDecimals = false;
+ }
+
+ Item {
+ id: groove
+ anchors.fill: parent
+ anchors.leftMargin: handle.width / 2
+ anchors.rightMargin: handle.width / 2
+ }
+
+ Item {
+ id: valueTrack
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: groove.left
+ anchors.right: handle.horizontalCenter
+ anchors.rightMargin: handle.width / 2
+
+ states: State {
+ when: slider.inverted
+ PropertyChanges {
+ target: valueTrack
+ anchors.rightMargin: 0
+ anchors.leftMargin: - handle.width / 2
+ }
+ AnchorChanges {
+ target: valueTrack
+ anchors.left: handle.horizontalCenter
+ anchors.right: groove.right
+ }
+ }
+ }
+
+ Item {
+ id: handle
+ transform: Translate { x: - handle.width / 2 }
+ rotation: __isVertical ? 90 : 0
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ width: __handleItem.width
+ height: __handleItem.height
+
+ x: fakeHandle.x
+ Behavior on x {
+ id: behavior
+ enabled: !mouseArea.drag.active
+
+ PropertyAnimation {
+ duration: behavior.enabled ? 150 : 0
+ easing.type: Easing.OutSine
+ }
+ }
+ }
+
+ Item {
+ id: fakeHandle
+ width: handle.width
+ height: handle.height
+ transform: Translate { x: - handle.width / 2 }
+ }
+
+ MouseArea {
+ id: mouseArea
+ property real oldPosition: 0
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ drag.target: fakeHandle
+ drag.axis: Drag.XAxis
+ drag.minimumX: range.positionAtMinimum
+ drag.maximumX: range.positionAtMaximum
+
+ onPressed: {
+ oldPosition = range.position;
+ // Clamp the value
+ var newX = Math.max(mouse.x + anchors.leftMargin, drag.minimumX);
+ newX = Math.min(newX, drag.maximumX);
+
+ // Debounce the press: a press event inside the handler will not
+ // change its position, the user needs to drag it.
+ if (Math.abs(newX - fakeHandle.x) > handle.width / 2)
+ range.position = newX;
+ }
+
+ onCanceled: {
+ range.position = oldPosition;
+ }
+ }
+
+ Item {
+ id: valueIndicator
+
+ transform: Translate {
+ x: - handle.width / 2;
+ y: __isVertical? -(__valueIndicatorItem.width/2)+20 : y ;
+ }
+
+ rotation: __isVertical ? 90 : 0
+ visible: valueIndicatorVisible
+
+ width: __valueIndicatorItem.width //+ (__isVertical? (handle.width/2) : 0 )
+ height: __valueIndicatorItem.height
+
+ state: {
+ if (!__isVertical)
+ return slider.valueIndicatorPosition;
+
+ if (valueIndicatorPosition == "Right")
+ return "Bottom";
+ if (valueIndicatorPosition == "Top")
+ return "Right";
+ if (valueIndicatorPosition == "Bottom")
+ return "Left";
+
+ return "Top";
+ }
+
+ anchors.margins: valueIndicatorMargin
+
+ states: [
+ State {
+ name: "Top"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.bottom: handle.top
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.top: handle.bottom
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Right"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.left: handle.right
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ },
+ State {
+ name: "Left"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.right: handle.left
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ }
+ ]
+ }
+ }
+
+ // when there is no mouse interaction, the handle's position binds to the value
+ Binding {
+ when: !mouseArea.drag.active
+ target: fakeHandle
+ property: "x"
+ value: range.position
+ }
+
+ // when the slider is dragged, the value binds to the handle's position
+ Binding {
+ when: mouseArea.drag.active
+ target: range
+ property: "position"
+ value: fakeHandle.x
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Item {
+ id: root
+ width: parent.width
+ height: 0
+
+ objectName: "softwareInputPanel"
+
+ property bool active: false
+
+ states: State {
+ when: active
+ PropertyChanges { target: root; height: childrenRect.height; }
+ }
+
+ transitions: Transition {
+ reversible: true
+ NumberAnimation { properties: "opacity"; easing.type: Easing.InOutCubic; duration: 200 }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+
+StatusBarInternal {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+
+ property bool showStatusBar: true
+ property bool __completed: false
+
+ states: State {
+ name: "hide"; when: showStatusBar==false
+ PropertyChanges { target: statusBar; anchors.topMargin: -statusBar.height; visible: false}
+ }
+
+ Component.onCompleted: {
+ statusBar.orientation = screen.currentOrientation
+ screen.updatePlatformStatusBarRect(statusBar)
+ __completed = true;
+ }
+
+ onWidthChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+
+ Timer {
+ // Timer is used to update statusbarrect to avoid duplicated calls during animation,
+ // also onActiveChanged coming too early
+ id: updatePlatformStatusBarTimer
+ repeat: false
+ interval: 50
+ onTriggered: {
+ screen.updatePlatformStatusBarRect(statusBar);
+ }
+ }
+
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+
+ transitions: Transition {
+ from: __completed ? "" : "invalid"
+ to: __completed ? "hide" : "invalid"
+ reversible: true
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+ PropertyAnimation { target: statusBar; properties: "anchors.topMargin"; easing.type: Easing.InOutExpo; duration: 500 }
+ PropertyAnimation { target: statusBar; properties: "visible"; }
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+QtObject {
+ id: styleClass
+ // Settings
+ property bool inverted: theme.inverted
+ property string __invertedString: inverted? "-inverted" : ""
+ property string __colorString: theme.colorString
+
+ // some style classes like SelectionDialogStyle are using nested elements (for example Text),
+ // which isn't allowed by QtObject; this fix makes this possible
+ default property alias children: styleClass.__defaultPropertyFix
+ property list<QtObject> __defaultPropertyFix: [Item {}] //QML doesn't allow an empty list here
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+/*
+Class: Switch
+ The Switch component is similar to the CheckBox component but instead of
+ selecting items it should be used when setting options to On/Off.
+*/
+Item {
+ id: root
+
+ width: slider.width
+ height: slider.height
+
+ /*
+ * Property: checked
+ * [bool=false] The checked state of switch
+ */
+ property bool checked: false
+
+ // Styling for the Switch
+ property Style platformStyle: SwitchStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ /*
+ * Property: enabled
+ * [bool=true] Enables/Disables the component. Notice that the disable state is not Toolkit compliant
+ * and not present inside the qt-components
+ */
+
+ Item {
+ id: slider
+
+ width: 66
+ height: 42
+
+ state: root.checked ? "checked" : "unchecked"
+
+ property real knobPos: (knob.x - platformStyle.minKnobX) / (platformStyle.maxKnobX - platformStyle.minKnobX)
+
+ Image {
+ source: platformStyle.switchOn
+ opacity: slider.knobPos
+ }
+ Image {
+ source: platformStyle.switchOff
+ opacity: 1.0 - slider.knobPos
+ }
+
+ states: [
+ State {
+ name: "unchecked"
+ PropertyChanges { target: knob; x: platformStyle.minKnobX }
+ },
+ State {
+ name: "checked"
+ PropertyChanges { target: knob; x: platformStyle.maxKnobX }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ SmoothedAnimation { properties: "x"; velocity: 500; maximumEasingTime: 0 }
+ }
+ ]
+
+ // thumb (shadow)
+ Image {
+ id: knob
+
+ // thumb (inline)
+ Image {
+ width: 30
+ height: 30
+ x: 0
+ y: -2
+ source: (slider.enabled ? (mouseArea.pressed ? platformStyle.thumbPressed : platformStyle.thumb) : platformStyle.thumbDisabled)
+ }
+
+ source: platformStyle.shadow
+
+ y: 8
+
+ width: 30
+ height: 30
+ }
+
+ MouseArea {
+ id: mouseArea
+ property int downMouseX
+ property int downKnobX
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ function snap() {
+ if (knob.x < (platformStyle.maxKnobX + platformStyle.minKnobX) / 2) {
+ if (root.checked) {
+ root.checked = false;
+ } else {
+ knob.x = platformStyle.minKnobX;
+ }
+ } else {
+ if (!root.checked) {
+ root.checked = true;
+ } else {
+ knob.x = platformStyle.maxKnobX;
+ }
+ }
+ }
+
+ onPressed: {
+ downMouseX = mouseX;
+ downKnobX = knob.x;
+ }
+
+ onPositionChanged: {
+ var newKnobX = downKnobX - (downMouseX - mouseX);
+ knob.x = newKnobX < platformStyle.minKnobX ? platformStyle.minKnobX : newKnobX > platformStyle.maxKnobX ? platformStyle.maxKnobX : newKnobX;
+ }
+
+ onReleased: {
+ if (Math.abs(downMouseX - mouseX) < 5)
+ root.checked = !root.checked;
+ else
+ snap();
+ }
+
+ onCanceled: {
+ snap();
+ }
+
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int minKnobX: 6
+ property int maxKnobX: 30
+
+ // Slider
+ property url switchOn: "image://theme/" + __colorString + "meegotouch-switch-on"+__invertedString
+ property url switchOff: "image://theme/meegotouch-switch-off"+__invertedString
+
+ // Knob
+ property url thumb: "image://theme/meegotouch-switch-thumb"+__invertedString
+ property url thumbPressed: "image://theme/meegotouch-switch-thumb-pressed"+__invertedString
+ property url thumbDisabled: "image://theme/meegotouch-switch-thumb-disabled"+__invertedString
+ property url shadow: "image://theme/meegotouch-switch-shadow"+__invertedString
+
+ // Mouse
+ property real mouseMarginRight: -UI.MARGIN_XLARGE
+ property real mouseMarginLeft: -UI.MARGIN_XLARGE
+ property real mouseMarginTop: -UI.MARGIN_XLARGE
+ property real mouseMarginBottom: -UI.MARGIN_XLARGE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ Component.onCompleted: {
+ __layout()
+ print("Warning, TabBarLayout has been deprecated from the API.")
+ print("To fix your code, please use:")
+ print(" tools: ToolBarLayout { ToolItem{} ButtonRow{TabButton{} ... } } instead.")
+ }
+ onChildrenChanged: __layout()
+ onWidthChanged: __layout()
+ onHeightChanged: __layout()
+
+ function __layout() {
+ if (parent == null || width == 0)
+ return;
+
+ var orientation = screen.currentOrientation == Screen.Landscape || screen.currentOrientation == Screen.LandscapeInverted ? "landscape" : "portrait",
+ padding = orientation == "landscape" ? 80 : 15;
+
+ for (var i = 0, childCount = children.length, tabCount = 0, widthOthers = 0; i < childCount; i++) {
+ if (children[i].tab !== undefined) {
+ children[i].platformStyle.position = (tabCount++ === 0) ? "horizontal-left" : "horizontal-center";
+ children[i].platformStyle.screenOrientation = orientation;
+ } else {
+ widthOthers += children[i].width;
+ children[i].y = (height - children[i].height) / 2;
+ }
+ }
+ // Check if last item is a tab button and set appropriate position
+ tabCount && (children[children[0].tab ? tabCount - 1 : tabCount].platformStyle.position = "horizontal-right");
+
+ widthOthers += children[0].tab ? padding : 0;
+ widthOthers += children[childCount - 1].tab ? padding : 0;
+
+ var tabWidth = Math.round((width - widthOthers) / tabCount),
+ offset = children[0].tab ? padding : children[0].width;
+
+ for (var i = children[0].tab ? 0 : 1, index = 0; i < childCount; i++, index++) {
+ children[i].x = tabWidth * index + offset;
+ children[i].tab && (children[i].width = tabWidth);
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+Button {
+ id: tabButton
+
+ // Common public API
+ property Item tab
+ property QtObject platformStyle: TabButtonStyle {}
+
+ //Deprecated: TODO, remove this!
+ property alias style: tabButton.platformStyle
+
+ property Item __tabGroup: tab !== null ? tab.parent : null
+
+ Connections {
+ target: __tabGroup
+ onCurrentTabChanged: checked = __tabGroup.currentTab == tab;
+ }
+
+ onClicked: privatePressed()
+
+ function privatePressed() {
+ if (tabButton.checkable) {
+ tabButton.checked = !tabButton.checked;
+ }
+
+ if (__tabGroup != null &&
+ tab != null) {
+ __tabGroup.currenTab == tab ? __tabGroup.currentTab.pop(): __tabGroup.currentTab = tab;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ /* The orientation of the button which can take one of the two values:
+ [portrait] [landscape]
+ */
+ property string screenOrientation: (screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape"
+
+ fontCapitalization: Font.MixedCase
+ fontPixelSize: 24
+ fontWeight: Font.Normal
+ checkedFontWeight: Font.Bold
+
+ buttonHeight: screenOrientation == "portrait"? 72 : 56
+
+ textColor: inverted ? "#CDCDCD" : "#505050"
+ pressedTextColor: inverted ? "#ffffff" : "#505050"
+ checkedTextColor: inverted ? "#ffffff" : "#000000"
+
+ background: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+
+ pressedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ disabledBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+ checkedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ checkedDisabledBackground: "image://theme/meegotouch-tab" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The TabGroup item defines a set of tabs consisting of page stacks or
+// pages that can be switched between to implement a tabbed user interface.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+
+ // The currently selected tab.
+ property Item currentTab
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ onVisibleChanged: __update()
+ onChildrenChanged: __update()
+ onCurrentTabChanged: __update()
+
+ function __update() {
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var newVis = child == currentTab;
+ if (child.visible != newVis) {
+ child.visible = newVis;
+ if (child.status !== undefined) {
+ if (newVis) {
+ child.status = PageStatus.Activating;
+ child.status = PageStatus.Active;
+ } else {
+ child.status = PageStatus.Deactivating;
+ child.status = PageStatus.Inactive;
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textEdit.text
+ property alias placeholderText: prompt.text
+
+ property alias font: textEdit.font
+ property alias cursorPosition: textEdit.cursorPosition
+ property alias readOnly: textEdit.readOnly
+
+ property alias horizontalAlignment: textEdit.horizontalAlignment
+ property alias verticalAlignment: textEdit.verticalAlignment
+
+ property alias selectedText: textEdit.selectedText
+ property alias selectionStart: textEdit.selectionStart
+ property alias selectionEnd: textEdit.selectionEnd
+
+ property alias wrapMode: textEdit.wrapMode
+ property alias textFormat: textEdit.textFormat
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textEdit.activeFocusOnPress
+
+ property alias inputMethodHints: textEdit.inputMethodHints
+
+ property bool errorHighlight: false
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextAreaStyle {}
+ property alias style: root.platformStyle
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textEdit)
+ }
+
+ function copy() {
+ textEdit.copy()
+ }
+
+ function paste() {
+ textEdit.paste()
+ }
+
+ function cut() {
+ textEdit.cut()
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textEdit.forceActiveFocus()
+ }
+
+ function select(start, end) {
+ textEdit.select(start, end)
+ }
+
+ function selectAll() {
+ textEdit.selectAll()
+ }
+
+ function selectWord() {
+ textEdit.selectWord()
+ }
+
+ function positionAt(x, y) {
+ var p = mapToItem(textEdit, x, y);
+ return textEdit.positionAt(p.x, p.y)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textEdit.positionToRectangle(pos)
+ var point = mapFromItem(textEdit, rect.x, rect.y)
+ rect.x = point.x; rect.y = point.y
+ return rect;
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextArea's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ textEdit.closeSoftwareInputPanel();
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextArea's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ textEdit.openSoftwareInputPanel();
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textEdit);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+ // private
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: Math.max (UI.FIELD_DEFAULT_HEIGHT,
+ textEdit.height + (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize))
+
+ onActiveFocusChanged: {
+ if (activeFocus &&
+ !readOnly) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ } else if (!activeFocus) {
+ if (!readOnly)
+ platformCloseSoftwareInputPanel();
+
+ Popup.close(textEdit);
+ }
+ }
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textEdit.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors.fill: parent
+ anchors.leftMargin: UI.PADDING_XLARGE
+ anchors.rightMargin: UI.PADDING_XLARGE
+ anchors.topMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textEdit.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var mappedMousePos = mapToItem(textEdit, mouseX, mouseY);
+ var newCursorPosition = textEdit.positionAt(mappedMousePos.x, mappedMousePos.y, TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextEdit {
+ id: textEdit
+
+ // Exposed for the edit bubble
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ x: UI.PADDING_XLARGE
+ y: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ width: parent.width - UI.PADDING_XLARGE * 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ wrapMode: TextEdit.Wrap
+ persistentSelection: false
+ focus: true
+
+ function updateMagnifierPosition(posX, posY) {
+ var yAdjustment = 0
+ var magnifier = MagnifierPopup.popup;
+ var cursorHeight = textEdit.positionToRectangle(0,0).height;
+ var mappedPos = mapToItem(magnifier.parent, posX - magnifier.width / 2,
+ posY - magnifier.height / 2 - cursorHeight - 70);
+
+ magnifier.xCenter = mapToItem(magnifier.sourceItem, posX, 0).x;
+ magnifier.x = mappedPos.x;
+ if (-root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight) < (magnifier.height / 1.5)) {
+ yAdjustment = Math.max(0,(magnifier.height / 1.5) + root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight));
+ } else {
+ yAdjustment = 0;
+ }
+ magnifier.yCenter = mapToItem(magnifier.sourceItem, 0, posY - cursorHeight + 50).y
+ magnifier.y = mappedPos.y + yAdjustment;
+ }
+
+ Component.onDestruction: {
+ Popup.close(textEdit);
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (textEdit.preedit == "" && Popup.isOpened(textEdit) && !Popup.isChangingInput())
+ Popup.close(textEdit);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelVisibleChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+
+ onCursorPositionChanged: {
+ if(!MagnifierPopup.isOpened() && activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textEdit.cursorPosition == textEdit.text.length) &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ Popup.open(textEdit,
+ textEdit.positionToRectangle(textEdit.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_XLARGE
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_MEDIUM
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ pressOnPreedit = textEdit.cursorPosition==mousePosition
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be committed before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ parent.selectByMouse = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ parent.cursorPosition = parent.positionAt(mouse.x,mouse.y)
+ parent.updateMagnifierPosition(mouse.x,mouse.y)
+ root.z = Number.MAX_VALUE
+ }
+ }
+
+ onReleased:{
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ editBubblePosition = textEdit.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textEdit.text;
+
+ textEdit.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textEdit.preedit.length >=1 && textEdit.preedit.length <= 4)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ } else {
+ textEdit.text=beforeText;
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ attemptToActivate = false;
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textEdit.cursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textEdit.preedit.length == 0)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ Popup.open(textEdit,editBubblePosition);
+ }
+ }
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ var pos = textEdit.positionAt (mouse.x,mouse.y)
+ var posNextLine = textEdit.positionAt (mouse.x, mouse.y + 1)
+ var posPrevLine = textEdit.positionAt (mouse.x, mouse.y - 1)
+ if (!(Math.abs(posNextLine - pos) > 1 ||
+ Math.abs(posPrevLine - pos) > 1)) {
+ parent.cursorPosition = pos
+ }
+ parent.updateMagnifierPosition(mouse.x,mouse.y);
+ }
+ }
+ onDoubleClicked: {
+ // possible pre-edit word have to be committed before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: root.activeFocus
+
+ onClickedOutside: {
+ if (Popup.isOpened(textEdit) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function findFlickable(component) {
+ var nextParent = component
+ var flickableItem = null
+ while(nextParent) {
+ if(nextParent.flicking !== undefined && nextParent.flickableDirection !== undefined)
+ flickableItem = nextParent
+
+ nextParent = nextParent.parent
+ }
+ if (flickableItem) return flickableItem
+ return null
+}
+
+function animateContentY(animation, flickable, newContentY) {
+ animation.target = flickable
+ animation.to = newContentY
+ animation.running = true
+}
+
+function locateFlickableY(flickable) {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ return flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.LandscapeInverted:
+ return screen.displayHeight - flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.Portrait:
+ return flickable.mapToItem(null, flickable.x, flickable.y).x
+
+ case Screen.PortraitInverted:
+ return screen.displayWidth - flickable.mapToItem(null, flickable.x, flickable.y).x
+ }
+}
+
+function getMargin() {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ return 40
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ return 48
+ }
+
+ return 0
+}
+
+function repositionFlickable(animation) {
+ inputContext.updateMicroFocus()
+ var mf = inputContext.microFocus
+
+ if(mf.x == -1 && mf.y == -1)
+ return
+
+ var object = findFlickable(parent)
+
+ if(object){
+ var flickable = object
+
+ // Specifies area from bottom and top when repositioning should be triggered
+ var margin = getMargin()
+ var newContentY = flickable.contentY
+ var flickableY = locateFlickableY(flickable)
+
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ if(flickableY + flickable.height - mf.height - margin < mf.y) {
+ // Find dY just to make textfield visible
+ var dY = mf.y - flickableY - flickable.height
+ // Center textfield
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.y) {
+ var dY = flickableY - mf.y
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.LandscapeInverted:
+ // In inverted screen we need to compensate for the focus height
+ var invertedMfY = screen.displayHeight - mf.y - mf.height
+
+ if(flickableY + flickable.height - mf.height - margin < invertedMfY) {
+ var dY = invertedMfY - flickableY - flickable.height
+ dY += flickable.height / 2 + mf.height / 2
+ } else if(flickableY + margin > invertedMfY){
+ var dY = flickableY - invertedMfY
+ dY += flickable.height / 2 - mf.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.Portrait:
+ if(flickableY + flickable.height - mf.width - margin < mf.x) {
+ var dY = mf.x - flickableY - flickable.height
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.x){
+ var dY = flickableY - mf.x
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.PortraitInverted:
+ var invertedMfX = screen.displayWidth - mf.x - mf.width
+
+ if(flickableY + flickable.height - mf.width - margin < invertedMfX) {
+ var dY = invertedMfX - flickableY - flickable.height + mf.height
+ dY += flickable.height / 2 + mf.height
+ newContentY += dY
+ } else if(flickableY + margin > invertedMfX){
+ var dY = flickableY - invertedMfX
+ dY += flickable.height / 2 - mf.height
+ newContentY -= dY
+ }
+
+ break
+ }
+
+ // If overpanned, set contentY to max possible value (reached bottom)
+ if(newContentY > flickable.contentHeight - flickable.height)
+ newContentY = flickable.contentHeight - flickable.height
+
+ // If overpanned, set contentY to min possible value (reached top)
+ if(newContentY < 0)
+ newContentY = 0
+
+ if(newContentY != flickable.contentY) {
+ animateContentY(animation, flickable, newContentY)
+ }
+ }
+}
+
+function injectWordToPreedit(newCursorPosition) {
+ var preeditStart = previousWordStart(newCursorPosition);
+ var preeditEnd = nextWordEnd(newCursorPosition);
+
+ // copy word to preedit text
+ var preeditText = root.text.substring(preeditStart,preeditEnd);
+
+ // inject preedit
+ cursorPosition = preeditStart;
+
+ var eventCursorPosition = newCursorPosition-preeditStart;
+
+ return inputContext.setPreeditText(preeditText, eventCursorPosition, 0, preeditText.length);
+}
+
+function previousWordStart(pos) {
+ var ret = pos;
+
+ if (ret && atWordSeparator(ret - 1)) {
+ ret--;
+ while (ret && atWordSeparator(ret - 1))
+ ret--;
+ } else {
+ while (ret && !atSpace(ret - 1) && !atWordSeparator(ret - 1))
+ ret--;
+ }
+
+ return ret;
+}
+
+function nextWordEnd(pos) {
+ var ret = pos;
+ var len = root.text.length;
+
+ if (ret < len && atWordSeparator(ret)) {
+ ret++;
+ while (ret < len && atWordSeparator(ret))
+ ret++;
+ } else {
+ while (ret < len && !atSpace(ret) && !atWordSeparator(ret))
+ ret++;
+ }
+
+ return ret;
+}
+
+function atSpace(pos) {
+ var c = root.text.charAt(pos);
+ return c == ' '
+ || c == '\t'
+ || c == '\n'
+ ;
+}
+
+function atWordSeparator(pos) {
+ switch (root.text.charAt(pos)) {
+ case '.':
+ case ',':
+ case '?':
+ case '!':
+ case '@':
+ case '#':
+ case '$':
+ case ':':
+ case ';':
+ case '-':
+ case '<':
+ case '>':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '{':
+ case '}':
+ case '=':
+ case '/':
+ case '+':
+ case '%':
+ case '&':
+ case '^':
+ case '*':
+ case '\'':
+ case '"':
+ case '`':
+ case '~':
+ case '|':
+ return true;
+ default:
+ return false;
+ }
+}
+
+var MIN_UPDATE_INTERVAL = 30
+var lastUpdateTime
+function filteredInputContextUpdate() {
+ if (Date.now() - lastUpdateTime > MIN_UPDATE_INTERVAL || !lastUpdateTime) {
+ inputContext.update();
+ lastUpdateTime = Date.now();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+TextFieldStyle {}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textInput.text
+ property alias placeholderText: prompt.text
+
+ property alias inputMethodHints: textInput.inputMethodHints
+ property alias font: textInput.font
+ property alias cursorPosition: textInput.cursorPosition
+ property alias maximumLength: textInput.maximumLength
+ property alias readOnly: textInput.readOnly
+ property alias acceptableInput: textInput.acceptableInput
+ property alias inputMask: textInput.inputMask
+ property alias validator: textInput.validator
+
+ property alias selectedText: textInput.selectedText
+ property alias selectionStart: textInput.selectionStart
+ property alias selectionEnd: textInput.selectionEnd
+
+ property alias echoMode: textInput.echoMode // ### TODO: declare own enum { Normal, Password }
+
+ property bool errorHighlight: !acceptableInput
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textInput.activeFocusOnPress
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextFieldStyle {}
+
+ property alias style: root.platformStyle
+
+ property Component customSoftwareInputPanel
+
+ property Component platformCustomSoftwareInputPanel
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ signal accepted
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textInput)
+ }
+
+ onCustomSoftwareInputPanelChanged: {
+ console.log("TextField's property customSoftwareInputPanel is deprecated. Use property platformCustomSoftwareInputPanel instead.")
+ platformCustomSoftwareInputPanel = customSoftwareInputPanel
+ }
+
+ onPlatformCustomSoftwareInputPanelChanged: {
+ textInput.activeFocusOnPress = platformCustomSoftwareInputPanel == null
+ }
+
+
+
+ function copy() {
+ textInput.copy()
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+
+ function paste() {
+ textInput.paste()
+ }
+
+ function cut() {
+ textInput.cut()
+ }
+
+ function select(start, end) {
+ textInput.select(start, end)
+ }
+
+ function selectAll() {
+ textInput.selectAll()
+ }
+
+ function selectWord() {
+ textInput.selectWord()
+ }
+
+ function positionAt(x) {
+ var p = mapToItem(textInput, x, 0);
+ return textInput.positionAt(p.x)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textInput.positionToRectangle(pos)
+ rect.x = mapFromItem(textInput, rect.x, 0).x
+ return rect;
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textInput.forceActiveFocus()
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextField's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ if (inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelVisible = false
+ inputContext.customSoftwareInputPanelComponent = null
+ inputContext.customSoftwareInputPanelTextField = null
+ } else {
+ textInput.closeSoftwareInputPanel();
+ }
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextField's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ if (platformCustomSoftwareInputPanel != null && !inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelTextField = root
+ inputContext.customSoftwareInputPanelComponent = platformCustomSoftwareInputPanel
+ inputContext.customSoftwareInputPanelVisible = true
+ } else {
+ textInput.openSoftwareInputPanel();
+ }
+ }
+
+ // private
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: UI.FIELD_DEFAULT_HEIGHT
+
+ onActiveFocusChanged: {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+
+ repositionTimer.running = true;
+ } else {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textInput.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textInput.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textInput.activeFocus) {
+ textInput.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var newCursorPosition = textInput.positionAt(mapToItem(textInput, mouseX, mouseY).x,TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textInput.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextInput {
+ id: textInput
+
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ passwordCharacter: "\u2022"
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ focus: true
+
+ onAccepted: { root.accepted() }
+
+ Component.onDestruction: {
+ Popup.close(textInput);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus) {
+ repositionTimer.running = true
+ }
+ }
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput())
+ Popup.close(textInput);
+ }
+
+ onCursorPositionChanged: {
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened()) {
+ Popup.close(textInput);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textInput.cursorPosition == textInput.text.length) &&
+ Popup.isOpened(textInput) &&
+ !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ Popup.open(textInput,
+ textInput.positionToRectangle(textInput.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingLeft
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingRight
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit: false
+ property int oldCursorPosition: 0
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ pressOnPreedit = textInput.cursorPosition==mousePosition
+ oldCursorPosition = textInput.cursorPosition;
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onDelayedPressSent: {
+ if (textInput.preedit) {
+ textInput.cursorPosition = oldCursorPosition;
+ }
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be commited before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ var cursorPos = textInput.positionToRectangle(0);
+ var mappedPosMf = mapFromItem(parent,mouse.x,cursorPos.y+cursorPos.height);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ var mappedPos = mapToItem(magnifier.parent, mappedPosMf.x - magnifier.width / 2,
+ textInput.y - 120 - UI.MARGIN_XLARGE - (height / 2));
+ var yAdjustment = -mapFromItem(magnifier.__rootElement(), 0, 0).y < magnifier.height / 2.5 ? magnifier.height / 2.5 + mapFromItem(magnifier.__rootElement(), 0,0).y : 0
+ magnifier.x = mappedPos.x;
+ magnifier.y = mappedPos.y + yAdjustment;
+ magnifier.yCenter = mapToItem(magnifier.sourceItem,0,mappedPosMf.y).y;
+ parent.cursorPosition = textInput.positionAt(mouse.x)
+ }
+ }
+
+ onReleased: {
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ editBubblePosition = textInput.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textInput.text;
+
+ textInput.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textInput.preedit.length >=1 && textInput.preedit.length <= 4)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition+1)
+ } else {
+ textInput.text=beforeText;
+ textInput.cursorPosition=newCursorPosition;
+ }
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textInput.cursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textInput.preedit.length == 0)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition);
+ Popup.open(textInput,editBubblePosition);
+
+ }
+ attemptToActivate = false
+ }
+
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ textInput.cursorPosition = textInput.positionAt(mouse.x)
+ var magnifier = MagnifierPopup.popup;
+ var mappedPosMf = mapFromItem(parent,mouse.x,0);
+ var mappedPos = mapToItem(magnifier.parent,mappedPosMf.x - magnifier.width / 2.0, 0);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ magnifier.x = mappedPos.x;
+ }
+ }
+
+ onDoubleClicked: {
+ // possible pre-edit word have to be commited before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: textInput.activeFocus
+ onClickedOutside: {
+ if (Popup.isOpened(textInput) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ property alias textFont: textProperties.font
+ property color textColor: UI.COLOR_FOREGROUND
+ property color selectedTextColor: UI.COLOR_INVERTED_FOREGROUND
+ property color selectionColor: theme.selectionColor
+
+ property color promptTextColor: UI.COLOR_SECONDARY_FOREGROUND
+
+ property url background: "image://theme/meegotouch-textedit-background"
+ property url backgroundSelected: "image://theme/" + theme.colorString + "meegotouch-textedit-background-selected"
+ property url backgroundDisabled: "image://theme/meegotouch-textedit-background-disabled"
+ property url backgroundError: "image://theme/meegotouch-textedit-background-error"
+ property real backgroundCornerMargin: UI.CORNER_MARGINS
+
+ property real paddingLeft: UI.PADDING_XLARGE
+ property real paddingRight: UI.PADDING_XLARGE
+ property real paddingTop // DEPRECATED
+ property real paddingBottom // DEPRECATED
+
+ property real baselineOffset: 2
+ property real defaultWidth: 250
+
+ property real touchExpansionMargin: UI.TOUCH_EXPANSION_MARGIN
+
+ Text {
+ id: textProperties
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.pixelSize: UI.FONT_DEFAULT
+ visible: false
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The ToolBar is a container for toolbar items such as ToolItem or ToolButton.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: bgImage.height
+
+ // Dummy property to allow qt component deprecated API clients to fail more gracefully
+ property bool __hidden: false
+
+ property int privateVisibility: ToolBarVisibility.Visible
+
+ // Styling for the ToolBar
+ property Style platformStyle: ToolBarStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: root.platformStyle
+
+ // Shadows:
+ Image {
+ anchors.top : bgImage.top
+ anchors.right: bgImage.left
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ }
+ Image {
+ anchors.bottom : bgImage.top
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ }
+ Image {
+ anchors.top : bgImage.top
+ anchors.left: bgImage.right
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ }
+ Image {
+ anchors.top : bgImage.bottom
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ }
+ // Toolbar background.
+ BorderImage {
+ id: bgImage
+ width: root.width
+ border.left: 10
+ border.right: 10
+ border.top: 10
+ border.bottom: 10
+ source: platformStyle.background
+
+ // Mousearea that eats clicks so they don't go through the toolbar to content
+ // that may exist below it in z-order, such as unclipped listview items.
+ MouseArea { anchors.fill: parent }
+ }
+
+ states: [
+ // Inactive state.
+ State {
+ name: "hidden"
+ when: privateVisibility == ToolBarVisibility.Hidden || tools == null
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: "HiddenImmediately"
+ when: privateVisibility == ToolBarVisibility.HiddenImmediately
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: ""
+ when: !(privateVisibility == ToolBarVisibility.Visible || tools == null)
+ PropertyChanges { target: root; height: bgImage.height }
+ }
+
+ ]
+
+ transitions: [
+ // Transition between active and inactive states.
+ Transition {
+ from: ""; to: "hidden"; reversible: true
+ ParallelAnimation {
+ PropertyAnimation { properties: "height"; easing.type: Easing.InOutExpo; duration: platformStyle.visibilityTransitionDuration }
+ }
+ }
+ ]
+
+ // The current set of tools.
+ property Item tools: null
+
+ onToolsChanged: {
+ __performTransition(__transition || transition);
+ __transition = undefined;
+ }
+
+ // The transition type. One of the following:
+ // set an instantaneous change (default)
+ // push follows page stack push animation
+ // pop follows page stack pop animation
+ // replace follows page stack replace animation
+ property string transition: "set"
+
+ // The currently displayed container; null if none.
+ property Item __currentContainer: null
+
+ // Alternating containers used for transitions.
+ property Item __containerA: null
+ property Item __containerB: null
+
+ // The transition to perform next.
+ property variant __transition
+
+ // Sets the tools with a transition.
+ function setTools(tools, transition) {
+ __transition = transition;
+ root.tools = tools;
+ }
+
+ // Performs a transition between tools in the toolbar.
+ function __performTransition(transition) {
+ // lazily create containers if they have not been created
+ if (!__currentContainer) {
+ // Parent is bgImage because it doesn't change height when toolbar gets hidden
+ __containerA = containerComponent.createObject(bgImage);
+ __containerB = containerComponent.createObject(bgImage);
+ __currentContainer = __containerB;
+ }
+
+ // no transition if the tools are unchanged
+ if (__currentContainer.tools == tools) {
+ return;
+ }
+
+ // select container states based on the transition animation
+ var transitions = {
+ "set": { "new": "", "old": "hidden" },
+ "push": { "new": "right", "old": "left" },
+ "pop": { "new": "left", "old": "right" },
+ "replace": { "new": "front", "old": "back" }
+ };
+ var animation = transitions[transition];
+
+ // initialize the free container
+ var container = __currentContainer == __containerA ? __containerB : __containerA;
+ container.state = "hidden";
+ if (tools) {
+ container.tools = tools;
+ container.owner = tools.parent;
+ tools.parent = container;
+ tools.visible = true;
+ }
+
+ // perform transition
+ __currentContainer.state = animation["old"];
+ if (tools) {
+ container.state = animation["new"];
+ container.state = "";
+ }
+
+ __currentContainer = container;
+ }
+
+ // Component for toolbar containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The tools held by this container.
+ property Item tools: null
+ // The owner of the tools.
+ property Item owner: null
+
+ states: [
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -30; opacity: 0.0 }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: 30; opacity: 0.0 }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.25; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.85; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ StateChangeScript {
+ script: {
+ if (container.tools) {
+ // re-parent back to original owner
+ tools.visible = false;
+ tools.parent = owner;
+
+ // reset container
+ container.tools = container.owner = null;
+ }
+ }
+ }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "left") state = "hidden"; }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "right") state = "hidden"; }
+ }
+ },
+ Transition {
+ // Replace entry transition.
+ from: "front"; to: "";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ }
+ },
+ Transition {
+ // Replace exit transition.
+ from: ""; to: "back";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ ScriptAction { script: if (state == "back") state = "hidden"; }
+ }
+ }
+ ]
+
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is needed by ToolBarLayout.
+
+var connectedItems = [];
+
+// Find item in an array
+function contains(container, obj) {
+ for (var i = 0 ; i < container.length; i++) {
+ if (container[i] == obj)
+ return true;
+ }
+ return false
+}
+
+// Remove item from an array
+function remove(container, obj)
+{
+ for (var i = 0 ; i < container.length ; i++ )
+ if (container[i] == obj)
+ container.splice(i,1);
+}
+
+// Helper function to give us the sender id on slots
+// This is needed to remove connectens on a reparent
+Function.prototype.bind = function() {
+ var func = this;
+ var thisObject = arguments[0];
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ return func.apply(thisObject, args);
+ }
+}
+
+// Called whenever a child is added or removed in the toolbar
+function childrenChanged() {
+ for (var i = 0; i < children.length; i++) {
+ if (!contains(connectedItems, children[i])) {
+ connectedItems.push(children[i]);
+ children[i].visibleChanged.connect(layout);
+ children[i].parentChanged.connect(cleanup.bind(children[i]));
+ }
+ }
+}
+
+// Disconnects signals connected by this layout
+function cleanup() {
+ remove(connectedItems, this);
+ this.visibleChanged.disconnect(layout);
+ this.parentChanged.disconnect(arguments.callee);
+}
+
+// Main layout function
+function layout() {
+
+ if (parent === null || width === 0)
+ return;
+
+ var i;
+ var items = new Array(); // Keep track of visible items
+ var expandingItems = new Array(); // Keep track of expandingItems for tabs
+ var widthOthers = 0;
+
+ for (i = 0; i < children.length; i++) {
+ if (children[i].visible) {
+ items.push(children[i])
+
+ // Center all items vertically
+ items[0].y = (function() {return height / 2 - items[0].height / 2})
+ // Find out which items are expanding
+ if (children[i].__expanding) {
+ expandingItems.push(children[i])
+ } else {
+ // Calculate the space that fixed size items take
+ widthOthers += children[i].width;
+ }
+ }
+ }
+
+ if (items.length === 0)
+ return;
+
+ // Extra padding is applied if the leftMost or rightmost widget is expanding (note** removed on new design)
+ var leftPadding = 0
+ var rightPadding = 0
+
+ // In LandScape mode we add extra margin to keep contents centered
+ // for two basic cases
+ if (items.length == 2 && screen.currentOrientation == Screen.Landscape) {
+ // expanding item on left
+ if (expandingItems.length > 0 && items[0].__expanding && !items[items.length-1].__expanding)
+ leftPadding += items[items.length-1].width
+
+ // expanding item is on right
+ if (expandingItems.length > 0 && items[items.length-1].__expanding && !items[0].__expanding)
+ rightPadding += items[0].width
+ }
+
+ var width = toolbarLayout.width - leftPadding - rightPadding
+
+ // Calc expandingItems and tabrows
+ for (i = 0; i < expandingItems.length; i++)
+ expandingItems[i].width = (width - widthOthers) / expandingItems.length
+
+ var lastItem = items[items.length-1] ? items[items.length-1] : undefined;
+
+ // Space to be divided between first and last items
+ var toolBox = width - (items[0] ? items[0].width : 0) -
+ (lastItem ? lastItem.width : 0);
+
+ // |X X X| etc.
+ var spacingBetween = toolBox;
+ for (i = 1; i < items.length - 1; i++)
+ spacingBetween -= items[i].width;
+ items[0].x = leftPadding
+
+ // Calculate spacing between items
+ spacingBetween /= items.length - 1;
+
+ // Starting after first item
+ var dX = items[0].width + spacingBetween;
+ for (i = 1; i < items.length; i++) {
+ items[i].x = dX + leftPadding;
+ dX += spacingBetween + items[i].width;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolBarLayout is a container for items on a toolbar that automatically
+// implements an appropriate layout for its children.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "ToolBarLayout.js" as Layout
+
+Item {
+ id: toolbarLayout
+
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ onWidthChanged: Layout.layout()
+ onHeightChanged: Layout.layout()
+ onChildrenChanged: Layout.childrenChanged()
+ Component.onCompleted: Layout.layout()
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-toolbar-" +
+ ((screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape") +
+ __invertedString + "-background"
+
+ property int visibilityTransitionDuration: 250
+ property int contentTransitionDuration: 400
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: toolButton
+
+ //Removes button background if set to true
+ property bool flat: false
+
+ property QtObject platformStyle: ToolButtonStyle { backgroundVisible: !toolButton.flat}
+
+ //Deprecated item, REMOVE THIS
+ property QtObject style: toolButton.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ default property alias children: row.children
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ Row{
+ id: row
+ width: Math.min(parent.width, childrenRect.width)
+ spacing: UI.PADDING_LARGE
+ anchors.centerIn: parent
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 186
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 22
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 15
+ backgroundMarginLeft: 15
+ backgroundMarginTop: 15
+ backgroundMarginBottom: 15
+ property bool backgroundVisible: true
+
+ background: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background" : ""
+ pressedBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-pressed" : ""
+ disabledBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-disabled" : ""
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ property url iconSource
+ property string platformIconId
+
+ // TODO: deprecated
+ property alias iconId: root.platformIconId
+ width: 80; height: 64
+ signal clicked
+
+ // Styling for the ToolItem
+ property Style platformStyle: ToolItemStyle{}
+
+ // TODO: deprecated
+ property Style style: root.platformStyle
+
+ Image {
+ source: mouseArea.pressed ? platformStyle.pressedBackground : ""
+ anchors.centerIn: parent
+
+ Image {
+ function handleIconSource(iconId) {
+ if (iconSource != "")
+ return iconSource;
+
+ var prefix = "icon-m-"
+ // check if id starts with prefix and use it as is
+ // otherwise append prefix and use the inverted version if required
+ if (iconId.indexOf(prefix) !== 0)
+ iconId = prefix.concat(iconId).concat(theme.inverted ? "-white" : "");
+ return "image://theme/" + iconId;
+ }
+
+ source: handleIconSource(iconId)
+ anchors.centerIn: parent
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+ToolIcon {
+ Component.onCompleted: {
+ print("Warning: ToolItem is deprecated, use ToolIcon instead")
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url pressedBackground: "image://theme/meegotouch-button-navigationbar-button"+__invertedString+"-background-pressed"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+var FONT_FAMILY = "Nokia Pure Text";
+var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
+var FONT_DEFAULT_SIZE = 24; // DEPRECATED
+
+var FONT_XLARGE = 32;
+var FONT_LARGE = 28;
+var FONT_SLARGE = 26;
+var FONT_DEFAULT = 24;
+var FONT_LSMALL = 22;
+var FONT_SMALL = 20;
+var FONT_XSMALL = 18;
+var FONT_XXSMALL = 16;
+
+var COLOR_FOREGROUND = "#191919"; // Text color
+var COLOR_SECONDARY_FOREGROUND = "#a6a8ab"; // Secondary text
+var COLOR_BACKGROUND = "#E0E1E2"; // Background
+var COLOR_SELECT = "#4591ff"; //Selected item background
+
+var COLOR_INVERTED_FOREGROUND = "#ffffff"; // Text color
+var COLOR_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Secondary text
+var COLOR_INVERTED_BACKGROUND = "#000000"; // Background
+
+var COLOR_DISABLED_FOREGROUND = "#b2b2b4";
+
+var COLOR_BUTTON_FOREGROUND = "#000000" //text color
+var COLOR_BUTTON_INVERTED_FOREGROUND = "#ffffff" //inverted text color
+var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c" //secondary text
+var COLOR_BUTTON_DISABLED_FOREGROUND = "#B2B2B4" //disabled text
+var COLOR_BUTTON_BACKGROUND = "#000000" //background
+
+var SIZE_ICON_DEFAULT = 32;
+var SIZE_ICON_LARGE = 48;
+
+var CORNER_MARGINS = 22;
+
+var MARGIN_DEFAULT = 0;
+var MARGIN_XLARGE = 16;
+
+// Distance in pixels from the widget bounding box inside which a release
+// event would still be accepted and trigger the widget
+var RELEASE_MISS_DELTA = 30;
+
+var OPACITY_ENABLED = 1.0;
+var OPACITY_DISABLED = 0.5;
+var SIZE_BUTTON = 64;
+
+var PADDING_XSMALL = 2;
+var PADDING_SMALL = 4;
+var PADDING_MEDIUM = 6;
+var PADDING_LARGE = 8;
+var PADDING_DOUBLE = 12;
+var PADDING_XLARGE = 16;
+var PADDING_XXLARGE = 24;
+
+var SCROLLDECORATOR_SHORT_MARGIN = 8;
+var SCROLLDECORATOR_LONG_MARGIN = 4;
+
+var TOUCH_EXPANSION_MARGIN = -12;
+
+var BUTTON_WIDTH = 322;
+var BUTTON_HEIGHT = 51;
+var BUTTON_LABEL_MARGIN = 10;
+
+var FIELD_DEFAULT_HEIGHT = 52;
+
+//Common UI layouts
+var DEFAULT_MARGIN = 16;
+var BUTTON_SPACING = 6;
+var HEADER_DEFAULT_HEIGHT_PORTRAIT = 72;
+var HEADER_DEFAULT_HEIGHT_LANDSCAPE = 46;
+var HEADER_DEFAULT_TOP_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_BOTTOM_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_TOP_SPACING_LANDSCAPE = 16;
+var HEADER_DEFAULT_BOTTOM_SPACING_LANDSCAPE = 14;
+var LIST_ITEM_HEIGHT_SMALL = 64;
+var LIST_ITEM_HEIGHT_DEFAULT = 80;
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+/*
+ Get the first flickable in hierarchy.
+*/
+function findFlickable(item)
+{
+ var next = item;
+
+ while (next) {
+ if (next.flicking !== undefined && next.flickableDirection !== undefined)
+ return next;
+
+ next = next.parent;
+ }
+
+ return null;
+}
+
+/*
+ Get the root item given an element and root item's name.
+ If root item name is not given, default is 'windowContent'.
+*/
+function findRootItem(item, objectName)
+{
+ var next = item;
+
+ var rootItemName = "windowContent";
+ if (typeof(objectName) != 'undefined') {
+ rootItemName = objectName;
+ }
+
+ if (next) {
+ while (next.parent) {
+ next = next.parent;
+
+ if (rootItemName == next.objectName) {
+ break;
+ }
+ }
+ }
+
+ return next;
+}
+
+/*
+ Get the root item for Notification banner
+ It will return 'appWindowContent' or 'windowContent' element if found.
+*/
+function findRootItemNotificationBanner(item)
+{
+ var next = item;
+
+ if (next) {
+ while (next.parent) {
+ if (next.objectName == "appWindowContent")
+ break;
+
+ if (next.objectName == "windowContent")
+ break;
+
+ next = next.parent;
+ }
+ }
+
+ return next;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: screen.displayWidth
+ height: screen.displayHeight
+
+ property alias color: background.color
+
+ default property alias content: windowContent.data
+
+ // Read only property true if window is in portrait
+ property alias inPortrait: window.portrait
+
+ signal orientationChangeAboutToStart
+ signal orientationChangeStarted
+ signal orientationChangeFinished
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "black"
+ }
+
+ Item {
+ id: window
+ property bool portrait
+
+ width: window.portrait ? screen.displayHeight : screen.displayWidth
+ height: window.portrait ? screen.displayWidth : screen.displayHeight
+
+ anchors.centerIn : parent
+ transform: Rotation { id: windowRotation;
+ origin.x: 0;
+ origin.y: 0;
+ angle: 0
+ }
+
+ Item {
+ id: windowContent
+ width: parent.width
+ height: parent.height - heightDelta
+
+ // Used for resizing windowContent when virtual keyboard appears
+ property int heightDelta: 0
+
+ objectName: "windowContent"
+ clip: true
+
+ Connections {
+ id: inputContextConnection
+ target: inputContext
+ onSoftwareInputPanelVisibleChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ onSoftwareInputPanelRectChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ function updateWindowContentHeightDelta() {
+ if(inputContext.customSoftwareInputPanelVisible)
+ return
+
+ if (root.inPortrait)
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.width
+ else
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.height
+ }
+ }
+ }
+
+ SoftwareInputPanel {
+ id: softwareInputPanel
+ active: inputContext.customSoftwareInputPanelVisible
+ anchors.bottom: parent.bottom
+
+ onHeightChanged: {
+ windowContent.heightDelta = height
+ }
+
+ Loader {
+ id: softwareInputPanelLoader
+ width: parent.width
+ sourceComponent: inputContext.customSoftwareInputPanelComponent
+ }
+ }
+
+ Snapshot {
+ id: snapshot
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: screen.displayWidth
+ height: screen.displayHeight
+ snapshotWidth: screen.displayWidth
+ snapshotHeight: screen.displayHeight
+ opacity: 0
+ transform: Rotation { id: snapshotRotation;
+ origin.x: screen.displayHeight / 2; origin.y: screen.displayHeight / 2;
+ angle: 0 }
+ }
+
+ state: screen.orientationString
+
+ states: [
+ State {
+ name: "Landscape"
+ PropertyChanges { target: window; rotation: 0; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "Portrait"
+ PropertyChanges { target: window; rotation: 270; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "LandscapeInverted"
+ PropertyChanges { target: window; rotation: 180; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 374; anchors.topMargin: 0 }
+ },
+ State {
+ name: "PortraitInverted"
+ PropertyChanges { target: window; rotation: 90; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 374 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ // use this transition when sip is visible
+ from: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ to: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ PropertyAction { target: window; properties: "rotation"; }
+ ScriptAction {
+ script: {
+ root.orientationChangeAboutToStart();
+ platformWindow.startSipOrientationChange(window.rotation);
+ // note : we should really connect these signals to MInputMethodState
+ // signals so that they are emitted at the appropriate time
+ // but there aren't any
+ root.orientationChangeStarted();
+ root.orientationChangeFinished();
+ }
+ }
+ },
+ Transition {
+ // use this transition when sip is not visible
+ from: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ to: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ SequentialAnimation {
+ alwaysRunToEnd: true
+
+ ScriptAction {
+ script: {
+ snapshot.take();
+ snapshot.opacity = 1.0;
+ snapshotRotation.angle = -window.rotation;
+ snapshot.smooth = false; // Quick & coarse rotation consistent with MTF
+ platformWindow.animating = true;
+ root.orientationChangeAboutToStart();
+ }
+ }
+ PropertyAction { target: window; properties: "portrait"; }
+ ScriptAction {
+ script: {
+ windowContent.opacity = 0.0;
+ root.orientationChangeStarted();
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { target: windowContent; property: "opacity";
+ to: 1.0; easing.type: Easing.InOutExpo; duration: 600; }
+ NumberAnimation { target: snapshot; property: "opacity";
+ to: 0.0; easing.type: Easing.InOutExpo; duration: 600; }
+ PropertyAction { target: windowRotation; properties: "origin.x"; }
+ PropertyAction { target: windowRotation; properties: "origin.y"; }
+ RotationAnimation { target: windowRotation; property: "angle";
+ from: -screen.rotationDirection * 90;
+ to: 0;
+ direction: RotationAnimation.Shortest;
+ easing.type: Easing.InOutExpo; duration: 600; }
+ }
+ ScriptAction {
+ script: {
+ windowRotation.angle = 0
+ snapshot.free();
+ root.orientationChangeFinished();
+ platformWindow.animating = false;
+ }
+ }
+ }
+ }
+ ]
+
+ focus: true
+ Keys.onReleased: {
+ if (event.key == Qt.Key_I && event.modifiers == Qt.AltModifier) {
+ theme.inverted = !theme.inverted;
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.AltModifier) {
+ if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.Landscape;
+ }
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.ControlModifier ) {
+ if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.Landscape;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+plugin meegoplugin
+ApplicationWindow 1.0 ApplicationWindow.qml
+ApplicationWindowStyle 1.0 ApplicationWindowStyle.qml
+BusyIndicator 1.0 BusyIndicator.qml
+BusyIndicatorStyle 1.0 BusyIndicatorStyle.qml
+Button 1.0 Button.qml
+ButtonStyle 1.0 ButtonStyle.qml
+GroupButtonStyle 1.0 GroupButtonStyle.qml
+ButtonColumn 1.0 ButtonColumn.qml
+ButtonRow 1.0 ButtonRow.qml
+CheckBox 1.0 CheckBox.qml
+CheckBoxStyle 1.0 CheckBoxStyle.qml
+ContextMenu 1.0 ContextMenu.qml
+ContextMenuStyle 1.0 ContextMenuStyle.qml
+Dialog 1.0 Dialog.qml
+DialogStyle 1.0 DialogStyle.qml
+EditBubble 1.0 EditBubble.qml
+QueryDialog 1.0 QueryDialog.qml
+QueryDialogStyle 1.0 QueryDialogStyle.qml
+SelectionDialog 1.0 SelectionDialog.qml
+MultiSelectionDialog 1.0 MultiSelectionDialog.qml
+SelectionDialogStyle 1.0 SelectionDialogStyle.qml
+Label 1.0 Label.qml
+LabelStyle 1.0 LabelStyle.qml
+Menu 1.0 Menu.qml
+MenuLayout 1.0 MenuLayout.qml
+MenuItem 1.0 MenuItem.qml
+MenuStyle 1.0 MenuStyle.qml
+MenuItemStyle 1.0 MenuItemStyle.qml
+MouseAreaDebug 1.0 MouseAreaDebug.qml
+Page 1.0 Page.qml
+PageStack 1.0 PageStack.qml
+PageStackWindow 1.0 PageStackWindow.qml
+PageStackWindowStyle 1.0 PageStackWindowStyle.qml
+ProgressBar 1.0 ProgressBar.qml
+ProgressBarStyle 1.0 ProgressBarStyle.qml
+RadioButton 1.0 RadioButton.qml
+RadioButtonStyle 1.0 RadioButtonStyle.qml
+ScrollDecorator 1.0 ScrollDecorator.qml
+ScrollDecoratorStyle 1.0 ScrollDecoratorStyle.qml
+SectionScroller 1.0 SectionScroller.qml
+SectionScrollerStyle 1.0 SectionScrollerStyle.qml
+Sheet 1.0 Sheet.qml
+SheetStyle 1.0 SheetStyle.qml
+SheetButton 1.0 SheetButton.qml
+SheetButtonStyle 1.0 SheetButtonStyle.qml
+SheetButtonAccentStyle 1.0 SheetButtonAccentStyle.qml
+Slider 1.0 Slider.qml
+SliderStyle 1.0 SliderStyle.qml
+SliderTemplate 1.0 SliderTemplate.qml
+StatusBar 1.0 StatusBar.qml
+Style 1.0 Style.qml
+Switch 1.0 Switch.qml
+SwitchStyle 1.0 SwitchStyle.qml
+TabBarLayout 1.0 TabBarLayout.qml
+TabButton 1.0 TabButton.qml
+TabButtonStyle 1.0 TabButtonStyle.qml
+TabGroup 1.0 TabGroup.qml
+TextArea 1.0 TextArea.qml
+TextAreaStyle 1.0 TextAreaStyle.qml
+TextField 1.0 TextField.qml
+TextFieldStyle 1.0 TextFieldStyle.qml
+ToolBar 1.0 ToolBar.qml
+ToolBarLayout 1.0 ToolBarLayout.qml
+ToolBarStyle 1.0 ToolBarStyle.qml
+ToolButton 1.0 ToolButton.qml
+ToolButtonRow 1.0 ToolButtonRow.qml
+ToolButtonStyle 1.0 ToolButtonStyle.qml
+ToolItem 1.0 ToolItem.qml
+ToolIcon 1.0 ToolIcon.qml
+ToolItemStyle 1.0 ToolItemStyle.qml
+Window 1.0 Window.qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+
+ // Common API
+ default property alias content: contentField.children
+
+ // Common API inherited from Popup:
+ /*
+ function open()
+ function close()
+
+ property QDeclarativeItem* visualParent
+ property int status
+ */
+
+ // platformStyle API
+ property Style platformStyle: MenuStyle{}
+ property alias style: root.platformStyle // Deprecated
+ property alias platformTitle: titleBar.children
+ property alias title: titleBar.children // Deprecated
+ property alias __footer: footerBar.children
+
+ // private api
+ property int __statusBarDelta: visualParent ? 0 :
+ __findItem( "appWindowContent") != null ? 0 :
+ __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").showStatusBar ? 36 : 0
+
+ property string __animationChief: "abstractMenu"
+ property int __pressDelay: platformStyle.pressDelay
+ property alias __statesWrapper: statesWrapper
+ property alias __menuPane: menuPane
+
+ // This item will find the object with the given objectName ... or will return
+ function __findItem( objectName ) {
+ var next = parent;
+
+ if (next != null) {
+ while (next) {
+ if(next.objectName == objectName){
+ return next;
+ }
+
+ next = next.parent;
+ }
+ }
+
+ return null;
+ }
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+ __faderBackground: platformStyle.faderBackground
+ __fadeInEasingType: platformStyle.fadeInEasingType
+ __fadeOutEasingType: platformStyle.fadeOutEasingType
+
+ anchors.fill: parent
+
+ // When application is minimized menu is closed.
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ if(!platformWindow.active)
+ close()
+ }
+ }
+
+ // This is needed for menus which are not instantiated inside the
+ // content window of the PageStackWindow:
+ Item {
+ id: roundedCorners
+ visible: root.status != DialogStatus.Closed && !visualParent
+ && __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").platformStyle.cornersVisible
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: parent.height - __statusBarDelta - 2
+ z: 10001
+
+ // compensate for the widening of the edges of the fader (which avoids artefacts during rotation)
+ anchors.topMargin: +1
+ anchors.rightMargin: +1
+ anchors.bottomMargin: +1
+ anchors.leftMargin: +1
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ // Shadows:
+ Image {
+ anchors.top : menuPane.top
+ anchors.right: menuPane.left
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.bottom : menuPane.top
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.top
+ anchors.left: menuPane.right
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.bottom
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ visible: root.status != DialogStatus.Closed
+ }
+
+ Item {
+ id: menuPane
+ //ToDo: add support for layoutDirection Qt::RightToLeft
+ x: platformStyle.leftMargin
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: (screen.currentOrientation == 1) || (screen.currentOrientation == 4) ?
+ /* Portrait */ titleBar.height + flickableContent.height + footerBar.height :
+ /* Landscape */ parent.height - platformStyle.topMargin - platformStyle.bottomMargin - __statusBarDelta
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+
+ state: __statesWrapper.state
+
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ root.platformStyle.background
+ anchors.fill : parent
+ border { left: 22; top: theme.inverted ? 124 : 22;
+ right: 22; bottom: theme.inverted ? 2 : 22 }
+ }
+
+ // this item contains the whole menu (content rectangle)
+ Item {
+ id: backgroundRect
+ anchors.fill: parent
+
+ Item {
+ id: titleBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: childrenRect.height
+ }
+
+ Item {
+ // Required to have the ScrollDecorator+Flickable handled
+ // by the column as a single item while keeping the
+ // ScrollDecorator working
+ id: flickableContent
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height
+ property int maxHeight : visualParent
+ ? visualParent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : root.parent
+ ? root.parent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : 350
+
+ height: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding < maxHeight
+ ? contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ : maxHeight
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentWidth: parent.width
+ contentHeight: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ interactive: contentHeight > flickable.height
+ flickableDirection: Flickable.VerticalFlick
+ pressDelay: __pressDelay
+ clip: true
+
+ Item {
+ id: contentRect
+ height: contentField.childrenRect.height
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.topMargin: platformStyle.topPadding
+ anchors.bottomMargin: platformStyle.bottomPadding
+ anchors.leftMargin: platformStyle.leftPadding
+ anchors.rightMargin: platformStyle.rightPadding
+
+ Item {
+ id: contentField
+ anchors.fill: contentRect
+
+ function closeMenu() { root.close(); }
+ }
+ }
+ }
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: flickable
+ }
+ }
+
+ Item {
+ id: footerBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height + flickableContent.height
+ height: childrenRect.height
+ }
+
+ }
+ }
+
+ onPrivateClicked: close() // "reject()"
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 0.0
+ }
+ }
+ ]
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+PageStackWindow {
+
+ Component.onCompleted: {
+ print("Warning: ApplicationWindow is deprecated, use PageStackWindow instead");
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: "image://theme/meegotouch-applicationpage-background"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var children = []
+
+function cleanup()
+{
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ item.widthChanged.disconnect(relayout);
+ item.heightChanged.disconnect(relayout);
+ item.visibleChanged.disconnect(relayout);
+ }
+
+ children = [];
+}
+
+function updateChildren()
+{
+ cleanup();
+
+ var length = row.children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = row.children[i];
+
+ item.widthChanged.connect(relayout);
+ item.heightChanged.connect(relayout);
+ item.visibleChanged.connect(relayout);
+
+ children.push(item);
+ }
+
+ relayout();
+}
+
+function relayout()
+{
+ var ix = 0;
+ var ih = 0;
+
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ if (!item.visible)
+ continue;
+
+ item.x = ix;
+ item.y = 0;
+ ih = Math.max(ih, item.height);
+ ix += item.width;
+ }
+
+ row.width = ix;
+ row.height = ih;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "BasicRow.js" as Private
+
+/*
+ This element should be used in place of the Row element to
+ avoid visual artifacts during the relayout operation.
+
+ The QML Row element updates its children position using a
+ singleShot, so a paint operation could happen before the items
+ are positioned in the right place.
+
+ This element reposition its children immediately to avoid this,
+ so it's recommended to be used with just a few elements, since
+ it's not optimized.
+
+ This element can be removed when the following bug is solved:
+ http://bugreports.qt.nokia.com/browse/QTBUG-18919
+*/
+
+Item {
+ id: row
+
+ onChildrenChanged: Private.updateChildren();
+ Component.onCompleted: Private.updateChildren();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+import "UIConstants.js" as UI
+import "TextAreaHelper.js" as AreaHelper
+
+// ### Display Entered / Exited! Pause animation when not "on display".
+// ### LayoutDirection
+
+ImplicitSizeItem {
+ id: root
+
+ property bool running: false
+
+ property Style platformStyle: BusyIndicatorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.size == "small" ? 24 : platformStyle.size == "medium" ? 32 : 96;
+ implicitHeight: implicitWidth
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ Image {
+ id: spinner
+ property int index: 1
+ source: root.platformStyle.spinnerFrames + "_" + root.implicitWidth + "_" + index
+ smooth: true
+
+ NumberAnimation on index {
+ from: 1; to: root.platformStyle.numberOfFrames
+ duration: root.platformStyle.period
+ running: root.running && root.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ }
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + root.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + root.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property string size: "medium"
+ property int period: 1000
+
+ property int numberOfFrames: 10
+
+ __invertedString: inverted? "inverted" : "" // The spinner frames do not follow the common inverted file naming :(
+
+ property url spinnerFrames: "image://theme/spinner"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: button
+
+ // Common public API
+ property bool checked: false
+ property bool checkable: false
+ property alias pressed: mouseArea.pressed
+ property alias text: label.text
+ property url iconSource
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ signal clicked
+
+ // Used in ButtonGroup.js to set the segmented look on the buttons.
+ property string __buttonType
+
+ // Styling for the Button
+ property Style platformStyle: ButtonStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: button.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+ width: implicitWidth
+
+ property alias font: label.font
+
+ //private property
+ property bool __dialogButton: false
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+ right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+
+ source: __dialogButton ? (pressed ? button.platformStyle.pressedDialog : button.platformStyle.dialog) :
+ !enabled ?
+ (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+ pressed ?
+ button.platformStyle.pressedBackground :
+ checked ?
+ button.platformStyle.checkedBackground :
+ button.platformStyle.background;
+ }
+
+ Image {
+ id: icon
+ anchors.left: label.visible ? parent.left : undefined
+ anchors.leftMargin: label.visible ? UI.MARGIN_XLARGE : 0
+ anchors.centerIn: label.visible ? undefined : parent
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -1
+
+ source: button.iconSource
+
+ visible: source != ""
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: icon.visible ? icon.right : parent.left
+ anchors.leftMargin: icon.visible ? UI.PADDING_XLARGE : UI.BUTTON_LABEL_MARGIN
+ anchors.right: parent.right
+ anchors.rightMargin: UI.BUTTON_LABEL_MARGIN
+
+ horizontalAlignment: icon.visible ? Text.AlignLeft : button.platformStyle.horizontalAlignment
+ elide: Text.ElideRight
+
+ font.family: button.platformStyle.fontFamily
+ font.weight: checked ? button.platformStyle.checkedFontWeight : button.platformStyle.fontWeight
+ font.pixelSize: button.platformStyle.fontPixelSize
+ font.capitalization: button.platformStyle.fontCapitalization
+ color: !enabled ? button.platformStyle.disabledTextColor :
+ pressed ? button.platformStyle.pressedTextColor :
+ checked ? button.platformStyle.checkedTextColor :
+ button.platformStyle.textColor;
+ text: ""
+ visible: text != ""
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors {
+ fill: parent
+ rightMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-left") ? platformStyle.mouseMarginRight : 0
+ leftMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-right") ? platformStyle.mouseMarginLeft : 0
+ topMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-bottom") ? platformStyle.mouseMarginTop : 0
+ bottomMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-top") ? platformStyle.mouseMarginBottom : 0
+ }
+ onClicked: if (button.checkable) button.checked = !button.checked
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Column {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ width: UI.BUTTON_WIDTH
+
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Vertical,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "vertical-top",
+ "middlePos": "vertical-center",
+ "lastPos": "vertical-bottom",
+ "resizeChildren": function(self) {
+ Private.buttons.forEach(function(item, i) {
+ if (Private.isButton(item) && item.visible) {
+ item.anchors.left = self.left;
+ item.anchors.right = self.right;
+ }
+ });
+ }
+ });
+ }
+
+ Component.onDestruction: {
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is shared between ButtonRow.qml and ButtonColumn.qml.
+
+var self = undefined;
+var checkedButton = null;
+var buttons = [];
+var firstVisible = -1;
+var lastVisible = -1;
+var visibleButtons = 0;
+var buttonHandlers = [];
+var styleComponent = undefined;
+var params = undefined;
+
+function isButton(item) {
+ return (item && item.hasOwnProperty("__buttonType"));
+}
+
+function hasChecked(item) {
+ return (item && item.hasOwnProperty("checked"));
+}
+
+function cleanup() {
+ buttons.forEach(function(button, i) {
+ if (button.visible && params.exclusive) {
+ button.checkedChanged.disconnect(buttonHandlers[i]);
+ }
+ if (isButton(button))
+ button.visibleChanged.disconnect(buttonVisibleChanged);
+ });
+ buttons = [];
+ buttonHandlers = [];
+}
+
+function updateButtons() {
+ cleanup();
+
+ params.exclusive = self.exclusive;
+
+ checkedButton = null;
+ var length = self.children.length;
+ for (var i = 0; i < length; i++) {
+ var item = self.children[i];
+ if (!hasChecked(item))
+ continue;
+ buttons.push(item);
+
+ item.visibleChanged.connect(buttonVisibleChanged);
+
+ if (item.checked) {
+ if (!checkedButton && (self.checkedButton === item || self.checkedButton == undefined))
+ checkedButton = item;
+ else if (params.exclusive && self.checkedButton != item)
+ item.checked = false;
+ } else if (self.checkedButton === item) {
+ if (checkedButton && params.exclusive)
+ checkedButton.checked = false;
+ checkedButton = item;
+ item.checked = true;
+ }
+
+ if (isButton(item)) {
+ if (styleComponent)
+ item.platformStyle = styleComponent.createObject(item)
+
+ // Only ButtonRow supports tab buttons and care about screen orientation
+ if (params.orientation == Qt.Horizontal && item.platformStyle.hasOwnProperty("screenOrientation"))
+ switch (screen.currentOrientation) {
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ item.platformStyle.screenOrientation = "portrait";
+ break;
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ item.platformStyle.screenOrientation = "landscape";
+ break;
+ }
+ }
+ if (params.exclusive) {
+ if (item["checkable"] !== undefined)
+ item.checkable = true;
+ var last = buttonHandlers.push(checkExclusive(item));
+ item.checkedChanged.connect(buttonHandlers[last - 1]);
+ }
+ }
+
+ if (!checkedButton && buttons.length > 0 && params.exclusive) {
+ checkedButton = buttons[0];
+ checkedButton.checked = true;
+ }
+ self.checkedButton = checkedButton;
+
+ buttonVisibleChanged();
+}
+
+var blockCheckedChanged = false;
+
+function checkExclusive(item) {
+ var button = item;
+ return function() {
+ if (blockCheckedChanged)
+ return;
+ if (!button.checked) {
+ if (self.checkedButton === button) {
+ blockCheckedChanged = true;
+ button.checked = true;
+ blockCheckedChanged = false;
+ }
+ return;
+ }
+ if (self.checkedButton === button)
+ return;
+ if (self.checkedButton) {
+ blockCheckedChanged = true;
+ self.checkedButton.checked = false;
+ blockCheckedChanged = false;
+ }
+ checkedButton = button;
+ self.checkedButton = button;
+ }
+}
+
+function checkedButtonChanged() {
+ if (checkedButton === self.checkedButton)
+ return;
+ blockCheckedChanged = true;
+ if (params.exclusive && checkedButton)
+ checkedButton.checked = false;
+ if (self.checkedButton)
+ self.checkedButton.checked = true;
+ blockCheckedChanged = false;
+ checkedButton = self.checkedButton;
+}
+
+function buttonVisibleChanged() {
+ visibleButtons = 0;
+ firstVisible = -1;
+ lastVisible = -1;
+ buttons.forEach(function (button, i) {
+ if (button.visible) {
+ if (firstVisible === -1)
+ firstVisible = i;
+ lastVisible = i;
+ visibleButtons++;
+ }
+ });
+
+ updateGroupPosition();
+ resizeChildren();
+}
+
+function updateGroupPosition() {
+ if (visibleButtons === 0)
+ return;
+
+ // Fix the children group position
+ if (visibleButtons == 1) {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.singlePos;
+ } else {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.firstPos;
+ for (var i = firstVisible + 1; i < lastVisible; i++) {
+ if (buttons[i].visible && isButton(buttons[i]))
+ buttons[i].platformStyle.position = params.middlePos;
+ }
+ if (isButton(buttons[lastVisible]))
+ buttons[lastVisible].platformStyle.position = params.lastPos;
+ }
+}
+
+var resizing = false; // resizeChildren() may trigger reentrant calls
+
+function resizeChildren() {
+ if (resizing || visibleButtons === 0)
+ return;
+
+ if (typeof params.resizeChildren === "function") {
+ resizing = true;
+ params.resizeChildren(self);
+ resizing = false;
+ }
+}
+
+function create(s, p) {
+ if (!s) {
+ console.log("Error creating ButtonGroup: invalid owner.");
+ return;
+ }
+ if (!s.hasOwnProperty("checkedButton")) {
+ console.log("Error creating ButtonGroup: owner has no 'checkedButton' property.");
+ return;
+ }
+
+ self = s;
+ params = p;
+
+ styleComponent = params.styleComponent;
+
+ if (styleComponent && styleComponent.status != Component.Ready) {
+ console.log("Error loading style:", styleComponent.errorString());
+ return
+ }
+
+ updateButtons();
+ self.checkedButtonChanged.connect(checkedButtonChanged);
+ self.childrenChanged.connect(updateButtons);
+ self.exclusiveChanged.connect(Private.updateButtons);
+ self.widthChanged.connect(resizeChildren);
+}
+
+function destroy() {
+ if (self) {
+ self.checkedButtonChanged.disconnect(checkedButtonChanged);
+ self.childrenChanged.disconnect(updateButtons);
+ self.widthChanged.disconnect(resizeChildren);
+ self = undefined;
+ }
+ if (styleComponent) {
+ styleComponent.destroy();
+ styleComponent = undefined;
+ }
+ cleanup();
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Row {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ property int __screenWidth: (screen.rotation === 0 || screen.rotation === 180 ? screen.displayWidth : screen.displayHeight) - 2 * UI.MARGIN_XLARGE
+ property int __visibleButtons
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __maxButtonSize: UI.BUTTON_WIDTH
+
+ width: Math.min(__visibleButtons * UI.BUTTON_WIDTH, __screenWidth)
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Horizontal,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "horizontal-left",
+ "middlePos": "horizontal-center",
+ "lastPos": "horizontal-right",
+ "resizeChildren": function(self) {
+ self.__visibleButtons = Private.visibleButtons;
+ var extraPixels = self.width % Private.visibleButtons;
+ var buttonSize = Math.min(__maxButtonSize, (self.width - extraPixels) / Private.visibleButtons);
+ Private.buttons.forEach(function(item, i) {
+ if (!item || !item.visible || !Private.isButton(item))
+ return;
+ if (extraPixels > 0) {
+ item.width = buttonSize + 1;
+ extraPixels--;
+ } else {
+ item.width = buttonSize;
+ }
+ });
+ }
+ });
+ screen.currentOrientationChanged.connect(Private.updateButtons);
+ }
+
+ Component.onDestruction: {
+ screen.currentOrientationChanged.disconnect(Private.updateButtons);
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int checkedFontWeight: Font.Bold
+ property int horizontalAlignment: Text.AlignHCenter
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ property color disabledTextColor: UI.COLOR_BUTTON_DISABLED_FOREGROUND
+ property color checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Dimensions
+ property int buttonWidth: UI.BUTTON_WIDTH
+ property int buttonHeight: UI.BUTTON_HEIGHT
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+
+ // Background
+ property int backgroundMarginRight: 22
+ property int backgroundMarginLeft: 22
+ property int backgroundMarginTop: 22
+ property int backgroundMarginBottom: 22
+
+ /* The position property can take one of the following values:
+
+ [horizontal-left] [horizontal-center] [horizontal-right]
+
+ [vertical-top]
+ [vertical-center]
+ [vertical-bottom]
+ */
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-button" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ property url disabledBackground: "image://theme/meegotouch-button" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+ property url checkedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ property url checkedDisabledBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-disabled-selected" + (position ? "-" + position : "")
+ property url dialog: "image://theme/meegotouch-dialog-button-negative"
+ property url pressedDialog: "image://theme/meegotouch-dialog-button-negative-pressed"
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: checkbox
+
+ property Style platformStyle: CheckBoxStyle{}
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: checkbox.platformStyle
+
+ property string text
+ property bool checked: false
+ property bool pressed
+ signal clicked
+
+ implicitWidth: image.width + body.spacing + label.implicitWidth
+ implicitHeight: body.height
+
+ onWidthChanged: if (width > 0 && width != implicitWidth)
+ label.width = checkbox.width - body.spacing - image.width
+
+ Binding {
+ target: checkbox
+ property: "pressed"
+ value: mouseArea.pressed && mouseArea.containsMouse
+ }
+
+ property alias __imageSource: image.source
+
+ function __handleChecked() {
+ checkbox.checked = !checkbox.checked;
+ }
+
+ Row {
+ id: body
+ spacing: 15
+
+ BorderImage {
+ id: image
+ smooth: true
+
+ width: 42; height: 42
+
+ source: !checkbox.enabled ? platformStyle.backgroundDisabled :
+ checkbox.pressed ? platformStyle.backgroundPressed :
+ checkbox.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: image.verticalCenter
+ text: checkbox.text
+ elide: checkbox.platformStyle.elideMode
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: body
+ anchors.topMargin: platformStyle.mouseMarginTop
+ anchors.leftMargin: platformStyle.mouseMarginLeft
+ anchors.rightMargin: platformStyle.mouseMarginRight
+ anchors.bottomMargin: platformStyle.mouseMarginBottom
+
+ onPressed: {
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("pressOnFeedback");
+ // else
+ // meegostyle.feedback("pressOffFeedback");
+ }
+
+ onClicked: {
+ __handleChecked();
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("releaseOnFeedback");
+ // else
+ // meegostyle.feedback("releaseOffFeedback");
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-checkbox"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Dialog {
+ id: genericDialog
+
+ property string titleText: ""
+
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: genericDialog.platformStyle
+
+ //private
+ property bool __drawFooterLine: false
+
+ title: Item {
+ id: header
+ height: genericDialog.platformStyle.titleBarHeight
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ Item {
+ id: labelField
+
+ anchors.fill: parent
+
+ Item {
+ id: labelWrapper
+ anchors.left: labelField.left
+ anchors.right: closeButton.left
+
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin
+
+ //anchors.verticalCenter: labelField.verticalCenter
+
+ height: titleLabel.height
+
+ Label {
+ id: titleLabel
+ x: genericDialog.platformStyle.titleBarIndent
+ width: parent.width - closeButton.width
+ //anchors.baseline: parent.bottom
+ font: genericDialog.platformStyle.titleBarFont
+ color: genericDialog.platformStyle.commonLabelColor
+ elide: genericDialog.platformStyle.titleElideMode
+ text: genericDialog.titleText
+ }
+
+ }
+
+ Image {
+ id: closeButton
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin-6
+ //anchors.verticalCenter: labelField.verticalCenter
+ anchors.right: labelField.right
+
+ opacity: closeButtonArea.pressed ? 0.5 : 1.0
+
+ source: "image://theme/icon-m-common-dialog-close"
+
+ MouseArea {
+ id: closeButtonArea
+ anchors.fill: parent
+ onClicked: {genericDialog.reject();}
+ }
+
+ }
+
+ }
+
+ Rectangle {
+ id: headerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.bottom: header.bottom
+
+ height: 1
+
+ color: "#4D4D4D"
+ }
+
+ }
+
+ content: Item {id: contentField}
+
+ buttons: Item {
+ id: footer
+
+ width: parent.width
+ height: childrenRect.height
+
+ //hack to make sure, we're evaluating the correct height
+ Item {
+ id: lineWrapper
+ width: parent.width
+ height: childrenRect.height
+ y: 10
+
+ Rectangle {
+ id: footerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ height: genericDialog.__drawFooterLine ? 1 : 0
+
+ color: "#4D4D4D"
+ }
+ }
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ Item {id: dummy; anchors.fill: parent}
+
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+
+ // API
+ property string platformTitleText
+ property string titleText
+ property url platformIcon
+ property url icon
+
+ // platformStyle API
+ property Style platformStyle: ContextMenuStyle{}
+ property Style style: ContextMenuStyle{}
+
+ onPlatformTitleTextChanged: logDeprecatedMsg("platformTitleText")
+ onTitleTextChanged: logDeprecatedMsg("titleText")
+ onPlatformIconChanged: logDeprecatedMsg("platformIcon")
+ onIconChanged: logDeprecatedMsg("iconChanged")
+ onPlatformStyleChanged: logDeprecatedMsg("platformStyle")
+ onStyleChanged: logDeprecatedMsg("style")
+
+ function logDeprecatedMsg(name) {
+ console.log("Warning: " + name + " is deprecated");
+ }
+
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+MenuStyle {
+ id: root
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_SMALL
+ property int titleFontCapitalization: Font.MixedCase
+ property color titleTextColor: "white"
+
+ property int titleBarHeight: 56
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.OutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property string faderBackground: "image://theme/meegotouch-menu-dimmer"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+ objectName: "baseDialog"
+
+ // API
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+
+ signal accepted
+ signal rejected
+
+ property Style platformStyle: DialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property string __animationChief: "baseDialog"
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ // true: center of the content field is center of the background rect
+ // false: the whole dialog is centered
+ property bool __centerContentField: false
+
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: titleBar.height + contentField.height + buttonRow.height
+
+ anchors.centerIn: parent
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ // this item contains the whole dialog (title bar + content rectangle, button row)
+ Item {
+ id: backgroundRect
+
+ height: root.height
+ width: root.width
+
+ anchors.centerIn: root
+
+ // center the whole dialog, not just the content field
+ transform: Translate {
+ id: contentTranslation
+ y: root.__centerContentField ? 0 : (titleBar.height - buttonRow.height) / 2
+ }
+
+
+ // title bar
+ Item {
+ id: titleBar
+
+ width: root.width
+ height: childrenRect.height
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: contentField.top
+
+ // animate over bottomMargin (i.e. the distance between the content field)
+ anchors.bottomMargin: 0
+
+ }
+
+ //content area
+ Item {
+ id: contentField
+
+ anchors.left: parent.left
+ //anchors.right: parent.right
+
+ anchors.horizontalCenter: backgroundRect.horizontalCenter
+ anchors.verticalCenter: backgroundRect.verticalCenter
+
+ height: childrenRect.height
+
+ transform: Scale {
+ id: contentScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(root, root.width / 2, root.height / 2).x
+ origin.y: mapFromItem(root, root.width / 2, root.height / 2).y
+
+ }
+
+ }
+
+ //button row
+ Item {
+ id: buttonRow
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: contentField.bottom
+
+ // animate over topMargin (i.e. the distance between the content field)
+ anchors.topMargin: 0
+
+ height: childrenRect.height
+ }
+
+ }
+
+ onPrivateClicked: reject()
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ // needed for button and title bar animation
+ // without resetting the button row's/title bar's coordinate system would be translated
+ property int __buttonSaver: buttonRow.y
+ property int __titleSaver: titleBar.y
+
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Opening || status == DialogStatus.Open)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Closing || status == DialogStatus.Closed)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ backgroundRect.opacity = 1.0;
+ root.opacity = 1.0
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ // With a 100ms delay the background fades to alpha 0% (500ms, quint ease out).
+ // --> done in the fader
+
+ PropertyAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+ PropertyAnimation { target: backgroundRect; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // The closing transition starts with the title and both lines dimming to
+ // alpha 0% and moving 100 pixels in Y axis towards the center (125ms,
+ // quint ease in). With no delay the list fades to alpha 0% and scales to
+ // 80% (anchorpoint in the middle of the list, 100ms, quint ease in).
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint }
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: buttonRow
+ properties: "anchors.topMargin"
+ from: 0
+ to: -100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ PropertyAnimation {target: titleBar
+ properties: "anchors.topMargin"
+ from: 0
+ to: 100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+ // make sure, root isn't visible:
+ backgroundRect = 0.0;
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0;
+ titleBar.opacity = 0.0;
+ contentField.opacity = 0.0;
+ buttonRow.opacity = 0.0;
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in). --> Done inside the fader
+
+ ParallelAnimation {
+ SequentialAnimation {
+ // a 250ms delay from the beginning
+ PauseAnimation { duration: 250 }
+ // the list scales from 80% to 100% and alpha 0%
+ // to 100% (anchorpoint in the middle of the list, 250ms, expo ease out)
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 0.0; to: 1.0; duration: 250}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 250; easing.type: Easing.OutExpo}
+ }
+ }
+ SequentialAnimation {
+ // a 200ms delay from the beginning
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ //the title and both lines come from alpha 0%
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ // and move towards the edges (40 pixels in Y axis
+ // away from their final destination, 450ms, custom ease).
+ PropertyAnimation {target: buttonRow; properties: "anchors.topMargin"
+ from: -40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+ PropertyAnimation {target: titleBar; properties: "anchors.bottomMargin"
+ from: 40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property real leftMargin: 88
+ property real rightMargin: 88
+ property real topMargin: 45
+ property real bottomMargin: 16
+ property bool centered: false
+
+ property int titleBarHeight: 56
+ property color titleBarColor: "white"
+ property int titleElideMode: Text.ElideRight
+
+ property int buttonsTopMargin: 10
+ property int buttonsBottomMargin: 0
+ property int buttonsColumnSpacing: 10
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // m
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+Qt.include("UIConstants.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("EditBubble.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared edit bubble for a given input item.
+
+ All operations and changes will be binded to the
+ given item.
+*/
+function open(input,position)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ // Position when text not selected.
+ popup.position = position;
+
+ // need to set before checking capabilities
+ popup.textInput = input;
+
+ if (popup.valid)
+ popup.state = "opened";
+ else
+ popup.textInput = null;
+
+ return popup.textInput != null;
+}
+
+/*
+ Close the shared edit bubble for a given input item.
+*/
+function close(input)
+{
+ if (!popup || !input || popup.textInput != input)
+ return false;
+
+ return closePopup(popup);
+}
+
+/*
+ Check if the shared edit bubble is opened for the
+ given input item.
+*/
+function isOpened(input)
+{
+ return (popup && popup.textInput == input);
+}
+
+/*
+ Check if the bubble is in the middle of a text
+ change operation.
+*/
+function isChangingInput()
+{
+ return (popup && popup.privateRect.changingText);
+}
+
+/*
+ Close a given edit bubble.
+*/
+function closePopup(bubble)
+{
+ if (bubble == null || bubble.textInput == null)
+ return false;
+
+ bubble.state = "closed";
+ bubble.textInput = null;
+ return true;
+}
+
+/*
+ Adjust EditBubble position to fit in the visible area.
+
+ If no argument is passed, it will adjust the shared
+ bubble position if already initialized.
+*/
+function adjustPosition(bubble)
+{
+ if (bubble === undefined)
+ bubble = popup;
+
+ if (bubble == null)
+ return;
+
+ var input = bubble.textInput;
+ var rect = bubble.privateRect;
+ var viewport = rect.parent;
+
+ if (viewport == null || input == null)
+ return;
+
+ var irect = input.positionToRectangle(input.selectionStart);
+ var frect = input.positionToRectangle(input.selectionEnd);
+ var mid = rect.width / 2;
+
+ if (input.selectionStart == input.selectionEnd) {
+ irect.x = popup.position.x;
+ irect.y = popup.position.y;
+ frect.x = popup.position.x;
+ frect.y = popup.position.y;
+ }
+
+ var ipoint = viewport.mapFromItem(input, irect.x, irect.y);
+ var fpoint = viewport.mapFromItem(input, frect.x, frect.y);
+
+ var px = ipoint.x + (fpoint.x - ipoint.x) / 2 - mid;
+ var py = ipoint.y - rect.height;
+
+ var SHADOW_SIZE = 6
+
+ rect.x = Math.min(Math.max(px, MARGIN_XLARGE - SHADOW_SIZE), viewport.width - rect.width);
+
+ if (py > SHADOW_SIZE) {
+ rect.y = py - SHADOW_SIZE;
+ rect.arrowDown = true;
+ } else {
+ rect.y = Math.min(Math.max(ipoint.y + irect.height, 0),
+ fpoint.y + frect.height);
+ rect.arrowDown = false;
+ }
+
+ var boundX = mid - rect.arrowBorder;
+ rect.arrowOffset = Math.min(Math.max(-boundX, px - rect.x), boundX);
+}
+
+function updateButtons(row)
+{
+ var children = row.children;
+ var visibleItems = new Array();
+
+ for (var i = 0, j = 0; i < children.length; i++) {
+ var child = children[i];
+
+ if (child.visible)
+ visibleItems[j++] = child;
+ }
+
+ for (var i = 0; i < visibleItems.length; i++) {
+ if (visibleItems.length == 1)
+ visibleItems[i].platformStyle.position = "";
+ else {
+ if (i == 0)
+ visibleItems[i].platformStyle.position = "horizontal-left";
+ else if (i == visibleItems.length - 1)
+ visibleItems[i].platformStyle.position = "horizontal-right";
+ else
+ visibleItems[i].platformStyle.position = "horizontal-center";
+ }
+ }
+}
+
+function geometry()
+{
+ if (popup == null)
+ return;
+
+ var bubbleContent = popup.privateRect;
+ var rect = {"left": bubbleContent.pos.x,
+ "right": bubbleContent.pos.x + bubbleContent.width,
+ "top": bubbleContent.pos.y,
+ "bottom": bubbleContent.pos.y + bubbleContent.height};
+
+ return rect;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "Utils.js" as Utils
+import "EditBubble.js" as Private
+
+Item {
+ id: bubble
+
+ property Item textInput: null
+ property bool valid: rect.canCut || rect.canCopy || rect.canPaste
+
+ property alias privateRect: rect
+
+ property Style platformStyle: EditBubbleStyle {}
+
+ property variant position: Qt.point(0,0)
+
+ anchors.fill: parent
+
+ Item {
+ id: rect
+ visible: false
+ width: row.width
+ height: row.height
+
+ property int arrowOffset: 0
+ property int arrowBorder: platformStyle.arrowMargin
+ property bool arrowDown: true
+ property bool changingText: false
+ property bool pastingText: false
+
+ property bool validInput: textInput != null
+ property bool canCut: rect.canCopy && !textInput.readOnly
+
+ // TextEdit will have echoMode == null
+ property bool canCopy: textSelected && (textInput.echoMode == null || textInput.echoMode == TextInput.Normal)
+ property bool canPaste: validInput && (textInput.canPaste && !textInput.readOnly)
+ property bool textSelected: validInput && (textInput.selectedText != "")
+
+ z: 1020
+
+ onWidthChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ onHeightChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ BasicRow {
+ id: row
+ Component.onCompleted: Private.updateButtons(row);
+
+ EditBubbleButton {
+ id: buttonCut
+ text: textTranslator.translate("qtn_comm_cut");
+ visible: rect.canCut
+ onClicked: {
+ rect.changingText = true;
+ textInput.cut();
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonCopy
+ text: textTranslator.translate("qtn_comm_copy");
+ visible: rect.canCopy
+ onClicked: {
+ textInput.copy();
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonPaste
+ text: textTranslator.translate("qtn_comm_paste");
+ visible: rect.canPaste
+ onClicked: {
+ rect.changingText = true;
+ if (textInput.inputMethodComposing) {
+ var cursorAdjust = textInput.preedit.length - textInput.preeditCursorPosition;
+ inputContext.reset();
+ textInput.cursorPosition -= cursorAdjust;
+ }
+ rect.pastingText = true;
+ var text = textInput.text;
+ textInput.paste();
+ // PastingText is set to false and clipboard is cleared if we catch onTextChanged
+ if (rect.pastingText && text == textInput.text) {
+ var root = Utils.findRootItemNotificationBanner(textInput);
+
+ // create notification banner
+ var bannerInstance = notificationBanner.createObject(root);
+ bannerInstance.show();
+ bannerInstance.timerEnabled = true;
+ rect.pastingText = false;
+ }
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ Component {
+ id : notificationBanner
+ NotificationBanner{
+ id: errorBannerPrivate
+ text: textTranslator.translate("qtn_comm_cantpaste");
+ timerShowTime: 5*1000
+ topMargin: 8
+ leftMargin: 8
+ }
+ }
+ }
+
+ Image {
+ source: platformStyle.bottomTailBackground
+ visible: rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.bottom
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+
+ Image {
+ source: platformStyle.topTailBackground
+ visible: !rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.top
+ anchors.bottomMargin: -platformStyle.backgroundMarginBottom - 2
+
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+ }
+
+ state: "closed"
+
+ states: [
+ State {
+ name: "opened"
+ ParentChange { target: rect; parent: Utils.findRootItem(textInput); }
+ PropertyChanges { target: rect; visible: true; }
+ },
+ State {
+ name: "closed"
+ ParentChange { target: rect; parent: bubble; }
+ PropertyChanges { target: rect; visible: false; }
+ }
+ ]
+
+ Connections {
+ target: Utils.findFlickable(textInput)
+ onContentYChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: screen
+ onCurrentOrientationChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: textInput
+ onTextChanged: {
+ if (rect.pastingText) {
+ inputContext.clearClipboard();
+ rect.pastingText = false;
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+BorderImage {
+ id: button
+
+ signal clicked()
+ property alias text: label.text
+ property bool selected: false
+
+ property Style platformStyle: EditBubbleButtonStyle {}
+
+ width: label.width + platformStyle.buttonPaddingLeft +
+ platformStyle.buttonPaddingRight +
+ platformStyle.backgroundMarginLeft +
+ platformStyle.backgroundMarginRight
+ height: platformStyle.buttonHeight +
+ platformStyle.backgroundMarginTop +
+ platformStyle.backgroundMarginBottom
+
+ source: {
+ if (mouseArea.pressed)
+ return platformStyle.pressedBackground;
+
+ // XXX: meegotouch-text-editor-selected image is missing
+ if (selected && platformStyle.position != "")
+ return platformStyle.checkedBackground;
+ else
+ return platformStyle.background;
+ }
+
+ border {
+ left: platformStyle.backgroundMarginLeft
+ top: platformStyle.backgroundMarginTop
+ right: platformStyle.backgroundMarginRight
+ bottom: platformStyle.backgroundMarginBottom
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+
+ color: platformStyle.textColor
+
+ font.family: platformStyle.fontFamily
+ font.weight: platformStyle.fontWeight
+ font.pixelSize: platformStyle.fontPixelSize
+ font.capitalization: platformStyle.fontCapitalization
+
+ style: platformStyle.textStyle
+ styleColor: platformStyle.textStyleColor
+ }
+
+ MouseArea {
+ id: mouseArea
+ enabled: button.enabled
+ anchors {
+ fill: parent
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ rightMargin: platformStyle.mouseMarginRight
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Normal
+
+ // Text
+ property color textColor: "black"
+ property int textStyle: Text.Sunken
+ property color textStyleColor: "#111111"
+
+ // Dimensions
+ property int buttonWidth: 40 // DEPRECATED
+ property int buttonPaddingLeft: 8
+ property int buttonPaddingRight: 8
+ property int buttonHeight: 56
+
+ // Mouse
+ property real mouseMarginLeft: (position == "horizontal-left") ? 6 : 0
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: (position == "horizontal-right") ? 6 : 0
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 19
+ property int backgroundMarginTop: 15
+ property int backgroundMarginRight: 19
+ property int backgroundMarginBottom: 15
+
+ // Position can take one of the following values:
+ // [horizontal-left] [horizontal-center] [horizontal-right]
+ property string position: ""
+
+ property string __suffix: (position ? "-" + position : "")
+
+ property url background: "image://theme/meegotouch-text-editor" + __suffix
+ property url pressedBackground: "image://theme/meegotouch-text-editor-pressed" + __suffix
+ property url checkedBackground: "image://theme/meegotouch-text-editor-selected" + __suffix
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Mouse
+ property real mouseMarginLeft: 6
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: 6
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 0
+ property int backgroundMarginTop: 0
+ property int backgroundMarginRight: 0
+ property int backgroundMarginBottom: 14 // XXX: need to crop images
+
+ property int arrowMargin: 16 // XXX: need to crop images
+
+ // Images
+ property url topTailBackground: "image://theme/meegotouch-text-editor-top-tail"
+ property url bottomTailBackground: "image://theme/meegotouch-text-editor-bottom-tail"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+// Background dimming
+Rectangle {
+ id: faderBackground
+
+ property double dim: 0.9
+ property int fadeInDuration: 250
+ property int fadeOutDuration: 250
+
+ property int fadeInDelay: 0
+ property int fadeOutDelay: 0
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+ property url background: ""
+
+ property Item visualParent: null
+ property Item originalParent: parent
+
+ // widen the edges to avoid artefacts during rotation
+ anchors.topMargin: -1
+ anchors.rightMargin: -1
+ anchors.bottomMargin: -1
+ anchors.leftMargin: -1
+
+ // opacity is passed to child elements - that is not, what we want
+ // so we need to use alpha value here
+ property double alpha: dim
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ // we need the possibility to fetch the red, green, blue components from a color
+ // see http://bugreports.qt.nokia.com/browse/QTBUG-14731
+ color: background != "" ? "transparent" : Qt.rgba(0.0, 0.0, 0.0, alpha)
+ state: 'hidden'
+
+ anchors.fill: parent
+
+ // eat mouse events
+ MouseArea {
+ id: mouseEventEater
+ anchors.fill: parent
+ enabled: faderBackground.alpha != 0.0
+ onClicked: { parent.privateClicked() }
+ }
+
+ Component {
+ id: backgroundComponent
+ BorderImage {
+ id: backgroundImage
+ source: background
+
+ width: faderBackground.width
+ height: faderBackground.height
+
+ opacity: faderBackground.alpha
+ }
+ }
+ Loader {id: backgroundLoader}
+
+ onAlphaChanged: {
+ if (background && faderBackground.alpha && backgroundLoader.sourceComponent == undefined) {
+ backgroundLoader.sourceComponent = backgroundComponent;
+ }
+ if (!faderBackground.alpha) {
+ backgroundLoader.sourceComponent = undefined;
+ }
+ }
+
+ function findRoot() {
+ var next = parent;
+
+ if (next != null) {
+ while (next.parent) {
+ if(next.objectName == "appWindowContent" || next.objectName == "windowContent"){
+ break
+ }
+
+ next = next.parent;
+ }
+ }
+ return next;
+ }
+
+
+ states: [
+ State {
+ name: "visible"
+ PropertyChanges {
+ target: faderBackground
+ alpha: dim
+ }
+ },
+ State {
+ name: "hidden"
+ PropertyChanges {
+ target: faderBackground
+ alpha: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "hidden"; to: "visible"
+ //reparent fader whenever it is going to be visible
+ SequentialAnimation {
+ ScriptAction {script: {
+ //console.log("=============00=============");
+ // the algorithm works in the following way:
+ // First: Check if visualParent property is set; if yes, center the fader in visualParent
+ // Second: If not, center inside window content element
+ // Third: If no window was found, use root window
+ originalParent = faderBackground.parent;
+ if (visualParent != null) {
+ faderBackground.parent = visualParent
+ } else {
+ var root = findRoot();
+ if (root != null) {
+ faderBackground.parent = root;
+ } else {
+ // console.log("Error: Cannot find root");
+ }
+ }
+ }
+ }
+ PauseAnimation { duration: fadeInDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeInDuration
+ easing.type: faderBackground.fadeInEasingType;
+ }
+ }
+ },
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ PauseAnimation { duration: fadeOutDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeOutDuration
+ easing.type: faderBackground.fadeOutEasingType;
+ }
+ ScriptAction {script: {
+ faderBackground.parent = originalParent;
+ }
+ }
+ }
+ }
+ ]
+}
+
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ // This style is deprecated and will be removed
+ Component.onCompleted: print("GroupButtonStyle has been deprecated, please use ButtonStyle instead.")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Text {
+ id: root
+
+ // Styling for the Button
+ property Style platformStyle: LabelStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ font.family: platformStyle.fontFamily
+ font.pixelSize: platformStyle.fontPixelSize
+ color: platformStyle.textColor
+
+ wrapMode: Text.Wrap
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Color
+ property color textColor: inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("Magnifier.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared magnifier for a given input item.
+
+ input item will be used as a sourceItem for the shader
+ effect
+*/
+function open(input)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ popup.sourceItem = input;
+ popup.active = true;
+ return true;
+}
+
+/*
+ Check if the shared magnifier is opened
+*/
+function isOpened()
+{
+ return (popup && popup.active);
+}
+
+/*
+ Close and destroy the magnifier.
+*/
+function close()
+{
+ if (popup){
+ popup.active = false;
+ popup.destroy();
+ popup = null;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias sourceItem: effectSource.sourceItem
+ property real xCenter: 0 // in source item coordinates
+ property real yCenter: 0 // in source item coordinates
+
+ // Source rect is not as small as it can be as there is drawing problems
+ // with small source rect/texture size.
+ property real _realScaleFactor: 1.25
+ property real _sourceRectMultiplier: 2
+
+ property bool active: false
+
+ visible: active
+ width: 182
+ height: 211
+ z: Number.MAX_VALUE
+
+ function __rootElement() {
+ var ret = parent
+ while (ret.parent) {
+ ret = ret.parent
+ }
+ return ret
+ }
+
+ Component.onCompleted: {
+ sourceItem = parent;
+ declarativeView.setFullViewportMode(root);
+ }
+
+ ShaderEffectSource {
+ id: effectSource
+ sourceRect: Qt.rect(root.xCenter - textureSize.width / 2,
+ root.yCenter - textureSize.height / 2,
+ textureSize.width,
+ textureSize.height);
+ textureSize: Qt.size(root._sourceRectMultiplier * root.width,
+ root._sourceRectMultiplier * root.height);
+
+ hideSource: false
+ smooth: true
+
+ property real scaleFactor: root._sourceRectMultiplier * root._realScaleFactor
+ }
+
+ Image {
+ id: magnifierFrameImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierFrame
+ sourceItem: magnifierFrameImage
+ hideSource: true
+ live: false
+ }
+
+ Image {
+ id: magnifierMaskImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame-mask.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierMask
+ sourceItem: magnifierMaskImage
+ hideSource: true
+ live: false
+ }
+
+ ShaderEffectItem {
+ id: magnifier
+ anchors.fill:parent
+ visible: root.visible
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float scaleFactor;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ void main() {
+ qt_TexCoord0.x = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.x / scaleFactor;
+ qt_TexCoord0.y = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.y / scaleFactor;
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
+ }";
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D frame;
+ uniform lowp sampler2D mask;
+ void main() {
+ lowp vec4 frame_c = texture2D(frame, qt_TexCoord1);
+ lowp vec4 mask_c = texture2D(mask, qt_TexCoord1);
+ lowp vec4 color_c = texture2D(source, qt_TexCoord0);
+ bool outsideElement=(qt_TexCoord0.s<0. || qt_TexCoord0.s>1. || qt_TexCoord0.t<0. || qt_TexCoord0.t>1.);
+ bool onGlass=(mask_c.a==1.);
+
+ if (outsideElement) {
+ // make white outside the element
+ color_c=vec4(1.,1.,1.,1.);
+ } else if (onGlass) {
+ // blend premultiplied texture with pure white (background)
+ color_c = color_c + vec4(1.,1.,1.,1.) * (1.-color_c.a);
+ }
+
+ if ( qt_TexCoord1.y >= 0.98 ) {
+ // Top part of item above visible magnifier frame is made
+ // transparent explicitly to prevent showing of wrongly
+ // colored pixels, which would otherwise appear sometimes
+ // when using sourceRect functionality.
+ gl_FragColor = vec4(0.,0.,0.,0.);
+ } else {
+ gl_FragColor = onGlass ? color_c : frame_c;
+ }
+ }";
+
+ property variant source: effectSource
+ property variant frame: magnifierFrame
+ property variant mask: magnifierMask
+ property real scaleFactor: effectSource.scaleFactor;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+/*
+ platformTitle: BorderImage {
+ id: topDivider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 2
+ source: "" // "image://theme/meegotouch-button-objectmenu-background-vertical-top"
+ border { top: 2; bottom: 1; left: 1; right: 1 }
+ }
+*/
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// MenuItem is a component that is used in menus.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ // Common API
+ property string text
+ signal clicked
+ property alias pressed: mouseArea.pressed
+
+ // platformStyle API
+ property Style platformStyle: MenuItemStyle{
+ position: root.parent.children.length == 1 ? ""
+ : root.parent.children[0] == root ? "vertical-top"
+ : root.parent.children[root.parent.children.length-1] == root ? "vertical-bottom"
+ : "vertical-center"
+ }
+ property alias style: root.platformStyle // Deprecated
+
+ width: parent ? parent.width: 0
+ height: ( root.platformStyle.height == 0 ) ?
+ root.platformStyle.topMargin + menuText.paintedHeight + root.platformStyle.bottomMargin :
+ root.platformStyle.topMargin + root.platformStyle.height + root.platformStyle.bottomMargin
+/*
+ Rectangle {
+ id: backgroundRec
+ // ToDo: remove hardcoded values
+ color: pressed ? "darkgray" : "transparent"
+ anchors.fill : root
+ opacity : 0.5
+ }
+*/
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ pressed ? root.platformStyle.pressedBackground
+ : root.platformStyle.background
+ anchors.fill : root
+ border { left: 22; top: 22;
+ right: 22; bottom: 22 }
+ }
+
+ Text {
+ id: menuText
+ text: parent.text
+ elide: Text.ElideRight
+ font.family : root.platformStyle.fontFamily
+ font.pixelSize : root.platformStyle.fontPixelSize
+ font.weight: root.platformStyle.fontWeight
+ color: !root.enabled ? root.platformStyle.disabledTextColor :
+ root.pressed ? root.platformStyle.pressedTextColor :
+ root.platformStyle.textColor
+
+ anchors.topMargin : root.platformStyle.topMargin
+ anchors.bottomMargin : root.platformStyle.bottomMargin
+ anchors.leftMargin : root.platformStyle.leftMargin
+ anchors.rightMargin : root.platformStyle.rightMargin
+
+ anchors.top : root.platformStyle.centered ? undefined : root.top
+ anchors.bottom : root.platformStyle.centered ? undefined : root.bottom
+ anchors.left : root.left
+ anchors.right : root.right
+// anchors.centerIn : parent.centerIn
+ anchors.verticalCenter : root.platformStyle.centered ? parent.verticalCenter : undefined
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: { if (parent.enabled) parent.clicked();}
+ }
+
+ onClicked: if (parent) parent.closeLayout();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ id: root
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: 26 // UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int height: 80
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color disabledTextColor: "#797979"
+ property color checkedTextColor: UI.COLOR_INVERTED_FOREGROUND
+
+ property real leftMargin: 24
+ property real rightMargin: 24
+ property real topMargin: 0
+ property real bottomMargin: 0
+ property bool centered: true
+
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-list" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/meegotouch-list" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+// TODO: Add disabled state once the graphics are available
+// property url disabledBackground: "image://theme/meegotouch-list" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "."
+
+Item {
+ id: root
+ anchors.left: parent!==undefined?parent.left:undefined
+ anchors.right: parent!==undefined?parent.right:undefined
+ height: menuItemColumn.height
+
+ default property alias menuChildren: menuItemColumn.children
+
+ Column {
+ id: menuItemColumn
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: childrenRect.height
+
+ function closeLayout() {
+ root.parent.closeMenu();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+
+Style {
+ id: root
+
+ property real leftMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 427
+ property real rightMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 0
+ property real topMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 246 : 0
+
+ property real bottomMargin: 0
+
+ property real leftPadding: 16
+ property real rightPadding: 16
+ property real topPadding: 16
+ property real bottomPadding: 16
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 350 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.InOutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property url faderBackground: "image://theme/meegotouch-menu-dimmer"
+
+ property int pressDelay: 0 // ms
+
+ property url background: "image://theme/meegotouch-menu-background" + __invertedString
+// property url pressedBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-pressed"
+// property url disabledBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ color: "#FCBD00"
+ opacity: 0.5
+ anchors {
+ fill: parent
+ topMargin: parent.platformMouseAnchors.topMargin
+ bottomMargin: parent.platformMouseAnchors.bottomMargin
+ leftMargin: parent.platformMouseAnchors.leftMargin
+ rightMargin: parent.platformMouseAnchors.rightMargin
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function __isSelected( index ){
+ return __selectedIndexesHash[index]==true;
+}
+
+function __syncHash(){
+ var selectedIndexesHash = new Array()
+ var il = selectedIndexes.length;
+ for( var it = 0; it < il; ++it ){
+ selectedIndexesHash[selectedIndexes[it]]=true;
+ }
+ __selectedIndexesHash = selectedIndexesHash
+}
+
+function __toggleIndex( index ){
+ // A QML list can not be modified, so let's create a new array
+ var selectedArray = new Array;
+
+ var il = selectedIndexes.length;
+
+ // If selectedIndexes is empty then add the index and return.
+ if ( il == 0 ){
+ selectedArray.push(index);
+ selectedIndexes = selectedArray;
+ return;
+ }
+
+ // Check whether the list is sorted.
+ var isSorted = true;
+ var previousIndex = -1;
+
+ for( var it = 0; it < il; ++it ){
+ if ( previousIndex > selectedIndexes[it] ){
+ isSorted = false;
+ break;
+ }
+ previousIndex = selectedIndexes[it];
+ }
+
+ if (!isSorted){
+ // For unsorted selectedIndexes just append the index if it's not present yet.
+ var indexAvailable = false;
+ for( var it = 0; it < il; ++it ) {
+ if ( index == selectedIndexes[it] ){
+ indexAvailable = true;
+ }
+ else {
+ selectedArray.push(selectedIndexes[it]);
+ }
+ }
+ if (!indexAvailable){
+ selectedArray.push(index);
+ }
+ }
+ else{
+ previousIndex = -1;
+ // insert the index in a sorted way in between the existing indexes
+ for( var it = 0; it < il; ++it ) {
+ if ( previousIndex < index && index < selectedIndexes[it] ) {
+ selectedArray.push(index);
+ }
+ if ( index != selectedIndexes[it] ) {
+ selectedArray.push(selectedIndexes[it]);
+ }
+
+ previousIndex = selectedIndexes[it];
+ }
+ // If the index is the highest one append it
+ if (index > selectedIndexes[selectedIndexes.length - 1]){
+ selectedArray.push(index);
+ }
+ }
+ // Assign the new built array to selectedIndexes
+ selectedIndexes = selectedArray;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "MultiSelectionDialog.js" as MultiSelectionDialog
+
+CommonDialog {
+ id: root
+
+ property alias model: selectionListView.model
+ // Common API: property list<int> selectedIndexes (currently not possible due to QTBUG-10822)
+ property variant selectedIndexes: [] // read & write, variant is supposed to be list<int>
+ property alias acceptButtonText: acceptButton.text //Convenience wrapper on top of the buttons
+ property alias rejectButtonText: rejectButton.text //Convenience wrapper on top of the buttons
+ //property alias titleText: titleLabel.text
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: MultiSelectionDialog.__toggleIndex(index);
+ }
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+ property variant __selectedIndexesHash: []
+
+ QtObject {
+ id: backup
+ property variant oldSelectedIndexes: []
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ selectionListView.positionViewAtIndex(selectedIndexes[0], ListView.Center)
+ }
+ if (status == DialogStatus.Open)
+ backup.oldSelectedIndexes = selectedIndexes
+ }
+ onRejected: { selectedIndexes = backup.oldSelectedIndexes }
+
+ onSelectedIndexesChanged: {
+ MultiSelectionDialog.__syncHash();
+ }
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText: "Multi-Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : root.parent
+ ? root.parent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+
+ buttons: Item {
+ id: buttonRowFiller
+ width: parent.width
+ height: childrenRect.height //+ root.platformStyle.buttonsTopMargin
+ y: root.platformStyle.buttonsTopMargin
+
+ onWidthChanged: {
+ if (acceptButton.width + rejectButton.width > width) {
+ acceptButton.width = width / 2
+ rejectButton.width = width / 2
+ } else {
+ acceptButton.width = acceptButton.implicitWidth
+ rejectButton.width = rejectButton.implicitWidth
+ }
+ }
+
+ Row {
+ id: buttonRow
+ height: childrenRect.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ Button {
+ id: acceptButton
+ height: implicitHeight
+ objectName: "acceptButton"
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ height: implicitHeight
+ objectName: "rejectButton"
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+//import com.nokia.meego 1.0
+
+/*
+ Class: InfoBanner
+ The InfoBanner component is used to display information to the user. The number of lines of text
+ shouldn't exceed 3.
+*/
+
+Item {
+ id: root
+
+ /*
+ * Property: iconSource
+ * [url] The path to the icon image
+ */
+ property url iconSource: ""
+
+ /*
+ * Property: text
+ * [string] Text to be displayed in InfoBanner
+ */
+ property alias text: text.text
+
+ /*
+ * Property: timerEnabled
+ * [bool=true] Enable/disable timer that dismisses InfoBanner
+ */
+ property bool timerEnabled: true
+
+ /*
+ * Property: timerShowTime
+ * [int=3000ms] For setting how long InfoBanner stays visible to user before being dismissed
+ */
+ property alias timerShowTime: sysBannerTimer.interval
+
+ /*
+ * Property: topMargin
+ * [int=8 pix] Allows user to customize top margin if needed
+ */
+ property alias topMargin: root.y
+
+ /*
+ * Property: leftMargin
+ * [int=8 pix] Allows user to customize left margin if needed
+ */
+ property alias leftMargin: root.x
+
+ /*
+ * Function: show
+ * Show InfoBanner
+ */
+ function show() {
+ parent = __findParent();
+ animationShow.running = true;
+ if (root.timerEnabled)
+ sysBannerTimer.restart();
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent && next.objectName != "appWindowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ /*
+ * Function: hide
+ * Hide InfoBanner
+ */
+ function hide() {
+ animationHide.running = true;
+ }
+
+ implicitHeight: internal.getBannerHeight()
+ implicitWidth: internal.getBannerWidth()
+ x:8; y:8
+ scale: 0
+
+ BorderImage {
+ source: "image://theme/meegotouch-notification-system-background"
+ anchors.fill: root
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ opacity: 1
+ }
+
+ Image {
+ id: image
+ anchors { left: parent.left; leftMargin: 16; top: parent.top; topMargin: 16 }
+ source: root.iconSource
+ visible: root.iconSource != ""
+ }
+
+ Text {
+ id: text
+ width: internal.getTextWidth()
+ anchors { left: (image.visible ? image.right : parent.left); leftMargin: (image.visible ? 14:16);
+ top: parent.top; topMargin: internal.getTopMargin(); bottom: parent.bottom }
+ color: "white"
+ wrapMode: Text.Wrap
+ verticalAlignment: Text.AlignHCenter
+ font.pixelSize: 24
+ font.family: "Nokia Pure"
+ font.letterSpacing: -1.2
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ }
+
+ QtObject {
+ id: internal
+
+ function getBannerHeight() {
+ if (image.visible) {
+ if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ } else {
+ if (text.lineCount <= 1)
+ return 80; //64
+ else if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ }
+ }
+
+ function getBannerWidth() {
+ if ( screen.currentOrientation==Screen.Portrait || screen.currentOrientation==Screen.PortraitInverted ) {
+ // In portrait mode, the width of the banner is equal to the width of parent minus left
+ // and right margins in-between banner and parent.
+ return parent.width-root.x*2;
+ } else {
+ if (image.visible) {
+ // If an icon image is specified...
+ if ((image.width+text.paintedWidth+46) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 46 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of icon, text, and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width*0.54;
+ } else {
+ return parent.width-root.x*2;
+ }
+ } else {
+ // If no icon image specified...
+ if ((text.paintedWidth+32) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 32 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of text and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width-root.x*2;
+ } else {
+ return parent.width-root.x*2;
+ }
+ }
+ }
+ }
+
+ function getTopMargin() {
+ if (text.lineCount <= 1 && !image.visible) {
+ // If there's only one line of text and no icon image, top and bottom margins are equal.
+ return (root.height-text.paintedHeight)/2;
+ } else {
+ // In all other cases, top margin is 4 px more than bottom margin.
+ return (root.height-text.paintedHeight)/2 + 2;
+ }
+ }
+
+ function getTextWidth() {
+ // 46(32 when there's no icon) is sum of all margins within banner. root.x*2 is sum of margins outside banner.
+ // Text element width is dertermined by substracting parent width(screen width) by all the margins and
+ // icon width(if applicable).
+ return image.visible ? (parent.width-root.x*2-46-image.width) : (parent.width-root.x*2-32);
+ }
+
+ function getScaleValue() {
+ // When banner is displayed, as part of transition effect, it'll first be enlarged to the point where its width
+ // is equal to screen width. root.x*2/root.width calculates the amount of expanding required, where root.x*2 is
+ // equal to screen.displayWidth minus banner.width
+ return root.x*2/root.width + 1;
+ }
+ }
+
+ Timer {
+ id: sysBannerTimer
+ repeat: false
+ running: false
+ interval: 3000
+ onTriggered: hide()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide()
+ }
+
+ SequentialAnimation {
+ id: animationShow
+ NumberAnimation { target: root; property: "scale"; from: 0; to: internal.getScaleValue(); duration: 200; easing.type: Easing.OutQuad}
+ NumberAnimation { target: root; property: "scale"; from: internal.getScaleValue(); to: 1; duration: 200 }
+ }
+
+ NumberAnimation {
+ id: animationHide
+ target: root; property: "scale"; to: 0; duration: 200; easing.type: Easing.InExpo
+ }
+
+ Component.onCompleted: {
+ //__owner = parent;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The Page item is intended for use as a root item in QML items that make
+// up pages to use with the PageStack.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ visible: false
+
+ // Note we do not use anchor fill here because it will force us to relayout
+ // hidden children when rotating the screen as well
+ width: visible && parent ? parent.width - anchors.leftMargin - anchors.rightMargin : __prevWidth
+ height: visible && parent ? parent.height - anchors.topMargin - anchors.bottomMargin : __prevHeight
+ x: parent ? anchors.leftMargin : 0
+ y: parent ? anchors.topMargin : 0
+
+ onWidthChanged: __prevWidth = visible ? width : __prevWidth
+ onHeightChanged: __prevHeight = visible ? height : __prevHeight
+
+ property int __prevWidth: 0
+ property int __prevHeight: 0
+
+ property bool __isPage: true
+
+ anchors.margins: 0 // Page margins should generally be 16 pixels as defined by UI.MARGIN_XLARGE
+
+ // The status of the page. One of the following:
+ // PageStatus.Inactive - the page is not visible
+ // PageStatus.Activating - the page is transitioning into becoming the active page
+ // PageStatus.Active - the page is the current active page
+ // PageStatus.Deactivating - the page is transitioning into becoming inactive
+ property int status: PageStatus.Inactive
+
+ // Defines the tools for the page; null for none.
+ property Item tools: null
+
+ // The page stack that the page is in.
+ property PageStack pageStack
+
+ // Defines if page is locked in landscape.
+ property bool lockInLandscape: false // Deprecated
+ onLockInLandscapeChanged: console.log("warning: Page.lockInLandscape is deprecated, use Page.orientationLock")
+
+ // Defines if page is locked in portrait.
+ property bool lockInPortrait: false // Deprecated
+ onLockInPortraitChanged: console.log("warning: Page.lockInPortrait is deprecated, use Page.orientationLock")
+
+ // Defines orientation lock for a page
+ property int orientationLock: PageOrientation.Automatic
+
+ onStatusChanged: {
+ if (status == PageStatus.Activating) {
+ __updateOrientationLock()
+ }
+ }
+
+ onOrientationLockChanged: {
+ __updateOrientationLock()
+ }
+
+ function __updateOrientationLock() {
+ switch (orientationLock) {
+ case PageOrientation.Automatic:
+ screen.setAllowedOrientations(Screen.Portrait | Screen.Landscape);
+ break
+ case PageOrientation.LockPortrait:
+ screen.setAllowedOrientations(Screen.Portrait);
+ break
+ case PageOrientation.LockLandscape:
+ screen.setAllowedOrientations(Screen.Landscape);
+ break
+ case PageOrientation.LockPrevious:
+ // Allowed orientation should be changed to current
+ // if previously it was locked, it will remain locked
+ // if previously it was not locked, it will be locked to current
+ screen.setAllowedOrientations(screen.currentOrientation);
+ break
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Page stack. Items are page containers.
+var pageStack = [];
+
+// Page component cache map. Key is page url, value is page component.
+var componentCache = {};
+
+// Returns the page stack depth.
+function getDepth() {
+ return pageStack.length;
+}
+
+// Pushes a page on the stack.
+function push(page, properties, replace, immediate) {
+ // page order sanity check
+ if ((!replace && page == currentPage) ||
+ (replace && pageStack.length > 1 && page == pageStack[pageStack.length - 2].page)) {
+ throw new Error("Cannot navigate so that the resulting page stack has two consecutive entries of the same page instance.");
+ }
+
+ // figure out if more than one page is being pushed
+ var pages;
+ if (page instanceof Array) {
+ pages = page;
+ page = pages.pop();
+ if (page.createObject === undefined && page.parent === undefined && typeof page != "string") {
+ properties = properties || page.properties;
+ page = page.page;
+ }
+ }
+
+ // get the current container
+ var oldContainer = pageStack[pageStack.length - 1];
+
+ // pop the old container off the stack if this is a replace
+ if (oldContainer && replace) {
+ pageStack.pop();
+ }
+
+ // push any extra defined pages onto the stack
+ if (pages) {
+ var i;
+ for (i = 0; i < pages.length; i++) {
+ var tPage = pages[i];
+ var tProps;
+ if (tPage.createObject === undefined && tPage.parent === undefined && typeof tPage != "string") {
+ tProps = tPage.properties;
+ tPage = tPage.page;
+ }
+ pageStack.push(initPage(tPage, tProps));
+ }
+ }
+
+ // initialize the page
+ var container = initPage(page, properties);
+
+ // push the page container onto the stack
+ pageStack.push(container);
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ immediate = immediate || !oldContainer;
+ if (oldContainer) {
+ oldContainer.pushExit(replace, immediate);
+ }
+ container.pushEnter(replace, immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : replace ? "replace" : "push");
+ }
+
+ return container.page;
+}
+
+// Initializes a page and its container.
+function initPage(page, properties) {
+ var container = containerComponent.createObject(root);
+
+ var pageComp;
+ if (page.createObject) {
+ // page defined as component
+ pageComp = page;
+ } else if (typeof page == "string") {
+ // page defined as string (a url)
+ pageComp = componentCache[page];
+ if (!pageComp) {
+ pageComp = componentCache[page] = Qt.createComponent(page);
+ }
+ }
+ if (pageComp) {
+ if (pageComp.status == Component.Error) {
+ throw new Error("Error while loading page: " + pageComp.errorString());
+ } else {
+ // instantiate page from component
+ page = pageComp.createObject(container, properties || {});
+ }
+ } else {
+ // copy properties to the page
+ for (var prop in properties) {
+ if (properties.hasOwnProperty(prop)) {
+ page[prop] = properties[prop];
+ }
+ }
+ }
+
+ container.page = page;
+ container.owner = page.parent;
+
+ // the page has to be reparented if
+ if (page.parent != container) {
+ page.parent = container;
+ }
+
+ if (page.pageStack !== undefined) {
+ page.pageStack = root;
+ }
+
+ return container;
+}
+
+// Pops a page off the stack.
+function pop(page, immediate) {
+ // make sure there are enough pages in the stack to pop
+ if (pageStack.length > 1) {
+ // pop the current container off the stack and get the next container
+ var oldContainer = pageStack.pop();
+ var container = pageStack[pageStack.length - 1];
+ if (page !== undefined) {
+ // an unwind target has been specified - pop until we find it
+ while (page != container.page && pageStack.length > 1) {
+ container.cleanup();
+ pageStack.pop();
+ container = pageStack[pageStack.length - 1];
+ }
+ }
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ oldContainer.popExit(immediate);
+ container.popEnter(immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : "pop");
+ }
+
+ return oldContainer.page;
+ } else {
+ return null;
+ }
+}
+
+// Clears the page stack.
+function clear() {
+ var container;
+ while (container = pageStack.pop()) {
+ container.cleanup();
+ }
+ depth = 0;
+ currentPage = null;
+}
+
+// Iterates through all pages in the stack (top to bottom) to find a page.
+function find(func) {
+ for (var i = pageStack.length - 1; i >= 0; i--) {
+ var page = pageStack[i].page;
+ if (func(page)) {
+ return page;
+ }
+ }
+ return null;
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The PageStack item defines a container for pages and a stack-based
+// navigation model. Pages can be defined as QML items or components.
+
+import QtQuick 1.1
+import "." 1.0
+import "PageStack.js" as Engine
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // Page stack depth.
+ property int depth: Engine.getDepth()
+
+ // The currently active page.
+ property Item currentPage: null
+
+ // The application tool bar.
+ property ToolBar toolBar
+
+ // Indicates whether there is an ongoing page transition.
+ property bool busy: __ongoingTransitionCount > 0
+
+ // The number of ongoing transitions.
+ property int __ongoingTransitionCount: 0
+
+ // Pushes a page on the stack.
+ // The page can be defined as a component, item or string.
+ // If an item is used then the page will get re-parented.
+ // If a string is used then it is interpreted as a url that is used to load a page component.
+ //
+ // The page can also be given as an array of pages. In this case all those pages will be pushed
+ // onto the stack. The items in the stack can be components, items or strings just like for single
+ // pages. Additionally an object can be used, which specifies a page and an optional properties
+ // property. This can be used to push multiple pages while still giving each of them properties.
+ // When an array is used the transition animation will only be to the last page.
+ //
+ // The properties argument is optional and allows defining a map of properties to set on the page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance.
+ function push(page, properties, immediate) {
+ return Engine.push(page, properties, false, immediate);
+ }
+
+ // Pops a page off the stack.
+ // If page is specified then the stack is unwound to that page; null to unwind the to first page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance that was popped off the stack.
+ function pop(page, immediate) {
+ return Engine.pop(page, immediate);
+ }
+
+ // Replaces a page on the stack.
+ // See push() for details.
+ function replace(page, properties, immediate) {
+ return Engine.push(page, properties, true, immediate);
+ }
+
+ // Clears the page stack.
+ function clear() {
+ return Engine.clear();
+ }
+
+ // Iterates through all pages (top to bottom) and invokes the specified function.
+ // If the specified function returns true the search stops and the find function
+ // returns the page that the iteration stopped at. If the search doesn't result
+ // in any page being found then null is returned.
+ function find(func) {
+ return Engine.find(func);
+ }
+
+ // Called when the page stack visibility changes.
+ onVisibleChanged: {
+ if (currentPage) {
+ __setPageStatus(currentPage, visible ? PageStatus.Active : PageStatus.Inactive);
+ if (visible) {
+ currentPage.visible = currentPage.parent.visible = true;
+ }
+ }
+ }
+
+ // Sets the page status.
+ function __setPageStatus(page, status) {
+ if (page.status !== undefined) {
+ if (status == PageStatus.Active && page.status == PageStatus.Inactive) {
+ page.status = PageStatus.Activating;
+ } else if (status == PageStatus.Inactive && page.status == PageStatus.Active) {
+ page.status = PageStatus.Deactivating;
+ }
+ page.status = status;
+ }
+ }
+
+ // Component for page containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The page held by this container.
+ property Item page: null
+
+ // The owner of the page.
+ property Item owner: null
+
+ // Duration of transition animation (in ms)
+ property int transitionDuration: 500
+
+ // Flag that indicates the container should be cleaned up after the transition has ended.
+ property bool cleanupAfterTransition: false
+
+ // Performs a push enter transition.
+ function pushEnter(replace, immediate) {
+ if (!immediate) {
+ state = replace ? "front" : "right";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a push exit transition.
+ function pushExit(replace, immediate) {
+ state = immediate ? "hidden" : (replace ? "back" : "left");
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (replace) {
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+ }
+
+ // Performs a pop enter transition.
+ function popEnter(immediate) {
+ if (!immediate) {
+ state = "left";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a pop exit transition.
+ function popExit(immediate) {
+ state = immediate ? "hidden" : "right";
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+
+ // Called when a transition has started.
+ function transitionStarted() {
+ __ongoingTransitionCount++;
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Activating : PageStatus.Deactivating);
+ }
+ }
+
+ // Called when a transition has ended.
+ function transitionEnded() {
+ if (state != "") {
+ state = "hidden";
+ }
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Active : PageStatus.Inactive);
+ }
+ __ongoingTransitionCount--;
+ if (cleanupAfterTransition) {
+ cleanup();
+ }
+ }
+
+ states: [
+ // Explicit properties for default state.
+ State {
+ name: ""
+ PropertyChanges { target: container; visible: true }
+ },
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -width }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: width }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.5; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.5; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "left") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "left") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "right") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "right") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Replace entry transition.
+ Transition {
+ from: "front"; to: "";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ },
+ // Replace exit transition.
+ Transition {
+ from: ""; to: "back";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ }
+ ]
+
+ // Cleans up the container and then destroys it.
+ function cleanup() {
+ if (page.status == PageStatus.Active) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (owner != container) {
+ // container is not the owner of the page - re-parent back to original owner
+ page.visible = false;
+ page.parent = owner;
+ }
+ container.destroy();
+ }
+
+ }
+ }
+
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import "." 1.0
+
+Window {
+ id: window
+
+ property bool showStatusBar: true
+ property bool showToolBar: true
+ property bool toolBarOnTop: false
+ property variant initialPage
+ property alias pageStack: stack
+ property Style platformStyle: PageStackWindowStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: window.platformStyle
+
+ //private api
+ property int __statusBarHeight: showStatusBar ? statusBar.height : 0
+
+ objectName: "pageStackWindow"
+
+ StatusBar {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+ showStatusBar: window.showStatusBar
+ }
+
+ onOrientationChangeStarted: {
+ statusBar.orientation = screen.currentOrientation
+ }
+
+ Rectangle {
+ id: background
+ visible: platformStyle.background == ""
+ color: platformStyle.backgroundColor
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Image {
+ id: backgroundImage
+ visible: platformStyle.background != ""
+ source: window.inPortrait ? platformStyle.portraitBackground : platformStyle.landscapeBackground
+ fillMode: platformStyle.backgroundFillMode
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Item {
+ objectName: "appWindowContent"
+ width: parent.width
+ anchors.top: statusBar.bottom
+ anchors.bottom: parent.bottom
+
+ // content area
+ Item {
+ id: contentArea
+ anchors { top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; }
+ anchors.bottomMargin: !toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ anchors.topMargin: toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ PageStack {
+ id: stack
+ anchors.fill: parent
+ toolBar: toolBar
+ }
+ }
+
+ Item {
+ id: roundedCorners
+ visible: platformStyle.cornersVisible
+ anchors.fill: parent
+ z: 10001
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ ToolBar {
+ id: toolBar
+ anchors.top: toolBarOnTop ? parent.top: undefined
+ anchors.bottom: !toolBarOnTop ? parent.bottom: undefined
+ privateVisibility: (inputContext.softwareInputPanelVisible==true || inputContext.customSoftwareInputPanelVisible == true)
+ ? ToolBarVisibility.HiddenImmediately : (window.showToolBar ? ToolBarVisibility.Visible : ToolBarVisibility.Hidden)
+ }
+ }
+
+ // event preventer when page transition is active
+ MouseArea {
+ anchors.fill: parent
+ enabled: pageStack.busy
+ }
+
+ Component.onCompleted: {
+ if (initialPage) pageStack.push(initialPage);
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: ""
+
+ // Background color is used when no background is set.
+ property color backgroundColor: theme.inverted ? "#000000" : "#E0E1E2"
+
+ property url landscapeBackground: background
+ property url portraitBackground: background
+ property url portraiteBackground: background
+
+ property int backgroundFillMode: Image.Tile
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ // api
+ property alias visualParent: fader.visualParent
+
+ // possible states: Opening, Open, Closing, Closed
+ // Opening and Closing are used during animation (when the dialog fades/moves/pops/whatever in)
+ property int status: DialogStatus.Closed
+
+ // private api
+ property double __dim: 0.9
+ property int __fadeInDuration
+ property int __fadeOutDuration
+ property int __fadeInDelay
+ property int __fadeOutDelay
+ property int __fadeInEasingType
+ property int __fadeOutEasingType
+ property string __faderBackground
+
+ function open() {
+ if (status == DialogStatus.Closed)
+ status = DialogStatus.Opening;
+ }
+
+ function close() {
+ if (status == DialogStatus.Open)
+ status = DialogStatus.Closing;
+ }
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ QtObject {
+ id: parentCache
+ property QtObject oldParent: null
+ }
+
+ Component.onCompleted: {
+ parentCache.oldParent = parent;
+ fader.parent = parent;
+ parent = fader;
+ }
+
+ //if this is not given, application may crash in some cases
+ Component.onDestruction: {
+ if (parentCache.oldParent != null) {
+ parent = parentCache.oldParent
+ fader.parent = root
+ }
+ }
+
+ Fader {
+ id: fader
+ dim: root.__dim
+ fadeInDuration: root.__fadeInDuration
+ fadeOutDuration: root.__fadeOutDuration
+ fadeInDelay: root.__fadeInDelay
+ fadeOutDelay: root.__fadeOutDelay
+ fadeInEasingType: root.__fadeInEasingType
+ fadeOutEasingType: root.__fadeOutEasingType
+
+
+ background: root.__faderBackground
+ onPrivateClicked: root.privateClicked();
+
+ MouseArea {
+ anchors.fill: parent
+ enabled: root.status == DialogStatus.Opening || root.status == DialogStatus.Closing
+ z: Number.MAX_VALUE
+ }
+ }
+
+ function __fader() {
+ return fader;
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+import "TextAreaHelper.js" as AreaHelper
+
+ImplicitSizeItem {
+ id: container
+
+ property alias minimumValue: progressModel.minimumValue
+ property alias maximumValue: progressModel.maximumValue
+ property alias value: progressModel.value
+ property bool indeterminate: false
+
+ // Styling for the ProgressBar
+ property Style platformStyle: ProgressBarStyle{}
+
+ //Deprecated, can be removed on W13
+ property alias style: container.platformStyle
+
+ implicitWidth: platformStyle.sizeButton
+ implicitHeight: background.height
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ BorderImage {
+ id: background
+ width: parent.width
+ horizontalTileMode: BorderImage.Repeat
+ source: platformStyle.barBackground
+
+ border {
+ left: 6
+ top: 4
+ right: 6
+ bottom: 4
+ }
+ }
+
+ MaskedItem {
+ id: foreground
+ width: parent.width
+ height: parent.height
+
+ mask: BorderImage {
+ width: indeterminate ? container.width : progressModel.position
+ height: foreground.height
+ source: platformStyle.barMask
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Image {
+ id: texture
+ width: foreground.width + sourceSize.width + 25
+ height: foreground.height
+ fillMode: Image.Tile
+
+ property real xTemp;
+
+ source: indeterminate ? platformStyle.unknownTexture : platformStyle.knownTexture
+
+ onXTempChanged: {
+ // Control the animation speed with this multiplier and the NumberAnimation duration divider
+ texture.x = Math.round(texture.xTemp) * 4;
+ }
+
+ NumberAnimation on xTemp {
+ running: indeterminate && container.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ from: -texture.sourceSize.width
+ to: 0
+ // time = distance / speed, where speed = 10 from the platformStyle
+ duration: (1000 * texture.sourceSize.width / 10)
+ }
+ }
+ }
+
+ RangeModel {
+ id: progressModel
+ positionAtMinimum: 0
+ positionAtMaximum: background.width
+
+ // Defaults from Common API specification
+ minimumValue: 0
+ maximumValue: 1.0
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + container.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + container.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int sizeButton: UI.SIZE_BUTTON
+
+ // Images
+ property url barBackground: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-background"
+ property url barMask: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-mask"
+ property url unknownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-unknown-texture"
+ property url knownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-known-texture"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Dialog {
+ id: root
+ objectName: "queryDialog"
+
+ property string titleText
+ property string message
+
+ //are they necessary?
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ //ToDo
+ property alias icon: iconImage.source
+
+ property Style platformStyle: QueryDialogStyle {}
+
+ //__centerContentField: true
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ __animationChief: "queryDialog"
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ title: Item {
+ id: titleField
+ width: parent.width
+ height: titleText == "" ? titleBarIconField.height :
+ titleBarIconField.height + titleLabel.height + root.platformStyle.titleColumnSpacing
+ Column {
+ id: titleFieldCol
+ spacing: root.platformStyle.titleColumnSpacing
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ width: root.width
+
+ Item {
+ id: titleBarIconField
+ height: iconImage.height
+ width: parent.width
+ Image {
+ id: iconImage
+ anchors.horizontalCenter: titleBarIconField.horizontalCenter
+ source: ""
+ }
+
+ }
+
+
+ Item {
+ id: titleBarTextField
+ height: titleLabel.height
+ width: parent.width
+
+ Text {
+ id: titleLabel
+ width: parent.width
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: root.platformStyle.titleFontFamily
+ font.pixelSize: root.platformStyle.titleFontPixelSize
+ font.bold: root.platformStyle.titleFontBold
+ font.capitalization: root.platformStyle.titleFontCapitalization
+ elide: root.platformStyle.titleElideMode
+ wrapMode: elide == Text.ElideNone ? Text.Wrap : Text.NoWrap
+ color: root.platformStyle.titleTextColor
+ text: root.titleText
+
+ }
+ }
+
+ // needed for animation
+ transform: Scale {
+ id: titleScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).x
+ origin.y: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).y
+ }
+
+ }
+ }
+
+ // the content field which contains the message text
+ content: Item {
+ id: queryContentWrapper
+
+ property int upperBound: visualParent ? visualParent.height - titleField.height - buttonColFiller.height - 64
+ : root.parent.height - titleField.height - buttonColFiller.height - 64
+ property int __sizeHint: Math.min(Math.max(root.platformStyle.contentFieldMinSize, queryText.height), upperBound)
+
+ height: __sizeHint + root.platformStyle.contentTopMargin
+ width: root.width
+
+ Item {
+ id: queryContent
+ width: parent.width
+
+ y: root.platformStyle.contentTopMargin
+
+ Flickable {
+ id: queryFlickable
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ //anchors.bottom: parent.bottom
+ height: queryContentWrapper.__sizeHint
+
+ contentHeight: queryText.height
+ flickableDirection: Flickable.VerticalFlick
+ clip: true
+
+ interactive: queryText.height > queryContentWrapper.__sizeHint
+
+ Text {
+ id: queryText
+ width: queryFlickable.width
+ horizontalAlignment: Text.AlignHCenter
+ font.family: root.platformStyle.messageFontFamily
+ font.pixelSize: root.platformStyle.messageFontPixelSize
+ color: root.platformStyle.messageTextColor
+ wrapMode: Text.WordWrap
+ text: root.message
+ }
+
+ }
+
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: queryFlickable
+ anchors.rightMargin: - UI.SCROLLDECORATOR_LONG_MARGIN - 10 //ToDo: Don't use a hard-coded gap
+ }
+
+ }
+ }
+
+
+ buttons: Item {
+ id: buttonColFiller
+ width: parent.width
+ height: childrenRect.height
+
+ anchors.top: parent.top
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ //otherwise the topMargin wouldn't be considered
+ Item {id: dummy; anchors.fill: parent}
+
+ Column {
+ id: buttonCol
+ anchors.top: parent.top
+ anchors.topMargin: root.platformStyle.buttonTopMargin
+ spacing: root.platformStyle.buttonsColumnSpacing
+
+ height: (acceptButton.text == "" ? 0 : acceptButton.height)
+ + (rejectButton.text == "" ? 0 : rejectButton.height)
+ + anchors.buttonTopMargin + spacing
+
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Button {
+ id: acceptButton
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "__query__hidden"
+
+ // needed for button animation
+ // without resetting the button row's coordinate system would be translated
+ property int __buttonSaver: buttonColFiller.y
+
+ states: [
+ State {
+ name: "__query__visible"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: root
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "__query__hidden"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: root
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "__query__visible"; to: "__query__hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+ root.status = DialogStatus.Closing;
+
+ }
+ }
+
+ NumberAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // With a 100ms delay the background
+ // fades to alpha 0% (500ms, quint ease out).
+ // ---> done in the fader
+
+ ParallelAnimation {
+ // The closing transition starts with the message dimming to alpha 0% and
+ // scaling to 80% (anchorpoint in the middle of the message, 100ms, quint
+ // ease in).
+
+ // With no delay the buttons fade to alpha 0% and translate 30
+ // pixels upwards (100ms, quint ease in).
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: queryContent; property: "scale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y
+ to: buttonColFiller.y-30
+ duration: 100
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ // make sure, root isn't visible:
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+
+ }
+ },
+ Transition {
+ from: "__query__hidden"; to: "__query__visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0
+ titleField.opacity = 0.0
+ queryContent.opacity = 0.0
+ buttonColFiller.opacity = 0.0
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in).
+ // ---> done in the fader
+ ParallelAnimation {
+ SequentialAnimation {
+
+ // With a 200ms delay from the beginning the message fades
+ // from alpha 0% to 100% and scales from 80% to 100% (anchorpoint in the
+ // middle of the message, 550ms, custom ease).
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ NumberAnimation {target: queryContent; property: "scale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ }
+ }
+ SequentialAnimation {
+ // With a 250ms delay from the
+ // beginning the buttons fade from alpha 0% to 100% and translate 25 pixels
+ // in Y axis away from their final destination (400ms, custom ease).
+ PauseAnimation { duration: 250 }
+ ParallelAnimation {
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 0.0; to: 1.0; duration: 400; }
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y-25
+ to: buttonColFiller.y
+ duration: 400
+ easing.type: Easing.OutBack
+ }
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_XLARGE
+ property int titleFontCapitalization: Font.MixedCase
+ property bool titleFontBold: true
+ property color titleTextColor: "white"
+
+ property int contentFieldMinSize: 24
+
+ //spacing
+ property int contentTopMargin: 21
+ property int buttonTopMargin: 38
+
+ property int titleColumnSpacing: 17
+
+ //properties inherited by DialogStyle
+ buttonsColumnSpacing: 16
+ leftMargin: 33
+ rightMargin: 33
+ titleElideMode: Text.ElideNone
+
+ property string messageFontFamily: UI.FONT_FAMILY
+ property int messageFontPixelSize: UI.FONT_DEFAULT
+ property color messageTextColor: "#ffffff"
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // ms
+
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+CheckBox {
+ id: radioButton
+
+ property Style platformStyle: RadioButtonStyle{}
+ property alias style: radioButton.platformStyle
+
+ __imageSource: !radioButton.enabled ? platformStyle.backgroundDisabled :
+ radioButton.pressed ? platformStyle.backgroundPressed :
+ radioButton.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ function __handleChecked() {
+ if (!radioButton.checked)
+ radioButton.checked = true;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-radiobutton"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+/**
+ * Class: ScrollDecorator
+ * A ScrollDecorator shows the current position in a scrollable area.
+ */
+Item {
+ id: root
+
+ /**
+ * Property: flickableItem
+ * [Flickable] The Item that should show the ScrollDecorator
+ */
+ property Flickable flickableItem
+
+ property int __topPageMargin: 0
+ property int __bottomPageMargin: 0
+ property int __leftPageMargin: 0
+ property int __rightPageMargin: 0
+ property bool __hasPageWidth : false
+ property bool __hasPageHeight: false
+
+ // These can also be modified (but probably shouldn't)
+ property int __minIndicatorSize: 20
+ property int __hideTimeout: 500
+
+ property bool __alwaysShowIndicator: true
+
+ property Style platformStyle: ScrollDecoratorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // This function ensures that we allways anchor the decorator correctly according
+ // to the page margins.
+ function __updatePageMargin() {
+ if (!flickableItem)
+ return
+ var p = flickableItem.parent
+ while (p) {
+ if (p.hasOwnProperty("__isPage")) {
+ __hasPageHeight = function() { return p.height == flickableItem.height }
+ __hasPageWidth = function() { return p.width == flickableItem.width }
+ __topPageMargin = function() { return p.anchors.topMargin }
+ __bottomPageMargin = function() { return p.anchors.bottomMargin }
+ __leftPageMargin = function() { return p.anchors.leftMargin }
+ __rightPageMargin = function() { return p.anchors.rightMargin }
+ return;
+ } else {
+ p = p.parent;
+ }
+ }
+ }
+
+ onFlickableItemChanged: { __updatePageMargin() }
+
+ QtObject {
+ id: privateApi
+ function canFlick(direction) {
+ return flickableItem.flickableDirection === direction
+ || flickableItem.flickableDirection === Flickable.HorizontalAndVerticalFlick
+ || flickableItem.flickableDirection === Flickable.AutoFlickDirection;
+ }
+ }
+
+ // Private stuff
+ anchors.fill: flickableItem
+
+ Timer {
+ // Hack to have the indicators flash when the view is shown the first time.
+ // Ideally we would wait until the Flickable is complete, but it doesn't look
+ // possible given the current limitations of QML.
+ interval: 100
+ running: true
+ repeat: false
+ onTriggered: {
+ if (verticalIndicator.shouldShow) {
+ verticalIndicator.state = "visible";
+ verticalIndicator.state = "";
+ }
+ if (horizontalIndicator.shouldShow) {
+ horizontalIndicator.state = "visible";
+ horizontalIndicator.state = "";
+ }
+ }
+ }
+
+ Component {
+ id: verticalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: verticalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.yPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.heightRatio : 0
+ maxPosition: flickableItem ? flickableItem.height : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Component {
+ id: horizontalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: horizontalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.xPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.widthRatio : 0
+ maxPosition: flickableItem ? flickableItem.width : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Loader {id: verticalSizerLoader}
+ Loader {id: horizontalSizerLoader}
+
+ Item {
+ id: verticalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.VerticalFlick)) && (flickableItem.height > 0 && flickableItem.contentHeight > flickableItem.height))
+ opacity: 0
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageWidth ? __rightPageMargin : 0)
+ anchors.top: parent.top
+ anchors.topMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __topPageMargin : 0)
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __bottomPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ verticalSizerLoader.sourceComponent = verticalSizerWrapper;
+ else
+ verticalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.background
+ height: parent.height
+ anchors.right: parent.right
+ }
+ BorderImage {
+ source: platformStyle.indicator
+ border { left: 2; top: 4; right: 2; bottom: 4 }
+ anchors.right: parent.right
+ y: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ? verticalSizerLoader.item.position : 0
+ height: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ?
+ verticalSizerLoader.item.size - parent.anchors.topMargin - parent.anchors.bottomMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: verticalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: verticalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+
+ Item {
+ id: horizontalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.HorizontalFlick)) && (flickableItem.width > 0 && flickableItem.contentWidth > flickableItem.width))
+ opacity: 0
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageHeight ? __bottomPageMargin : 0)
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __rightPageMargin : 0)
+ anchors.left: parent.left
+ anchors.leftMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __leftPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ horizontalSizerLoader.sourceComponent = horizontalSizerWrapper;
+ else
+ horizontalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.backgroundHorizontal
+ width: parent.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+ BorderImage {
+ source: platformStyle.indicatorHorizontal
+ border { left: 4; top: 2; right: 4; bottom: 2 }
+ anchors.bottom: parent.bottom
+ x: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ? horizontalSizerLoader.item.position : 0
+ width: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ?
+ horizontalSizerLoader.item.size - parent.anchors.leftMargin - parent.anchors.rightMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: horizontalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: horizontalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ // relative (0..1) position of top and bottom
+ property real positionRatio
+ property real sizeRatio
+
+ // max position and min size
+ property real maxPosition
+ property real minSize
+
+ // size underflow
+ property real sizeUnderflow: (sizeRatio * maxPosition) < minSize ? minSize - (sizeRatio * maxPosition) : 0
+
+ // raw start and end position considering minimum size
+ property real rawStartPos: positionRatio * (maxPosition - sizeUnderflow)
+ property real rawEndPos: (positionRatio + sizeRatio) * (maxPosition - sizeUnderflow) + sizeUnderflow
+
+ // overshoot amount at start and end
+ property real overshootStart: rawStartPos < 0 ? -rawStartPos : 0
+ property real overshootEnd: rawEndPos > maxPosition ? rawEndPos - maxPosition : 0
+
+ // overshoot adjusted start and end
+ property real adjStartPos: rawStartPos + overshootStart
+ property real adjEndPos: rawEndPos - overshootStart - overshootEnd
+
+ // final position and size of thumb
+ property int position: 0.5 + (adjStartPos + minSize > maxPosition ? maxPosition - minSize : adjStartPos)
+ property int size: 0.5 + ((adjEndPos - position) < minSize ? minSize : (adjEndPos - position))
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-positionindicator"+__invertedString+"-background"
+ property url indicator: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator"
+ property url backgroundHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-background-horizontal"
+ property url indicatorHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator-horizontal"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var sectionData = [];
+var _sections = [];
+
+function initialize(list) {
+ initSectionData(list);
+}
+
+function initSectionData(list) {
+ if (!list || !list.model) return;
+ sectionData = [];
+ _sections = [];
+ var current = "",
+ prop = list.section.property,
+ item;
+
+ for (var i = 0, count = list.model.count; i < count; i++) {
+ item = list.model.get(i);
+ if (item[prop] !== current) {
+ current = item[prop];
+ _sections.push(current);
+ sectionData.push({ index: i, header: current });
+ }
+ }
+}
+
+function getSectionPositionString(name) {
+ var val = _sections.indexOf(name);
+ return val === 0 ? "first" :
+ val === _sections.length - 1 ? "last" : false;
+}
+
+function getAt(pos) {
+ return _sections[pos] ? _sections[pos] : "";
+}
+
+function getRelativeSections(current) {
+ var val = _sections.indexOf(current),
+ sect = [],
+ sl = _sections.length;
+
+ val = val < 1 ? 1 : val >= sl-1 ? sl-2 : val;
+ sect = [getAt(val - 1), getAt(val), getAt(val + 1)];
+
+ return sect;
+}
+
+function getClosestSection(pos, down) {
+ var tmp = (_sections.length) * pos;
+ var val = Math.ceil(tmp) // TODO: better algorithm
+ val = val < 2 ? 1 : val;
+ return _sections[val-1];
+}
+
+function getNextSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val < _sections.length - 1 ? val + 1 : val)] : _sections[0]) || "";
+}
+
+function getPreviousSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val > 0 ? val - 1 : val)] : _sections[0]) || "";
+}
+
+function getIndexFor(sectionName) {
+ var val = sectionData[_sections.indexOf(sectionName)].index;
+ return val === 0 || val > 0 ? val : -1;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "SectionScroller.js" as Sections
+
+Item {
+ id: root
+
+ property ListView listView
+
+ onListViewChanged: {
+ if (listView && listView.model) {
+ internal.initDirtyObserver();
+ } else if (listView) {
+ listView.modelChanged.connect(function() {
+ if (listView.model) {
+ internal.initDirtyObserver();
+ }
+ });
+ }
+ }
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Rectangle {
+ id: container
+ color: "transparent"
+ width: 35
+ height: listView.height
+ x: listView.x + listView.width - width
+ property bool dragging: false
+
+ MouseArea {
+ id: dragArea
+ objectName: "dragArea"
+ anchors.fill: parent
+ drag.target: tooltip
+ drag.axis: Drag.YAxis
+ drag.minimumY: listView.y
+ drag.maximumY: listView.y + listView.height - tooltip.height
+
+ onPressed: {
+ mouseDownTimer.restart()
+ }
+
+ onReleased: {
+ container.dragging = false;
+ mouseDownTimer.stop()
+ }
+
+ onPositionChanged: {
+ internal.adjustContentPosition(dragArea.mouseY);
+ }
+
+ Timer {
+ id: mouseDownTimer
+ interval: 150
+
+ onTriggered: {
+ container.dragging = true;
+ internal.adjustContentPosition(dragArea.mouseY);
+ tooltip.positionAtY(dragArea.mouseY);
+ }
+ }
+ }
+ Item {
+ id: tooltip
+ objectName: "popup"
+ opacity: container.dragging ? 1 : 0
+ anchors.right: parent.right
+ anchors.rightMargin: 50
+ width: childrenRect.width
+ height: childrenRect.height
+
+ function positionAtY(yCoord) {
+ tooltip.y = Math.max(dragArea.drag.minimumY, Math.min(yCoord - tooltip.height/2, dragArea.drag.maximumY));
+ }
+
+ BorderImage {
+ id: background
+ width: childrenRect.width// + 20
+ height: childrenRect.height// + 20
+ anchors.left: parent.left
+ source: platformStyle.backgroundImage
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+
+ Column {
+ width: Math.max(previousSectionLabel.width, currentSectionLabel.width, nextSectionLabel.width)
+ height: childrenRect.height
+
+ SectionScrollerLabel {
+ id: previousSectionLabel
+ objectName: "previousSectionLabel"
+ text: internal.prevSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider1"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: currentSectionLabel
+ objectName: "currentSectionLabel"
+ text: internal.currentSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider2"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: nextSectionLabel
+ objectName: "nextSectionLabel"
+ text: internal.nextSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+ }
+ }
+
+ Image {
+ id: arrow
+ objectName: "arrow"
+ width: 8
+ height: 16
+ anchors.left: background.right
+ property int threshold: currentSectionLabel.height
+ property int yInitial: background.y + background.height/2 - height/2
+ y: getYPosition()
+ source: platformStyle.arrowImage
+
+ function getYPosition() {
+ var v = internal.curPos;
+ var adjust = v === "first" ? -threshold :
+ v === "last" ? threshold : 0;
+
+ return yInitial + adjust;
+ }
+
+ states: [
+ State {
+ when: root.dragging && dragArea.mouseY < (root.listView.y + threshold)
+ PropertyChanges {
+ target: arrow
+ y: yInitial - threshold
+ }
+ }
+ ]
+
+ Behavior on y {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "visible"
+ when: container.dragging
+ },
+
+ State {
+ extend: "visible"
+ name: "atTop"
+ when: internal.curPos === "first"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: internal.currentSection
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.nextSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: Sections.getNextSection(internal.nextSection)
+ }
+ },
+
+ State {
+ extend: "visible"
+ name: "atBottom"
+ when: internal.curPos === "last"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: Sections.getPreviousSection(internal.prevSection)
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.prevSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: internal.currentSection
+ }
+ }
+ ]
+
+ Behavior on opacity {
+ NumberAnimation { duration: 100 }
+ }
+ }
+ }
+
+ Timer {
+ id: dirtyTimer
+ interval: 100
+ running: false
+ onTriggered: {
+ Sections.initSectionData(listView);
+ internal.modelDirty = false;
+ }
+ }
+
+ Connections {
+ target: root.listView
+ onCurrentSectionChanged: internal.curSect = container.dragging ? internal.curSect : ""
+ }
+
+ QtObject {
+ id: internal
+
+ property string prevSection: ""
+ property string currentSection: listView.currentSection
+ property string nextSection: ""
+ property string curSect: ""
+ property string curPos: "first"
+ property int oldY: 0
+ property bool modelDirty: false
+ property bool down: true
+
+ function initDirtyObserver() {
+ Sections.initialize(listView);
+ function dirtyObserver() {
+ if (!internal.modelDirty) {
+ internal.modelDirty = true;
+ dirtyTimer.running = true;
+ }
+ }
+
+ if (listView.model.countChanged)
+ listView.model.countChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsChanged)
+ listView.model.itemsChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsInserted)
+ listView.model.itemsInserted.connect(dirtyObserver);
+
+ if (listView.model.itemsMoved)
+ listView.model.itemsMoved.connect(dirtyObserver);
+
+ if (listView.model.itemsRemoved)
+ listView.model.itemsRemoved.connect(dirtyObserver);
+ }
+
+ function adjustContentPosition(y) {
+ if (y < 0 || y > dragArea.height) return;
+
+ internal.down = (y > internal.oldY);
+ var sect = Sections.getClosestSection((y / dragArea.height), internal.down);
+ internal.oldY = y;
+ if (internal.curSect != sect) {
+ internal.curSect = sect;
+ internal.curPos = Sections.getSectionPositionString(internal.curSect);
+ var sec = Sections.getRelativeSections(internal.curSect);
+ internal.prevSection = sec[0];
+ internal.currentSection = sec[1];
+ internal.nextSection = sec[2];
+ var idx = Sections.getIndexFor(sect);
+ listView.positionViewAtIndex(idx, ListView.Beginning);
+ }
+ }
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias text: label.current
+ property alias up: label.up
+ property bool highlighted: false
+
+ width: wrapper.width
+ height: wrapper.height
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Item {
+ id: wrapper
+
+ clip: true
+ height: label.height
+
+ Text {
+ id: label
+
+ property string current: ""
+ property bool up: true
+ property int shift: 30
+
+ height: 60
+ width: parent.width - 40
+ text: ""
+ x: 20
+ color: root.highlighted ? root.platformStyle.textColorHighlighted : root.platformStyle.textColor
+ font {
+ bold: root.platformStyle.fontBoldProperty
+ pixelSize: root.platformStyle.fontPixelSize
+ }
+ verticalAlignment: Text.AlignVCenter
+ onCurrentChanged: {
+ text = current;
+ }
+ onTextChanged: {
+ var w = paintedWidth
+ parent.width = w + 40;
+ }
+
+ Behavior on current {
+ SequentialAnimation {
+ NumberAnimation { target: label; property: "y"; to: label.up ? label.shift : -label.shift; duration: 50 }
+ PropertyAction { target: label; property: "y"; value: label.up ? -label.shift : label.shift }
+ NumberAnimation { target: label; property: "y"; to: 0; duration: 50 }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+
+ // Font
+ property int fontPixelSize: UI.FONT_XXSMALL
+ property bool fontBoldProperty: true
+
+ // Color
+ property color textColorHighlighted: "#fff"
+ property color textColor: "#888"
+
+ property url dividerImage: "image://theme/meegotouch-scroll-bubble-divider"+__invertedString
+ property url backgroundImage: "image://theme/meegotouch-scroll-bubble-background"+__invertedString
+ property url arrowImage: "image://theme/meegotouch-scroll-bubble-arrow"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+CommonDialog {
+ id: root
+
+ // Common API
+ property alias model: selectionListView.model
+ property int selectedIndex: -1 // read & write
+ //property string titleText: "Selection Dialog"
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+ property bool selected: index == selectedIndex;
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: selectedIndex = index;
+ onClicked: accept();
+ }
+
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: delegateItem.selected ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ delegateItem.selected ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: delegateItem.selected ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ text: modelData
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ onStatusChanged: {
+ if (status == DialogStatus.Opening && selectedIndex >= 0) {
+ selectionListView.positionViewAtIndex(selectedIndex, ListView.Center)
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText:"Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : root.parent
+ ? root.parent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+}
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property alias titleBarFont: titleText.font
+ property int titleBarHeight: 44
+ property color titleBarColor: "white"
+ property int titleBarIndent: 17
+ property int titleBarLineMargin: 10
+
+ property bool __portrait: (screen.currentOrientation == 1) || (screen.currentOrientation == 4)
+
+ property int leftMargin: __portrait ? 11 : 160
+ property int rightMargin: __portrait ? 11 : 160
+
+ property alias itemFont: itemText.font
+ property int fontXLarge: 32
+ property int fontLarge: 28
+ property int fontDefault: 24
+ property int fontSmall: 20
+ property int fontXSmall: 18
+ property int fontXXSmall: 16
+
+ property color colorForeground: "#191919"
+ property color colorSecondaryForeground: "#8c8c8c"
+ property color colorBackground: "#ffffff"
+ property color colorSelect: "#7fb133"
+
+ property color commonLabelColor: "white"
+
+ property int itemHeight: 64
+ property color itemTextColor: "white"
+ property color itemSelectedTextColor: "white"
+ property int itemLeftMargin: 16
+ property int itemRightMargin: 16
+
+ property int contentSpacing: 10
+
+ property int pressDelay: 350 // ms
+
+ // Background
+ property url itemBackground: ""
+ property color itemBackgroundColor: "transparent"
+ property color itemSelectedBackgroundColor: "#3D3D3D"
+ property url itemSelectedBackground: "" // "image://theme/" + __colorString + "meegotouch-list-fullwidth-background-selected"
+ property url itemPressedBackground: "image://theme/" + __colorString + "meegotouch-panel-inverted-background-pressed"
+
+ property int buttonsTopMargin: 30 // ToDo: evaluate correct value
+
+ Text {
+ id: titleText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_XLARGE
+ font.capitalization: Font.MixedCase
+ font.bold: false
+ }
+
+ Text {
+ id: itemText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_DEFAULT_SIZE
+ font.capitalization: Font.MixedCase
+ font.bold: true
+ }
+ }
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+ property Item visualParent
+ property int status: DialogStatus.Closed
+
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ property alias acceptButton: acceptButton
+ property alias rejectButton: rejectButton
+
+ signal accepted
+ signal rejected
+
+ property QtObject platformStyle: SheetStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ visible: status != DialogStatus.Closed;
+
+ function open() {
+ parent = visualParent || __findParent();
+ sheet.state = "";
+ }
+
+ function close() {
+ sheet.state = "closed";
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent
+ && next.objectName != "appWindowContent"
+ && next.objectName != "windowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ function getButton(name) {
+ for (var i=0; i<buttons.length; ++i) {
+ if (buttons[i].objectName == name)
+ return buttons[i];
+ }
+ return undefined;
+ }
+
+ MouseArea {
+ id: blockMouseInput
+ anchors.fill: parent
+ }
+
+ Item {
+ id: sheet
+
+ //when the sheet is part of a page do nothing
+ //when the sheet is a direct child of a PageStackWindow, consider the status bar
+ property int statusBarOffset: (typeof __isPage != "undefined") ? 0
+ : (typeof __statusBarHeight == "undefined") ? 0
+ : __statusBarHeight
+
+ width: parent.width
+ height: parent.height - statusBarOffset
+
+ y: statusBarOffset
+
+ clip: true
+
+ property int transitionDurationIn: 300
+ property int transitionDurationOut: 450
+
+ state: "closed"
+
+ function transitionStarted() {
+ status = (state == "closed") ? DialogStatus.Closing : DialogStatus.Opening;
+ }
+
+ function transitionEnded() {
+ status = (state == "closed") ? DialogStatus.Closed : DialogStatus.Open;
+ }
+
+ states: [
+ // Closed state.
+ State {
+ name: "closed"
+ PropertyChanges { target: sheet; y: height; }
+ }
+ ]
+
+ transitions: [
+ // Transition between open and closed states.
+ Transition {
+ from: ""; to: "closed"; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.InOutQuint; duration: sheet.transitionDurationOut }
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ },
+ Transition {
+ from: "closed"; to: ""; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.OutQuint; duration: sheet.transitionDurationIn }
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ }
+ ]
+
+ BorderImage {
+ source: platformStyle.background
+ width: parent.width
+ anchors.top: header.bottom
+ anchors.bottom: parent.bottom
+ Item {
+ id: contentField
+ anchors.fill: parent
+ }
+ }
+
+ Item {
+ id: header
+ width: parent.width
+ height: headerBackground.height
+ BorderImage {
+ id: headerBackground
+ border {
+ left: platformStyle.headerBackgroundMarginLeft
+ right: platformStyle.headerBackgroundMarginRight
+ top: platformStyle.headerBackgroundMarginTop
+ bottom: platformStyle.headerBackgroundMarginBottom
+ }
+ source: platformStyle.headerBackground
+ width: header.width
+ }
+ Item {
+ id: buttonRow
+ anchors.fill: parent
+ SheetButton {
+ id: rejectButton
+ objectName: "rejectButton"
+ anchors.left: parent.left
+ anchors.leftMargin: root.platformStyle.rejectButtonLeftMargin
+ anchors.verticalCenter: parent.verticalCenter
+ visible: text != ""
+ onClicked: close()
+ }
+ SheetButton {
+ id: acceptButton
+ objectName: "acceptButton"
+ anchors.right: parent.right
+ anchors.rightMargin: root.platformStyle.acceptButtonRightMargin
+ anchors.verticalCenter: parent.verticalCenter
+ platformStyle: SheetButtonAccentStyle { }
+ visible: text != ""
+ onClicked: close()
+ }
+ Component.onCompleted: {
+ acceptButton.clicked.connect(accepted)
+ rejectButton.clicked.connect(rejected)
+ }
+ }
+ Item {
+ id: titleBar
+ anchors.fill: parent
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: root
+
+ property Style platformStyle: SheetButtonStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ property color textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background"
+ pressedBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/meegotouch-sheet-button"+__invertedString+"-background"
+ pressedBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int acceptButtonRightMargin: 15
+ property int rejectButtonLeftMargin: 15
+
+ property url background: "image://theme/meegotouch-applicationpage-background" + __invertedString;
+ property url headerBackground: "image://theme/meegotouch-sheet-header" + __invertedString + "-background";
+
+ property int headerBackgroundMarginLeft: 10
+ property int headerBackgroundMarginRight: 10
+ property int headerBackgroundMarginTop: 10
+ property int headerBackgroundMarginBottom: 2
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ id: root
+ width: parent ? parent.width : 0
+ height: 250
+ color: "black"
+ opacity: 0.9
+
+ Text {
+ id: label
+ font.pixelSize: 43
+ text: "Software Input Panel"
+ anchors.centerIn: parent
+ color: "white"
+ opacity: 0.0
+ }
+
+ MouseArea {
+ // Block clicks from falling through the simulator
+ anchors.fill: parent
+ onClicked: {
+ root.parent.focus = true;
+ inputContext.simulateSipClose();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+
+SliderTemplate {
+ id: slider
+
+ property Style platformStyle: SliderStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: slider.platformStyle
+
+ opacity: enabled ? UI.OPACITY_ENABLED : UI.OPACITY_DISABLED
+
+ __handleItem: Image {
+ source: pressed? platformStyle.handleBackgroundPressed : platformStyle.handleBackground;
+ }
+
+ __grooveItem: BorderImage {
+ source: platformStyle.grooveItemBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueTrackItem: BorderImage {
+ source: platformStyle.grooveItemElapsedBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueIndicatorItem: BorderImage {
+ id: indicatorBackground
+ source: platformStyle.valueBackground
+ border { left: 12; top: 12; right: 12; bottom: 12 }
+
+ width: label.width + 28
+ height: 40
+
+ Image {
+ id: arrow
+ }
+
+ state: slider.valueIndicatorPosition
+ states: [
+ State {
+ name: "Top"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowDown
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.top: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowUp
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.bottom: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ AnchorChanges {
+ target: indicatorBackground
+// anchors.
+ }
+ },
+ State {
+ name: "Left"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowLeft
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.left: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ },
+ State {
+ name: "Right"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowRight
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.right: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ ]
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: slider.valueIndicatorText
+ color: slider.platformStyle.textColor
+ font.pixelSize: slider.platformStyle.fontPixelSize
+ font.family: slider.platformStyle.fontFamily
+ }
+
+ // Native libmeegotouch slider value indicator pops up 100ms after pressing
+ // the handle... but hiding happens without delay.
+ visible: slider.valueIndicatorVisible && slider.pressed
+ Behavior on visible {
+ enabled: !indicatorBackground.visible
+ PropertyAnimation {
+ duration: 100
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+
+ // Color
+ property color textColor: !inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Background
+ property url valueBackground: "image://theme/meegotouch-slider-handle-value"+__invertedString+"-background"
+ property url labelArrowDown: "image://theme/meegotouch-slider-handle-label-arrow-down"+__invertedString
+ property url labelArrowUp: "image://theme/meegotouch-slider-handle-label-arrow-up"+__invertedString
+ property url labelArrowLeft: "image://theme/meegotouch-slider-handle-label-arrow-left"+__invertedString
+ property url labelArrowRight: "image://theme/meegotouch-slider-handle-label-arrow-right"+__invertedString
+ property url handleBackground: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-horizontal"
+ property url handleBackgroundPressed: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-pressed-horizontal"
+ property url grooveItemBackground: "image://theme/meegotouch-slider"+__invertedString+"-background-horizontal"
+ property url grooveItemElapsedBackground: "image://theme/" + __colorString + "meegotouch-slider-elapsed"+__invertedString+"-background-horizontal"
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+Item {
+ id: slider
+
+ //
+ // Common API
+ //
+ property int orientation: Qt.Horizontal
+ property alias minimumValue: range.minimumValue
+ property alias maximumValue: range.maximumValue
+ property alias pressed: mouseArea.pressed
+ property alias stepSize: range.stepSize
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ // NOTE: this property is in/out, the user can set it, create bindings to it, and
+ // at the same time the slider wants to update. There's no way in QML to do this kind
+ // of updates AND allow the user bind it (without a Binding object). That's the
+ // reason this is an alias to a C++ property in range model.
+ property alias value: range.value
+
+ //
+ // Public extensions
+ //
+ property alias inverted: range.inverted
+
+ // Value indicator displays the current value near the slider
+ // if valueIndicatorText == "", a default formating will be applied
+ property string valueIndicatorText: formatValue(range.value)
+ property bool valueIndicatorVisible: false
+
+ property int valueIndicatorMargin: 1
+ property string valueIndicatorPosition: __isVertical ? "Left" : "Top"
+
+ // The default implementation for label hides decimals until it hits a
+ // floating point value at which point it keeps decimals
+ property bool __useDecimals: false
+ function formatValue(v) {
+ return __useDecimals ? (v.toFixed(2)) : v;
+ }
+
+ //
+ // "Protected" properties
+ //
+
+ // Hooks for customizing the pieces of the slider
+ property Item __grooveItem
+ property Item __valueTrackItem
+ property Item __handleItem
+ property Item __valueIndicatorItem
+
+ property bool __isVertical: orientation == Qt.Vertical
+
+ implicitWidth: 400
+ implicitHeight: handle.height
+
+ width: __isVertical ? implicitHeight : implicitWidth
+ height: __isVertical ? implicitWidth : implicitHeight
+
+ // This is a template slider, so every piece can be modified by passing a
+ // different Component. The main elements in the implementation are
+ //
+ // - the 'range' does the calculations to map position to/from value,
+ // it also serves as a data storage for both properties;
+ //
+ // - the 'fakeHandle' is what the mouse area drags on the screen, it feeds
+ // the 'range' position and also reads it when convenient;
+ //
+ // - the real 'handle' it is the visual representation of the handle, that
+ // just follows the 'fakeHandle' position.
+ //
+ // Everything is encapsulated in a contents Item, so for the
+ // vertical slider, we just swap the height/width, make it
+ // horizontal, and then use rotation to make it vertical again.
+
+ Component.onCompleted: {
+ __grooveItem.parent = groove;
+ __valueTrackItem.parent = valueTrack;
+ __handleItem.parent = handle;
+ __valueIndicatorItem.parent = valueIndicator;
+ }
+
+ Item {
+ id: contents
+
+ width: __isVertical ? slider.height : slider.width
+ height: __isVertical ? slider.width : slider.height
+ rotation: __isVertical ? -90 : 0
+
+ anchors.centerIn: slider
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ onValueChanged: {
+ // XXX: Moved that outside formatValue to get rid of binding loop warnings
+ var v = range.value
+ if (parseInt(v) != v)
+ __useDecimals = true;
+ }
+ positionAtMinimum: handle.width / 2
+ positionAtMaximum: contents.width - handle.width / 2
+ onMaximumChanged: __useDecimals = false;
+ onMinimumChanged: __useDecimals = false;
+ onStepSizeChanged: __useDecimals = false;
+ }
+
+ Item {
+ id: groove
+ anchors.fill: parent
+ anchors.leftMargin: handle.width / 2
+ anchors.rightMargin: handle.width / 2
+ }
+
+ Item {
+ id: valueTrack
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: groove.left
+ anchors.right: handle.horizontalCenter
+ anchors.rightMargin: handle.width / 2
+
+ states: State {
+ when: slider.inverted
+ PropertyChanges {
+ target: valueTrack
+ anchors.rightMargin: 0
+ anchors.leftMargin: - handle.width / 2
+ }
+ AnchorChanges {
+ target: valueTrack
+ anchors.left: handle.horizontalCenter
+ anchors.right: groove.right
+ }
+ }
+ }
+
+ Item {
+ id: handle
+ transform: Translate { x: - handle.width / 2 }
+ rotation: __isVertical ? 90 : 0
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ width: __handleItem.width
+ height: __handleItem.height
+
+ x: fakeHandle.x
+ Behavior on x {
+ id: behavior
+ enabled: !mouseArea.drag.active
+
+ PropertyAnimation {
+ duration: behavior.enabled ? 150 : 0
+ easing.type: Easing.OutSine
+ }
+ }
+ }
+
+ Item {
+ id: fakeHandle
+ width: handle.width
+ height: handle.height
+ transform: Translate { x: - handle.width / 2 }
+ }
+
+ MouseArea {
+ id: mouseArea
+ property real oldPosition: 0
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ drag.target: fakeHandle
+ drag.axis: Drag.XAxis
+ drag.minimumX: range.positionAtMinimum
+ drag.maximumX: range.positionAtMaximum
+
+ onPressed: {
+ oldPosition = range.position;
+ // Clamp the value
+ var newX = Math.max(mouse.x + anchors.leftMargin, drag.minimumX);
+ newX = Math.min(newX, drag.maximumX);
+
+ // Debounce the press: a press event inside the handler will not
+ // change its position, the user needs to drag it.
+ if (Math.abs(newX - fakeHandle.x) > handle.width / 2)
+ range.position = newX;
+ }
+
+ onCanceled: {
+ range.position = oldPosition;
+ }
+ }
+
+ Item {
+ id: valueIndicator
+
+ transform: Translate {
+ x: - handle.width / 2;
+ y: __isVertical? -(__valueIndicatorItem.width/2)+20 : y ;
+ }
+
+ rotation: __isVertical ? 90 : 0
+ visible: valueIndicatorVisible
+
+ width: __valueIndicatorItem.width //+ (__isVertical? (handle.width/2) : 0 )
+ height: __valueIndicatorItem.height
+
+ state: {
+ if (!__isVertical)
+ return slider.valueIndicatorPosition;
+
+ if (valueIndicatorPosition == "Right")
+ return "Bottom";
+ if (valueIndicatorPosition == "Top")
+ return "Right";
+ if (valueIndicatorPosition == "Bottom")
+ return "Left";
+
+ return "Top";
+ }
+
+ anchors.margins: valueIndicatorMargin
+
+ states: [
+ State {
+ name: "Top"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.bottom: handle.top
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.top: handle.bottom
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Right"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.left: handle.right
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ },
+ State {
+ name: "Left"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.right: handle.left
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ }
+ ]
+ }
+ }
+
+ // when there is no mouse interaction, the handle's position binds to the value
+ Binding {
+ when: !mouseArea.drag.active
+ target: fakeHandle
+ property: "x"
+ value: range.position
+ }
+
+ // when the slider is dragged, the value binds to the handle's position
+ Binding {
+ when: mouseArea.drag.active
+ target: range
+ property: "position"
+ value: fakeHandle.x
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Item {
+ id: root
+ width: parent.width
+ height: 0
+
+ objectName: "softwareInputPanel"
+
+ property bool active: false
+
+ states: State {
+ when: active
+ PropertyChanges { target: root; height: childrenRect.height; }
+ }
+
+ transitions: Transition {
+ reversible: true
+ NumberAnimation { properties: "opacity"; easing.type: Easing.InOutCubic; duration: 200 }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+
+StatusBarInternal {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+
+ property bool showStatusBar: true
+ property bool __completed: false
+
+ states: State {
+ name: "hide"; when: showStatusBar==false
+ PropertyChanges { target: statusBar; anchors.topMargin: -statusBar.height; visible: false}
+ }
+
+ Component.onCompleted: {
+ statusBar.orientation = screen.currentOrientation
+ screen.updatePlatformStatusBarRect(statusBar)
+ __completed = true;
+ }
+
+ onWidthChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+
+ Timer {
+ // Timer is used to update statusbarrect to avoid duplicated calls during animation,
+ // also onActiveChanged coming too early
+ id: updatePlatformStatusBarTimer
+ repeat: false
+ interval: 50
+ onTriggered: {
+ screen.updatePlatformStatusBarRect(statusBar);
+ }
+ }
+
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+
+ transitions: Transition {
+ from: __completed ? "" : "invalid"
+ to: __completed ? "hide" : "invalid"
+ reversible: true
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+ PropertyAnimation { target: statusBar; properties: "anchors.topMargin"; easing.type: Easing.InOutExpo; duration: 500 }
+ PropertyAnimation { target: statusBar; properties: "visible"; }
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+QtObject {
+ id: styleClass
+ // Settings
+ property bool inverted: theme.inverted
+ property string __invertedString: inverted? "-inverted" : ""
+ property string __colorString: theme.colorString
+
+ // some style classes like SelectionDialogStyle are using nested elements (for example Text),
+ // which isn't allowed by QtObject; this fix makes this possible
+ default property alias children: styleClass.__defaultPropertyFix
+ property list<QtObject> __defaultPropertyFix: [Item {}] //QML doesn't allow an empty list here
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+/*
+Class: Switch
+ The Switch component is similar to the CheckBox component but instead of
+ selecting items it should be used when setting options to On/Off.
+*/
+Item {
+ id: root
+
+ width: slider.width
+ height: slider.height
+
+ /*
+ * Property: checked
+ * [bool=false] The checked state of switch
+ */
+ property bool checked: false
+
+ // Styling for the Switch
+ property Style platformStyle: SwitchStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ /*
+ * Property: enabled
+ * [bool=true] Enables/Disables the component. Notice that the disable state is not Toolkit compliant
+ * and not present inside the qt-components
+ */
+
+ Item {
+ id: slider
+
+ width: 66
+ height: 42
+
+ state: root.checked ? "checked" : "unchecked"
+
+ property real knobPos: (knob.x - platformStyle.minKnobX) / (platformStyle.maxKnobX - platformStyle.minKnobX)
+
+ Image {
+ source: platformStyle.switchOn
+ opacity: slider.knobPos
+ }
+ Image {
+ source: platformStyle.switchOff
+ opacity: 1.0 - slider.knobPos
+ }
+
+ states: [
+ State {
+ name: "unchecked"
+ PropertyChanges { target: knob; x: platformStyle.minKnobX }
+ },
+ State {
+ name: "checked"
+ PropertyChanges { target: knob; x: platformStyle.maxKnobX }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ SmoothedAnimation { properties: "x"; velocity: 500; maximumEasingTime: 0 }
+ }
+ ]
+
+ // thumb (shadow)
+ Image {
+ id: knob
+
+ // thumb (inline)
+ Image {
+ width: 30
+ height: 30
+ x: 0
+ y: -2
+ source: (slider.enabled ? (mouseArea.pressed ? platformStyle.thumbPressed : platformStyle.thumb) : platformStyle.thumbDisabled)
+ }
+
+ source: platformStyle.shadow
+
+ y: 8
+
+ width: 30
+ height: 30
+ }
+
+ MouseArea {
+ id: mouseArea
+ property int downMouseX
+ property int downKnobX
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ function snap() {
+ if (knob.x < (platformStyle.maxKnobX + platformStyle.minKnobX) / 2) {
+ if (root.checked) {
+ root.checked = false;
+ } else {
+ knob.x = platformStyle.minKnobX;
+ }
+ } else {
+ if (!root.checked) {
+ root.checked = true;
+ } else {
+ knob.x = platformStyle.maxKnobX;
+ }
+ }
+ }
+
+ onPressed: {
+ downMouseX = mouseX;
+ downKnobX = knob.x;
+ }
+
+ onPositionChanged: {
+ var newKnobX = downKnobX - (downMouseX - mouseX);
+ knob.x = newKnobX < platformStyle.minKnobX ? platformStyle.minKnobX : newKnobX > platformStyle.maxKnobX ? platformStyle.maxKnobX : newKnobX;
+ }
+
+ onReleased: {
+ if (Math.abs(downMouseX - mouseX) < 5)
+ root.checked = !root.checked;
+ else
+ snap();
+ }
+
+ onCanceled: {
+ snap();
+ }
+
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int minKnobX: 6
+ property int maxKnobX: 30
+
+ // Slider
+ property url switchOn: "image://theme/" + __colorString + "meegotouch-switch-on"+__invertedString
+ property url switchOff: "image://theme/meegotouch-switch-off"+__invertedString
+
+ // Knob
+ property url thumb: "image://theme/meegotouch-switch-thumb"+__invertedString
+ property url thumbPressed: "image://theme/meegotouch-switch-thumb-pressed"+__invertedString
+ property url thumbDisabled: "image://theme/meegotouch-switch-thumb-disabled"+__invertedString
+ property url shadow: "image://theme/meegotouch-switch-shadow"+__invertedString
+
+ // Mouse
+ property real mouseMarginRight: -UI.MARGIN_XLARGE
+ property real mouseMarginLeft: -UI.MARGIN_XLARGE
+ property real mouseMarginTop: -UI.MARGIN_XLARGE
+ property real mouseMarginBottom: -UI.MARGIN_XLARGE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ Component.onCompleted: {
+ __layout()
+ print("Warning, TabBarLayout has been deprecated from the API.")
+ print("To fix your code, please use:")
+ print(" tools: ToolBarLayout { ToolItem{} ButtonRow{TabButton{} ... } } instead.")
+ }
+ onChildrenChanged: __layout()
+ onWidthChanged: __layout()
+ onHeightChanged: __layout()
+
+ function __layout() {
+ if (parent == null || width == 0)
+ return;
+
+ var orientation = screen.currentOrientation == Screen.Landscape || screen.currentOrientation == Screen.LandscapeInverted ? "landscape" : "portrait",
+ padding = orientation == "landscape" ? 80 : 15;
+
+ for (var i = 0, childCount = children.length, tabCount = 0, widthOthers = 0; i < childCount; i++) {
+ if (children[i].tab !== undefined) {
+ children[i].platformStyle.position = (tabCount++ === 0) ? "horizontal-left" : "horizontal-center";
+ children[i].platformStyle.screenOrientation = orientation;
+ } else {
+ widthOthers += children[i].width;
+ children[i].y = (height - children[i].height) / 2;
+ }
+ }
+ // Check if last item is a tab button and set appropriate position
+ tabCount && (children[children[0].tab ? tabCount - 1 : tabCount].platformStyle.position = "horizontal-right");
+
+ widthOthers += children[0].tab ? padding : 0;
+ widthOthers += children[childCount - 1].tab ? padding : 0;
+
+ var tabWidth = Math.round((width - widthOthers) / tabCount),
+ offset = children[0].tab ? padding : children[0].width;
+
+ for (var i = children[0].tab ? 0 : 1, index = 0; i < childCount; i++, index++) {
+ children[i].x = tabWidth * index + offset;
+ children[i].tab && (children[i].width = tabWidth);
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+Button {
+ id: tabButton
+
+ // Common public API
+ property Item tab
+ property QtObject platformStyle: TabButtonStyle {}
+
+ //Deprecated: TODO, remove this!
+ property alias style: tabButton.platformStyle
+
+ property Item __tabGroup: tab !== null ? tab.parent : null
+
+ Connections {
+ target: __tabGroup
+ onCurrentTabChanged: checked = __tabGroup.currentTab == tab;
+ }
+
+ onClicked: privatePressed()
+
+ function privatePressed() {
+ if (tabButton.checkable) {
+ tabButton.checked = !tabButton.checked;
+ }
+
+ if (__tabGroup != null &&
+ tab != null) {
+ __tabGroup.currenTab == tab ? __tabGroup.currentTab.pop(): __tabGroup.currentTab = tab;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ /* The orientation of the button which can take one of the two values:
+ [portrait] [landscape]
+ */
+ property string screenOrientation: (screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape"
+
+ fontCapitalization: Font.MixedCase
+ fontPixelSize: 24
+ fontWeight: Font.Normal
+ checkedFontWeight: Font.Bold
+
+ buttonHeight: screenOrientation == "portrait"? 72 : 56
+
+ textColor: inverted ? "#CDCDCD" : "#505050"
+ pressedTextColor: inverted ? "#ffffff" : "#505050"
+ checkedTextColor: inverted ? "#ffffff" : "#000000"
+
+ background: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+
+ pressedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ disabledBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+ checkedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ checkedDisabledBackground: "image://theme/meegotouch-tab" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The TabGroup item defines a set of tabs consisting of page stacks or
+// pages that can be switched between to implement a tabbed user interface.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+
+ // The currently selected tab.
+ property Item currentTab
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ onVisibleChanged: __update()
+ onChildrenChanged: __update()
+ onCurrentTabChanged: __update()
+
+ function __update() {
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var newVis = child == currentTab;
+ if (child.visible != newVis) {
+ child.visible = newVis;
+ if (child.status !== undefined) {
+ if (newVis) {
+ child.status = PageStatus.Activating;
+ child.status = PageStatus.Active;
+ } else {
+ child.status = PageStatus.Deactivating;
+ child.status = PageStatus.Inactive;
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textEdit.text
+ property alias placeholderText: prompt.text
+
+ property alias font: textEdit.font
+ property alias cursorPosition: textEdit.cursorPosition
+ property alias readOnly: textEdit.readOnly
+
+ property alias horizontalAlignment: textEdit.horizontalAlignment
+ property alias verticalAlignment: textEdit.verticalAlignment
+
+ property alias selectedText: textEdit.selectedText
+ property alias selectionStart: textEdit.selectionStart
+ property alias selectionEnd: textEdit.selectionEnd
+
+ property alias wrapMode: textEdit.wrapMode
+ property alias textFormat: textEdit.textFormat
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textEdit.activeFocusOnPress
+
+ property alias inputMethodHints: textEdit.inputMethodHints
+
+ property bool errorHighlight: false
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextAreaStyle {}
+ property alias style: root.platformStyle
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textEdit)
+ }
+
+ function copy() {
+ textEdit.copy()
+ }
+
+ function paste() {
+ textEdit.paste()
+ }
+
+ function cut() {
+ textEdit.cut()
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textEdit.forceActiveFocus()
+ }
+
+ function select(start, end) {
+ textEdit.select(start, end)
+ }
+
+ function selectAll() {
+ textEdit.selectAll()
+ }
+
+ function selectWord() {
+ textEdit.selectWord()
+ }
+
+ function positionAt(x, y) {
+ var p = mapToItem(textEdit, x, y);
+ return textEdit.positionAt(p.x, p.y)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textEdit.positionToRectangle(pos)
+ var point = mapFromItem(textEdit, rect.x, rect.y)
+ rect.x = point.x; rect.y = point.y
+ return rect;
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextArea's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ textEdit.closeSoftwareInputPanel();
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextArea's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ textEdit.openSoftwareInputPanel();
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textEdit);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+ // private
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: Math.max (UI.FIELD_DEFAULT_HEIGHT,
+ textEdit.height + (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize))
+
+ onActiveFocusChanged: {
+ if (activeFocus &&
+ !readOnly) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ } else if (!activeFocus) {
+ if (!readOnly)
+ platformCloseSoftwareInputPanel();
+
+ Popup.close(textEdit);
+ }
+ }
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textEdit.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors.fill: parent
+ anchors.leftMargin: UI.PADDING_XLARGE
+ anchors.rightMargin: UI.PADDING_XLARGE
+ anchors.topMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textEdit.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var mappedMousePos = mapToItem(textEdit, mouseX, mouseY);
+ var newCursorPosition = textEdit.positionAt(mappedMousePos.x, mappedMousePos.y, TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextEdit {
+ id: textEdit
+
+ // Exposed for the edit bubble
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ x: UI.PADDING_XLARGE
+ y: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ width: parent.width - UI.PADDING_XLARGE * 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ wrapMode: TextEdit.Wrap
+ persistentSelection: false
+ focus: true
+
+ function updateMagnifierPosition(posX, posY) {
+ var yAdjustment = 0
+ var magnifier = MagnifierPopup.popup;
+ var cursorHeight = textEdit.positionToRectangle(0,0).height;
+ var mappedPos = mapToItem(magnifier.parent, posX - magnifier.width / 2,
+ posY - magnifier.height / 2 - cursorHeight - 70);
+
+ magnifier.xCenter = mapToItem(magnifier.sourceItem, posX, 0).x;
+ magnifier.x = mappedPos.x;
+ if (-root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight) < (magnifier.height / 1.5)) {
+ yAdjustment = Math.max(0,(magnifier.height / 1.5) + root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight));
+ } else {
+ yAdjustment = 0;
+ }
+ magnifier.yCenter = mapToItem(magnifier.sourceItem, 0, posY - cursorHeight + 50).y
+ magnifier.y = mappedPos.y + yAdjustment;
+ }
+
+ Component.onDestruction: {
+ Popup.close(textEdit);
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (textEdit.preedit == "" && Popup.isOpened(textEdit) && !Popup.isChangingInput())
+ Popup.close(textEdit);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelVisibleChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+
+ onCursorPositionChanged: {
+ if(!MagnifierPopup.isOpened() && activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textEdit.cursorPosition == textEdit.text.length) &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ Popup.open(textEdit,
+ textEdit.positionToRectangle(textEdit.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_XLARGE
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_MEDIUM
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ pressOnPreedit = textEdit.cursorPosition==mousePosition
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be committed before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ parent.selectByMouse = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ parent.cursorPosition = parent.positionAt(mouse.x,mouse.y)
+ parent.updateMagnifierPosition(mouse.x,mouse.y)
+ root.z = Number.MAX_VALUE
+ }
+ }
+
+ onReleased:{
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ editBubblePosition = textEdit.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textEdit.text;
+
+ textEdit.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textEdit.preedit.length >=1 && textEdit.preedit.length <= 4)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ } else {
+ textEdit.text=beforeText;
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ attemptToActivate = false;
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textEdit.cursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textEdit.preedit.length == 0)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ Popup.open(textEdit,editBubblePosition);
+ }
+ }
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ var pos = textEdit.positionAt (mouse.x,mouse.y)
+ var posNextLine = textEdit.positionAt (mouse.x, mouse.y + 1)
+ var posPrevLine = textEdit.positionAt (mouse.x, mouse.y - 1)
+ if (!(Math.abs(posNextLine - pos) > 1 ||
+ Math.abs(posPrevLine - pos) > 1)) {
+ parent.cursorPosition = pos
+ }
+ parent.updateMagnifierPosition(mouse.x,mouse.y);
+ }
+ }
+ onDoubleClicked: {
+ // possible pre-edit word have to be committed before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: root.activeFocus
+
+ onClickedOutside: {
+ if (Popup.isOpened(textEdit) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function findFlickable(component) {
+ var nextParent = component
+ var flickableItem = null
+ while(nextParent) {
+ if(nextParent.flicking !== undefined && nextParent.flickableDirection !== undefined)
+ flickableItem = nextParent
+
+ nextParent = nextParent.parent
+ }
+ if (flickableItem) return flickableItem
+ return null
+}
+
+function animateContentY(animation, flickable, newContentY) {
+ animation.target = flickable
+ animation.to = newContentY
+ animation.running = true
+}
+
+function locateFlickableY(flickable) {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ return flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.LandscapeInverted:
+ return screen.displayHeight - flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.Portrait:
+ return flickable.mapToItem(null, flickable.x, flickable.y).x
+
+ case Screen.PortraitInverted:
+ return screen.displayWidth - flickable.mapToItem(null, flickable.x, flickable.y).x
+ }
+}
+
+function getMargin() {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ return 40
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ return 48
+ }
+
+ return 0
+}
+
+function repositionFlickable(animation) {
+ inputContext.updateMicroFocus()
+ var mf = inputContext.microFocus
+
+ if(mf.x == -1 && mf.y == -1)
+ return
+
+ var object = findFlickable(parent)
+
+ if(object){
+ var flickable = object
+
+ // Specifies area from bottom and top when repositioning should be triggered
+ var margin = getMargin()
+ var newContentY = flickable.contentY
+ var flickableY = locateFlickableY(flickable)
+
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ if(flickableY + flickable.height - mf.height - margin < mf.y) {
+ // Find dY just to make textfield visible
+ var dY = mf.y - flickableY - flickable.height
+ // Center textfield
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.y) {
+ var dY = flickableY - mf.y
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.LandscapeInverted:
+ // In inverted screen we need to compensate for the focus height
+ var invertedMfY = screen.displayHeight - mf.y - mf.height
+
+ if(flickableY + flickable.height - mf.height - margin < invertedMfY) {
+ var dY = invertedMfY - flickableY - flickable.height
+ dY += flickable.height / 2 + mf.height / 2
+ } else if(flickableY + margin > invertedMfY){
+ var dY = flickableY - invertedMfY
+ dY += flickable.height / 2 - mf.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.Portrait:
+ if(flickableY + flickable.height - mf.width - margin < mf.x) {
+ var dY = mf.x - flickableY - flickable.height
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.x){
+ var dY = flickableY - mf.x
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.PortraitInverted:
+ var invertedMfX = screen.displayWidth - mf.x - mf.width
+
+ if(flickableY + flickable.height - mf.width - margin < invertedMfX) {
+ var dY = invertedMfX - flickableY - flickable.height + mf.height
+ dY += flickable.height / 2 + mf.height
+ newContentY += dY
+ } else if(flickableY + margin > invertedMfX){
+ var dY = flickableY - invertedMfX
+ dY += flickable.height / 2 - mf.height
+ newContentY -= dY
+ }
+
+ break
+ }
+
+ // If overpanned, set contentY to max possible value (reached bottom)
+ if(newContentY > flickable.contentHeight - flickable.height)
+ newContentY = flickable.contentHeight - flickable.height
+
+ // If overpanned, set contentY to min possible value (reached top)
+ if(newContentY < 0)
+ newContentY = 0
+
+ if(newContentY != flickable.contentY) {
+ animateContentY(animation, flickable, newContentY)
+ }
+ }
+}
+
+function injectWordToPreedit(newCursorPosition) {
+ var preeditStart = previousWordStart(newCursorPosition);
+ var preeditEnd = nextWordEnd(newCursorPosition);
+
+ // copy word to preedit text
+ var preeditText = root.text.substring(preeditStart,preeditEnd);
+
+ // inject preedit
+ cursorPosition = preeditStart;
+
+ var eventCursorPosition = newCursorPosition-preeditStart;
+
+ return inputContext.setPreeditText(preeditText, eventCursorPosition, 0, preeditText.length);
+}
+
+function previousWordStart(pos) {
+ var ret = pos;
+
+ if (ret && atWordSeparator(ret - 1)) {
+ ret--;
+ while (ret && atWordSeparator(ret - 1))
+ ret--;
+ } else {
+ while (ret && !atSpace(ret - 1) && !atWordSeparator(ret - 1))
+ ret--;
+ }
+
+ return ret;
+}
+
+function nextWordEnd(pos) {
+ var ret = pos;
+ var len = root.text.length;
+
+ if (ret < len && atWordSeparator(ret)) {
+ ret++;
+ while (ret < len && atWordSeparator(ret))
+ ret++;
+ } else {
+ while (ret < len && !atSpace(ret) && !atWordSeparator(ret))
+ ret++;
+ }
+
+ return ret;
+}
+
+function atSpace(pos) {
+ var c = root.text.charAt(pos);
+ return c == ' '
+ || c == '\t'
+ || c == '\n'
+ ;
+}
+
+function atWordSeparator(pos) {
+ switch (root.text.charAt(pos)) {
+ case '.':
+ case ',':
+ case '?':
+ case '!':
+ case '@':
+ case '#':
+ case '$':
+ case ':':
+ case ';':
+ case '-':
+ case '<':
+ case '>':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '{':
+ case '}':
+ case '=':
+ case '/':
+ case '+':
+ case '%':
+ case '&':
+ case '^':
+ case '*':
+ case '\'':
+ case '"':
+ case '`':
+ case '~':
+ case '|':
+ return true;
+ default:
+ return false;
+ }
+}
+
+var MIN_UPDATE_INTERVAL = 30
+var lastUpdateTime
+function filteredInputContextUpdate() {
+ if (Date.now() - lastUpdateTime > MIN_UPDATE_INTERVAL || !lastUpdateTime) {
+ inputContext.update();
+ lastUpdateTime = Date.now();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+TextFieldStyle {}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textInput.text
+ property alias placeholderText: prompt.text
+
+ property alias inputMethodHints: textInput.inputMethodHints
+ property alias font: textInput.font
+ property alias cursorPosition: textInput.cursorPosition
+ property alias maximumLength: textInput.maximumLength
+ property alias readOnly: textInput.readOnly
+ property alias acceptableInput: textInput.acceptableInput
+ property alias inputMask: textInput.inputMask
+ property alias validator: textInput.validator
+
+ property alias selectedText: textInput.selectedText
+ property alias selectionStart: textInput.selectionStart
+ property alias selectionEnd: textInput.selectionEnd
+
+ property alias echoMode: textInput.echoMode // ### TODO: declare own enum { Normal, Password }
+
+ property bool errorHighlight: !acceptableInput
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textInput.activeFocusOnPress
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextFieldStyle {}
+
+ property alias style: root.platformStyle
+
+ property Component customSoftwareInputPanel
+
+ property Component platformCustomSoftwareInputPanel
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ signal accepted
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textInput)
+ }
+
+ onCustomSoftwareInputPanelChanged: {
+ console.log("TextField's property customSoftwareInputPanel is deprecated. Use property platformCustomSoftwareInputPanel instead.")
+ platformCustomSoftwareInputPanel = customSoftwareInputPanel
+ }
+
+ onPlatformCustomSoftwareInputPanelChanged: {
+ textInput.activeFocusOnPress = platformCustomSoftwareInputPanel == null
+ }
+
+
+
+ function copy() {
+ textInput.copy()
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+
+ function paste() {
+ textInput.paste()
+ }
+
+ function cut() {
+ textInput.cut()
+ }
+
+ function select(start, end) {
+ textInput.select(start, end)
+ }
+
+ function selectAll() {
+ textInput.selectAll()
+ }
+
+ function selectWord() {
+ textInput.selectWord()
+ }
+
+ function positionAt(x) {
+ var p = mapToItem(textInput, x, 0);
+ return textInput.positionAt(p.x)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textInput.positionToRectangle(pos)
+ rect.x = mapFromItem(textInput, rect.x, 0).x
+ return rect;
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textInput.forceActiveFocus()
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextField's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ if (inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelVisible = false
+ inputContext.customSoftwareInputPanelComponent = null
+ inputContext.customSoftwareInputPanelTextField = null
+ } else {
+ textInput.closeSoftwareInputPanel();
+ }
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextField's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ if (platformCustomSoftwareInputPanel != null && !inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelTextField = root
+ inputContext.customSoftwareInputPanelComponent = platformCustomSoftwareInputPanel
+ inputContext.customSoftwareInputPanelVisible = true
+ } else {
+ textInput.openSoftwareInputPanel();
+ }
+ }
+
+ // private
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: UI.FIELD_DEFAULT_HEIGHT
+
+ onActiveFocusChanged: {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+
+ repositionTimer.running = true;
+ } else {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textInput.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textInput.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textInput.activeFocus) {
+ textInput.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var newCursorPosition = textInput.positionAt(mapToItem(textInput, mouseX, mouseY).x,TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textInput.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextInput {
+ id: textInput
+
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ passwordCharacter: "\u2022"
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ focus: true
+
+ onAccepted: { root.accepted() }
+
+ Component.onDestruction: {
+ Popup.close(textInput);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus) {
+ repositionTimer.running = true
+ }
+ }
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput())
+ Popup.close(textInput);
+ }
+
+ onCursorPositionChanged: {
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened()) {
+ Popup.close(textInput);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textInput.cursorPosition == textInput.text.length) &&
+ Popup.isOpened(textInput) &&
+ !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ Popup.open(textInput,
+ textInput.positionToRectangle(textInput.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingLeft
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingRight
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit: false
+ property int oldCursorPosition: 0
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ pressOnPreedit = textInput.cursorPosition==mousePosition
+ oldCursorPosition = textInput.cursorPosition;
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onDelayedPressSent: {
+ if (textInput.preedit) {
+ textInput.cursorPosition = oldCursorPosition;
+ }
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be commited before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ var cursorPos = textInput.positionToRectangle(0);
+ var mappedPosMf = mapFromItem(parent,mouse.x,cursorPos.y+cursorPos.height);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ var mappedPos = mapToItem(magnifier.parent, mappedPosMf.x - magnifier.width / 2,
+ textInput.y - 120 - UI.MARGIN_XLARGE - (height / 2));
+ var yAdjustment = -mapFromItem(magnifier.__rootElement(), 0, 0).y < magnifier.height / 2.5 ? magnifier.height / 2.5 + mapFromItem(magnifier.__rootElement(), 0,0).y : 0
+ magnifier.x = mappedPos.x;
+ magnifier.y = mappedPos.y + yAdjustment;
+ magnifier.yCenter = mapToItem(magnifier.sourceItem,0,mappedPosMf.y).y;
+ parent.cursorPosition = textInput.positionAt(mouse.x)
+ }
+ }
+
+ onReleased: {
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ editBubblePosition = textInput.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textInput.text;
+
+ textInput.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textInput.preedit.length >=1 && textInput.preedit.length <= 4)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition+1)
+ } else {
+ textInput.text=beforeText;
+ textInput.cursorPosition=newCursorPosition;
+ }
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textInput.cursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textInput.preedit.length == 0)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition);
+ Popup.open(textInput,editBubblePosition);
+
+ }
+ attemptToActivate = false
+ }
+
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ textInput.cursorPosition = textInput.positionAt(mouse.x)
+ var magnifier = MagnifierPopup.popup;
+ var mappedPosMf = mapFromItem(parent,mouse.x,0);
+ var mappedPos = mapToItem(magnifier.parent,mappedPosMf.x - magnifier.width / 2.0, 0);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ magnifier.x = mappedPos.x;
+ }
+ }
+
+ onDoubleClicked: {
+ // possible pre-edit word have to be commited before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: textInput.activeFocus
+ onClickedOutside: {
+ if (Popup.isOpened(textInput) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ property alias textFont: textProperties.font
+ property color textColor: UI.COLOR_FOREGROUND
+ property color selectedTextColor: UI.COLOR_INVERTED_FOREGROUND
+ property color selectionColor: theme.selectionColor
+
+ property color promptTextColor: UI.COLOR_SECONDARY_FOREGROUND
+
+ property url background: "image://theme/meegotouch-textedit-background"
+ property url backgroundSelected: "image://theme/" + theme.colorString + "meegotouch-textedit-background-selected"
+ property url backgroundDisabled: "image://theme/meegotouch-textedit-background-disabled"
+ property url backgroundError: "image://theme/meegotouch-textedit-background-error"
+ property real backgroundCornerMargin: UI.CORNER_MARGINS
+
+ property real paddingLeft: UI.PADDING_XLARGE
+ property real paddingRight: UI.PADDING_XLARGE
+ property real paddingTop // DEPRECATED
+ property real paddingBottom // DEPRECATED
+
+ property real baselineOffset: 2
+ property real defaultWidth: 250
+
+ property real touchExpansionMargin: UI.TOUCH_EXPANSION_MARGIN
+
+ Text {
+ id: textProperties
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.pixelSize: UI.FONT_DEFAULT
+ visible: false
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The ToolBar is a container for toolbar items such as ToolItem or ToolButton.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: bgImage.height
+
+ // Dummy property to allow qt component deprecated API clients to fail more gracefully
+ property bool __hidden: false
+
+ property int privateVisibility: ToolBarVisibility.Visible
+
+ // Styling for the ToolBar
+ property Style platformStyle: ToolBarStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: root.platformStyle
+
+ // Shadows:
+ Image {
+ anchors.top : bgImage.top
+ anchors.right: bgImage.left
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ }
+ Image {
+ anchors.bottom : bgImage.top
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ }
+ Image {
+ anchors.top : bgImage.top
+ anchors.left: bgImage.right
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ }
+ Image {
+ anchors.top : bgImage.bottom
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ }
+ // Toolbar background.
+ BorderImage {
+ id: bgImage
+ width: root.width
+ border.left: 10
+ border.right: 10
+ border.top: 10
+ border.bottom: 10
+ source: platformStyle.background
+
+ // Mousearea that eats clicks so they don't go through the toolbar to content
+ // that may exist below it in z-order, such as unclipped listview items.
+ MouseArea { anchors.fill: parent }
+ }
+
+ states: [
+ // Inactive state.
+ State {
+ name: "hidden"
+ when: privateVisibility == ToolBarVisibility.Hidden || tools == null
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: "HiddenImmediately"
+ when: privateVisibility == ToolBarVisibility.HiddenImmediately
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: ""
+ when: !(privateVisibility == ToolBarVisibility.Visible || tools == null)
+ PropertyChanges { target: root; height: bgImage.height }
+ }
+
+ ]
+
+ transitions: [
+ // Transition between active and inactive states.
+ Transition {
+ from: ""; to: "hidden"; reversible: true
+ ParallelAnimation {
+ PropertyAnimation { properties: "height"; easing.type: Easing.InOutExpo; duration: platformStyle.visibilityTransitionDuration }
+ }
+ }
+ ]
+
+ // The current set of tools.
+ property Item tools: null
+
+ onToolsChanged: {
+ __performTransition(__transition || transition);
+ __transition = undefined;
+ }
+
+ // The transition type. One of the following:
+ // set an instantaneous change (default)
+ // push follows page stack push animation
+ // pop follows page stack pop animation
+ // replace follows page stack replace animation
+ property string transition: "set"
+
+ // The currently displayed container; null if none.
+ property Item __currentContainer: null
+
+ // Alternating containers used for transitions.
+ property Item __containerA: null
+ property Item __containerB: null
+
+ // The transition to perform next.
+ property variant __transition
+
+ // Sets the tools with a transition.
+ function setTools(tools, transition) {
+ __transition = transition;
+ root.tools = tools;
+ }
+
+ // Performs a transition between tools in the toolbar.
+ function __performTransition(transition) {
+ // lazily create containers if they have not been created
+ if (!__currentContainer) {
+ // Parent is bgImage because it doesn't change height when toolbar gets hidden
+ __containerA = containerComponent.createObject(bgImage);
+ __containerB = containerComponent.createObject(bgImage);
+ __currentContainer = __containerB;
+ }
+
+ // no transition if the tools are unchanged
+ if (__currentContainer.tools == tools) {
+ return;
+ }
+
+ // select container states based on the transition animation
+ var transitions = {
+ "set": { "new": "", "old": "hidden" },
+ "push": { "new": "right", "old": "left" },
+ "pop": { "new": "left", "old": "right" },
+ "replace": { "new": "front", "old": "back" }
+ };
+ var animation = transitions[transition];
+
+ // initialize the free container
+ var container = __currentContainer == __containerA ? __containerB : __containerA;
+ container.state = "hidden";
+ if (tools) {
+ container.tools = tools;
+ container.owner = tools.parent;
+ tools.parent = container;
+ tools.visible = true;
+ }
+
+ // perform transition
+ __currentContainer.state = animation["old"];
+ if (tools) {
+ container.state = animation["new"];
+ container.state = "";
+ }
+
+ __currentContainer = container;
+ }
+
+ // Component for toolbar containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The tools held by this container.
+ property Item tools: null
+ // The owner of the tools.
+ property Item owner: null
+
+ states: [
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -30; opacity: 0.0 }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: 30; opacity: 0.0 }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.25; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.85; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ StateChangeScript {
+ script: {
+ if (container.tools) {
+ // re-parent back to original owner
+ tools.visible = false;
+ tools.parent = owner;
+
+ // reset container
+ container.tools = container.owner = null;
+ }
+ }
+ }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "left") state = "hidden"; }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "right") state = "hidden"; }
+ }
+ },
+ Transition {
+ // Replace entry transition.
+ from: "front"; to: "";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ }
+ },
+ Transition {
+ // Replace exit transition.
+ from: ""; to: "back";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ ScriptAction { script: if (state == "back") state = "hidden"; }
+ }
+ }
+ ]
+
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is needed by ToolBarLayout.
+
+var connectedItems = [];
+
+// Find item in an array
+function contains(container, obj) {
+ for (var i = 0 ; i < container.length; i++) {
+ if (container[i] == obj)
+ return true;
+ }
+ return false
+}
+
+// Remove item from an array
+function remove(container, obj)
+{
+ for (var i = 0 ; i < container.length ; i++ )
+ if (container[i] == obj)
+ container.splice(i,1);
+}
+
+// Helper function to give us the sender id on slots
+// This is needed to remove connectens on a reparent
+Function.prototype.bind = function() {
+ var func = this;
+ var thisObject = arguments[0];
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ return func.apply(thisObject, args);
+ }
+}
+
+// Called whenever a child is added or removed in the toolbar
+function childrenChanged() {
+ for (var i = 0; i < children.length; i++) {
+ if (!contains(connectedItems, children[i])) {
+ connectedItems.push(children[i]);
+ children[i].visibleChanged.connect(layout);
+ children[i].parentChanged.connect(cleanup.bind(children[i]));
+ }
+ }
+}
+
+// Disconnects signals connected by this layout
+function cleanup() {
+ remove(connectedItems, this);
+ this.visibleChanged.disconnect(layout);
+ this.parentChanged.disconnect(arguments.callee);
+}
+
+// Main layout function
+function layout() {
+
+ if (parent === null || width === 0)
+ return;
+
+ var i;
+ var items = new Array(); // Keep track of visible items
+ var expandingItems = new Array(); // Keep track of expandingItems for tabs
+ var widthOthers = 0;
+
+ for (i = 0; i < children.length; i++) {
+ if (children[i].visible) {
+ items.push(children[i])
+
+ // Center all items vertically
+ items[0].y = (function() {return height / 2 - items[0].height / 2})
+ // Find out which items are expanding
+ if (children[i].__expanding) {
+ expandingItems.push(children[i])
+ } else {
+ // Calculate the space that fixed size items take
+ widthOthers += children[i].width;
+ }
+ }
+ }
+
+ if (items.length === 0)
+ return;
+
+ // Extra padding is applied if the leftMost or rightmost widget is expanding (note** removed on new design)
+ var leftPadding = 0
+ var rightPadding = 0
+
+ // In LandScape mode we add extra margin to keep contents centered
+ // for two basic cases
+ if (items.length == 2 && screen.currentOrientation == Screen.Landscape) {
+ // expanding item on left
+ if (expandingItems.length > 0 && items[0].__expanding && !items[items.length-1].__expanding)
+ leftPadding += items[items.length-1].width
+
+ // expanding item is on right
+ if (expandingItems.length > 0 && items[items.length-1].__expanding && !items[0].__expanding)
+ rightPadding += items[0].width
+ }
+
+ var width = toolbarLayout.width - leftPadding - rightPadding
+
+ // Calc expandingItems and tabrows
+ for (i = 0; i < expandingItems.length; i++)
+ expandingItems[i].width = (width - widthOthers) / expandingItems.length
+
+ var lastItem = items[items.length-1] ? items[items.length-1] : undefined;
+
+ // Space to be divided between first and last items
+ var toolBox = width - (items[0] ? items[0].width : 0) -
+ (lastItem ? lastItem.width : 0);
+
+ // |X X X| etc.
+ var spacingBetween = toolBox;
+ for (i = 1; i < items.length - 1; i++)
+ spacingBetween -= items[i].width;
+ items[0].x = leftPadding
+
+ // Calculate spacing between items
+ spacingBetween /= items.length - 1;
+
+ // Starting after first item
+ var dX = items[0].width + spacingBetween;
+ for (i = 1; i < items.length; i++) {
+ items[i].x = dX + leftPadding;
+ dX += spacingBetween + items[i].width;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolBarLayout is a container for items on a toolbar that automatically
+// implements an appropriate layout for its children.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "ToolBarLayout.js" as Layout
+
+Item {
+ id: toolbarLayout
+
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ onWidthChanged: Layout.layout()
+ onHeightChanged: Layout.layout()
+ onChildrenChanged: Layout.childrenChanged()
+ Component.onCompleted: Layout.layout()
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-toolbar-" +
+ ((screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape") +
+ __invertedString + "-background"
+
+ property int visibilityTransitionDuration: 250
+ property int contentTransitionDuration: 400
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: toolButton
+
+ //Removes button background if set to true
+ property bool flat: false
+
+ property QtObject platformStyle: ToolButtonStyle { backgroundVisible: !toolButton.flat}
+
+ //Deprecated item, REMOVE THIS
+ property QtObject style: toolButton.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ default property alias children: row.children
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ Row{
+ id: row
+ width: Math.min(parent.width, childrenRect.width)
+ spacing: UI.PADDING_LARGE
+ anchors.centerIn: parent
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 186
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 22
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 15
+ backgroundMarginLeft: 15
+ backgroundMarginTop: 15
+ backgroundMarginBottom: 15
+ property bool backgroundVisible: true
+
+ background: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background" : ""
+ pressedBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-pressed" : ""
+ disabledBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-disabled" : ""
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ property url iconSource
+ property string platformIconId
+
+ // TODO: deprecated
+ property alias iconId: root.platformIconId
+ width: 80; height: 64
+ signal clicked
+
+ // Styling for the ToolItem
+ property Style platformStyle: ToolItemStyle{}
+
+ // TODO: deprecated
+ property Style style: root.platformStyle
+
+ Image {
+ source: mouseArea.pressed ? platformStyle.pressedBackground : ""
+ anchors.centerIn: parent
+
+ Image {
+ function handleIconSource(iconId) {
+ if (iconSource != "")
+ return iconSource;
+
+ var prefix = "icon-m-"
+ // check if id starts with prefix and use it as is
+ // otherwise append prefix and use the inverted version if required
+ if (iconId.indexOf(prefix) !== 0)
+ iconId = prefix.concat(iconId).concat(theme.inverted ? "-white" : "");
+ return "image://theme/" + iconId;
+ }
+
+ source: handleIconSource(iconId)
+ anchors.centerIn: parent
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+ToolIcon {
+ Component.onCompleted: {
+ print("Warning: ToolItem is deprecated, use ToolIcon instead")
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url pressedBackground: "image://theme/meegotouch-button-navigationbar-button"+__invertedString+"-background-pressed"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+var FONT_FAMILY = "Nokia Pure Text";
+var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
+var FONT_DEFAULT_SIZE = 24; // DEPRECATED
+
+var FONT_XLARGE = 32;
+var FONT_LARGE = 28;
+var FONT_SLARGE = 26;
+var FONT_DEFAULT = 24;
+var FONT_LSMALL = 22;
+var FONT_SMALL = 20;
+var FONT_XSMALL = 18;
+var FONT_XXSMALL = 16;
+
+var COLOR_FOREGROUND = "#191919"; // Text color
+var COLOR_SECONDARY_FOREGROUND = "#a6a8ab"; // Secondary text
+var COLOR_BACKGROUND = "#E0E1E2"; // Background
+var COLOR_SELECT = "#4591ff"; //Selected item background
+
+var COLOR_INVERTED_FOREGROUND = "#ffffff"; // Text color
+var COLOR_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Secondary text
+var COLOR_INVERTED_BACKGROUND = "#000000"; // Background
+
+var COLOR_DISABLED_FOREGROUND = "#b2b2b4";
+
+var COLOR_BUTTON_FOREGROUND = "#000000" //text color
+var COLOR_BUTTON_INVERTED_FOREGROUND = "#ffffff" //inverted text color
+var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c" //secondary text
+var COLOR_BUTTON_DISABLED_FOREGROUND = "#B2B2B4" //disabled text
+var COLOR_BUTTON_BACKGROUND = "#000000" //background
+
+var SIZE_ICON_DEFAULT = 32;
+var SIZE_ICON_LARGE = 48;
+
+var CORNER_MARGINS = 22;
+
+var MARGIN_DEFAULT = 0;
+var MARGIN_XLARGE = 16;
+
+// Distance in pixels from the widget bounding box inside which a release
+// event would still be accepted and trigger the widget
+var RELEASE_MISS_DELTA = 30;
+
+var OPACITY_ENABLED = 1.0;
+var OPACITY_DISABLED = 0.5;
+var SIZE_BUTTON = 64;
+
+var PADDING_XSMALL = 2;
+var PADDING_SMALL = 4;
+var PADDING_MEDIUM = 6;
+var PADDING_LARGE = 8;
+var PADDING_DOUBLE = 12;
+var PADDING_XLARGE = 16;
+var PADDING_XXLARGE = 24;
+
+var SCROLLDECORATOR_SHORT_MARGIN = 8;
+var SCROLLDECORATOR_LONG_MARGIN = 4;
+
+var TOUCH_EXPANSION_MARGIN = -12;
+
+var BUTTON_WIDTH = 322;
+var BUTTON_HEIGHT = 51;
+var BUTTON_LABEL_MARGIN = 10;
+
+var FIELD_DEFAULT_HEIGHT = 52;
+
+//Common UI layouts
+var DEFAULT_MARGIN = 16;
+var BUTTON_SPACING = 6;
+var HEADER_DEFAULT_HEIGHT_PORTRAIT = 72;
+var HEADER_DEFAULT_HEIGHT_LANDSCAPE = 46;
+var HEADER_DEFAULT_TOP_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_BOTTOM_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_TOP_SPACING_LANDSCAPE = 16;
+var HEADER_DEFAULT_BOTTOM_SPACING_LANDSCAPE = 14;
+var LIST_ITEM_HEIGHT_SMALL = 64;
+var LIST_ITEM_HEIGHT_DEFAULT = 80;
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+/*
+ Get the first flickable in hierarchy.
+*/
+function findFlickable(item)
+{
+ var next = item;
+
+ while (next) {
+ if (next.flicking !== undefined && next.flickableDirection !== undefined)
+ return next;
+
+ next = next.parent;
+ }
+
+ return null;
+}
+
+/*
+ Get the root item given an element and root item's name.
+ If root item name is not given, default is 'windowContent'.
+*/
+function findRootItem(item, objectName)
+{
+ var next = item;
+
+ var rootItemName = "windowContent";
+ if (typeof(objectName) != 'undefined') {
+ rootItemName = objectName;
+ }
+
+ if (next) {
+ while (next.parent) {
+ next = next.parent;
+
+ if (rootItemName == next.objectName) {
+ break;
+ }
+ }
+ }
+
+ return next;
+}
+
+/*
+ Get the root item for Notification banner
+ It will return 'appWindowContent' or 'windowContent' element if found.
+*/
+function findRootItemNotificationBanner(item)
+{
+ var next = item;
+
+ if (next) {
+ while (next.parent) {
+ if (next.objectName == "appWindowContent")
+ break;
+
+ if (next.objectName == "windowContent")
+ break;
+
+ next = next.parent;
+ }
+ }
+
+ return next;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: screen.displayWidth
+ height: screen.displayHeight
+
+ property alias color: background.color
+
+ default property alias content: windowContent.data
+
+ // Read only property true if window is in portrait
+ property alias inPortrait: window.portrait
+
+ signal orientationChangeAboutToStart
+ signal orientationChangeStarted
+ signal orientationChangeFinished
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "black"
+ }
+
+ Item {
+ id: window
+ property bool portrait
+
+ width: window.portrait ? screen.displayHeight : screen.displayWidth
+ height: window.portrait ? screen.displayWidth : screen.displayHeight
+
+ anchors.centerIn : parent
+ transform: Rotation { id: windowRotation;
+ origin.x: 0;
+ origin.y: 0;
+ angle: 0
+ }
+
+ Item {
+ id: windowContent
+ width: parent.width
+ height: parent.height - heightDelta
+
+ // Used for resizing windowContent when virtual keyboard appears
+ property int heightDelta: 0
+
+ objectName: "windowContent"
+ clip: true
+
+ Connections {
+ id: inputContextConnection
+ target: inputContext
+ onSoftwareInputPanelVisibleChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ onSoftwareInputPanelRectChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ function updateWindowContentHeightDelta() {
+ if(inputContext.customSoftwareInputPanelVisible)
+ return
+
+ if (root.inPortrait)
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.width
+ else
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.height
+ }
+ }
+ }
+
+ SoftwareInputPanel {
+ id: softwareInputPanel
+ active: inputContext.customSoftwareInputPanelVisible
+ anchors.bottom: parent.bottom
+
+ onHeightChanged: {
+ windowContent.heightDelta = height
+ }
+
+ Loader {
+ id: softwareInputPanelLoader
+ width: parent.width
+ sourceComponent: inputContext.customSoftwareInputPanelComponent
+ }
+ }
+
+ Snapshot {
+ id: snapshot
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: screen.displayWidth
+ height: screen.displayHeight
+ snapshotWidth: screen.displayWidth
+ snapshotHeight: screen.displayHeight
+ opacity: 0
+ transform: Rotation { id: snapshotRotation;
+ origin.x: screen.displayHeight / 2; origin.y: screen.displayHeight / 2;
+ angle: 0 }
+ }
+
+ state: screen.orientationString
+
+ states: [
+ State {
+ name: "Landscape"
+ PropertyChanges { target: window; rotation: 0; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "Portrait"
+ PropertyChanges { target: window; rotation: 270; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "LandscapeInverted"
+ PropertyChanges { target: window; rotation: 180; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 374; anchors.topMargin: 0 }
+ },
+ State {
+ name: "PortraitInverted"
+ PropertyChanges { target: window; rotation: 90; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 374 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ // use this transition when sip is visible
+ from: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ to: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ PropertyAction { target: window; properties: "rotation"; }
+ ScriptAction {
+ script: {
+ root.orientationChangeAboutToStart();
+ platformWindow.startSipOrientationChange(window.rotation);
+ // note : we should really connect these signals to MInputMethodState
+ // signals so that they are emitted at the appropriate time
+ // but there aren't any
+ root.orientationChangeStarted();
+ root.orientationChangeFinished();
+ }
+ }
+ },
+ Transition {
+ // use this transition when sip is not visible
+ from: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ to: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ SequentialAnimation {
+ alwaysRunToEnd: true
+
+ ScriptAction {
+ script: {
+ snapshot.take();
+ snapshot.opacity = 1.0;
+ snapshotRotation.angle = -window.rotation;
+ snapshot.smooth = false; // Quick & coarse rotation consistent with MTF
+ platformWindow.animating = true;
+ root.orientationChangeAboutToStart();
+ }
+ }
+ PropertyAction { target: window; properties: "portrait"; }
+ ScriptAction {
+ script: {
+ windowContent.opacity = 0.0;
+ root.orientationChangeStarted();
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { target: windowContent; property: "opacity";
+ to: 1.0; easing.type: Easing.InOutExpo; duration: 600; }
+ NumberAnimation { target: snapshot; property: "opacity";
+ to: 0.0; easing.type: Easing.InOutExpo; duration: 600; }
+ PropertyAction { target: windowRotation; properties: "origin.x"; }
+ PropertyAction { target: windowRotation; properties: "origin.y"; }
+ RotationAnimation { target: windowRotation; property: "angle";
+ from: -screen.rotationDirection * 90;
+ to: 0;
+ direction: RotationAnimation.Shortest;
+ easing.type: Easing.InOutExpo; duration: 600; }
+ }
+ ScriptAction {
+ script: {
+ windowRotation.angle = 0
+ snapshot.free();
+ root.orientationChangeFinished();
+ platformWindow.animating = false;
+ }
+ }
+ }
+ }
+ ]
+
+ focus: true
+ Keys.onReleased: {
+ if (event.key == Qt.Key_I && event.modifiers == Qt.AltModifier) {
+ theme.inverted = !theme.inverted;
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.AltModifier) {
+ if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.Landscape;
+ }
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.ControlModifier ) {
+ if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.Landscape;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+
+/*
+ Class: CountBubble
+ CountBubble component is a flexible shape that holds a number and can be added in lists or
+ notification banners for example.
+*/
+
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: largeSized
+ * [bool=false] Use small or large count bubble.
+ */
+ property bool largeSized: false
+
+ /*
+ * Property: value
+ * [int=0] Reflects the current value.
+ */
+ property int value: 0
+
+ implicitWidth: internal.getBubbleWidth()
+ implicitHeight: largeSized ? 32:24
+
+ BorderImage {
+ source: "image://theme/" + theme.colorString + "meegotouch-countbubble-background"+(largeSized ? "-large":"")
+ anchors.fill: parent
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ }
+
+ Text {
+ id: text
+ height: parent.height
+ y:1
+ color: largeSized ? "#FFFFFF" : "black"
+ font.family: C.FONT_FAMILY
+ anchors.horizontalCenter: parent.horizontalCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: largeSized ? 22:18
+ text: root.value
+ }
+
+ QtObject {
+ id: internal
+
+ function getBubbleWidth() {
+ if (largeSized) {
+ if (root.value < 10)
+ return 32;
+ else if (root.value < 100)
+ return 40;
+ else if (root.value < 1000)
+ return 52;
+ else
+ return text.paintedWidth+19
+ } else {
+ if (root.value < 10)
+ return 24;
+ else if (root.value < 100)
+ return 30;
+ else if (root.value < 1000)
+ return 40;
+ else
+ return text.paintedWidth+13
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+import "TumblerIndexHelper.js" as TH
+
+/*
+ Class: DatePickerDialog
+ Dialog that shows a date picker.
+*/
+
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: year
+ * [int] The displayed year.
+ */
+ property int year: dateTime.currentYear()
+
+ /*
+ * Property: month
+ * [int] The displayed month.
+ */
+ property int month: 1
+
+ /*
+ * Property: day
+ * [int] The displayed day.
+ */
+ property int day: 1
+
+ /*
+ * Property: minimumYear
+ * [int] Optional, the minimum year shown on the tumbler. This property should
+ * only be set once during construction. If the value is not specified,
+ * it is default to current year - 1.
+ */
+ property int minimumYear: dateTime.currentYear() - 1
+
+ /*
+ * Property: maximumYear
+ * [int] Optional, the maximum year shown on the tumbler. This property should
+ * only be set once during construction. If the value is not specified,
+ * it is default to current year + 20.
+ */
+ property int maximumYear: dateTime.currentYear() + 20
+
+ /*
+ * Property: acceptButtonText
+ * [string] Optional, the button text for the accept button.
+ */
+ property alias acceptButtonText: confirmButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] Optional, the button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "title"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ id: dialogContent
+ height: 300
+ width: parent.width
+
+ Tumbler {
+ id: tumbler
+
+ function _handleTumblerChanges(index) {
+ if (index == 1 || index == 2) {
+ var curYear = yearColumn.selectedIndex + yearList.get(0).value;
+ var curMonth = monthColumn.selectedIndex + 1;
+
+ var d = dateTime.daysInMonth(curYear, curMonth);
+ if (dayColumn.selectedIndex >= d)
+ dayColumn.selectedIndex = d - 1
+ while (dayList.count > d)
+ dayList.remove(dayList.count - 1)
+ while (dayList.count < d)
+ dayList.append({"value" : dayList.count + 1})
+ }
+ }
+
+ columns: [dayColumn, monthColumn, yearColumn]
+ onChanged: {
+ _handleTumblerChanges(index);
+ }
+ height: 300
+ privateDelayInit: true
+
+ TumblerColumn {
+ id: dayColumn
+ items: ListModel {
+ id: dayList
+ }
+ label: "DAY"
+ selectedIndex: root.day - (root.day > 0 ? 1 : 0)
+ }
+
+ TumblerColumn {
+ id: monthColumn
+ items: ListModel {
+ id: monthList
+ }
+ label: "MONTH"
+ selectedIndex: root.month - (root.month > 0 ? 1 : 0)
+ }
+
+ TumblerColumn {
+ id: yearColumn
+ items: ListModel {
+ id: yearList
+ }
+ label: "YEAR"
+ selectedIndex: yearList.length > 0 ? internal.year - yearList.get(0).value : 0
+ }
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: confirmButton
+ text: "CONFIRM"
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ Button {
+ id: rejectButton
+ text: "CANCEL"
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ platformStyle: ButtonStyle { inverted: true }
+ }
+ }
+ onMinimumYearChanged: {
+ if (!internal.surpassUpdate) {
+ internal.year = root.year
+ internal.minYear = root.minimumYear
+
+ if (internal.minYear < 0)
+ internal.minYear = dateTime.currentYear() - 1;
+ else if (internal.minYear > root.maximumYear)
+ internal.minYear = root.maximumYear;
+
+ internal.updateYearList()
+ internal.validateDate()
+ internal.year = internal.year < internal.minYear ? internal.minYear :
+ (internal.year > root.maximumYear ? root.maximumYear :internal.year)
+ }
+ }
+ onMaximumYearChanged: {
+ internal.minYear = root.minimumYear
+
+ if (root.maximumYear < 0)
+ root.maximumYear = dateTime.currentYear() + 20;
+ else if (root.maximumYear < internal.minYear)
+ root.maximumYear = internal.minYear;
+
+ internal.updateYearList()
+ internal.validateDate()
+ internal.year = internal.year > root.maximumYear ? root.maximumYear :
+ (internal.year < internal.minYear ? internal.minYear : internal.year)
+ if (internal.minYear < 0)
+ root.minimumYear = dateTime.currentYear() - 1
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ TH.saveIndex(tumbler);
+ if (!internal.initialized)
+ internal.initializeDataModels();
+ if (internal.year > 0)
+ yearColumn.selectedIndex = internal.year - yearList.get(0).value;
+ tumbler._handleTumblerChanges(2);
+ dayColumn.selectedIndex = root.day - 1;
+ }
+ if (status == DialogStatus.Closing) {
+ internal.surpassUpdate = true
+ if (internal.surpassUpdate) {
+ root.year = internal.year
+ root.minimumYear = internal.minYear
+ }
+ internal.surpassUpdate = false
+ }
+ }
+ onDayChanged: {
+ internal.validateDate()
+ if (dayColumn.items.length > root.day - 1)
+ dayColumn.selectedIndex = root.day - 1
+ }
+ onMonthChanged: {
+ internal.validateDate()
+ monthColumn.selectedIndex = root.month - 1
+ }
+ onYearChanged: {
+ if (!internal.surpassUpdate) {
+ internal.year = root.year
+ internal.validateDate()
+ internal.year = internal.year < internal.minYear ? internal.minYear :
+ (internal.year > root.maximumYear ? root.maximumYear : internal.year)
+
+ if (internal.initialized)
+ yearColumn.selectedIndex = internal.year - yearList.get(0).value
+ }
+ }
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ root.year = yearColumn.selectedIndex + yearList.get(0).value;
+ root.month = monthColumn.selectedIndex + 1;
+ root.day = dayColumn.selectedIndex + 1;
+ }
+ onRejected: {
+ TH.restoreIndex(tumbler);
+ }
+
+ QtObject {
+ id: internal
+
+ property variant initialized: false
+ property int year
+ property int minYear
+ property bool surpassUpdate: false
+
+ function initializeDataModels() {
+ var currentYear = new Date().getFullYear();
+ minimumYear = minimumYear ? minimumYear : currentYear - 1;
+ maximumYear = maximumYear ? maximumYear : currentYear + 20;
+
+ for (var y = minimumYear; y <= maximumYear; ++y)
+ yearList.append({"value" : y}) // year
+
+ var nDays = dateTime.daysInMonth(internal.year, root.month);
+ for (var d = 1; d <= nDays; ++d)
+ dayList.append({"value" : d}) // day
+ for (var m = 1; m <= 12; ++m)
+ monthList.append({"value" : dateTime.shortMonthName(m)});
+
+ tumbler.privateInitialize();
+ internal.initialized = true;
+ }
+
+ function updateYearList() {
+ if (internal.initialized) {
+ var tmp = yearColumn.selectedIndex;
+ yearList.clear();
+ for (var i = internal.minYear; i <= root.maximumYear; ++i)
+ yearList.append({"value" : i})
+ if (tmp < yearList.count) {
+ yearColumn.selectedIndex = 0;
+ yearColumn.selectedIndex = tmp;
+ }
+ }
+ }
+
+ function validateDate() {
+ if (internal.year < 1){
+ internal.year = new Date().getFullYear()
+ if (maximumYear < internal.year)
+ root.maximumYear = dateTime.currentYear() + 20;
+ if (minimumYear > internal.year)
+ internal.minYear = dateTime.currentYear() - 1;
+ }
+
+ root.month = Math.max(1, Math.min(12, root.month))
+ var d = dateTime.daysInMonth(internal.year, root.month);
+ root.day = Math.max(1, Math.min(d, root.day))
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+/*
+ Class: InfoBanner
+ The InfoBanner component is used to display information to the user. The number of lines of text
+ shouldn't exceed 3.
+*/
+
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: iconSource
+ * [url] The path to the icon image
+ */
+ property url iconSource: ""
+
+ /*
+ * Property: text
+ * [string] Text to be displayed in InfoBanner
+ */
+ property alias text: text.text
+
+ /*
+ * Property: timerEnabled
+ * [bool=true] Enable/disable timer that dismisses InfoBanner
+ */
+ property bool timerEnabled: true
+
+ /*
+ * Property: timerShowTime
+ * [int=3000ms] For setting how long InfoBanner stays visible to user before being dismissed
+ */
+ property alias timerShowTime: sysBannerTimer.interval
+
+ /*
+ * Property: topMargin
+ * [int=8 pix] Allows user to customize top margin if needed
+ */
+ property alias topMargin: root.y
+
+ /*
+ * Property: leftMargin
+ * [int=8 pix] Allows user to customize left margin if needed
+ */
+ property alias leftMargin: root.x
+
+ /*
+ * Function: show
+ * Show InfoBanner
+ */
+ function show() {
+ animationShow.running = true;
+ if (root.timerEnabled)
+ sysBannerTimer.restart();
+ }
+
+ /*
+ * Function: hide
+ * Hide InfoBanner
+ */
+ function hide() {
+ animationHide.running = true;
+ }
+
+ implicitHeight: internal.getBannerHeight()
+ implicitWidth: internal.getBannerWidth()
+ x:8; y:8
+ scale: 0
+
+ BorderImage {
+ source: "image://theme/meegotouch-notification-system-background"
+ anchors.fill: root
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ opacity: UI.INFO_BANNER_OPACITY
+ }
+
+ Image {
+ id: image
+ anchors { left: parent.left; leftMargin: 16; top: parent.top; topMargin: 16 }
+ source: root.iconSource
+ visible: root.iconSource != ""
+ }
+
+ Text {
+ id: text
+ width: internal.getTextWidth()
+ anchors { left: (image.visible ? image.right : parent.left); leftMargin: (image.visible ? 14:16);
+ top: parent.top; topMargin: internal.getTopMargin(); bottom: parent.bottom }
+ color: "white"
+ wrapMode: Text.Wrap
+ verticalAlignment: Text.AlignHCenter
+ font.pixelSize: UI.FONT_DEFAULT_SIZE
+ font.family: UI.FONT_FAMILY
+ font.letterSpacing: UI.INFO_BANNER_LETTER_SPACING
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ }
+
+ QtObject {
+ id: internal
+
+ function getBannerHeight() {
+ if (image.visible) {
+ if (text.lineCount <= 2)
+ return 80;
+ else
+ return 106;
+ } else {
+ if (text.lineCount <= 1)
+ return 64;
+ else if (text.lineCount <= 2)
+ return 80;
+ else
+ return 106;
+ }
+ }
+
+ function getBannerWidth() {
+ return parent.width - root.x*2;
+ }
+
+ function getTopMargin() {
+ if (text.lineCount <= 1 && !image.visible) {
+ // If there's only one line of text and no icon image, top and bottom margins are equal.
+ return (root.height-text.paintedHeight)/2;
+ } else {
+ // In all other cases, top margin is 4 px more than bottom margin.
+ return (root.height-text.paintedHeight)/2 + 2;
+ }
+ }
+
+ function getTextWidth() {
+ // 46(32 when there's no icon) is sum of all margins within banner. root.x*2 is sum of margins outside banner.
+ // Text element width is dertermined by substracting parent width(screen width) by all the margins and
+ // icon width(if applicable).
+ return image.visible ? (parent.width-root.x*2-46-image.width) : (parent.width-root.x*2-32);
+ }
+
+ function getScaleValue() {
+ // When banner is displayed, as part of transition effect, it'll first be enlarged to the point where its width
+ // is equal to screen width. root.x*2/root.width calculates the amount of expanding required, where root.x*2 is
+ // equal to screen.displayWidth minus banner.width
+ return root.x*2/root.width + 1;
+ }
+ }
+
+ Timer {
+ id: sysBannerTimer
+ repeat: false
+ running: false
+ interval: 3000
+ onTriggered: hide()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide()
+ }
+
+ SequentialAnimation {
+ id: animationShow
+ NumberAnimation { target: root; property: "scale"; from: 0; to: internal.getScaleValue(); duration: 200; easing.type: Easing.OutQuad}
+ NumberAnimation { target: root; property: "scale"; from: internal.getScaleValue(); to: 1; duration: 200 }
+ }
+
+ NumberAnimation {
+ id: animationHide
+ target: root; property: "scale"; to: 0; duration: 200; easing.type: Easing.InExpo
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+import "." 1.0
+import "../meego/UIConstants.js" as UI
+import com.nokia.meego 1.0
+
+Item {
+ id: button
+
+ // Common public API
+ property bool checked: false
+ property bool checkable: false
+ property alias pressed: mouseArea.pressed
+ property alias text: label.text
+ property url iconSource
+
+ signal clicked
+
+ // Used in ButtonGroup.js to set the segmented look on the buttons.
+ property string __buttonType
+
+ // Styling for the Button
+ property Style platformStyle: ButtonStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: button.platformStyle
+
+ implicitWidth: iconAndLabel.prefferedWidth
+ implicitHeight: platformStyle.buttonHeight
+
+ property alias font: label.font
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+
+ border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+ right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+ source: !enabled ?
+ (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+ pressed ?
+ button.platformStyle.pressedBackground :
+ checked ?
+ button.platformStyle.checkedBackground :
+ button.platformStyle.background;
+ }
+
+ Item {
+ id: iconAndLabel
+ property real xMargins: icon.visible ? (UI.PADDING_XLARGE * (label.visible ? 3 : 2)) : (UI.BUTTON_LABEL_MARGIN * 2)
+ property real prefferedWidth: xMargins + (icon.visible ? icon.width : 0) + (label.visible ? label.prefferedSize.width : 0)
+
+ width: xMargins + (icon.visible ? icon.width : 0) + (label.visible? label.width : 0)
+ height: platformStyle.buttonHeight
+
+ anchors.verticalCenter: button.verticalCenter
+ anchors.horizontalCenter: button.horizontalCenter
+ anchors.verticalCenterOffset: -1
+
+ Image {
+ id: icon
+ source: button.iconSource
+ x: UI.PADDING_XLARGE
+ anchors.verticalCenter: iconAndLabel.verticalCenter
+ width: UI.SIZE_ICON_DEFAULT
+ height: UI.SIZE_ICON_DEFAULT
+ visible: source != ""
+ }
+
+ Label {
+ id: label
+ x: icon.visible ? (icon.x + icon.width + UI.PADDING_XLARGE) : UI.BUTTON_LABEL_MARGIN
+ anchors.verticalCenter: iconAndLabel.verticalCenter
+ anchors.verticalCenterOffset: 1
+
+ property real availableWidth: button.width - iconAndLabel.xMargins - (icon.visible ? icon.width : 0)
+ width: Math.min(prefferedSize.width, availableWidth)
+
+ elide: Text.ElideRight
+ font.family: button.platformStyle.fontFamily
+ font.weight: button.platformStyle.fontWeight
+ font.pixelSize: button.platformStyle.fontPixelSize
+ font.capitalization: button.platformStyle.fontCapitalization
+ color: !enabled ? button.platformStyle.disabledTextColor :
+ pressed ? button.platformStyle.pressedTextColor :
+ checked ? button.platformStyle.checkedTextColor :
+ button.platformStyle.textColor;
+ text: ""
+ visible: text != ""
+
+ Label {
+ id: prefferedSize
+ font: parent.font
+ text: parent.text
+ visible: false
+ }
+ property alias prefferedSize: prefferedSize
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+
+ onClicked: {
+ if (button.checkable)
+ button.checked = !button.checked;
+ button.clicked();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ buttonHeight: UI.SIZE_SMALL_BUTTON
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+Item {
+ id: listItem
+
+ signal clicked
+ property alias pressed: mouseArea.pressed
+
+ property int titleSize: UI.LIST_TILE_SIZE
+ property int titleWeight: Font.Bold
+ property string titleFont: UI.FONT_FAMILY
+ property color titleColor: theme.inverted ? UI.LIST_TITLE_COLOR_INVERTED : UI.LIST_TITLE_COLOR
+ property color titleColorPressed: theme.inverted ? UI.LIST_TITLE_COLOR_PRESSED_INVERTED : UI.LIST_TITLE_COLOR_PRESSED
+
+ property int subtitleSize: UI.LIST_SUBTILE_SIZE
+ property int subtitleWeight: Font.Normal
+ property string subtitleFont: UI.FONT_FAMILY_LIGHT
+ property color subtitleColor: theme.inverted ? UI.LIST_SUBTITLE_COLOR_INVERTED : UI.LIST_SUBTITLE_COLOR
+ property color subtitleColorPressed: theme.inverted ? UI.LIST_SUBTITLE_COLOR_PRESSED_INVERTED : UI.LIST_SUBTITLE_COLOR_PRESSED
+
+ height: UI.LIST_ITEM_HEIGHT
+ width: parent.width
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ // Fill page porders
+ anchors.leftMargin: -UI.MARGIN_XLARGE
+ anchors.rightMargin: -UI.MARGIN_XLARGE
+ visible: mouseArea.pressed
+ source: theme.inverted ? "image://theme/meegotouch-panel-inverted-background-pressed" : "image://theme/meegotouch-panel-background-pressed"
+ }
+
+ Row {
+ anchors.fill: parent
+ spacing: UI.LIST_ITEM_SPACING
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: model.iconSource ? true : false
+ width: UI.LIST_ICON_SIZE
+ height: UI.LIST_ICON_SIZE
+ source: model.iconSource ? model.iconSource : ""
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+
+ Label {
+ id: mainText
+ text: model.title
+ font.family: listItem.titleFont
+ font.weight: listItem.titleWeight
+ font.pixelSize: listItem.titleSize
+ color: mouseArea.pressed ? listItem.titleColorPressed : listItem.titleColor
+ }
+
+ Label {
+ id: subText
+ text: model.subtitle ? model.subtitle : ""
+ font.family: listItem.subtitleFont
+ font.weight: listItem.subtitleWeight
+ font.pixelSize: listItem.subtitleSize
+ color: mouseArea.pressed ? listItem.subtitleColorPressed : listItem.subtitleColor
+
+ visible: text != ""
+ }
+ }
+ }
+ MouseArea {
+ id: mouseArea;
+ anchors.fill: parent
+ onClicked: {
+ listItem.clicked();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0 // needed for the custom image loader
+
+/*
+ Class: MoreIndicator
+ Component to indicate that more content is available for the user.
+
+ A more indicator is a component that displayes an arrow to show the user that there are more contents
+ available.
+*/
+
+Image {
+ source: !theme.inverted ?
+ "image://theme/icon-m-common-drilldown-arrow" :
+ "image://theme/icon-m-common-drilldown-arrow-inverse"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND
+ checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button-negative-background"
+ pressedBackground: "image://theme/meegotouch-button-negative-background-pressed"
+ disabledBackground: "image://theme/meegotouch-button-negative-background-disabled"
+ checkedBackground: "image://theme/meegotouch-button-negative-background-selected"
+ checkedDisabledBackground: "image://theme/meegotouch-button-negative-background-disabled-selected"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+Rectangle {
+ id: root
+
+ // Common public API
+
+ // Input. Set to true if user is signed in to Nokia account.
+ // Account email using agreement is shown if user is signed in.
+ // Otherwise email input box is shown instead.
+ property bool isSignedIn: false
+
+ // Input. Array of localised UI strings:
+ // header - 'Tell us what you think'
+ // question - 'How likely ... ?'
+ // notLikely - 'Not at all\nlikely'
+ // extremelyLikely - 'Extremely\nlikely'
+ // selectScore - 'You must select ...'
+ // commentsInputLabel - 'Please tell us why ...'
+ // contactAgreement - 'You can contact me using ...'
+ // emailInputLabel - 'You can contact me for details...'
+ // emailPlaceholderText - 'Your email address'
+ // emailSipActionKeyLabel - 'Done'
+ // invalidEmail - 'Invalid email address'
+ // legalText - 'Your information will be ...'
+ // submit - 'Submit'
+
+ property variant uiString: QtObject {}
+
+ // Input. Array of horizontal alignments for strings. Accept same
+ // values as Text { horizontalAlignment: ... } e.g. Text.AlignLeft, Text.AlignRight and so on.
+ // By default all text strings aligned to the left.
+ // header
+ // question
+ // selectScore
+ // commentsInputLabel
+ // contactAgreement
+ // emailInputLabel
+ // invalidEmail
+ // legalText
+
+ property variant uiHorizontalAlignment: QtObject {}
+
+ // Promoter score, between 0 ~ 10
+ property alias score: scoreSlider.value
+
+ // True if user touched score slider
+ property alias scoreTouched: scoreSlider.touched
+
+ // Optional comments text
+ property alias comments: commentsText.text
+
+ // Optional email address
+ // emailAddress shall be ignored if isSignedIn is true.
+ property alias emailAddress: emailAddressField.text
+
+ // True if user agrees to be contacted using Nokia Account email address.
+ // useEmail shall be ignored if isSignedIn is false.
+ property alias useEmail: useEmailCheckBox.checked
+
+ // Signal emitted when 'Submit' button is clicked and form passes validation.
+ signal submit()
+
+ height: childrenRect.height
+ color: "#E0E1E2"
+
+ QtObject {
+ id: internal
+
+ property variant defaultValidator: RegExpValidator{regExp: /.*/}
+ property variant emailValidator: RegExpValidator{regExp: /^\w([a-zA-Z0-9._-]+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/}
+
+ function validateForm() {
+
+ var isValid = true;
+
+ if (!scoreSlider.touched) {
+ sliderErrorLabel.visible = true;
+ isValid = false;
+ }
+
+ if (emailAddress && emailAddress.length > 0) {
+ var validator = internal.emailValidator
+ emailAddressField.validator = validator;
+ var result = emailAddressField.acceptableInput;
+ if (result)emailAddressField.validator = internal.defaultValidator;
+ mouseArea.enabled = !result;
+ invalidEmailLabel.visible = !result;
+ if (!result)isValid = false;
+ }
+
+ return isValid;
+ }
+ }
+
+ Column {
+ id: formContent
+
+ anchors {
+ left: parent.left
+ leftMargin: 16
+ right: parent.right
+ rightMargin: 16
+ }
+ height: childrenRect.height
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Label {
+ id: header
+
+ anchors {
+ left: parent.left
+ leftMargin: 18 - parent.anchors.leftMargin
+ right: parent.right
+ }
+
+ wrapMode: Text.Wrap
+ font.pixelSize: 40
+ color: "#282828"
+ horizontalAlignment: uiHorizontalAlignment.header || Text.AlignLeft
+ text: uiString.header ||
+ "!!Tell us what you think"
+ }
+
+ Item {
+ width: parent.width
+ height: 12
+ }
+
+ // Question
+ Label {
+ width: parent.width
+ wrapMode: Text.Wrap
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: uiHorizontalAlignment.question || Text.AlignLeft
+ text: uiString.question ||
+ "!!How likely are you to recommend this app to a friend or a colleague?"
+ }
+
+ Item {
+ width: parent.width
+ height: 22
+ }
+
+ // Numbers
+ Row {
+ width: parent.width
+ height: childrenRect.height
+
+ Label {
+ width: parent.width/2
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: Text.AlignLeft
+ text: "0"
+ }
+ Label {
+ width: parent.width/2
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: Text.AlignRight
+ text: "10"
+ }
+ }
+
+ Slider {
+ id: scoreSlider
+ objectName: "slider_nps_score"
+
+ property bool touched: false
+ width: parent.width
+ height: 64
+ maximumValue: 10
+ stepSize: 1
+ value: 5
+ valueIndicatorVisible: true
+
+ onPressedChanged: {
+ if (pressed) {
+ sliderErrorLabel.visible = false;
+ touched = true;
+ }
+ }
+ }
+
+ // Slider text
+ Row {
+ width: parent.width
+ height: childrenRect.height
+
+ Label {
+ width: parent.width/3
+ font.pixelSize: 18
+ color: "#282828"
+ horizontalAlignment: Text.AlignLeft
+ text: uiString.notLikely || "!!Not at all \nlikely"
+ }
+
+ Item {
+ width: parent.width/3
+ height: 1
+ }
+
+ Label {
+ width: parent.width/3
+ font.pixelSize: 18
+ color: "#282828"
+ horizontalAlignment: Text.AlignRight
+ text: uiString.extremelyLikely || "!!Extremely \nlikely"
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 8
+ visible: sliderErrorLabel.visible
+ }
+
+ // Slider error text
+ Label {
+ id: sliderErrorLabel
+ visible: false
+ width: parent.width
+ font.pixelSize: 18
+ color: "#FF3200"
+ horizontalAlignment: uiHorizontalAlignment.selectScore || Text.AlignLeft
+ text: uiString.selectScore ||
+ "!!You must select a rating"
+ }
+
+ Item {
+ width: parent.width
+ height: 18
+ }
+
+ Image {
+ width: parent.width + 16
+ x: 8 - parent.anchors.leftMargin
+ source: "image://theme/meegotouch-separator-background-horizontal"
+ fillMode: Image.TileHorizontally
+ }
+
+ Item {
+ width: parent.width
+ height: 7
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.commentsInputLabel || Text.AlignLeft
+ text: uiString.commentsInputLabel ||
+ "!!Please tell us why you gave this score (optional)"
+ }
+
+ SipAttributes {
+ id: sipAttributesDefault
+ }
+
+ // Comments
+ TextArea {
+ id: commentsText
+ width: parent.width
+ height: Math.max(118, implicitHeight)
+ platformSipAttributes: sipAttributesDefault
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Row {
+ visible: isSignedIn
+ width: parent.width
+
+ spacing: 16
+
+ CheckBox {
+ id: useEmailCheckBox
+ objectName: "check_nps_email"
+ anchors {
+ verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Label {
+ id: description
+ anchors {
+ verticalCenter: parent.verticalCenter
+ }
+
+ width: parent.width - useEmailCheckBox.width - parent.spacing
+ font.pixelSize: 22
+ wrapMode: Text.Wrap
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.contactAgreement || Text.AlignLeft
+ text: uiString.contactAgreement ||
+ "!!You can contact me for details using my Nokia Account e-mail."
+ }
+
+ }
+
+ Image {
+ width: parent.width + 16
+ x: 8 - parent.anchors.leftMargin
+ source: "image://theme/meegotouch-separator-background-horizontal"
+ fillMode: Image.TileHorizontally
+ visible: !isSignedIn
+ }
+
+ // Email address
+ Column {
+ id: emailAddressPane
+ width: parent.width
+ visible: !isSignedIn
+
+ Item {
+ width: parent.width
+ height: 7
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.emailInputLabel || Text.AlignLeft
+ text: uiString.emailInputLabel ||
+ "!!You can contact me for details (Optional)"
+ }
+
+ TextField {
+ id: emailAddressField
+ objectName: "input_nps_email"
+ width: parent.width
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
+ placeholderText: uiString.emailPlaceholderText ||
+ "!!Your email address"
+ platformSipAttributes: SipAttributes {
+ actionKeyLabel: uiString.emailSipActionKeyLabel || ""
+ actionKeyHighlighted: !!uiString.emailSipActionKeyLabel
+ }
+
+ Keys.onReturnPressed: {
+ if (internal.validateForm()) {
+ platformCloseSoftwareInputPanel();
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ enabled: false
+ z: 10
+ onClicked: {
+ enabled = false;
+ invalidEmailLabel.visible = false;
+ emailAddressField.forceActiveFocus();
+ emailAddressField.validator = internal.defaultValidator;
+ }
+ }
+
+ onTextChanged: {
+ if (invalidEmailLabel.visible) {
+ invalidEmailLabel.visible = false;
+ emailAddressField.validator = internal.defaultValidator;
+ }
+ }
+ }
+
+ Label {
+ id: invalidEmailLabel
+ visible: false
+ width: parent.width
+ font.pixelSize: 18
+ color: "#FF3200"
+ horizontalAlignment: uiHorizontalAlignment.invalidEmail || Text.AlignLeft
+ text: uiString.invalidEmail ||
+ "!!Invalid email address"
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ wrapMode: Text.Wrap
+ horizontalAlignment: uiHorizontalAlignment.legalText || Text.AlignLeft
+ text: uiString.legalText ||
+ "!!Your information will be treated according to Nokia privacy policy."
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Button {
+ objectName: "btn_nps_submit"
+ width: 322
+
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+
+ text: uiString.submit || "!!Submit"
+
+ onClicked: {
+ if (internal.validateForm()) {
+ submit()
+ }
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+/*
+ Class: PageIndicator
+ Component to indicate the page user is currently viewing.
+
+ A page indicator is a component that shows the number of availabe pages as well as the page the user is
+ currently on. The user can also specify the display type to select the normal/inverted visual.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: totalPages
+ * [int] The total number of pages. This value should be larger than 0.
+ */
+ property int totalPages: 0
+
+ /*
+ * Property: currentPage
+ * [int] The current page the user is on. This value should be larger than 0.
+ */
+ property int currentPage: 0
+
+ /*
+ * Property: inverted
+ * [bool] Specify whether the visual for the rating indicator uses the inverted color. The value is
+ * false for use with a light background and true for use with a dark background.
+ */
+ property bool inverted: theme.inverted
+
+ implicitWidth: currentImage.width * totalPages + (totalPages - 1) * internal.spacing
+ implicitHeight: currentImage.height
+
+ /* private */
+ QtObject {
+ id: internal
+
+ property int spacing: 8
+
+ property string totalPagesImageSource: inverted ?
+ "image://theme/meegotouch-inverted-pageindicator-page" :
+ "image://theme/meegotouch-pageindicator-page"
+ property string currentPageImageSource: inverted ?
+ "image://theme/meegotouch-inverted-pageindicator-page-current" :
+ "image://theme/meegotouch-pageindicator-page-current"
+
+ property bool init: true
+
+
+ function updateUI() {
+
+ if(totalPages <=0) {
+ totalPages = 1;
+ currentPage = 1;
+ } else {
+ if(currentPage <=0)
+ currentPage = 1;
+ if(currentPage > totalPages)
+ currentPage = totalPages;
+ }
+
+ frontRepeater.model = currentPage - 1;
+ backRepeater.model = totalPages - currentPage;
+ }
+ }
+
+ Component.onCompleted: {
+ internal.updateUI();
+ internal.init = false;
+ }
+
+ onTotalPagesChanged: {
+ if(!internal.init)
+ internal.updateUI();
+ }
+
+ onCurrentPageChanged: {
+ if(!internal.init)
+ internal.updateUI();
+ }
+
+ Row {
+ Repeater {
+ id: frontRepeater
+
+ Item {
+ height: currentImage.height
+ width: currentImage.width + internal.spacing
+
+ Image {
+ source: internal.totalPagesImageSource
+ }
+ }
+ }
+
+ Image {
+ id: currentImage
+ source: internal.currentPageImageSource
+ }
+
+ Repeater {
+ id: backRepeater
+
+ Item {
+ height: currentImage.height
+ width: currentImage.width + internal.spacing
+
+ Image {
+ source: internal.totalPagesImageSource
+ anchors.right: parent.right
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND
+ checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button-positive-background"
+ pressedBackground: "image://theme/meegotouch-button-positive-background-pressed"
+ disabledBackground: "image://theme/meegotouch-button-positive-background-disabled"
+ checkedBackground: "image://theme/meegotouch-button-positive-background-selected"
+ checkedDisabledBackground: "image://theme/meegotouch-button-positive-background-disabled-selected"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import Qt.labs.components 1.1 as QtComponents
+
+/*
+ Class: RatingIndicator
+ Component to indicate user specified ratings.
+
+ A rating indicator is a component that shows the rating value within the maximum allowed range according
+ to the user's specification. The user can also specify the display type to select the positive/negative
+ visual. Optionally, the user can also specify a count value that will be displayed next to the images.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: maximumValue
+ * [double] The maximum rating. The number should be larger or equal to 0.
+ */
+ property alias maximumValue: model.maximumValue
+
+ /*
+ * Property: ratingValue
+ * [double] The rating value. The number should be larger or equal to 0.
+ */
+ property alias ratingValue: model.value
+
+ /*
+ * Property: count
+ * [int] A number to be displayed next to the rating images. It is usually used to count the number of
+ * votes cast. It is only displayed if a number larger or equal to 0 is specified.
+ */
+ property int count: -1
+
+ /*
+ * Property: inverted
+ * [string] Specify whether the visual for the rating indicator uses the inverted color. The value is
+ * false for use with a light background and true for use with a dark background.
+ */
+ property bool inverted: theme.inverted
+
+ implicitHeight: Math.max(background.height, text.paintedHeight);
+ implicitWidth: background.width + (count >= 0 ? internal.textSpacing + text.paintedWidth : 0);
+
+ QtComponents.RangeModel {
+ id: model
+ value: 0.0
+ minimumValue: 0.0
+ maximumValue: 0.0
+ }
+
+ QtObject {
+ id: internal
+
+ property int imageWidth: 16
+ property int imageHeight: 16
+ property int indicatorSpacing: 5 // spacing between images
+ property int textSpacing: 8 // spacing between image and text
+ property url backgroundImageSource: inverted ?
+ "image://theme/meegotouch-indicator-rating-inverted-background-star" :
+ "image://theme/meegotouch-indicator-rating-background-star"
+ property url indicatorImageSource: inverted ?
+ "image://theme/meegotouch-indicator-rating-inverted-star" :
+ "image://theme/meegotouch-indicator-rating-star"
+ property string textColor: inverted ? "#fafafa" : "#505050"
+ }
+
+ Image {
+ id: background
+ width: internal.imageWidth * maximumValue + (Math.max(Math.ceil(maximumValue-1), 0)) * internal.indicatorSpacing;
+ height: internal.imageHeight
+ anchors.verticalCenter: height < text.paintedHeight ? text.verticalCenter : undefined
+ fillMode: Image.Tile
+ source: internal.backgroundImageSource
+
+ Image {
+ id: indicator
+ width: internal.imageWidth * ratingValue + Math.max((Math.ceil(ratingValue) - 1), 0) * internal.indicatorSpacing
+ height: internal.imageHeight
+ fillMode: Image.Tile
+ source: internal.indicatorImageSource
+ }
+ }
+
+ Text {
+ id: text
+ visible: count >= 0
+ text: "(" + count + ")"
+ color: internal.textColor
+ font { family: "Nokia Standard Light"; pixelSize: 18 }
+ anchors.left: background.right
+ anchors.leftMargin: internal.textSpacing
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import com.nokia.extras 1.1
+import "constants.js" as UI
+
+InfoBanner
+{
+
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import com.nokia.extras 1.1
+import "constants.js" as C
+import "TumblerIndexHelper.js" as TH
+
+/*
+ Class: TimePickerDialog
+ Dialog that shows a time picker.
+*/
+
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: hour
+ * [int] The displayed hour (in 24h format).
+ */
+ property int hour: 0
+
+ /*
+ * Property: minute
+ * [int] The displayed minute.
+ */
+ property int minute: 0
+
+ /*
+ * Property: second
+ * [int] The displayed second.
+ */
+ property int second: 0
+
+ /*
+ * Property: fields
+ * [int=DateTime.All] Sets if the time picker should show hours, minutes,
+ * and/or seconds.
+ * (DateTime.Hours, DateTime.Minutes,
+ * DateTime.Seconds, DateTime.All)
+ */
+ property int fields: DateTime.All
+
+ /*
+ * Property: hourMode
+ * [int=DateTime.TwentyFourHours] Sets if the time picker should show time in 24-hour clock
+ * or 12-hour clock format.
+ * (DateTime.TwentyFourHours, DateTime.TwelveHours)
+ */
+ property int hourMode: dateTime.hourMode() //DateTime.TwentyFourHours
+
+ /*
+ * Property: mode24Hour
+ * [bool=false] Sets if the time picker should show time in military time (24h).
+ */
+ property bool mode24Hour
+
+ /*
+ * Property: showSeconds
+ * [bool=true] Sets if the time picker should show seconds. Modifying this value
+ * after initialization will uninitialize everything.
+ */
+ property bool showSeconds
+
+ /*
+ * Property: acceptButtonText
+ * [string] Optional, the button text for the accept button.
+ */
+ property alias acceptButtonText: acceptButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] Optional, the button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "title"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ height: 300
+ width: parent.width
+
+ Tumbler {
+ id: tumbler
+
+ columns: [hourColumn, minuteColumn, secondColumn, meridiemColumn]
+ height: 300
+ privateDelayInit: true
+
+ TumblerColumn {
+ id: hourColumn
+ items: ListModel {
+ id: hourList
+ }
+ label: "HR"
+ selectedIndex: root.hour - ((root.hourMode == DateTime.TwelveHours && root.hour > 11) ? 12 : 0)
+ visible: fields & DateTime.Hours
+ }
+
+ TumblerColumn {
+ id: minuteColumn
+ items: ListModel {
+ id: minuteList
+ }
+ label: "MIN"
+ selectedIndex: root.minute
+ visible: fields & DateTime.Minutes
+ }
+
+ TumblerColumn {
+ id: secondColumn
+ items: ListModel {
+ id: secondList
+ }
+ label: "SEC"
+ selectedIndex: root.second
+ visible: fields & DateTime.Seconds
+ }
+
+ TumblerColumn {
+ id: meridiemColumn
+ items: ListModel {
+ id: meridiemList
+ }
+ selectedIndex: root.hour > 11 ? 1: 0
+ visible: root.hourMode == DateTime.TwelveHours
+ privateLoopAround: false
+ }
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: acceptButton
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ Button {
+ id: rejectButton
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ }
+ onMode24HourChanged: {
+ console.log("The property 'mode24Hour' from TimePickerDialog is deprecated. Please use 'hourMode' instead.")
+ root.hourMode = mode24Hour == true ? DateTime.TwentyFourHours : DateTime.TwelveHours
+ }
+ onShowSecondsChanged: {
+ console.log("The property 'showSeconds' from TimePickerDialog is deprecated. Please use 'fields' instead.")
+ root.fields = showSeconds == true ? DateTime.All : DateTime.Hours | DateTime.Minutes
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ TH.saveIndex(tumbler);
+ if (!internal.initialised)
+ internal.initializeDataModels();
+ }
+ }
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ if (root.hourMode == DateTime.TwelveHours)
+ root.hour = hourColumn.selectedIndex + (meridiemColumn.selectedIndex > 0 ? 12 : 0);
+ else
+ root.hour = hourColumn.selectedIndex;
+ root.minute = minuteColumn.selectedIndex;
+ root.second = secondColumn.selectedIndex;
+ }
+ onRejected: {
+ TH.restoreIndex(tumbler);
+ }
+ onHourModeChanged: {
+ hourList.clear();
+ var tmp = hourColumn.selectedIndex;
+ if (root.hourMode == DateTime.TwentyFourHours) {
+ tmp = (root.hour < 12 ? tmp : tmp + 12)
+ for (var i = 0; i < 24; ++i)
+ hourList.append({"value" : (i < 10 ? "0" : "") + i});
+ } else {
+ tmp = (root.hour < 12 ? tmp : tmp - 12)
+ hourList.append({"value" : 12 + ""});
+ for (var i = 1; i < 12; ++i)
+ hourList.append({"value" : i + ""});
+ }
+ hourColumn.selectedIndex = -1;
+ hourColumn.selectedIndex = tmp;
+ }
+ onHourChanged: {
+ internal.validateTime()
+ hourColumn.selectedIndex = root.hour - ((root.hourMode == DateTime.TwelveHours && root.hour > 11) ? 12 : 0)
+ meridiemColumn.selectedIndex = root.hour > 11 ? 1: 0
+ }
+ onMinuteChanged: {
+ internal.validateTime()
+ minuteColumn.selectedIndex = root.minute
+ }
+ onSecondChanged: {
+ internal.validateTime()
+ secondColumn.selectedIndex = root.second
+ }
+
+ QtObject {
+ id: internal
+
+ property variant initialised: false
+
+ function initializeDataModels() {
+ if (root.hourMode == DateTime.TwelveHours) {
+ hourList.append({"value" : 12 + ""});
+ for (var i = 1; i < 12; ++i)
+ hourList.append({"value" : i + ""});
+ }
+ for (var i = 0; i < 60; ++i) {
+ minuteList.append({"value" : (i < 10 ? "0" : "") + i });
+ secondList.append({"value" : (i < 10 ? "0" : "") + i });
+ }
+ meridiemList.append({"value" : dateTime.amText()});
+ meridiemList.append({"value" : dateTime.pmText()});
+
+ tumbler.privateInitialize();
+ internal.initialised = true;
+ }
+
+ function validateTime() {
+ root.hour = Math.max(0, Math.min(23, root.hour))
+ root.minute = Math.max(0, Math.min(59, root.minute))
+ root.second = Math.max(0, Math.min(59, root.second))
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var __columns = [];
+var __autoColumnWidth = 0;
+var __suppressLayoutUpdates = false;
+
+function initialize() {
+ // check the width requested by fixed width columns
+ var requestedWidth = 0;
+ var requestedCount = 0;
+ var invisibleCount = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].visible) {
+ if (columns[i].width > 0 && !columns[i].privateIsAutoWidth) {
+ requestedWidth += columns[i].width;
+ requestedCount++;
+ }
+ } else {
+ invisibleCount++;
+ }
+ }
+
+ // allocate the rest to auto width columns
+ if ((columns.length - requestedCount - invisibleCount) > 0) {
+ __autoColumnWidth = Math.floor((parent.width - requestedWidth) / (columns.length - requestedCount - invisibleCount));
+ }
+
+ for (var i = 0; i < columns.length; i++) {
+ var comp = Qt.createComponent("TumblerTemplate.qml");
+ var newObj = comp.createObject(tumblerRow);
+ if (!columns[i].width || columns[i].privateIsAutoWidth) {
+ columns[i].width = __autoColumnWidth;
+ columns[i].privateIsAutoWidth = true;
+ }
+ if (columns[i].label) {
+ // enable label for the tumbler
+ internal.hasLabel = true;
+ }
+ newObj.height = root.height;
+ newObj.index = i;
+ newObj.tumblerColumn = columns[i];
+ newObj.widthChanged.connect(layout);
+ newObj.visibleChanged.connect(layout);
+ __columns.push(newObj);
+ }
+ privateTemplates = __columns;
+}
+
+function clear() {
+ var count = __columns.length;
+ for (var i = 0; i < count; i++) {
+ var tmp = __columns.pop();
+ tmp.destroy();
+ }
+}
+
+function forceUpdate() {
+ for (var i = 0; i < columns.length; i++) {
+ columns[i].selectedIndex = __columns[i].view.currentIndex;
+ }
+}
+
+function layout() {
+ if (__suppressLayoutUpdates) {
+ // guard against onWidthChanged triggering again during this process
+ return;
+ }
+ var requestedWidth = 0;
+ var requestedCount = 0;
+ var invisibleCount = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].visible) {
+ var w = columns[i].width;
+ var a = columns[i].privateIsAutoWidth;
+ if (!a || (a && w != __autoColumnWidth)) {
+ requestedWidth += columns[i].width;
+ requestedCount++;
+ columns[i].privateIsAutoWidth = false;
+ } else {
+ columns[i].privateIsAutoWidth = true;
+ }
+ } else {
+ invisibleCount++;
+ }
+ }
+
+ if ((columns.length - requestedCount - invisibleCount) > 0) {
+ __autoColumnWidth = Math.floor((parent.width - requestedWidth) / (columns.length - requestedCount - invisibleCount));
+ }
+
+ // guard against onWidthChanged triggering again during this process
+ __suppressLayoutUpdates = true;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].privateIsAutoWidth) {
+ columns[i].width = __autoColumnWidth;
+ }
+ }
+ __suppressLayoutUpdates = false;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "Tumbler.js" as Engine
+import "constants.js" as C
+
+/*
+ Class: Tumbler
+ A tumbler.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: items
+ * [ListModel] Array of ListModel for each column of the dialog.
+ */
+ property list<Item> columns
+
+ /*
+ * Event: changed
+ * Is emitted when the value of the tumbler changes.
+ */
+ signal changed(int index)
+
+ /* private */
+ property bool privateDelayInit: false
+ property list<Item> privateTemplates
+
+ implicitWidth: C.TUMBLER_WIDTH
+ implicitHeight: screen.displayWidth > screen.displayHeight ?
+ C.TUMBLER_HEIGHT_LANDSCAPE :
+ C.TUMBLER_HEIGHT_PORTRAIT
+
+ /* private */
+ function privateInitialize() {
+ if (!internal.initialized) {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+
+ /* private */
+ function privateForceUpdate() {
+ Engine.forceUpdate();
+ }
+
+ anchors.fill: parent
+ clip: true
+ Component.onCompleted: {
+ if (!privateDelayInit && !internal.initialized) {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+ onChanged: {
+ if (internal.movementCount == 0)
+ Engine.forceUpdate();
+ }
+ onColumnsChanged: {
+ if (internal.initialized) {
+ // when new columns are added, the system first removes all
+ // the old columns
+ internal.initialized = false;
+ Engine.clear();
+ internal.reInit = true;
+ } else if (internal.reInit && columns.length > 0) {
+ // timer is used because the new columns are added one by one
+ // we only want to act after the last column is added
+ internal.reInit = false;
+ columnChangedTimer.restart();
+ }
+ }
+ onWidthChanged: {
+ Engine.layout();
+ }
+
+ QtObject {
+ id: internal
+
+ property int movementCount: 0
+ property bool initialized: false
+ property bool reInit: false
+ property bool hasLabel: false
+
+ property Timer timer: Timer {
+ id: columnChangedTimer
+ interval: 50
+ onTriggered: {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+ }
+
+ BorderImage {
+ width: parent.width
+ height: internal.hasLabel ?
+ parent.height - C.TUMBLER_LABEL_HEIGHT : // decrease by bottom text height
+ parent.height
+ source: "image://theme/" + theme.colorString + "meegotouch-list-fullwidth-background-selected"
+ anchors.top: parent.top
+ border { left: C.TUMBLER_BORDER_MARGIN; top: C.TUMBLER_BORDER_MARGIN; right: C.TUMBLER_BORDER_MARGIN; bottom: C.TUMBLER_BORDER_MARGIN }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: internal.hasLabel ?
+ parent.height - C.TUMBLER_LABEL_HEIGHT - 2 * C.TUMBLER_BORDER_MARGIN : // decrease by bottom text & border height
+ parent.height - 2*C.TUMBLER_BORDER_MARGIN
+ color: C.TUMBLER_COLOR
+ anchors { top: parent.top; topMargin: C.TUMBLER_BORDER_MARGIN }
+ }
+
+ Row {
+ id: tumblerRow
+ anchors { fill: parent; topMargin: 1 }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "constants.js" as UI
+
+/*
+ Class: TumblerButton
+ button component that has a label and has click event handling.
+
+ A button is a component that accepts user input and send a clicked() signal for
+ the application to handle. The button has resizable properties, event
+ handling, and can undergo state changes and transitions.
+
+ The TumblerButton has a fixed width. Longer text will be elided.
+ To avoid that for longer texts please set the implicitWidth explicitly.
+
+ <code>
+ // Create a button with different icon states:
+ // This approach works for all supported states: normal, disabled, pressed, selected, selected && disabled
+ TumblerButton {
+ text: "Tumbler Button"
+ }
+ </code>
+*/
+Item {
+ id: tumblerbutton
+
+ /*
+ * Property: text
+ * [string] The text displayed on button.
+ */
+ property string text: "Get Value"
+
+ /*
+ * Property: pressed
+ * [bool] (ReadOnly) Is true when the button is pressed
+ */
+ property alias pressed: mouse.pressed
+
+ property QtObject style: TumblerButtonStyle{}
+
+ /*
+ * Event: clicked
+ * Is emitted after the button is released
+ */
+ signal clicked
+
+ height: UI.SIZE_BUTTON
+ width: UI.WIDTH_TUMBLER_BUTTON // fixed width to prevent jumping size after selecting value from tumbler
+
+ BorderImage {
+ border { top: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS;
+ left: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS }
+ anchors.fill: parent
+ source: mouse.pressed ?
+ tumblerbutton.style.pressedBackground : tumblerbutton.enabled ?
+ tumblerbutton.style.background : tumblerbutton.style.disabledBackground;
+ }
+
+ MouseArea {
+ id: mouse
+
+ anchors.fill: parent
+ enabled: parent.enabled
+ onClicked: {
+ parent.clicked()
+ }
+ }
+
+ Image {
+ id: icon
+
+ anchors { right: (label.text != "") ? parent.right : undefined;
+ rightMargin: UI.INDENT_DEFAULT;
+ horizontalCenter: (label.text != "") ? undefined : parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ height: sourceSize.height
+ width: sourceSize.width
+ source: "image://theme/meegotouch-combobox-indicator" +
+ (tumblerbutton.style.inverted ? "-inverted" : "") +
+ (tumblerbutton.enabled ? "" : "-disabled") +
+ (mouse.pressed ? "-pressed" : "")
+ }
+
+ Text {
+ id: label
+
+ anchors { left: parent.left; right: icon.left;
+ leftMargin: UI.INDENT_DEFAULT; rightMargin: UI.INDENT_DEFAULT;
+ verticalCenter: parent.verticalCenter }
+ font { family: UI.FONT_FAMILY; pixelSize: UI.FONT_DEFAULT_SIZE;
+ bold: UI.FONT_BOLD_BUTTON; capitalization: tumblerbutton.style.fontCapitalization }
+ text: tumblerbutton.text
+ color: (mouse.pressed) ?
+ tumblerbutton.style.pressedTextColor :
+ (tumblerbutton.enabled) ?
+ tumblerbutton.style.textColor : tumblerbutton.style.disabledTextColor ;
+ horizontalAlignment: Text.AlignLeft
+ elide: Text.ElideRight
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: inverted ? UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND : UI.COLOR_BUTTON_DISABLED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button" + __invertedString + "-background"
+ pressedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-pressed"
+ disabledBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ property variant items
+ property string label
+ property int selectedIndex: 0
+ property bool enabled: true
+
+ // private
+ property bool privateIsAutoWidth: false
+ property bool privateLoopAround: true
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+import "TumblerIndexHelper.js" as IH
+
+/*
+ Class: TumblerDialog
+ Dialog that shows a tumbler.
+*/
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: items
+ * [ListModel] Array of ListModel for each column of the dialog.
+ */
+ property alias columns: tumbler.columns
+
+ /*
+ * Property: acceptButtonText
+ * [string] The button text for the accept button.
+ */
+ property alias acceptButtonText: acceptButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] The button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "titleText"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ height: 300
+ width: parent.width
+ Tumbler {
+ id: tumbler
+ height: 300
+ privateDelayInit: true
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: acceptButton
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ visible: text != ""
+ }
+ Button {
+ id: rejectButton
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ visible: text != ""
+ }
+ }
+
+ QtObject {
+ id: internal
+ property bool init: true
+ }
+
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ tumbler.privateInitialize();
+
+ if (internal.init) {
+ IH.saveIndex(tumbler);
+ internal.init = false;
+ }
+ else {
+ // restore index when dialog was canceled.
+ // another case is when dialog was closed while tumbler was
+ // still rotating (Qt sets the index to the last rotated
+ // number, need to retore to a previously saved index in
+ // this case)
+ IH.restoreIndex(tumbler);
+ }
+ }
+ }
+
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ IH.saveIndex(tumbler);
+ }
+
+ onRejected: {
+ IH.restoreIndex(tumbler);
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+TumblerDialog {
+ Component.onCompleted: console.log("DEPRECATION WARNING: TumblerDialogNew is being deprecated, please renmae to TumblerDialog instead. This component will be removed on April 25th, 2011")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var __origIndex = [];
+
+function saveIndex(src) {
+ __origIndex = [];
+ for (var i = 0; i < src.columns.length; i++) {
+ __origIndex.push(src.columns[i].selectedIndex);
+ }
+}
+
+function restoreIndex(src) {
+ for (var i = 0; i < __origIndex.length; i++) {
+ // position view at the right index then make sure selectedIndex
+ // is updated to reflect that
+ if (src.privateTemplates[i].view.currentIndex > __origIndex[i]) {
+ while (src.privateTemplates[i].view.currentIndex != __origIndex[i]) {
+ src.privateTemplates[i].view.decrementCurrentIndex()
+ }
+ } else if (src.privateTemplates[i].view.currentIndex < __origIndex[i]) {
+ while (src.privateTemplates[i].view.currentIndex != __origIndex[i]) {
+ src.privateTemplates[i].view.incrementCurrentIndex()
+ }
+ }
+ src.columns[i].selectedIndex = __origIndex[i];
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Tumbler {
+ Component.onCompleted: console.log("DEPRECATION WARNING: TumblerNew is being deprecated, please renmae to Tumbler instead. This component will be removed on April 25th, 2011")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "constants.js" as C
+
+Item {
+ id: template
+ objectName: "tumblerColumn" + index
+
+ property Item tumblerColumn
+ property int index: -1
+ property Item view: viewContainer.item
+
+ opacity: enabled ? C.TUMBLER_OPACITY_FULL : C.TUMBLER_OPACITY
+ width: childrenRect.width
+ visible: tumblerColumn ? tumblerColumn.visible : false
+ enabled: tumblerColumn ? tumblerColumn.enabled : true
+ onTumblerColumnChanged: {
+ if (tumblerColumn)
+ viewContainer.sourceComponent = tumblerColumn.privateLoopAround ? pViewComponent : lViewComponent;
+ }
+
+ Loader {
+ id: viewContainer
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: parent.height - container.height - 2*C.TUMBLER_BORDER_MARGIN // decrease by text & border heights
+ }
+
+ Component {
+ // Component for loop around column
+ id: pViewComponent
+ PathView {
+ id: pView
+
+ model: tumblerColumn ? tumblerColumn.items : undefined
+ currentIndex: tumblerColumn ? tumblerColumn.selectedIndex : 0
+ preferredHighlightBegin: (height / 2) / (C.TUMBLER_ROW_HEIGHT * pView.count)
+ preferredHighlightEnd: preferredHighlightBegin
+ highlightRangeMode: PathView.StrictlyEnforceRange
+ clip: true
+ delegate: defaultDelegate
+ highlight: defaultHighlight
+ interactive: template.enabled
+ anchors.fill: parent
+
+ onMovementStarted: {
+ internal.movementCount++;
+ }
+ onMovementEnded: {
+ internal.movementCount--;
+ root.changed(template.index) // got index from delegate
+ }
+
+ Rectangle {
+ width: 1
+ height: parent.height
+ color: C.TUMBLER_COLOR_TEXT
+ opacity: C.TUMBLER_OPACITY_LOW
+ }
+
+ path: Path {
+ startX: template.width / 2; startY: 0
+ PathLine {
+ x: template.width / 2
+ y: C.TUMBLER_ROW_HEIGHT * pView.count
+ }
+ }
+ }
+ }
+
+ Component {
+ // Component for non loop around column
+ id: lViewComponent
+ ListView {
+ id: lView
+
+ model: tumblerColumn ? tumblerColumn.items : undefined
+ currentIndex: tumblerColumn ? tumblerColumn.selectedIndex : 0
+ preferredHighlightBegin: Math.floor((height - C.TUMBLER_ROW_HEIGHT) / 2)
+ preferredHighlightEnd: preferredHighlightBegin + C.TUMBLER_ROW_HEIGHT
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ clip: true
+ delegate: defaultDelegate
+ highlight: defaultHighlight
+ interactive: template.enabled
+ anchors.fill: parent
+
+ onMovementStarted: {
+ internal.movementCount++;
+ }
+ onMovementEnded: {
+ internal.movementCount--;
+ root.changed(template.index) // got index from delegate
+ }
+
+ Rectangle {
+ width: 1
+ height: parent.height
+ color: C.TUMBLER_COLOR_TEXT
+ opacity: C.TUMBLER_OPACITY_LOW
+ }
+ }
+ }
+
+ Item {
+ id: container
+ anchors.top: viewContainer.bottom
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: internal.hasLabel ? C.TUMBLER_LABEL_HEIGHT : 0 // internal.hasLabel is from root tumbler
+
+ Text {
+ id: label
+
+ text: tumblerColumn ? tumblerColumn.label : ""
+ elide: Text.ElideRight
+ horizontalAlignment: "AlignHCenter"
+ color: C.TUMBLER_COLOR_LABEL
+ font { family: C.FONT_FAMILY_LIGHT; pixelSize: C.FONT_LIGHT_SIZE }
+ anchors { fill: parent; margins: C.TUMBLER_MARGIN}
+ }
+ }
+
+ Component {
+ id: defaultDelegate
+
+ Item {
+ width: tumblerColumn.width
+ height: C.TUMBLER_ROW_HEIGHT
+
+ Text {
+ id: txt
+ elide: Text.ElideRight
+ horizontalAlignment: "AlignHCenter"
+ color: C.TUMBLER_COLOR_TEXT
+ font { family: C.FONT_FAMILY_BOLD; pixelSize: C.FONT_DEFAULT_SIZE }
+ anchors { fill: parent; margins: C.TUMBLER_MARGIN }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (template.view.interactive) {
+ tumblerColumn.selectedIndex = index; // got index from delegate
+ root.changed(template.index);
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ try {
+ // Legacy. "value" use to be the role which was used by delegate
+ txt.text = value
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ txt.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ txt.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: defaultHighlight
+
+ Image {
+ id: highlight
+ objectName: "highlight"
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: C.TUMBLER_ROW_HEIGHT
+ source: "image://theme/" + theme.colorString + "meegotouch-list-fullwidth-background-selected-horizontal-center"
+ fillMode: Image.TileHorizontally
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+/* Margins */
+var INDENT_DEFAULT = 16;
+var CORNER_MARGINS = 22;
+var MARGIN_DEFAULT = 0;
+var MARGIN_XLARGE = 16;
+
+// ListDelegate
+var LIST_ITEM_MARGIN = 16
+var LIST_ITEM_SPACING = 16
+var LIST_ITEM_HEIGHT = 80
+var LIST_ICON_SIZE = 64
+var LIST_TILE_SIZE = 26
+var LIST_TITLE_COLOR = "#282828"
+var LIST_TITLE_COLOR_PRESSED = "#797979"
+var LIST_TITLE_COLOR_INVERTED = "#ffffff"
+var LIST_TITLE_COLOR_PRESSED_INVERTED = "#797979"
+var LIST_SUBTILE_SIZE = 22
+var LIST_SUBTITLE_COLOR = "#505050"
+var LIST_SUBTITLE_COLOR_PRESSED = "#797979"
+var LIST_SUBTITLE_COLOR_INVERTED = "#C8C8C8"
+var LIST_SUBTITLE_COLOR_PRESSED_INVERTED = "#797979"
+
+/* Font properties */
+var FONT_FAMILY = "Nokia Pure Text";
+var FONT_FAMILY_BOLD = "Nokia Pure Text Bold";
+var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
+var FONT_DEFAULT_SIZE = 24;
+var FONT_LIGHT_SIZE = 22;
+
+/* TUMBLER properties */
+var TUMBLER_COLOR_TEXT = "#FFFFFF";
+var TUMBLER_COLOR_LABEL = "#8C8C8C";
+var TUMBLER_COLOR = "#000000";
+var TUMBLER_OPACITY_FULL = 1.0;
+var TUMBLER_OPACITY = 0.4;
+var TUMBLER_OPACITY_LOW = 0.1;
+var TUMBLER_FLICK_VELOCITY = 700;
+var TUMBLER_ROW_HEIGHT = 64;
+var TUMBLER_LABEL_HEIGHT = 54;
+var TUMBLER_MARGIN = 16;
+var TUMBLER_BORDER_MARGIN = 1;
+var TUMBLER_WIDTH = 344;
+var TUMBLER_HEIGHT_PORTRAIT = 256;
+var TUMBLER_HEIGHT_LANDSCAPE = 192;
+
+/* Button styles */
+// Normal
+var COLOR_BUTTON_FOREGROUND = "#191919"; // Text color
+var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
+var COLOR_BUTTON_DISABLED_FOREGROUND = "#b2b2b4"; // Disabled
+// Inverted
+var COLOR_BUTTON_INVERTED_FOREGROUND = "#FFFFFF";
+var COLOR_BUTTON_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
+var COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND = "#f5f5f5"; // Disabled
+
+var SIZE_BUTTON = 51;
+var SIZE_SMALL_BUTTON = 43;
+var WIDTH_SMALL_BUTTON = 122;
+var WIDTH_TUMBLER_BUTTON = 222;
+
+var FONT_BOLD_BUTTON = true;
+
+var INFO_BANNER_OPACITY = 0.9
+var INFO_BANNER_LETTER_SPACING = -1.2
--- /dev/null
+plugin meegoextrasplugin
+CountBubble 1.0 CountBubble.qml
+DatePickerDialog 1.0 DatePickerDialog.qml
+InfoBanner 1.0 InfoBanner.qml
+ListDelegate 1.0 ListDelegate.qml
+MoreIndicator 1.0 MoreIndicator.qml
+NetPromoterScore 1.0 NetPromoterScore.qml
+PageIndicator 1.0 PageIndicator.qml
+RatingIndicator 1.0 RatingIndicator.qml
+TimePickerDialog 1.0 TimePickerDialog.qml
+Tumbler 1.0 Tumbler.qml
+TumblerColumn 1.0 TumblerColumn.qml
+TumblerButton 1.0 TumblerButton.qml
+TumblerDialog 1.0 TumblerDialog.qml
+ListButton 1.0 ListButton.qml
+ListButtonStyle 1.0 ListButtonStyle.qml
+NegativeButtonStyle 1.0 NegativeButtonStyle.qml
+PositiveButtonStyle 1.0 PositiveButtonStyle.qml
+SystemBanner 1.0 SystemBanner.qml
+TumblerButtonStyle 1.0 TumblerButtonStyle.qml
+TumblerNew 1.0 TumblerNew.qml
+TumblerDialogNew 1.0 TumblerDialogNew.qml
+CountBubble 1.1 CountBubble.qml
+DatePickerDialog 1.1 DatePickerDialog.qml
+InfoBanner 1.1 InfoBanner.qml
+ListDelegate 1.1 ListDelegate.qml
+MoreIndicator 1.1 MoreIndicator.qml
+NetPromoterScore 1.1 NetPromoterScore.qml
+PageIndicator 1.1 PageIndicator.qml
+RatingIndicator 1.1 RatingIndicator.qml
+TimePickerDialog 1.1 TimePickerDialog.qml
+Tumbler 1.1 Tumbler.qml
+TumblerColumn 1.1 TumblerColumn.qml
+TumblerButton 1.1 TumblerButton.qml
+TumblerDialog 1.1 TumblerDialog.qml
+ListButton 1.1 ListButton.qml
+ListButtonStyle 1.1 ListButtonStyle.qml
+NegativeButtonStyle 1.1 NegativeButtonStyle.qml
+PositiveButtonStyle 1.1 PositiveButtonStyle.qml
+SystemBanner 1.1 SystemBanner.qml
+TumblerButtonStyle 1.1 TumblerButtonStyle.qml
+TumblerNew 1.1 TumblerNew.qml
+TumblerDialogNew 1.1 TumblerDialogNew.qml
--- /dev/null
+plugin meegoplugin
+ApplicationWindow 1.0 ApplicationWindow.qml
+ApplicationWindowStyle 1.0 ApplicationWindowStyle.qml
+BusyIndicator 1.0 BusyIndicator.qml
+BusyIndicatorStyle 1.0 BusyIndicatorStyle.qml
+Button 1.0 Button.qml
+ButtonStyle 1.0 ButtonStyle.qml
+GroupButtonStyle 1.0 GroupButtonStyle.qml
+ButtonColumn 1.0 ButtonColumn.qml
+ButtonRow 1.0 ButtonRow.qml
+CheckBox 1.0 CheckBox.qml
+CheckBoxStyle 1.0 CheckBoxStyle.qml
+ContextMenu 1.0 ContextMenu.qml
+ContextMenuStyle 1.0 ContextMenuStyle.qml
+Dialog 1.0 Dialog.qml
+DialogStyle 1.0 DialogStyle.qml
+EditBubble 1.0 EditBubble.qml
+QueryDialog 1.0 QueryDialog.qml
+QueryDialogStyle 1.0 QueryDialogStyle.qml
+SelectionDialog 1.0 SelectionDialog.qml
+MultiSelectionDialog 1.0 MultiSelectionDialog.qml
+SelectionDialogStyle 1.0 SelectionDialogStyle.qml
+Label 1.0 Label.qml
+LabelStyle 1.0 LabelStyle.qml
+Menu 1.0 Menu.qml
+MenuLayout 1.0 MenuLayout.qml
+MenuItem 1.0 MenuItem.qml
+MenuStyle 1.0 MenuStyle.qml
+MenuItemStyle 1.0 MenuItemStyle.qml
+MouseAreaDebug 1.0 MouseAreaDebug.qml
+Page 1.0 Page.qml
+PageStack 1.0 PageStack.qml
+PageStackWindow 1.0 PageStackWindow.qml
+PageStackWindowStyle 1.0 PageStackWindowStyle.qml
+ProgressBar 1.0 ProgressBar.qml
+ProgressBarStyle 1.0 ProgressBarStyle.qml
+RadioButton 1.0 RadioButton.qml
+RadioButtonStyle 1.0 RadioButtonStyle.qml
+ScrollDecorator 1.0 ScrollDecorator.qml
+ScrollDecoratorStyle 1.0 ScrollDecoratorStyle.qml
+SectionScroller 1.0 SectionScroller.qml
+SectionScrollerStyle 1.0 SectionScrollerStyle.qml
+Sheet 1.0 Sheet.qml
+SheetStyle 1.0 SheetStyle.qml
+SheetButton 1.0 SheetButton.qml
+SheetButtonStyle 1.0 SheetButtonStyle.qml
+SheetButtonAccentStyle 1.0 SheetButtonAccentStyle.qml
+Slider 1.0 Slider.qml
+SliderStyle 1.0 SliderStyle.qml
+SliderTemplate 1.0 SliderTemplate.qml
+StatusBar 1.0 StatusBar.qml
+Style 1.0 Style.qml
+Switch 1.0 Switch.qml
+SwitchStyle 1.0 SwitchStyle.qml
+TabBarLayout 1.0 TabBarLayout.qml
+TabButton 1.0 TabButton.qml
+TabButtonStyle 1.0 TabButtonStyle.qml
+TabGroup 1.0 TabGroup.qml
+TextArea 1.0 TextArea.qml
+TextAreaStyle 1.0 TextAreaStyle.qml
+TextField 1.0 TextField.qml
+TextFieldStyle 1.0 TextFieldStyle.qml
+ToolBar 1.0 ToolBar.qml
+ToolBarLayout 1.0 ToolBarLayout.qml
+ToolBarStyle 1.0 ToolBarStyle.qml
+ToolButton 1.0 ToolButton.qml
+ToolButtonRow 1.0 ToolButtonRow.qml
+ToolButtonStyle 1.0 ToolButtonStyle.qml
+ToolItem 1.0 ToolItem.qml
+ToolIcon 1.0 ToolIcon.qml
+ToolItemStyle 1.0 ToolItemStyle.qml
+Window 1.0 Window.qml
+
+ApplicationWindow 1.1 ApplicationWindow.qml
+ApplicationWindowStyle 1.1 ApplicationWindowStyle.qml
+BusyIndicator 1.1 BusyIndicator.qml
+BusyIndicatorStyle 1.1 BusyIndicatorStyle.qml
+Button 1.1 Button.qml
+ButtonStyle 1.1 ButtonStyle.qml
+GroupButtonStyle 1.1 GroupButtonStyle.qml
+ButtonColumn 1.1 ButtonColumn.qml
+ButtonRow 1.1 ButtonRow.qml
+CheckBox 1.1 CheckBox.qml
+CheckBoxStyle 1.1 CheckBoxStyle.qml
+ContextMenu 1.1 ContextMenu.qml
+ContextMenuStyle 1.1 ContextMenuStyle.qml
+Dialog 1.1 Dialog.qml
+DialogStyle 1.1 DialogStyle.qml
+EditBubble 1.1 EditBubble.qml
+QueryDialog 1.1 QueryDialog.qml
+QueryDialogStyle 1.1 QueryDialogStyle.qml
+SelectionDialog 1.1 SelectionDialog.qml
+MultiSelectionDialog 1.1 MultiSelectionDialog.qml
+SelectionDialogStyle 1.1 SelectionDialogStyle.qml
+Label 1.1 Label.qml
+LabelStyle 1.1 LabelStyle.qml
+Menu 1.1 Menu.qml
+MenuLayout 1.1 MenuLayout.qml
+MenuItem 1.1 MenuItem.qml
+MenuStyle 1.1 MenuStyle.qml
+MenuItemStyle 1.1 MenuItemStyle.qml
+MouseAreaDebug 1.1 MouseAreaDebug.qml
+Page 1.1 Page.qml
+PageStack 1.1 PageStack.qml
+PageStackWindow 1.1 PageStackWindow.qml
+PageStackWindowStyle 1.1 PageStackWindowStyle.qml
+ProgressBar 1.1 ProgressBar.qml
+ProgressBarStyle 1.1 ProgressBarStyle.qml
+RadioButton 1.1 RadioButton.qml
+RadioButtonStyle 1.1 RadioButtonStyle.qml
+ScrollDecorator 1.1 ScrollDecorator.qml
+ScrollDecoratorStyle 1.1 ScrollDecoratorStyle.qml
+SectionScroller 1.1 SectionScroller.qml
+SectionScrollerStyle 1.1 SectionScrollerStyle.qml
+Sheet 1.1 Sheet.qml
+SheetStyle 1.1 SheetStyle.qml
+SheetButton 1.1 SheetButton.qml
+SheetButtonStyle 1.1 SheetButtonStyle.qml
+SheetButtonAccentStyle 1.1 SheetButtonAccentStyle.qml
+Slider 1.1 Slider.qml
+SliderStyle 1.1 SliderStyle.qml
+SliderTemplate 1.1 SliderTemplate.qml
+StatusBar 1.1 StatusBar.qml
+Style 1.1 Style.qml
+Switch 1.1 Switch.qml
+SwitchStyle 1.1 SwitchStyle.qml
+TabBarLayout 1.1 TabBarLayout.qml
+TabButton 1.1 TabButton.qml
+TabButtonStyle 1.1 TabButtonStyle.qml
+TabGroup 1.1 TabGroup.qml
+TextArea 1.1 TextArea.qml
+TextAreaStyle 1.1 TextAreaStyle.qml
+TextField 1.1 TextField.qml
+TextFieldStyle 1.1 TextFieldStyle.qml
+ToolBar 1.1 ToolBar.qml
+ToolBarLayout 1.1 ToolBarLayout.qml
+ToolBarStyle 1.1 ToolBarStyle.qml
+ToolButton 1.1 ToolButton.qml
+ToolButtonRow 1.1 ToolButtonRow.qml
+ToolButtonStyle 1.1 ToolButtonStyle.qml
+ToolItem 1.1 ToolItem.qml
+ToolIcon 1.1 ToolIcon.qml
+ToolItemStyle 1.1 ToolItemStyle.qml
+Window 1.1 Window.qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+
+/*
+ Class: CountBubble
+ CountBubble component is a flexible shape that holds a number and can be added in lists or
+ notification banners for example.
+*/
+
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: largeSized
+ * [bool=false] Use small or large count bubble.
+ */
+ property bool largeSized: false
+
+ /*
+ * Property: value
+ * [int=0] Reflects the current value.
+ */
+ property int value: 0
+
+ implicitWidth: internal.getBubbleWidth()
+ implicitHeight: largeSized ? 32:24
+
+ BorderImage {
+ source: "image://theme/" + theme.colorString + "meegotouch-countbubble-background"+(largeSized ? "-large":"")
+ anchors.fill: parent
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ }
+
+ Text {
+ id: text
+ height: parent.height
+ y:1
+ color: largeSized ? "#FFFFFF" : "black"
+ font.family: C.FONT_FAMILY
+ anchors.horizontalCenter: parent.horizontalCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: largeSized ? 22:18
+ text: root.value
+ }
+
+ QtObject {
+ id: internal
+
+ function getBubbleWidth() {
+ if (largeSized) {
+ if (root.value < 10)
+ return 32;
+ else if (root.value < 100)
+ return 40;
+ else if (root.value < 1000)
+ return 52;
+ else
+ return text.paintedWidth+19
+ } else {
+ if (root.value < 10)
+ return 24;
+ else if (root.value < 100)
+ return 30;
+ else if (root.value < 1000)
+ return 40;
+ else
+ return text.paintedWidth+13
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+import "TumblerIndexHelper.js" as TH
+
+/*
+ Class: DatePickerDialog
+ Dialog that shows a date picker.
+*/
+
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: year
+ * [int] The displayed year.
+ */
+ property int year: dateTime.currentYear()
+
+ /*
+ * Property: month
+ * [int] The displayed month.
+ */
+ property int month: 1
+
+ /*
+ * Property: day
+ * [int] The displayed day.
+ */
+ property int day: 1
+
+ /*
+ * Property: minimumYear
+ * [int] Optional, the minimum year shown on the tumbler. This property should
+ * only be set once during construction. If the value is not specified,
+ * it is default to current year - 1.
+ */
+ property int minimumYear: dateTime.currentYear() - 1
+
+ /*
+ * Property: maximumYear
+ * [int] Optional, the maximum year shown on the tumbler. This property should
+ * only be set once during construction. If the value is not specified,
+ * it is default to current year + 20.
+ */
+ property int maximumYear: dateTime.currentYear() + 20
+
+ /*
+ * Property: acceptButtonText
+ * [string] Optional, the button text for the accept button.
+ */
+ property alias acceptButtonText: confirmButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] Optional, the button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "title"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ id: dialogContent
+ height: 300
+ width: parent.width
+
+ Tumbler {
+ id: tumbler
+
+ function _handleTumblerChanges(index) {
+ if (index == 1 || index == 2) {
+ var curYear = yearColumn.selectedIndex + yearList.get(0).value;
+ var curMonth = monthColumn.selectedIndex + 1;
+
+ var d = dateTime.daysInMonth(curYear, curMonth);
+ if (dayColumn.selectedIndex >= d)
+ dayColumn.selectedIndex = d - 1
+ while (dayList.count > d)
+ dayList.remove(dayList.count - 1)
+ while (dayList.count < d)
+ dayList.append({"value" : dayList.count + 1})
+ }
+ }
+
+ columns: [dayColumn, monthColumn, yearColumn]
+ onChanged: {
+ _handleTumblerChanges(index);
+ }
+ height: 300
+ privateDelayInit: true
+
+ TumblerColumn {
+ id: dayColumn
+ items: ListModel {
+ id: dayList
+ }
+ label: "DAY"
+ selectedIndex: root.day - (root.day > 0 ? 1 : 0)
+ }
+
+ TumblerColumn {
+ id: monthColumn
+ items: ListModel {
+ id: monthList
+ }
+ label: "MONTH"
+ selectedIndex: root.month - (root.month > 0 ? 1 : 0)
+ }
+
+ TumblerColumn {
+ id: yearColumn
+ items: ListModel {
+ id: yearList
+ }
+ label: "YEAR"
+ selectedIndex: yearList.length > 0 ? internal.year - yearList.get(0).value : 0
+ }
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: confirmButton
+ text: "CONFIRM"
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ Button {
+ id: rejectButton
+ text: "CANCEL"
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ platformStyle: ButtonStyle { inverted: true }
+ }
+ }
+ onMinimumYearChanged: {
+ if (!internal.surpassUpdate) {
+ internal.year = root.year
+ internal.minYear = root.minimumYear
+
+ if (internal.minYear < 0)
+ internal.minYear = dateTime.currentYear() - 1;
+ else if (internal.minYear > root.maximumYear)
+ internal.minYear = root.maximumYear;
+
+ internal.updateYearList()
+ internal.validateDate()
+ internal.year = internal.year < internal.minYear ? internal.minYear :
+ (internal.year > root.maximumYear ? root.maximumYear :internal.year)
+ }
+ }
+ onMaximumYearChanged: {
+ internal.minYear = root.minimumYear
+
+ if (root.maximumYear < 0)
+ root.maximumYear = dateTime.currentYear() + 20;
+ else if (root.maximumYear < internal.minYear)
+ root.maximumYear = internal.minYear;
+
+ internal.updateYearList()
+ internal.validateDate()
+ internal.year = internal.year > root.maximumYear ? root.maximumYear :
+ (internal.year < internal.minYear ? internal.minYear : internal.year)
+ if (internal.minYear < 0)
+ root.minimumYear = dateTime.currentYear() - 1
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ TH.saveIndex(tumbler);
+ if (!internal.initialized)
+ internal.initializeDataModels();
+ if (internal.year > 0)
+ yearColumn.selectedIndex = internal.year - yearList.get(0).value;
+ tumbler._handleTumblerChanges(2);
+ dayColumn.selectedIndex = root.day - 1;
+ }
+ if (status == DialogStatus.Closing) {
+ internal.surpassUpdate = true
+ if (internal.surpassUpdate) {
+ root.year = internal.year
+ root.minimumYear = internal.minYear
+ }
+ internal.surpassUpdate = false
+ }
+ }
+ onDayChanged: {
+ internal.validateDate()
+ if (dayColumn.items.length > root.day - 1)
+ dayColumn.selectedIndex = root.day - 1
+ }
+ onMonthChanged: {
+ internal.validateDate()
+ monthColumn.selectedIndex = root.month - 1
+ }
+ onYearChanged: {
+ if (!internal.surpassUpdate) {
+ internal.year = root.year
+ internal.validateDate()
+ internal.year = internal.year < internal.minYear ? internal.minYear :
+ (internal.year > root.maximumYear ? root.maximumYear : internal.year)
+
+ if (internal.initialized)
+ yearColumn.selectedIndex = internal.year - yearList.get(0).value
+ }
+ }
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ root.year = yearColumn.selectedIndex + yearList.get(0).value;
+ root.month = monthColumn.selectedIndex + 1;
+ root.day = dayColumn.selectedIndex + 1;
+ }
+ onRejected: {
+ TH.restoreIndex(tumbler);
+ }
+
+ QtObject {
+ id: internal
+
+ property variant initialized: false
+ property int year
+ property int minYear
+ property bool surpassUpdate: false
+
+ function initializeDataModels() {
+ var currentYear = new Date().getFullYear();
+ minimumYear = minimumYear ? minimumYear : currentYear - 1;
+ maximumYear = maximumYear ? maximumYear : currentYear + 20;
+
+ for (var y = minimumYear; y <= maximumYear; ++y)
+ yearList.append({"value" : y}) // year
+
+ var nDays = dateTime.daysInMonth(internal.year, root.month);
+ for (var d = 1; d <= nDays; ++d)
+ dayList.append({"value" : d}) // day
+ for (var m = 1; m <= 12; ++m)
+ monthList.append({"value" : dateTime.shortMonthName(m)});
+
+ tumbler.privateInitialize();
+ internal.initialized = true;
+ }
+
+ function updateYearList() {
+ if (internal.initialized) {
+ var tmp = yearColumn.selectedIndex;
+ yearList.clear();
+ for (var i = internal.minYear; i <= root.maximumYear; ++i)
+ yearList.append({"value" : i})
+ if (tmp < yearList.count) {
+ yearColumn.selectedIndex = 0;
+ yearColumn.selectedIndex = tmp;
+ }
+ }
+ }
+
+ function validateDate() {
+ if (internal.year < 1){
+ internal.year = new Date().getFullYear()
+ if (maximumYear < internal.year)
+ root.maximumYear = dateTime.currentYear() + 20;
+ if (minimumYear > internal.year)
+ internal.minYear = dateTime.currentYear() - 1;
+ }
+
+ root.month = Math.max(1, Math.min(12, root.month))
+ var d = dateTime.daysInMonth(internal.year, root.month);
+ root.day = Math.max(1, Math.min(d, root.day))
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+/*
+ Class: InfoBanner
+ The InfoBanner component is used to display information to the user. The number of lines of text
+ shouldn't exceed 3.
+*/
+
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: iconSource
+ * [url] The path to the icon image
+ */
+ property url iconSource: ""
+
+ /*
+ * Property: text
+ * [string] Text to be displayed in InfoBanner
+ */
+ property alias text: text.text
+
+ /*
+ * Property: timerEnabled
+ * [bool=true] Enable/disable timer that dismisses InfoBanner
+ */
+ property bool timerEnabled: true
+
+ /*
+ * Property: timerShowTime
+ * [int=3000ms] For setting how long InfoBanner stays visible to user before being dismissed
+ */
+ property alias timerShowTime: sysBannerTimer.interval
+
+ /*
+ * Property: topMargin
+ * [int=8 pix] Allows user to customize top margin if needed
+ */
+ property alias topMargin: root.y
+
+ /*
+ * Property: leftMargin
+ * [int=8 pix] Allows user to customize left margin if needed
+ */
+ property alias leftMargin: root.x
+
+ /*
+ * Function: show
+ * Show InfoBanner
+ */
+ function show() {
+ animationShow.running = true;
+ if (root.timerEnabled)
+ sysBannerTimer.restart();
+ }
+
+ /*
+ * Function: hide
+ * Hide InfoBanner
+ */
+ function hide() {
+ animationHide.running = true;
+ }
+
+ implicitHeight: internal.getBannerHeight()
+ implicitWidth: internal.getBannerWidth()
+ x:8; y:8
+ scale: 0
+
+ BorderImage {
+ source: "image://theme/meegotouch-notification-system-background"
+ anchors.fill: root
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ opacity: UI.INFO_BANNER_OPACITY
+ }
+
+ Image {
+ id: image
+ anchors { left: parent.left; leftMargin: 16; top: parent.top; topMargin: 16 }
+ source: root.iconSource
+ visible: root.iconSource != ""
+ }
+
+ Text {
+ id: text
+ width: internal.getTextWidth()
+ anchors { left: (image.visible ? image.right : parent.left); leftMargin: (image.visible ? 14:16);
+ top: parent.top; topMargin: internal.getTopMargin(); bottom: parent.bottom }
+ color: "white"
+ wrapMode: Text.Wrap
+ verticalAlignment: Text.AlignHCenter
+ font.pixelSize: UI.FONT_DEFAULT_SIZE
+ font.family: UI.FONT_FAMILY
+ font.letterSpacing: UI.INFO_BANNER_LETTER_SPACING
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ }
+
+ QtObject {
+ id: internal
+
+ function getBannerHeight() {
+ if (image.visible) {
+ if (text.lineCount <= 2)
+ return 80;
+ else
+ return 106;
+ } else {
+ if (text.lineCount <= 1)
+ return 64;
+ else if (text.lineCount <= 2)
+ return 80;
+ else
+ return 106;
+ }
+ }
+
+ function getBannerWidth() {
+ return parent.width - root.x*2;
+ }
+
+ function getTopMargin() {
+ if (text.lineCount <= 1 && !image.visible) {
+ // If there's only one line of text and no icon image, top and bottom margins are equal.
+ return (root.height-text.paintedHeight)/2;
+ } else {
+ // In all other cases, top margin is 4 px more than bottom margin.
+ return (root.height-text.paintedHeight)/2 + 2;
+ }
+ }
+
+ function getTextWidth() {
+ // 46(32 when there's no icon) is sum of all margins within banner. root.x*2 is sum of margins outside banner.
+ // Text element width is dertermined by substracting parent width(screen width) by all the margins and
+ // icon width(if applicable).
+ return image.visible ? (parent.width-root.x*2-46-image.width) : (parent.width-root.x*2-32);
+ }
+
+ function getScaleValue() {
+ // When banner is displayed, as part of transition effect, it'll first be enlarged to the point where its width
+ // is equal to screen width. root.x*2/root.width calculates the amount of expanding required, where root.x*2 is
+ // equal to screen.displayWidth minus banner.width
+ return root.x*2/root.width + 1;
+ }
+ }
+
+ Timer {
+ id: sysBannerTimer
+ repeat: false
+ running: false
+ interval: 3000
+ onTriggered: hide()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide()
+ }
+
+ SequentialAnimation {
+ id: animationShow
+ NumberAnimation { target: root; property: "scale"; from: 0; to: internal.getScaleValue(); duration: 200; easing.type: Easing.OutQuad}
+ NumberAnimation { target: root; property: "scale"; from: internal.getScaleValue(); to: 1; duration: 200 }
+ }
+
+ NumberAnimation {
+ id: animationHide
+ target: root; property: "scale"; to: 0; duration: 200; easing.type: Easing.InExpo
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+import "." 1.0
+import "../meego/UIConstants.js" as UI
+import com.nokia.meego 1.0
+
+Item {
+ id: button
+
+ // Common public API
+ property bool checked: false
+ property bool checkable: false
+ property alias pressed: mouseArea.pressed
+ property alias text: label.text
+ property url iconSource
+
+ signal clicked
+
+ // Used in ButtonGroup.js to set the segmented look on the buttons.
+ property string __buttonType
+
+ // Styling for the Button
+ property Style platformStyle: ButtonStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: button.platformStyle
+
+ implicitWidth: iconAndLabel.prefferedWidth
+ implicitHeight: platformStyle.buttonHeight
+
+ property alias font: label.font
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+
+ border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+ right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+ source: !enabled ?
+ (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+ pressed ?
+ button.platformStyle.pressedBackground :
+ checked ?
+ button.platformStyle.checkedBackground :
+ button.platformStyle.background;
+ }
+
+ Item {
+ id: iconAndLabel
+ property real xMargins: icon.visible ? (UI.PADDING_XLARGE * (label.visible ? 3 : 2)) : (UI.BUTTON_LABEL_MARGIN * 2)
+ property real prefferedWidth: xMargins + (icon.visible ? icon.width : 0) + (label.visible ? label.prefferedSize.width : 0)
+
+ width: xMargins + (icon.visible ? icon.width : 0) + (label.visible? label.width : 0)
+ height: platformStyle.buttonHeight
+
+ anchors.verticalCenter: button.verticalCenter
+ anchors.horizontalCenter: button.horizontalCenter
+ anchors.verticalCenterOffset: -1
+
+ Image {
+ id: icon
+ source: button.iconSource
+ x: UI.PADDING_XLARGE
+ anchors.verticalCenter: iconAndLabel.verticalCenter
+ width: UI.SIZE_ICON_DEFAULT
+ height: UI.SIZE_ICON_DEFAULT
+ visible: source != ""
+ }
+
+ Label {
+ id: label
+ x: icon.visible ? (icon.x + icon.width + UI.PADDING_XLARGE) : UI.BUTTON_LABEL_MARGIN
+ anchors.verticalCenter: iconAndLabel.verticalCenter
+ anchors.verticalCenterOffset: 1
+
+ property real availableWidth: button.width - iconAndLabel.xMargins - (icon.visible ? icon.width : 0)
+ width: Math.min(prefferedSize.width, availableWidth)
+
+ elide: Text.ElideRight
+ font.family: button.platformStyle.fontFamily
+ font.weight: button.platformStyle.fontWeight
+ font.pixelSize: button.platformStyle.fontPixelSize
+ font.capitalization: button.platformStyle.fontCapitalization
+ color: !enabled ? button.platformStyle.disabledTextColor :
+ pressed ? button.platformStyle.pressedTextColor :
+ checked ? button.platformStyle.checkedTextColor :
+ button.platformStyle.textColor;
+ text: ""
+ visible: text != ""
+
+ Label {
+ id: prefferedSize
+ font: parent.font
+ text: parent.text
+ visible: false
+ }
+ property alias prefferedSize: prefferedSize
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+
+ onClicked: {
+ if (button.checkable)
+ button.checked = !button.checked;
+ button.clicked();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ buttonHeight: UI.SIZE_SMALL_BUTTON
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+Item {
+ id: listItem
+
+ signal clicked
+ property alias pressed: mouseArea.pressed
+
+ property int titleSize: UI.LIST_TILE_SIZE
+ property int titleWeight: Font.Bold
+ property string titleFont: UI.FONT_FAMILY
+ property color titleColor: theme.inverted ? UI.LIST_TITLE_COLOR_INVERTED : UI.LIST_TITLE_COLOR
+ property color titleColorPressed: theme.inverted ? UI.LIST_TITLE_COLOR_PRESSED_INVERTED : UI.LIST_TITLE_COLOR_PRESSED
+
+ property int subtitleSize: UI.LIST_SUBTILE_SIZE
+ property int subtitleWeight: Font.Normal
+ property string subtitleFont: UI.FONT_FAMILY_LIGHT
+ property color subtitleColor: theme.inverted ? UI.LIST_SUBTITLE_COLOR_INVERTED : UI.LIST_SUBTITLE_COLOR
+ property color subtitleColorPressed: theme.inverted ? UI.LIST_SUBTITLE_COLOR_PRESSED_INVERTED : UI.LIST_SUBTITLE_COLOR_PRESSED
+
+ height: UI.LIST_ITEM_HEIGHT
+ width: parent.width
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ // Fill page porders
+ anchors.leftMargin: -UI.MARGIN_XLARGE
+ anchors.rightMargin: -UI.MARGIN_XLARGE
+ visible: mouseArea.pressed
+ source: theme.inverted ? "image://theme/meegotouch-panel-inverted-background-pressed" : "image://theme/meegotouch-panel-background-pressed"
+ }
+
+ Row {
+ anchors.fill: parent
+ spacing: UI.LIST_ITEM_SPACING
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: model.iconSource ? true : false
+ width: UI.LIST_ICON_SIZE
+ height: UI.LIST_ICON_SIZE
+ source: model.iconSource ? model.iconSource : ""
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+
+ Label {
+ id: mainText
+ text: model.title
+ font.family: listItem.titleFont
+ font.weight: listItem.titleWeight
+ font.pixelSize: listItem.titleSize
+ color: mouseArea.pressed ? listItem.titleColorPressed : listItem.titleColor
+ }
+
+ Label {
+ id: subText
+ text: model.subtitle ? model.subtitle : ""
+ font.family: listItem.subtitleFont
+ font.weight: listItem.subtitleWeight
+ font.pixelSize: listItem.subtitleSize
+ color: mouseArea.pressed ? listItem.subtitleColorPressed : listItem.subtitleColor
+
+ visible: text != ""
+ }
+ }
+ }
+ MouseArea {
+ id: mouseArea;
+ anchors.fill: parent
+ onClicked: {
+ listItem.clicked();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0 // needed for the custom image loader
+
+/*
+ Class: MoreIndicator
+ Component to indicate that more content is available for the user.
+
+ A more indicator is a component that displayes an arrow to show the user that there are more contents
+ available.
+*/
+
+Image {
+ source: !theme.inverted ?
+ "image://theme/icon-m-common-drilldown-arrow" :
+ "image://theme/icon-m-common-drilldown-arrow-inverse"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND
+ checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button-negative-background"
+ pressedBackground: "image://theme/meegotouch-button-negative-background-pressed"
+ disabledBackground: "image://theme/meegotouch-button-negative-background-disabled"
+ checkedBackground: "image://theme/meegotouch-button-negative-background-selected"
+ checkedDisabledBackground: "image://theme/meegotouch-button-negative-background-disabled-selected"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+Rectangle {
+ id: root
+
+ // Common public API
+
+ // Input. Set to true if user is signed in to Nokia account.
+ // Account email using agreement is shown if user is signed in.
+ // Otherwise email input box is shown instead.
+ property bool isSignedIn: false
+
+ // Input. Array of localised UI strings:
+ // header - 'Tell us what you think'
+ // question - 'How likely ... ?'
+ // notLikely - 'Not at all\nlikely'
+ // extremelyLikely - 'Extremely\nlikely'
+ // selectScore - 'You must select ...'
+ // commentsInputLabel - 'Please tell us why ...'
+ // contactAgreement - 'You can contact me using ...'
+ // emailInputLabel - 'You can contact me for details...'
+ // emailPlaceholderText - 'Your email address'
+ // emailSipActionKeyLabel - 'Done'
+ // invalidEmail - 'Invalid email address'
+ // legalText - 'Your information will be ...'
+ // submit - 'Submit'
+
+ property variant uiString: QtObject {}
+
+ // Input. Array of horizontal alignments for strings. Accept same
+ // values as Text { horizontalAlignment: ... } e.g. Text.AlignLeft, Text.AlignRight and so on.
+ // By default all text strings aligned to the left.
+ // header
+ // question
+ // selectScore
+ // commentsInputLabel
+ // contactAgreement
+ // emailInputLabel
+ // invalidEmail
+ // legalText
+
+ property variant uiHorizontalAlignment: QtObject {}
+
+ // Promoter score, between 0 ~ 10
+ property alias score: scoreSlider.value
+
+ // True if user touched score slider
+ property alias scoreTouched: scoreSlider.touched
+
+ // Optional comments text
+ property alias comments: commentsText.text
+
+ // Optional email address
+ // emailAddress shall be ignored if isSignedIn is true.
+ property alias emailAddress: emailAddressField.text
+
+ // True if user agrees to be contacted using Nokia Account email address.
+ // useEmail shall be ignored if isSignedIn is false.
+ property alias useEmail: useEmailCheckBox.checked
+
+ // Signal emitted when 'Submit' button is clicked and form passes validation.
+ signal submit()
+
+ height: childrenRect.height
+ color: "#E0E1E2"
+
+ QtObject {
+ id: internal
+
+ property variant defaultValidator: RegExpValidator{regExp: /.*/}
+ property variant emailValidator: RegExpValidator{regExp: /^\w([a-zA-Z0-9._-]+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/}
+
+ function validateForm() {
+
+ var isValid = true;
+
+ if (!scoreSlider.touched) {
+ sliderErrorLabel.visible = true;
+ isValid = false;
+ }
+
+ if (emailAddress && emailAddress.length > 0) {
+ var validator = internal.emailValidator
+ emailAddressField.validator = validator;
+ var result = emailAddressField.acceptableInput;
+ if (result)emailAddressField.validator = internal.defaultValidator;
+ mouseArea.enabled = !result;
+ invalidEmailLabel.visible = !result;
+ if (!result)isValid = false;
+ }
+
+ return isValid;
+ }
+ }
+
+ Column {
+ id: formContent
+
+ anchors {
+ left: parent.left
+ leftMargin: 16
+ right: parent.right
+ rightMargin: 16
+ }
+ height: childrenRect.height
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Label {
+ id: header
+
+ anchors {
+ left: parent.left
+ leftMargin: 18 - parent.anchors.leftMargin
+ right: parent.right
+ }
+
+ wrapMode: Text.Wrap
+ font.pixelSize: 40
+ color: "#282828"
+ horizontalAlignment: uiHorizontalAlignment.header || Text.AlignLeft
+ text: uiString.header ||
+ "!!Tell us what you think"
+ }
+
+ Item {
+ width: parent.width
+ height: 12
+ }
+
+ // Question
+ Label {
+ width: parent.width
+ wrapMode: Text.Wrap
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: uiHorizontalAlignment.question || Text.AlignLeft
+ text: uiString.question ||
+ "!!How likely are you to recommend this app to a friend or a colleague?"
+ }
+
+ Item {
+ width: parent.width
+ height: 22
+ }
+
+ // Numbers
+ Row {
+ width: parent.width
+ height: childrenRect.height
+
+ Label {
+ width: parent.width/2
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: Text.AlignLeft
+ text: "0"
+ }
+ Label {
+ width: parent.width/2
+ font.pixelSize: 24
+ color: "#282828"
+ horizontalAlignment: Text.AlignRight
+ text: "10"
+ }
+ }
+
+ Slider {
+ id: scoreSlider
+ objectName: "slider_nps_score"
+
+ property bool touched: false
+ width: parent.width
+ height: 64
+ maximumValue: 10
+ stepSize: 1
+ value: 5
+ valueIndicatorVisible: true
+
+ onPressedChanged: {
+ if (pressed) {
+ sliderErrorLabel.visible = false;
+ touched = true;
+ }
+ }
+ }
+
+ // Slider text
+ Row {
+ width: parent.width
+ height: childrenRect.height
+
+ Label {
+ width: parent.width/3
+ font.pixelSize: 18
+ color: "#282828"
+ horizontalAlignment: Text.AlignLeft
+ text: uiString.notLikely || "!!Not at all \nlikely"
+ }
+
+ Item {
+ width: parent.width/3
+ height: 1
+ }
+
+ Label {
+ width: parent.width/3
+ font.pixelSize: 18
+ color: "#282828"
+ horizontalAlignment: Text.AlignRight
+ text: uiString.extremelyLikely || "!!Extremely \nlikely"
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 8
+ visible: sliderErrorLabel.visible
+ }
+
+ // Slider error text
+ Label {
+ id: sliderErrorLabel
+ visible: false
+ width: parent.width
+ font.pixelSize: 18
+ color: "#FF3200"
+ horizontalAlignment: uiHorizontalAlignment.selectScore || Text.AlignLeft
+ text: uiString.selectScore ||
+ "!!You must select a rating"
+ }
+
+ Item {
+ width: parent.width
+ height: 18
+ }
+
+ Image {
+ width: parent.width + 16
+ x: 8 - parent.anchors.leftMargin
+ source: "image://theme/meegotouch-separator-background-horizontal"
+ fillMode: Image.TileHorizontally
+ }
+
+ Item {
+ width: parent.width
+ height: 7
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.commentsInputLabel || Text.AlignLeft
+ text: uiString.commentsInputLabel ||
+ "!!Please tell us why you gave this score (optional)"
+ }
+
+ SipAttributes {
+ id: sipAttributesDefault
+ }
+
+ // Comments
+ TextArea {
+ id: commentsText
+ width: parent.width
+ height: Math.max(118, implicitHeight)
+ platformSipAttributes: sipAttributesDefault
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Row {
+ visible: isSignedIn
+ width: parent.width
+
+ spacing: 16
+
+ CheckBox {
+ id: useEmailCheckBox
+ objectName: "check_nps_email"
+ anchors {
+ verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Label {
+ id: description
+ anchors {
+ verticalCenter: parent.verticalCenter
+ }
+
+ width: parent.width - useEmailCheckBox.width - parent.spacing
+ font.pixelSize: 22
+ wrapMode: Text.Wrap
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.contactAgreement || Text.AlignLeft
+ text: uiString.contactAgreement ||
+ "!!You can contact me for details using my Nokia Account e-mail."
+ }
+
+ }
+
+ Image {
+ width: parent.width + 16
+ x: 8 - parent.anchors.leftMargin
+ source: "image://theme/meegotouch-separator-background-horizontal"
+ fillMode: Image.TileHorizontally
+ visible: !isSignedIn
+ }
+
+ // Email address
+ Column {
+ id: emailAddressPane
+ width: parent.width
+ visible: !isSignedIn
+
+ Item {
+ width: parent.width
+ height: 7
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ horizontalAlignment: uiHorizontalAlignment.emailInputLabel || Text.AlignLeft
+ text: uiString.emailInputLabel ||
+ "!!You can contact me for details (Optional)"
+ }
+
+ TextField {
+ id: emailAddressField
+ objectName: "input_nps_email"
+ width: parent.width
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
+ placeholderText: uiString.emailPlaceholderText ||
+ "!!Your email address"
+ platformSipAttributes: SipAttributes {
+ actionKeyLabel: uiString.emailSipActionKeyLabel || ""
+ actionKeyHighlighted: !!uiString.emailSipActionKeyLabel
+ }
+
+ Keys.onReturnPressed: {
+ if (internal.validateForm()) {
+ platformCloseSoftwareInputPanel();
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ enabled: false
+ z: 10
+ onClicked: {
+ enabled = false;
+ invalidEmailLabel.visible = false;
+ emailAddressField.forceActiveFocus();
+ emailAddressField.validator = internal.defaultValidator;
+ }
+ }
+
+ onTextChanged: {
+ if (invalidEmailLabel.visible) {
+ invalidEmailLabel.visible = false;
+ emailAddressField.validator = internal.defaultValidator;
+ }
+ }
+ }
+
+ Label {
+ id: invalidEmailLabel
+ visible: false
+ width: parent.width
+ font.pixelSize: 18
+ color: "#FF3200"
+ horizontalAlignment: uiHorizontalAlignment.invalidEmail || Text.AlignLeft
+ text: uiString.invalidEmail ||
+ "!!Invalid email address"
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: 22
+ color: "#505050"
+ wrapMode: Text.Wrap
+ horizontalAlignment: uiHorizontalAlignment.legalText || Text.AlignLeft
+ text: uiString.legalText ||
+ "!!Your information will be treated according to Nokia privacy policy."
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+
+ Button {
+ objectName: "btn_nps_submit"
+ width: 322
+
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+
+ text: uiString.submit || "!!Submit"
+
+ onClicked: {
+ if (internal.validateForm()) {
+ submit()
+ }
+ }
+ }
+
+ Item {
+ width: parent.width
+ height: 16
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+/*
+ Class: PageIndicator
+ Component to indicate the page user is currently viewing.
+
+ A page indicator is a component that shows the number of availabe pages as well as the page the user is
+ currently on. The user can also specify the display type to select the normal/inverted visual.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: totalPages
+ * [int] The total number of pages. This value should be larger than 0.
+ */
+ property int totalPages: 0
+
+ /*
+ * Property: currentPage
+ * [int] The current page the user is on. This value should be larger than 0.
+ */
+ property int currentPage: 0
+
+ /*
+ * Property: inverted
+ * [bool] Specify whether the visual for the rating indicator uses the inverted color. The value is
+ * false for use with a light background and true for use with a dark background.
+ */
+ property bool inverted: theme.inverted
+
+ implicitWidth: currentImage.width * totalPages + (totalPages - 1) * internal.spacing
+ implicitHeight: currentImage.height
+
+ /* private */
+ QtObject {
+ id: internal
+
+ property int spacing: 8
+
+ property string totalPagesImageSource: inverted ?
+ "image://theme/meegotouch-inverted-pageindicator-page" :
+ "image://theme/meegotouch-pageindicator-page"
+ property string currentPageImageSource: inverted ?
+ "image://theme/meegotouch-inverted-pageindicator-page-current" :
+ "image://theme/meegotouch-pageindicator-page-current"
+
+ property bool init: true
+
+
+ function updateUI() {
+
+ if(totalPages <=0) {
+ totalPages = 1;
+ currentPage = 1;
+ } else {
+ if(currentPage <=0)
+ currentPage = 1;
+ if(currentPage > totalPages)
+ currentPage = totalPages;
+ }
+
+ frontRepeater.model = currentPage - 1;
+ backRepeater.model = totalPages - currentPage;
+ }
+ }
+
+ Component.onCompleted: {
+ internal.updateUI();
+ internal.init = false;
+ }
+
+ onTotalPagesChanged: {
+ if(!internal.init)
+ internal.updateUI();
+ }
+
+ onCurrentPageChanged: {
+ if(!internal.init)
+ internal.updateUI();
+ }
+
+ Row {
+ Repeater {
+ id: frontRepeater
+
+ Item {
+ height: currentImage.height
+ width: currentImage.width + internal.spacing
+
+ Image {
+ source: internal.totalPagesImageSource
+ }
+ }
+ }
+
+ Image {
+ id: currentImage
+ source: internal.currentPageImageSource
+ }
+
+ Repeater {
+ id: backRepeater
+
+ Item {
+ height: currentImage.height
+ width: currentImage.width + internal.spacing
+
+ Image {
+ source: internal.totalPagesImageSource
+ anchors.right: parent.right
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND
+ checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button-positive-background"
+ pressedBackground: "image://theme/meegotouch-button-positive-background-pressed"
+ disabledBackground: "image://theme/meegotouch-button-positive-background-disabled"
+ checkedBackground: "image://theme/meegotouch-button-positive-background-selected"
+ checkedDisabledBackground: "image://theme/meegotouch-button-positive-background-disabled-selected"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import Qt.labs.components 1.1 as QtComponents
+
+/*
+ Class: RatingIndicator
+ Component to indicate user specified ratings.
+
+ A rating indicator is a component that shows the rating value within the maximum allowed range according
+ to the user's specification. The user can also specify the display type to select the positive/negative
+ visual. Optionally, the user can also specify a count value that will be displayed next to the images.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: maximumValue
+ * [double] The maximum rating. The number should be larger or equal to 0.
+ */
+ property alias maximumValue: model.maximumValue
+
+ /*
+ * Property: ratingValue
+ * [double] The rating value. The number should be larger or equal to 0.
+ */
+ property alias ratingValue: model.value
+
+ /*
+ * Property: count
+ * [int] A number to be displayed next to the rating images. It is usually used to count the number of
+ * votes cast. It is only displayed if a number larger or equal to 0 is specified.
+ */
+ property int count: -1
+
+ /*
+ * Property: inverted
+ * [string] Specify whether the visual for the rating indicator uses the inverted color. The value is
+ * false for use with a light background and true for use with a dark background.
+ */
+ property bool inverted: theme.inverted
+
+ implicitHeight: Math.max(background.height, text.paintedHeight);
+ implicitWidth: background.width + (count >= 0 ? internal.textSpacing + text.paintedWidth : 0);
+
+ QtComponents.RangeModel {
+ id: model
+ value: 0.0
+ minimumValue: 0.0
+ maximumValue: 0.0
+ }
+
+ QtObject {
+ id: internal
+
+ property int imageWidth: 16
+ property int imageHeight: 16
+ property int indicatorSpacing: 5 // spacing between images
+ property int textSpacing: 8 // spacing between image and text
+ property url backgroundImageSource: inverted ?
+ "image://theme/meegotouch-indicator-rating-inverted-background-star" :
+ "image://theme/meegotouch-indicator-rating-background-star"
+ property url indicatorImageSource: inverted ?
+ "image://theme/meegotouch-indicator-rating-inverted-star" :
+ "image://theme/meegotouch-indicator-rating-star"
+ property string textColor: inverted ? "#fafafa" : "#505050"
+ }
+
+ Image {
+ id: background
+ width: internal.imageWidth * maximumValue + (Math.max(Math.ceil(maximumValue-1), 0)) * internal.indicatorSpacing;
+ height: internal.imageHeight
+ anchors.verticalCenter: height < text.paintedHeight ? text.verticalCenter : undefined
+ fillMode: Image.Tile
+ source: internal.backgroundImageSource
+
+ Image {
+ id: indicator
+ width: internal.imageWidth * ratingValue + Math.max((Math.ceil(ratingValue) - 1), 0) * internal.indicatorSpacing
+ height: internal.imageHeight
+ fillMode: Image.Tile
+ source: internal.indicatorImageSource
+ }
+ }
+
+ Text {
+ id: text
+ visible: count >= 0
+ text: "(" + count + ")"
+ color: internal.textColor
+ font { family: "Nokia Standard Light"; pixelSize: 18 }
+ anchors.left: background.right
+ anchors.leftMargin: internal.textSpacing
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import com.nokia.extras 1.1
+import "constants.js" as UI
+
+InfoBanner
+{
+
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import com.nokia.extras 1.1
+import "constants.js" as C
+import "TumblerIndexHelper.js" as TH
+
+/*
+ Class: TimePickerDialog
+ Dialog that shows a time picker.
+*/
+
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: hour
+ * [int] The displayed hour (in 24h format).
+ */
+ property int hour: 0
+
+ /*
+ * Property: minute
+ * [int] The displayed minute.
+ */
+ property int minute: 0
+
+ /*
+ * Property: second
+ * [int] The displayed second.
+ */
+ property int second: 0
+
+ /*
+ * Property: fields
+ * [int=DateTime.All] Sets if the time picker should show hours, minutes,
+ * and/or seconds.
+ * (DateTime.Hours, DateTime.Minutes,
+ * DateTime.Seconds, DateTime.All)
+ */
+ property int fields: DateTime.All
+
+ /*
+ * Property: hourMode
+ * [int=DateTime.TwentyFourHours] Sets if the time picker should show time in 24-hour clock
+ * or 12-hour clock format.
+ * (DateTime.TwentyFourHours, DateTime.TwelveHours)
+ */
+ property int hourMode: dateTime.hourMode() //DateTime.TwentyFourHours
+
+ /*
+ * Property: mode24Hour
+ * [bool=false] Sets if the time picker should show time in military time (24h).
+ */
+ property bool mode24Hour
+
+ /*
+ * Property: showSeconds
+ * [bool=true] Sets if the time picker should show seconds. Modifying this value
+ * after initialization will uninitialize everything.
+ */
+ property bool showSeconds
+
+ /*
+ * Property: acceptButtonText
+ * [string] Optional, the button text for the accept button.
+ */
+ property alias acceptButtonText: acceptButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] Optional, the button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "title"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ height: 300
+ width: parent.width
+
+ Tumbler {
+ id: tumbler
+
+ columns: [hourColumn, minuteColumn, secondColumn, meridiemColumn]
+ height: 300
+ privateDelayInit: true
+
+ TumblerColumn {
+ id: hourColumn
+ items: ListModel {
+ id: hourList
+ }
+ label: "HR"
+ selectedIndex: root.hour - ((root.hourMode == DateTime.TwelveHours && root.hour > 11) ? 12 : 0)
+ visible: fields & DateTime.Hours
+ }
+
+ TumblerColumn {
+ id: minuteColumn
+ items: ListModel {
+ id: minuteList
+ }
+ label: "MIN"
+ selectedIndex: root.minute
+ visible: fields & DateTime.Minutes
+ }
+
+ TumblerColumn {
+ id: secondColumn
+ items: ListModel {
+ id: secondList
+ }
+ label: "SEC"
+ selectedIndex: root.second
+ visible: fields & DateTime.Seconds
+ }
+
+ TumblerColumn {
+ id: meridiemColumn
+ items: ListModel {
+ id: meridiemList
+ }
+ selectedIndex: root.hour > 11 ? 1: 0
+ visible: root.hourMode == DateTime.TwelveHours
+ privateLoopAround: false
+ }
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: acceptButton
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ Button {
+ id: rejectButton
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ }
+ }
+ onMode24HourChanged: {
+ console.log("The property 'mode24Hour' from TimePickerDialog is deprecated. Please use 'hourMode' instead.")
+ root.hourMode = mode24Hour == true ? DateTime.TwentyFourHours : DateTime.TwelveHours
+ }
+ onShowSecondsChanged: {
+ console.log("The property 'showSeconds' from TimePickerDialog is deprecated. Please use 'fields' instead.")
+ root.fields = showSeconds == true ? DateTime.All : DateTime.Hours | DateTime.Minutes
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ TH.saveIndex(tumbler);
+ if (!internal.initialised)
+ internal.initializeDataModels();
+ }
+ }
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ if (root.hourMode == DateTime.TwelveHours)
+ root.hour = hourColumn.selectedIndex + (meridiemColumn.selectedIndex > 0 ? 12 : 0);
+ else
+ root.hour = hourColumn.selectedIndex;
+ root.minute = minuteColumn.selectedIndex;
+ root.second = secondColumn.selectedIndex;
+ }
+ onRejected: {
+ TH.restoreIndex(tumbler);
+ }
+ onHourModeChanged: {
+ hourList.clear();
+ var tmp = hourColumn.selectedIndex;
+ if (root.hourMode == DateTime.TwentyFourHours) {
+ tmp = (root.hour < 12 ? tmp : tmp + 12)
+ for (var i = 0; i < 24; ++i)
+ hourList.append({"value" : (i < 10 ? "0" : "") + i});
+ } else {
+ tmp = (root.hour < 12 ? tmp : tmp - 12)
+ hourList.append({"value" : 12 + ""});
+ for (var i = 1; i < 12; ++i)
+ hourList.append({"value" : i + ""});
+ }
+ hourColumn.selectedIndex = -1;
+ hourColumn.selectedIndex = tmp;
+ }
+ onHourChanged: {
+ internal.validateTime()
+ hourColumn.selectedIndex = root.hour - ((root.hourMode == DateTime.TwelveHours && root.hour > 11) ? 12 : 0)
+ meridiemColumn.selectedIndex = root.hour > 11 ? 1: 0
+ }
+ onMinuteChanged: {
+ internal.validateTime()
+ minuteColumn.selectedIndex = root.minute
+ }
+ onSecondChanged: {
+ internal.validateTime()
+ secondColumn.selectedIndex = root.second
+ }
+
+ QtObject {
+ id: internal
+
+ property variant initialised: false
+
+ function initializeDataModels() {
+ if (root.hourMode == DateTime.TwelveHours) {
+ hourList.append({"value" : 12 + ""});
+ for (var i = 1; i < 12; ++i)
+ hourList.append({"value" : i + ""});
+ }
+ for (var i = 0; i < 60; ++i) {
+ minuteList.append({"value" : (i < 10 ? "0" : "") + i });
+ secondList.append({"value" : (i < 10 ? "0" : "") + i });
+ }
+ meridiemList.append({"value" : dateTime.amText()});
+ meridiemList.append({"value" : dateTime.pmText()});
+
+ tumbler.privateInitialize();
+ internal.initialised = true;
+ }
+
+ function validateTime() {
+ root.hour = Math.max(0, Math.min(23, root.hour))
+ root.minute = Math.max(0, Math.min(59, root.minute))
+ root.second = Math.max(0, Math.min(59, root.second))
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var __columns = [];
+var __autoColumnWidth = 0;
+var __suppressLayoutUpdates = false;
+
+function initialize() {
+ // check the width requested by fixed width columns
+ var requestedWidth = 0;
+ var requestedCount = 0;
+ var invisibleCount = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].visible) {
+ if (columns[i].width > 0 && !columns[i].privateIsAutoWidth) {
+ requestedWidth += columns[i].width;
+ requestedCount++;
+ }
+ } else {
+ invisibleCount++;
+ }
+ }
+
+ // allocate the rest to auto width columns
+ if ((columns.length - requestedCount - invisibleCount) > 0) {
+ __autoColumnWidth = Math.floor((parent.width - requestedWidth) / (columns.length - requestedCount - invisibleCount));
+ }
+
+ for (var i = 0; i < columns.length; i++) {
+ var comp = Qt.createComponent("TumblerTemplate.qml");
+ var newObj = comp.createObject(tumblerRow);
+ if (!columns[i].width || columns[i].privateIsAutoWidth) {
+ columns[i].width = __autoColumnWidth;
+ columns[i].privateIsAutoWidth = true;
+ }
+ if (columns[i].label) {
+ // enable label for the tumbler
+ internal.hasLabel = true;
+ }
+ newObj.height = root.height;
+ newObj.index = i;
+ newObj.tumblerColumn = columns[i];
+ newObj.widthChanged.connect(layout);
+ newObj.visibleChanged.connect(layout);
+ __columns.push(newObj);
+ }
+ privateTemplates = __columns;
+}
+
+function clear() {
+ var count = __columns.length;
+ for (var i = 0; i < count; i++) {
+ var tmp = __columns.pop();
+ tmp.destroy();
+ }
+}
+
+function forceUpdate() {
+ for (var i = 0; i < columns.length; i++) {
+ columns[i].selectedIndex = __columns[i].view.currentIndex;
+ }
+}
+
+function layout() {
+ if (__suppressLayoutUpdates) {
+ // guard against onWidthChanged triggering again during this process
+ return;
+ }
+ var requestedWidth = 0;
+ var requestedCount = 0;
+ var invisibleCount = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].visible) {
+ var w = columns[i].width;
+ var a = columns[i].privateIsAutoWidth;
+ if (!a || (a && w != __autoColumnWidth)) {
+ requestedWidth += columns[i].width;
+ requestedCount++;
+ columns[i].privateIsAutoWidth = false;
+ } else {
+ columns[i].privateIsAutoWidth = true;
+ }
+ } else {
+ invisibleCount++;
+ }
+ }
+
+ if ((columns.length - requestedCount - invisibleCount) > 0) {
+ __autoColumnWidth = Math.floor((parent.width - requestedWidth) / (columns.length - requestedCount - invisibleCount));
+ }
+
+ // guard against onWidthChanged triggering again during this process
+ __suppressLayoutUpdates = true;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].privateIsAutoWidth) {
+ columns[i].width = __autoColumnWidth;
+ }
+ }
+ __suppressLayoutUpdates = false;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "Tumbler.js" as Engine
+import "constants.js" as C
+
+/*
+ Class: Tumbler
+ A tumbler.
+*/
+ImplicitSizeItem {
+ id: root
+
+ /*
+ * Property: items
+ * [ListModel] Array of ListModel for each column of the dialog.
+ */
+ property list<Item> columns
+
+ /*
+ * Event: changed
+ * Is emitted when the value of the tumbler changes.
+ */
+ signal changed(int index)
+
+ /* private */
+ property bool privateDelayInit: false
+ property list<Item> privateTemplates
+
+ implicitWidth: C.TUMBLER_WIDTH
+ implicitHeight: screen.displayWidth > screen.displayHeight ?
+ C.TUMBLER_HEIGHT_LANDSCAPE :
+ C.TUMBLER_HEIGHT_PORTRAIT
+
+ /* private */
+ function privateInitialize() {
+ if (!internal.initialized) {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+
+ /* private */
+ function privateForceUpdate() {
+ Engine.forceUpdate();
+ }
+
+ anchors.fill: parent
+ clip: true
+ Component.onCompleted: {
+ if (!privateDelayInit && !internal.initialized) {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+ onChanged: {
+ if (internal.movementCount == 0)
+ Engine.forceUpdate();
+ }
+ onColumnsChanged: {
+ if (internal.initialized) {
+ // when new columns are added, the system first removes all
+ // the old columns
+ internal.initialized = false;
+ Engine.clear();
+ internal.reInit = true;
+ } else if (internal.reInit && columns.length > 0) {
+ // timer is used because the new columns are added one by one
+ // we only want to act after the last column is added
+ internal.reInit = false;
+ columnChangedTimer.restart();
+ }
+ }
+ onWidthChanged: {
+ Engine.layout();
+ }
+
+ QtObject {
+ id: internal
+
+ property int movementCount: 0
+ property bool initialized: false
+ property bool reInit: false
+ property bool hasLabel: false
+
+ property Timer timer: Timer {
+ id: columnChangedTimer
+ interval: 50
+ onTriggered: {
+ Engine.initialize();
+ internal.initialized = true;
+ }
+ }
+ }
+
+ BorderImage {
+ width: parent.width
+ height: internal.hasLabel ?
+ parent.height - C.TUMBLER_LABEL_HEIGHT : // decrease by bottom text height
+ parent.height
+ source: "image://theme/" + theme.colorString + "meegotouch-list-fullwidth-background-selected"
+ anchors.top: parent.top
+ border { left: C.TUMBLER_BORDER_MARGIN; top: C.TUMBLER_BORDER_MARGIN; right: C.TUMBLER_BORDER_MARGIN; bottom: C.TUMBLER_BORDER_MARGIN }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: internal.hasLabel ?
+ parent.height - C.TUMBLER_LABEL_HEIGHT - 2 * C.TUMBLER_BORDER_MARGIN : // decrease by bottom text & border height
+ parent.height - 2*C.TUMBLER_BORDER_MARGIN
+ color: C.TUMBLER_COLOR
+ anchors { top: parent.top; topMargin: C.TUMBLER_BORDER_MARGIN }
+ }
+
+ Row {
+ id: tumblerRow
+ anchors { fill: parent; topMargin: 1 }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "constants.js" as UI
+
+/*
+ Class: TumblerButton
+ button component that has a label and has click event handling.
+
+ A button is a component that accepts user input and send a clicked() signal for
+ the application to handle. The button has resizable properties, event
+ handling, and can undergo state changes and transitions.
+
+ The TumblerButton has a fixed width. Longer text will be elided.
+ To avoid that for longer texts please set the implicitWidth explicitly.
+
+ <code>
+ // Create a button with different icon states:
+ // This approach works for all supported states: normal, disabled, pressed, selected, selected && disabled
+ TumblerButton {
+ text: "Tumbler Button"
+ }
+ </code>
+*/
+Item {
+ id: tumblerbutton
+
+ /*
+ * Property: text
+ * [string] The text displayed on button.
+ */
+ property string text: "Get Value"
+
+ /*
+ * Property: pressed
+ * [bool] (ReadOnly) Is true when the button is pressed
+ */
+ property alias pressed: mouse.pressed
+
+ property QtObject style: TumblerButtonStyle{}
+
+ /*
+ * Event: clicked
+ * Is emitted after the button is released
+ */
+ signal clicked
+
+ height: UI.SIZE_BUTTON
+ width: UI.WIDTH_TUMBLER_BUTTON // fixed width to prevent jumping size after selecting value from tumbler
+
+ BorderImage {
+ border { top: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS;
+ left: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS }
+ anchors.fill: parent
+ source: mouse.pressed ?
+ tumblerbutton.style.pressedBackground : tumblerbutton.enabled ?
+ tumblerbutton.style.background : tumblerbutton.style.disabledBackground;
+ }
+
+ MouseArea {
+ id: mouse
+
+ anchors.fill: parent
+ enabled: parent.enabled
+ onClicked: {
+ parent.clicked()
+ }
+ }
+
+ Image {
+ id: icon
+
+ anchors { right: (label.text != "") ? parent.right : undefined;
+ rightMargin: UI.INDENT_DEFAULT;
+ horizontalCenter: (label.text != "") ? undefined : parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ height: sourceSize.height
+ width: sourceSize.width
+ source: "image://theme/meegotouch-combobox-indicator" +
+ (tumblerbutton.style.inverted ? "-inverted" : "") +
+ (tumblerbutton.enabled ? "" : "-disabled") +
+ (mouse.pressed ? "-pressed" : "")
+ }
+
+ Text {
+ id: label
+
+ anchors { left: parent.left; right: icon.left;
+ leftMargin: UI.INDENT_DEFAULT; rightMargin: UI.INDENT_DEFAULT;
+ verticalCenter: parent.verticalCenter }
+ font { family: UI.FONT_FAMILY; pixelSize: UI.FONT_DEFAULT_SIZE;
+ bold: UI.FONT_BOLD_BUTTON; capitalization: tumblerbutton.style.fontCapitalization }
+ text: tumblerbutton.text
+ color: (mouse.pressed) ?
+ tumblerbutton.style.pressedTextColor :
+ (tumblerbutton.enabled) ?
+ tumblerbutton.style.textColor : tumblerbutton.style.disabledTextColor ;
+ horizontalAlignment: Text.AlignLeft
+ elide: Text.ElideRight
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as UI
+
+ButtonStyle {
+ // Text Color
+ textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ disabledTextColor: inverted ? UI.COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND : UI.COLOR_BUTTON_DISABLED_FOREGROUND
+
+ // Background
+ background: "image://theme/meegotouch-button" + __invertedString + "-background"
+ pressedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-pressed"
+ disabledBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ property variant items
+ property string label
+ property int selectedIndex: 0
+ property bool enabled: true
+
+ // private
+ property bool privateIsAutoWidth: false
+ property bool privateLoopAround: true
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import "constants.js" as C
+import "TumblerIndexHelper.js" as IH
+
+/*
+ Class: TumblerDialog
+ Dialog that shows a tumbler.
+*/
+Dialog {
+ id: root
+
+ /*
+ * Property: titleText
+ * [string] If not null, it will be used as the title text for the dialog.
+ * If further customization is needed, use property title instead
+ */
+ property alias titleText: title.text
+
+ /*
+ * Property: items
+ * [ListModel] Array of ListModel for each column of the dialog.
+ */
+ property alias columns: tumbler.columns
+
+ /*
+ * Property: acceptButtonText
+ * [string] The button text for the accept button.
+ */
+ property alias acceptButtonText: acceptButton.text
+
+ /*
+ * Property: rejectButtonText
+ * [string] The button text for the reject button.
+ */
+ property alias rejectButtonText: rejectButton.text
+
+ // TODO do not dismiss the dialog when empty area is clicked
+ style: DialogStyle {
+ titleBarHeight: 48
+ leftMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ rightMargin: screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted ? 16 : 215
+ centered: true
+ }
+ title: Text {
+ id: title
+ objectName: "titleText"
+ visible: text.length > 0
+ color: theme.selectionColor
+ font { pixelSize: 32; family: C.FONT_FAMILY_BOLD }
+ elide: Text.ElideRight
+ }
+ content: Item {
+ height: 300
+ width: parent.width
+ Tumbler {
+ id: tumbler
+ height: 300
+ privateDelayInit: true
+ }
+ }
+ buttons: Row {
+ height: 56
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+ Button {
+ id: acceptButton
+ onClicked: accept()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ visible: text != ""
+ }
+ Button {
+ id: rejectButton
+ onClicked: reject()
+ width: (root.width / 2) - 3
+ style: ButtonStyle { inverted: true }
+ visible: text != ""
+ }
+ }
+
+ QtObject {
+ id: internal
+ property bool init: true
+ }
+
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ tumbler.privateInitialize();
+
+ if (internal.init) {
+ IH.saveIndex(tumbler);
+ internal.init = false;
+ }
+ else {
+ // restore index when dialog was canceled.
+ // another case is when dialog was closed while tumbler was
+ // still rotating (Qt sets the index to the last rotated
+ // number, need to retore to a previously saved index in
+ // this case)
+ IH.restoreIndex(tumbler);
+ }
+ }
+ }
+
+ onAccepted: {
+ tumbler.privateForceUpdate();
+ IH.saveIndex(tumbler);
+ }
+
+ onRejected: {
+ IH.restoreIndex(tumbler);
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+TumblerDialog {
+ Component.onCompleted: console.log("DEPRECATION WARNING: TumblerDialogNew is being deprecated, please renmae to TumblerDialog instead. This component will be removed on April 25th, 2011")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var __origIndex = [];
+
+function saveIndex(src) {
+ __origIndex = [];
+ for (var i = 0; i < src.columns.length; i++) {
+ __origIndex.push(src.columns[i].selectedIndex);
+ }
+}
+
+function restoreIndex(src) {
+ for (var i = 0; i < __origIndex.length; i++) {
+ // position view at the right index then make sure selectedIndex
+ // is updated to reflect that
+ if (src.privateTemplates[i].view.currentIndex > __origIndex[i]) {
+ while (src.privateTemplates[i].view.currentIndex != __origIndex[i]) {
+ src.privateTemplates[i].view.decrementCurrentIndex()
+ }
+ } else if (src.privateTemplates[i].view.currentIndex < __origIndex[i]) {
+ while (src.privateTemplates[i].view.currentIndex != __origIndex[i]) {
+ src.privateTemplates[i].view.incrementCurrentIndex()
+ }
+ }
+ src.columns[i].selectedIndex = __origIndex[i];
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Tumbler {
+ Component.onCompleted: console.log("DEPRECATION WARNING: TumblerNew is being deprecated, please renmae to Tumbler instead. This component will be removed on April 25th, 2011")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "constants.js" as C
+
+Item {
+ id: template
+ objectName: "tumblerColumn" + index
+
+ property Item tumblerColumn
+ property int index: -1
+ property Item view: viewContainer.item
+
+ opacity: enabled ? C.TUMBLER_OPACITY_FULL : C.TUMBLER_OPACITY
+ width: childrenRect.width
+ visible: tumblerColumn ? tumblerColumn.visible : false
+ enabled: tumblerColumn ? tumblerColumn.enabled : true
+ onTumblerColumnChanged: {
+ if (tumblerColumn)
+ viewContainer.sourceComponent = tumblerColumn.privateLoopAround ? pViewComponent : lViewComponent;
+ }
+
+ Loader {
+ id: viewContainer
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: parent.height - container.height - 2*C.TUMBLER_BORDER_MARGIN // decrease by text & border heights
+ }
+
+ Component {
+ // Component for loop around column
+ id: pViewComponent
+ PathView {
+ id: pView
+
+ model: tumblerColumn ? tumblerColumn.items : undefined
+ currentIndex: tumblerColumn ? tumblerColumn.selectedIndex : 0
+ preferredHighlightBegin: (height / 2) / (C.TUMBLER_ROW_HEIGHT * pView.count)
+ preferredHighlightEnd: preferredHighlightBegin
+ highlightRangeMode: PathView.StrictlyEnforceRange
+ clip: true
+ delegate: defaultDelegate
+ highlight: defaultHighlight
+ interactive: template.enabled
+ anchors.fill: parent
+
+ onMovementStarted: {
+ internal.movementCount++;
+ }
+ onMovementEnded: {
+ internal.movementCount--;
+ root.changed(template.index) // got index from delegate
+ }
+
+ Rectangle {
+ width: 1
+ height: parent.height
+ color: C.TUMBLER_COLOR_TEXT
+ opacity: C.TUMBLER_OPACITY_LOW
+ }
+
+ path: Path {
+ startX: template.width / 2; startY: 0
+ PathLine {
+ x: template.width / 2
+ y: C.TUMBLER_ROW_HEIGHT * pView.count
+ }
+ }
+ }
+ }
+
+ Component {
+ // Component for non loop around column
+ id: lViewComponent
+ ListView {
+ id: lView
+
+ model: tumblerColumn ? tumblerColumn.items : undefined
+ currentIndex: tumblerColumn ? tumblerColumn.selectedIndex : 0
+ preferredHighlightBegin: Math.floor((height - C.TUMBLER_ROW_HEIGHT) / 2)
+ preferredHighlightEnd: preferredHighlightBegin + C.TUMBLER_ROW_HEIGHT
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ clip: true
+ delegate: defaultDelegate
+ highlight: defaultHighlight
+ interactive: template.enabled
+ anchors.fill: parent
+
+ onMovementStarted: {
+ internal.movementCount++;
+ }
+ onMovementEnded: {
+ internal.movementCount--;
+ root.changed(template.index) // got index from delegate
+ }
+
+ Rectangle {
+ width: 1
+ height: parent.height
+ color: C.TUMBLER_COLOR_TEXT
+ opacity: C.TUMBLER_OPACITY_LOW
+ }
+ }
+ }
+
+ Item {
+ id: container
+ anchors.top: viewContainer.bottom
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: internal.hasLabel ? C.TUMBLER_LABEL_HEIGHT : 0 // internal.hasLabel is from root tumbler
+
+ Text {
+ id: label
+
+ text: tumblerColumn ? tumblerColumn.label : ""
+ elide: Text.ElideRight
+ horizontalAlignment: "AlignHCenter"
+ color: C.TUMBLER_COLOR_LABEL
+ font { family: C.FONT_FAMILY_LIGHT; pixelSize: C.FONT_LIGHT_SIZE }
+ anchors { fill: parent; margins: C.TUMBLER_MARGIN}
+ }
+ }
+
+ Component {
+ id: defaultDelegate
+
+ Item {
+ width: tumblerColumn.width
+ height: C.TUMBLER_ROW_HEIGHT
+
+ Text {
+ id: txt
+ elide: Text.ElideRight
+ horizontalAlignment: "AlignHCenter"
+ color: C.TUMBLER_COLOR_TEXT
+ font { family: C.FONT_FAMILY_BOLD; pixelSize: C.FONT_DEFAULT_SIZE }
+ anchors { fill: parent; margins: C.TUMBLER_MARGIN }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (template.view.interactive) {
+ tumblerColumn.selectedIndex = index; // got index from delegate
+ root.changed(template.index);
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ try {
+ // Legacy. "value" use to be the role which was used by delegate
+ txt.text = value
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ txt.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ txt.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: defaultHighlight
+
+ Image {
+ id: highlight
+ objectName: "highlight"
+ width: tumblerColumn ? tumblerColumn.width : 0
+ height: C.TUMBLER_ROW_HEIGHT
+ source: "image://theme/" + theme.colorString + "meegotouch-list-fullwidth-background-selected-horizontal-center"
+ fillMode: Image.TileHorizontally
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+/* Margins */
+var INDENT_DEFAULT = 16;
+var CORNER_MARGINS = 22;
+var MARGIN_DEFAULT = 0;
+var MARGIN_XLARGE = 16;
+
+// ListDelegate
+var LIST_ITEM_MARGIN = 16
+var LIST_ITEM_SPACING = 16
+var LIST_ITEM_HEIGHT = 80
+var LIST_ICON_SIZE = 64
+var LIST_TILE_SIZE = 26
+var LIST_TITLE_COLOR = "#282828"
+var LIST_TITLE_COLOR_PRESSED = "#797979"
+var LIST_TITLE_COLOR_INVERTED = "#ffffff"
+var LIST_TITLE_COLOR_PRESSED_INVERTED = "#797979"
+var LIST_SUBTILE_SIZE = 22
+var LIST_SUBTITLE_COLOR = "#505050"
+var LIST_SUBTITLE_COLOR_PRESSED = "#797979"
+var LIST_SUBTITLE_COLOR_INVERTED = "#C8C8C8"
+var LIST_SUBTITLE_COLOR_PRESSED_INVERTED = "#797979"
+
+/* Font properties */
+var FONT_FAMILY = "Nokia Pure Text";
+var FONT_FAMILY_BOLD = "Nokia Pure Text Bold";
+var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
+var FONT_DEFAULT_SIZE = 24;
+var FONT_LIGHT_SIZE = 22;
+
+/* TUMBLER properties */
+var TUMBLER_COLOR_TEXT = "#FFFFFF";
+var TUMBLER_COLOR_LABEL = "#8C8C8C";
+var TUMBLER_COLOR = "#000000";
+var TUMBLER_OPACITY_FULL = 1.0;
+var TUMBLER_OPACITY = 0.4;
+var TUMBLER_OPACITY_LOW = 0.1;
+var TUMBLER_FLICK_VELOCITY = 700;
+var TUMBLER_ROW_HEIGHT = 64;
+var TUMBLER_LABEL_HEIGHT = 54;
+var TUMBLER_MARGIN = 16;
+var TUMBLER_BORDER_MARGIN = 1;
+var TUMBLER_WIDTH = 344;
+var TUMBLER_HEIGHT_PORTRAIT = 256;
+var TUMBLER_HEIGHT_LANDSCAPE = 192;
+
+/* Button styles */
+// Normal
+var COLOR_BUTTON_FOREGROUND = "#191919"; // Text color
+var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
+var COLOR_BUTTON_DISABLED_FOREGROUND = "#b2b2b4"; // Disabled
+// Inverted
+var COLOR_BUTTON_INVERTED_FOREGROUND = "#FFFFFF";
+var COLOR_BUTTON_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
+var COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND = "#f5f5f5"; // Disabled
+
+var SIZE_BUTTON = 51;
+var SIZE_SMALL_BUTTON = 43;
+var WIDTH_SMALL_BUTTON = 122;
+var WIDTH_TUMBLER_BUTTON = 222;
+
+var FONT_BOLD_BUTTON = true;
+
+var INFO_BANNER_OPACITY = 0.9
+var INFO_BANNER_LETTER_SPACING = -1.2
--- /dev/null
+plugin meegoextrasplugin
+CountBubble 1.0 CountBubble.qml
+DatePickerDialog 1.0 DatePickerDialog.qml
+InfoBanner 1.0 InfoBanner.qml
+ListDelegate 1.0 ListDelegate.qml
+MoreIndicator 1.0 MoreIndicator.qml
+NetPromoterScore 1.0 NetPromoterScore.qml
+PageIndicator 1.0 PageIndicator.qml
+RatingIndicator 1.0 RatingIndicator.qml
+TimePickerDialog 1.0 TimePickerDialog.qml
+Tumbler 1.0 Tumbler.qml
+TumblerColumn 1.0 TumblerColumn.qml
+TumblerButton 1.0 TumblerButton.qml
+TumblerDialog 1.0 TumblerDialog.qml
+ListButton 1.0 ListButton.qml
+ListButtonStyle 1.0 ListButtonStyle.qml
+NegativeButtonStyle 1.0 NegativeButtonStyle.qml
+PositiveButtonStyle 1.0 PositiveButtonStyle.qml
+SystemBanner 1.0 SystemBanner.qml
+TumblerButtonStyle 1.0 TumblerButtonStyle.qml
+TumblerNew 1.0 TumblerNew.qml
+TumblerDialogNew 1.0 TumblerDialogNew.qml
+CountBubble 1.1 CountBubble.qml
+DatePickerDialog 1.1 DatePickerDialog.qml
+InfoBanner 1.1 InfoBanner.qml
+ListDelegate 1.1 ListDelegate.qml
+MoreIndicator 1.1 MoreIndicator.qml
+NetPromoterScore 1.1 NetPromoterScore.qml
+PageIndicator 1.1 PageIndicator.qml
+RatingIndicator 1.1 RatingIndicator.qml
+TimePickerDialog 1.1 TimePickerDialog.qml
+Tumbler 1.1 Tumbler.qml
+TumblerColumn 1.1 TumblerColumn.qml
+TumblerButton 1.1 TumblerButton.qml
+TumblerDialog 1.1 TumblerDialog.qml
+ListButton 1.1 ListButton.qml
+ListButtonStyle 1.1 ListButtonStyle.qml
+NegativeButtonStyle 1.1 NegativeButtonStyle.qml
+PositiveButtonStyle 1.1 PositiveButtonStyle.qml
+SystemBanner 1.1 SystemBanner.qml
+TumblerButtonStyle 1.1 TumblerButtonStyle.qml
+TumblerNew 1.1 TumblerNew.qml
+TumblerDialogNew 1.1 TumblerDialogNew.qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+
+ // Common API
+ default property alias content: contentField.children
+
+ // Common API inherited from Popup:
+ /*
+ function open()
+ function close()
+
+ property QDeclarativeItem* visualParent
+ property int status
+ */
+
+ // platformStyle API
+ property Style platformStyle: MenuStyle{}
+ property alias style: root.platformStyle // Deprecated
+ property alias platformTitle: titleBar.children
+ property alias title: titleBar.children // Deprecated
+ property alias __footer: footerBar.children
+
+ // private api
+ property int __statusBarDelta: visualParent ? 0 :
+ __findItem( "appWindowContent") != null ? 0 :
+ __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").showStatusBar ? 36 : 0
+
+ property string __animationChief: "abstractMenu"
+ property int __pressDelay: platformStyle.pressDelay
+ property alias __statesWrapper: statesWrapper
+ property alias __menuPane: menuPane
+
+ // This item will find the object with the given objectName ... or will return
+ function __findItem( objectName ) {
+ var next = parent;
+
+ if (next != null) {
+ while (next) {
+ if(next.objectName == objectName){
+ return next;
+ }
+
+ next = next.parent;
+ }
+ }
+
+ return null;
+ }
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+ __faderBackground: platformStyle.faderBackground
+ __fadeInEasingType: platformStyle.fadeInEasingType
+ __fadeOutEasingType: platformStyle.fadeOutEasingType
+
+ anchors.fill: parent
+
+ // When application is minimized menu is closed.
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ if(!platformWindow.active)
+ close()
+ }
+ }
+
+ // This is needed for menus which are not instantiated inside the
+ // content window of the PageStackWindow:
+ Item {
+ id: roundedCorners
+ visible: root.status != DialogStatus.Closed && !visualParent
+ && __findItem( "pageStackWindow") != null && __findItem( "pageStackWindow").platformStyle.cornersVisible
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: parent.height - __statusBarDelta - 2
+ z: 10001
+
+ // compensate for the widening of the edges of the fader (which avoids artefacts during rotation)
+ anchors.topMargin: +1
+ anchors.rightMargin: +1
+ anchors.bottomMargin: +1
+ anchors.leftMargin: +1
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ // Shadows:
+ Image {
+ anchors.top : menuPane.top
+ anchors.right: menuPane.left
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.bottom : menuPane.top
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.top
+ anchors.left: menuPane.right
+ anchors.bottom : menuPane.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ visible: root.status != DialogStatus.Closed
+ }
+ Image {
+ anchors.top : menuPane.bottom
+ anchors.left: menuPane.left
+ anchors.right : menuPane.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ visible: root.status != DialogStatus.Closed
+ }
+
+ Item {
+ id: menuPane
+ //ToDo: add support for layoutDirection Qt::RightToLeft
+ x: platformStyle.leftMargin
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: (screen.currentOrientation == 1) || (screen.currentOrientation == 4) ?
+ /* Portrait */ titleBar.height + flickableContent.height + footerBar.height :
+ /* Landscape */ parent.height - platformStyle.topMargin - platformStyle.bottomMargin - __statusBarDelta
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+
+ state: __statesWrapper.state
+
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ root.platformStyle.background
+ anchors.fill : parent
+ border { left: 22; top: theme.inverted ? 124 : 22;
+ right: 22; bottom: theme.inverted ? 2 : 22 }
+ }
+
+ // this item contains the whole menu (content rectangle)
+ Item {
+ id: backgroundRect
+ anchors.fill: parent
+
+ Item {
+ id: titleBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: childrenRect.height
+ }
+
+ Item {
+ // Required to have the ScrollDecorator+Flickable handled
+ // by the column as a single item while keeping the
+ // ScrollDecorator working
+ id: flickableContent
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height
+ property int maxHeight : visualParent
+ ? visualParent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : root.parent
+ ? root.parent.height - platformStyle.topMargin - __statusBarDelta
+ - footerBar.height - titleBar.height
+ : 350
+
+ height: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding < maxHeight
+ ? contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ : maxHeight
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentWidth: parent.width
+ contentHeight: contentField.childrenRect.height + platformStyle.topPadding + platformStyle.bottomPadding
+ interactive: contentHeight > flickable.height
+ flickableDirection: Flickable.VerticalFlick
+ pressDelay: __pressDelay
+ clip: true
+
+ Item {
+ id: contentRect
+ height: contentField.childrenRect.height
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.topMargin: platformStyle.topPadding
+ anchors.bottomMargin: platformStyle.bottomPadding
+ anchors.leftMargin: platformStyle.leftPadding
+ anchors.rightMargin: platformStyle.rightPadding
+
+ Item {
+ id: contentField
+ anchors.fill: contentRect
+
+ function closeMenu() { root.close(); }
+ }
+ }
+ }
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: flickable
+ }
+ }
+
+ Item {
+ id: footerBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: backgroundRect.top
+ anchors.topMargin: titleBar.height + flickableContent.height
+ height: childrenRect.height
+ }
+
+ }
+ }
+
+ onPrivateClicked: close() // "reject()"
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "abstractMenu" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: __menuPane
+ opacity: 0.0
+ }
+ }
+ ]
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+PageStackWindow {
+
+ Component.onCompleted: {
+ print("Warning: ApplicationWindow is deprecated, use PageStackWindow instead");
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: "image://theme/meegotouch-applicationpage-background"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var children = []
+
+function cleanup()
+{
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ item.widthChanged.disconnect(relayout);
+ item.heightChanged.disconnect(relayout);
+ item.visibleChanged.disconnect(relayout);
+ }
+
+ children = [];
+}
+
+function updateChildren()
+{
+ cleanup();
+
+ var length = row.children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = row.children[i];
+
+ item.widthChanged.connect(relayout);
+ item.heightChanged.connect(relayout);
+ item.visibleChanged.connect(relayout);
+
+ children.push(item);
+ }
+
+ relayout();
+}
+
+function relayout()
+{
+ var ix = 0;
+ var ih = 0;
+
+ var length = children.length;
+
+ for (var i = 0; i < length; i++) {
+ var item = children[i];
+
+ if (!item.visible)
+ continue;
+
+ item.x = ix;
+ item.y = 0;
+ ih = Math.max(ih, item.height);
+ ix += item.width;
+ }
+
+ row.width = ix;
+ row.height = ih;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "BasicRow.js" as Private
+
+/*
+ This element should be used in place of the Row element to
+ avoid visual artifacts during the relayout operation.
+
+ The QML Row element updates its children position using a
+ singleShot, so a paint operation could happen before the items
+ are positioned in the right place.
+
+ This element reposition its children immediately to avoid this,
+ so it's recommended to be used with just a few elements, since
+ it's not optimized.
+
+ This element can be removed when the following bug is solved:
+ http://bugreports.qt.nokia.com/browse/QTBUG-18919
+*/
+
+Item {
+ id: row
+
+ onChildrenChanged: Private.updateChildren();
+ Component.onCompleted: Private.updateChildren();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+import "UIConstants.js" as UI
+import "TextAreaHelper.js" as AreaHelper
+
+// ### Display Entered / Exited! Pause animation when not "on display".
+// ### LayoutDirection
+
+ImplicitSizeItem {
+ id: root
+
+ property bool running: false
+
+ property Style platformStyle: BusyIndicatorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.size == "small" ? 24 : platformStyle.size == "medium" ? 32 : 96;
+ implicitHeight: implicitWidth
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ Image {
+ id: spinner
+ property int index: 1
+ source: root.platformStyle.spinnerFrames + "_" + root.implicitWidth + "_" + index
+ smooth: true
+
+ NumberAnimation on index {
+ from: 1; to: root.platformStyle.numberOfFrames
+ duration: root.platformStyle.period
+ running: root.running && root.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ }
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + root.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + root.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property string size: "medium"
+ property int period: 1000
+
+ property int numberOfFrames: 10
+
+ __invertedString: inverted? "inverted" : "" // The spinner frames do not follow the common inverted file naming :(
+
+ property url spinnerFrames: "image://theme/spinner"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: button
+
+ // Common public API
+ property bool checked: false
+ property bool checkable: false
+ property alias pressed: mouseArea.pressed
+ property alias text: label.text
+ property url iconSource
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ signal clicked
+
+ // Used in ButtonGroup.js to set the segmented look on the buttons.
+ property string __buttonType
+
+ // Styling for the Button
+ property Style platformStyle: ButtonStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: button.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+ width: implicitWidth
+
+ property alias font: label.font
+
+ //private property
+ property bool __dialogButton: false
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+ right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+
+ source: __dialogButton ? (pressed ? button.platformStyle.pressedDialog : button.platformStyle.dialog) :
+ !enabled ?
+ (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+ pressed ?
+ button.platformStyle.pressedBackground :
+ checked ?
+ button.platformStyle.checkedBackground :
+ button.platformStyle.background;
+ }
+
+ Image {
+ id: icon
+ anchors.left: label.visible ? parent.left : undefined
+ anchors.leftMargin: label.visible ? UI.MARGIN_XLARGE : 0
+ anchors.centerIn: label.visible ? undefined : parent
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -1
+
+ source: button.iconSource
+
+ visible: source != ""
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: icon.visible ? icon.right : parent.left
+ anchors.leftMargin: icon.visible ? UI.PADDING_XLARGE : UI.BUTTON_LABEL_MARGIN
+ anchors.right: parent.right
+ anchors.rightMargin: UI.BUTTON_LABEL_MARGIN
+
+ horizontalAlignment: icon.visible ? Text.AlignLeft : button.platformStyle.horizontalAlignment
+ elide: Text.ElideRight
+
+ font.family: button.platformStyle.fontFamily
+ font.weight: checked ? button.platformStyle.checkedFontWeight : button.platformStyle.fontWeight
+ font.pixelSize: button.platformStyle.fontPixelSize
+ font.capitalization: button.platformStyle.fontCapitalization
+ color: !enabled ? button.platformStyle.disabledTextColor :
+ pressed ? button.platformStyle.pressedTextColor :
+ checked ? button.platformStyle.checkedTextColor :
+ button.platformStyle.textColor;
+ text: ""
+ visible: text != ""
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors {
+ fill: parent
+ rightMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-left") ? platformStyle.mouseMarginRight : 0
+ leftMargin: (platformStyle.position != "horizontal-center"
+ && platformStyle.position != "horizontal-right") ? platformStyle.mouseMarginLeft : 0
+ topMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-bottom") ? platformStyle.mouseMarginTop : 0
+ bottomMargin: (platformStyle.position != "vertical-center"
+ && platformStyle.position != "vertical-top") ? platformStyle.mouseMarginBottom : 0
+ }
+ onClicked: if (button.checkable) button.checked = !button.checked
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Column {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ width: UI.BUTTON_WIDTH
+
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Vertical,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "vertical-top",
+ "middlePos": "vertical-center",
+ "lastPos": "vertical-bottom",
+ "resizeChildren": function(self) {
+ Private.buttons.forEach(function(item, i) {
+ if (Private.isButton(item) && item.visible) {
+ item.anchors.left = self.left;
+ item.anchors.right = self.right;
+ }
+ });
+ }
+ });
+ }
+
+ Component.onDestruction: {
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is shared between ButtonRow.qml and ButtonColumn.qml.
+
+var self = undefined;
+var checkedButton = null;
+var buttons = [];
+var firstVisible = -1;
+var lastVisible = -1;
+var visibleButtons = 0;
+var buttonHandlers = [];
+var styleComponent = undefined;
+var params = undefined;
+
+function isButton(item) {
+ return (item && item.hasOwnProperty("__buttonType"));
+}
+
+function hasChecked(item) {
+ return (item && item.hasOwnProperty("checked"));
+}
+
+function cleanup() {
+ buttons.forEach(function(button, i) {
+ if (button.visible && params.exclusive) {
+ button.checkedChanged.disconnect(buttonHandlers[i]);
+ }
+ if (isButton(button))
+ button.visibleChanged.disconnect(buttonVisibleChanged);
+ });
+ buttons = [];
+ buttonHandlers = [];
+}
+
+function updateButtons() {
+ cleanup();
+
+ params.exclusive = self.exclusive;
+
+ checkedButton = null;
+ var length = self.children.length;
+ for (var i = 0; i < length; i++) {
+ var item = self.children[i];
+ if (!hasChecked(item))
+ continue;
+ buttons.push(item);
+
+ item.visibleChanged.connect(buttonVisibleChanged);
+
+ if (item.checked) {
+ if (!checkedButton && (self.checkedButton === item || self.checkedButton == undefined))
+ checkedButton = item;
+ else if (params.exclusive && self.checkedButton != item)
+ item.checked = false;
+ } else if (self.checkedButton === item) {
+ if (checkedButton && params.exclusive)
+ checkedButton.checked = false;
+ checkedButton = item;
+ item.checked = true;
+ }
+
+ if (isButton(item)) {
+ if (styleComponent)
+ item.platformStyle = styleComponent.createObject(item)
+
+ // Only ButtonRow supports tab buttons and care about screen orientation
+ if (params.orientation == Qt.Horizontal && item.platformStyle.hasOwnProperty("screenOrientation"))
+ switch (screen.currentOrientation) {
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ item.platformStyle.screenOrientation = "portrait";
+ break;
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ item.platformStyle.screenOrientation = "landscape";
+ break;
+ }
+ }
+ if (params.exclusive) {
+ if (item["checkable"] !== undefined)
+ item.checkable = true;
+ var last = buttonHandlers.push(checkExclusive(item));
+ item.checkedChanged.connect(buttonHandlers[last - 1]);
+ }
+ }
+
+ if (!checkedButton && buttons.length > 0 && params.exclusive) {
+ checkedButton = buttons[0];
+ checkedButton.checked = true;
+ }
+ self.checkedButton = checkedButton;
+
+ buttonVisibleChanged();
+}
+
+var blockCheckedChanged = false;
+
+function checkExclusive(item) {
+ var button = item;
+ return function() {
+ if (blockCheckedChanged)
+ return;
+ if (!button.checked) {
+ if (self.checkedButton === button) {
+ blockCheckedChanged = true;
+ button.checked = true;
+ blockCheckedChanged = false;
+ }
+ return;
+ }
+ if (self.checkedButton === button)
+ return;
+ if (self.checkedButton) {
+ blockCheckedChanged = true;
+ self.checkedButton.checked = false;
+ blockCheckedChanged = false;
+ }
+ checkedButton = button;
+ self.checkedButton = button;
+ }
+}
+
+function checkedButtonChanged() {
+ if (checkedButton === self.checkedButton)
+ return;
+ blockCheckedChanged = true;
+ if (params.exclusive && checkedButton)
+ checkedButton.checked = false;
+ if (self.checkedButton)
+ self.checkedButton.checked = true;
+ blockCheckedChanged = false;
+ checkedButton = self.checkedButton;
+}
+
+function buttonVisibleChanged() {
+ visibleButtons = 0;
+ firstVisible = -1;
+ lastVisible = -1;
+ buttons.forEach(function (button, i) {
+ if (button.visible) {
+ if (firstVisible === -1)
+ firstVisible = i;
+ lastVisible = i;
+ visibleButtons++;
+ }
+ });
+
+ updateGroupPosition();
+ resizeChildren();
+}
+
+function updateGroupPosition() {
+ if (visibleButtons === 0)
+ return;
+
+ // Fix the children group position
+ if (visibleButtons == 1) {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.singlePos;
+ } else {
+ if (isButton(buttons[firstVisible]))
+ buttons[firstVisible].platformStyle.position = params.firstPos;
+ for (var i = firstVisible + 1; i < lastVisible; i++) {
+ if (buttons[i].visible && isButton(buttons[i]))
+ buttons[i].platformStyle.position = params.middlePos;
+ }
+ if (isButton(buttons[lastVisible]))
+ buttons[lastVisible].platformStyle.position = params.lastPos;
+ }
+}
+
+var resizing = false; // resizeChildren() may trigger reentrant calls
+
+function resizeChildren() {
+ if (resizing || visibleButtons === 0)
+ return;
+
+ if (typeof params.resizeChildren === "function") {
+ resizing = true;
+ params.resizeChildren(self);
+ resizing = false;
+ }
+}
+
+function create(s, p) {
+ if (!s) {
+ console.log("Error creating ButtonGroup: invalid owner.");
+ return;
+ }
+ if (!s.hasOwnProperty("checkedButton")) {
+ console.log("Error creating ButtonGroup: owner has no 'checkedButton' property.");
+ return;
+ }
+
+ self = s;
+ params = p;
+
+ styleComponent = params.styleComponent;
+
+ if (styleComponent && styleComponent.status != Component.Ready) {
+ console.log("Error loading style:", styleComponent.errorString());
+ return
+ }
+
+ updateButtons();
+ self.checkedButtonChanged.connect(checkedButtonChanged);
+ self.childrenChanged.connect(updateButtons);
+ self.exclusiveChanged.connect(Private.updateButtons);
+ self.widthChanged.connect(resizeChildren);
+}
+
+function destroy() {
+ if (self) {
+ self.checkedButtonChanged.disconnect(checkedButtonChanged);
+ self.childrenChanged.disconnect(updateButtons);
+ self.widthChanged.disconnect(resizeChildren);
+ self = undefined;
+ }
+ if (styleComponent) {
+ styleComponent.destroy();
+ styleComponent = undefined;
+ }
+ cleanup();
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+import "ButtonGroup.js" as Private
+import "UIConstants.js" as UI
+
+Row {
+ id: root
+
+ property bool exclusive: true
+ property Item checkedButton
+
+ property Component platformStyle: null
+ property Component style: null
+
+ property int __screenWidth: (screen.rotation === 0 || screen.rotation === 180 ? screen.displayWidth : screen.displayHeight) - 2 * UI.MARGIN_XLARGE
+ property int __visibleButtons
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __maxButtonSize: UI.BUTTON_WIDTH
+
+ width: Math.min(__visibleButtons * UI.BUTTON_WIDTH, __screenWidth)
+ Component.onCompleted: {
+ Private.create(root, {
+ "orientation": Qt.Horizontal,
+ "exclusive": exclusive,
+ "styleComponent": platformStyle? platformStyle : style,
+ "singlePos": "",
+ "firstPos": "horizontal-left",
+ "middlePos": "horizontal-center",
+ "lastPos": "horizontal-right",
+ "resizeChildren": function(self) {
+ self.__visibleButtons = Private.visibleButtons;
+ var extraPixels = self.width % Private.visibleButtons;
+ var buttonSize = Math.min(__maxButtonSize, (self.width - extraPixels) / Private.visibleButtons);
+ Private.buttons.forEach(function(item, i) {
+ if (!item || !item.visible || !Private.isButton(item))
+ return;
+ if (extraPixels > 0) {
+ item.width = buttonSize + 1;
+ extraPixels--;
+ } else {
+ item.width = buttonSize;
+ }
+ });
+ }
+ });
+ screen.currentOrientationChanged.connect(Private.updateButtons);
+ }
+
+ Component.onDestruction: {
+ screen.currentOrientationChanged.disconnect(Private.updateButtons);
+ Private.destroy();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int checkedFontWeight: Font.Bold
+ property int horizontalAlignment: Text.AlignHCenter
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: UI.COLOR_BUTTON_SECONDARY_FOREGROUND
+ property color disabledTextColor: UI.COLOR_BUTTON_DISABLED_FOREGROUND
+ property color checkedTextColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Dimensions
+ property int buttonWidth: UI.BUTTON_WIDTH
+ property int buttonHeight: UI.BUTTON_HEIGHT
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+
+ // Background
+ property int backgroundMarginRight: 22
+ property int backgroundMarginLeft: 22
+ property int backgroundMarginTop: 22
+ property int backgroundMarginBottom: 22
+
+ /* The position property can take one of the following values:
+
+ [horizontal-left] [horizontal-center] [horizontal-right]
+
+ [vertical-top]
+ [vertical-center]
+ [vertical-bottom]
+ */
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-button" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ property url disabledBackground: "image://theme/meegotouch-button" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+ property url checkedBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ property url checkedDisabledBackground: "image://theme/" + __colorString + "meegotouch-button" + __invertedString + "-background-disabled-selected" + (position ? "-" + position : "")
+ property url dialog: "image://theme/meegotouch-dialog-button-negative"
+ property url pressedDialog: "image://theme/meegotouch-dialog-button-negative-pressed"
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+import "UIConstants.js" as UI
+
+ImplicitSizeItem {
+ id: checkbox
+
+ property Style platformStyle: CheckBoxStyle{}
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: checkbox.platformStyle
+
+ property string text
+ property bool checked: false
+ property bool pressed
+ signal clicked
+
+ implicitWidth: image.width + body.spacing + label.implicitWidth
+ implicitHeight: body.height
+
+ onWidthChanged: if (width > 0 && width != implicitWidth)
+ label.width = checkbox.width - body.spacing - image.width
+
+ Binding {
+ target: checkbox
+ property: "pressed"
+ value: mouseArea.pressed && mouseArea.containsMouse
+ }
+
+ property alias __imageSource: image.source
+
+ function __handleChecked() {
+ checkbox.checked = !checkbox.checked;
+ }
+
+ Row {
+ id: body
+ spacing: 15
+
+ BorderImage {
+ id: image
+ smooth: true
+
+ width: 42; height: 42
+
+ source: !checkbox.enabled ? platformStyle.backgroundDisabled :
+ checkbox.pressed ? platformStyle.backgroundPressed :
+ checkbox.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Label {
+ id: label
+ anchors.verticalCenter: image.verticalCenter
+ text: checkbox.text
+ elide: checkbox.platformStyle.elideMode
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: body
+ anchors.topMargin: platformStyle.mouseMarginTop
+ anchors.leftMargin: platformStyle.mouseMarginLeft
+ anchors.rightMargin: platformStyle.mouseMarginRight
+ anchors.bottomMargin: platformStyle.mouseMarginBottom
+
+ onPressed: {
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("pressOnFeedback");
+ // else
+ // meegostyle.feedback("pressOffFeedback");
+ }
+
+ onClicked: {
+ __handleChecked();
+ // TODO: enable feedback without old themebridge
+ // if (checkbox.checked)
+ // meegostyle.feedback("releaseOnFeedback");
+ // else
+ // meegostyle.feedback("releaseOffFeedback");
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-checkbox"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-checkbox"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Dialog {
+ id: genericDialog
+
+ property string titleText: ""
+
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: genericDialog.platformStyle
+
+ //private
+ property bool __drawFooterLine: false
+
+ title: Item {
+ id: header
+ height: genericDialog.platformStyle.titleBarHeight
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ Item {
+ id: labelField
+
+ anchors.fill: parent
+
+ Item {
+ id: labelWrapper
+ anchors.left: labelField.left
+ anchors.right: closeButton.left
+
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin
+
+ //anchors.verticalCenter: labelField.verticalCenter
+
+ height: titleLabel.height
+
+ Label {
+ id: titleLabel
+ x: genericDialog.platformStyle.titleBarIndent
+ width: parent.width - closeButton.width
+ //anchors.baseline: parent.bottom
+ font: genericDialog.platformStyle.titleBarFont
+ color: genericDialog.platformStyle.commonLabelColor
+ elide: genericDialog.platformStyle.titleElideMode
+ text: genericDialog.titleText
+ }
+
+ }
+
+ Image {
+ id: closeButton
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin-6
+ //anchors.verticalCenter: labelField.verticalCenter
+ anchors.right: labelField.right
+
+ opacity: closeButtonArea.pressed ? 0.5 : 1.0
+
+ source: "image://theme/icon-m-common-dialog-close"
+
+ MouseArea {
+ id: closeButtonArea
+ anchors.fill: parent
+ onClicked: {genericDialog.reject();}
+ }
+
+ }
+
+ }
+
+ Rectangle {
+ id: headerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.bottom: header.bottom
+
+ height: 1
+
+ color: "#4D4D4D"
+ }
+
+ }
+
+ content: Item {id: contentField}
+
+ buttons: Item {
+ id: footer
+
+ width: parent.width
+ height: childrenRect.height
+
+ //hack to make sure, we're evaluating the correct height
+ Item {
+ id: lineWrapper
+ width: parent.width
+ height: childrenRect.height
+ y: 10
+
+ Rectangle {
+ id: footerLine
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ height: genericDialog.__drawFooterLine ? 1 : 0
+
+ color: "#4D4D4D"
+ }
+ }
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ Item {id: dummy; anchors.fill: parent}
+
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+
+ // API
+ property string platformTitleText
+ property string titleText
+ property url platformIcon
+ property url icon
+
+ // platformStyle API
+ property Style platformStyle: ContextMenuStyle{}
+ property Style style: ContextMenuStyle{}
+
+ onPlatformTitleTextChanged: logDeprecatedMsg("platformTitleText")
+ onTitleTextChanged: logDeprecatedMsg("titleText")
+ onPlatformIconChanged: logDeprecatedMsg("platformIcon")
+ onIconChanged: logDeprecatedMsg("iconChanged")
+ onPlatformStyleChanged: logDeprecatedMsg("platformStyle")
+ onStyleChanged: logDeprecatedMsg("style")
+
+ function logDeprecatedMsg(name) {
+ console.log("Warning: " + name + " is deprecated");
+ }
+
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+MenuStyle {
+ id: root
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_SMALL
+ property int titleFontCapitalization: Font.MixedCase
+ property color titleTextColor: "white"
+
+ property int titleBarHeight: 56
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.OutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property string faderBackground: "image://theme/meegotouch-menu-dimmer"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Popup {
+ id: root
+ objectName: "baseDialog"
+
+ // API
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+
+ signal accepted
+ signal rejected
+
+ property Style platformStyle: DialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property string __animationChief: "baseDialog"
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ // true: center of the content field is center of the background rect
+ // false: the whole dialog is centered
+ property bool __centerContentField: false
+
+ width: parent.width - platformStyle.leftMargin - platformStyle.rightMargin // ToDo: better width heuristic
+ height: titleBar.height + contentField.height + buttonRow.height
+
+ anchors.centerIn: parent
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ // this item contains the whole dialog (title bar + content rectangle, button row)
+ Item {
+ id: backgroundRect
+
+ height: root.height
+ width: root.width
+
+ anchors.centerIn: root
+
+ // center the whole dialog, not just the content field
+ transform: Translate {
+ id: contentTranslation
+ y: root.__centerContentField ? 0 : (titleBar.height - buttonRow.height) / 2
+ }
+
+
+ // title bar
+ Item {
+ id: titleBar
+
+ width: root.width
+ height: childrenRect.height
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: contentField.top
+
+ // animate over bottomMargin (i.e. the distance between the content field)
+ anchors.bottomMargin: 0
+
+ }
+
+ //content area
+ Item {
+ id: contentField
+
+ anchors.left: parent.left
+ //anchors.right: parent.right
+
+ anchors.horizontalCenter: backgroundRect.horizontalCenter
+ anchors.verticalCenter: backgroundRect.verticalCenter
+
+ height: childrenRect.height
+
+ transform: Scale {
+ id: contentScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(root, root.width / 2, root.height / 2).x
+ origin.y: mapFromItem(root, root.width / 2, root.height / 2).y
+
+ }
+
+ }
+
+ //button row
+ Item {
+ id: buttonRow
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ anchors.top: contentField.bottom
+
+ // animate over topMargin (i.e. the distance between the content field)
+ anchors.topMargin: 0
+
+ height: childrenRect.height
+ }
+
+ }
+
+ onPrivateClicked: reject()
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "hidden"
+
+ // needed for button and title bar animation
+ // without resetting the button row's/title bar's coordinate system would be translated
+ property int __buttonSaver: buttonRow.y
+ property int __titleSaver: titleBar.y
+
+
+ states: [
+ State {
+ name: "visible"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Opening || status == DialogStatus.Open)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "hidden"
+ when: root.__animationChief == "baseDialog" && (status == DialogStatus.Closing || status == DialogStatus.Closed)
+ PropertyChanges {
+ target: backgroundRect
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ backgroundRect.opacity = 1.0;
+ root.opacity = 1.0
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ // With a 100ms delay the background fades to alpha 0% (500ms, quint ease out).
+ // --> done in the fader
+
+ PropertyAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+ PropertyAnimation { target: backgroundRect; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // The closing transition starts with the title and both lines dimming to
+ // alpha 0% and moving 100 pixels in Y axis towards the center (125ms,
+ // quint ease in). With no delay the list fades to alpha 0% and scales to
+ // 80% (anchorpoint in the middle of the list, 100ms, quint ease in).
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint }
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 1.0; to: 0.0; duration: 125}
+ PropertyAnimation {target: buttonRow
+ properties: "anchors.topMargin"
+ from: 0
+ to: -100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ PropertyAnimation {target: titleBar
+ properties: "anchors.topMargin"
+ from: 0
+ to: 100
+ duration: 125
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+ // make sure, root isn't visible:
+ backgroundRect = 0.0;
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonRow.y
+ statesWrapper.__titleSaver = titleBar.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0;
+ titleBar.opacity = 0.0;
+ contentField.opacity = 0.0;
+ buttonRow.opacity = 0.0;
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in). --> Done inside the fader
+
+ ParallelAnimation {
+ SequentialAnimation {
+ // a 250ms delay from the beginning
+ PauseAnimation { duration: 250 }
+ // the list scales from 80% to 100% and alpha 0%
+ // to 100% (anchorpoint in the middle of the list, 250ms, expo ease out)
+ ParallelAnimation {
+ PropertyAnimation {target: contentField; properties: "opacity"; from: 0.0; to: 1.0; duration: 250}
+ PropertyAnimation {target: contentScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 250; easing.type: Easing.OutExpo}
+ }
+ }
+ SequentialAnimation {
+ // a 200ms delay from the beginning
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ //the title and both lines come from alpha 0%
+ PropertyAnimation {target: buttonRow; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ PropertyAnimation {target: titleBar; properties: "opacity"; from: 0.0; to: 1.0; duration: 450; }
+ // and move towards the edges (40 pixels in Y axis
+ // away from their final destination, 450ms, custom ease).
+ PropertyAnimation {target: buttonRow; properties: "anchors.topMargin"
+ from: -40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+ PropertyAnimation {target: titleBar; properties: "anchors.bottomMargin"
+ from: 40
+ to: 0
+ duration: 450
+ easing.type: Easing.OutBack
+ }
+
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button and title bar
+ buttonRow.y = statesWrapper.__buttonSaver
+ titleBar.y = statesWrapper.__titleSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property real leftMargin: 88
+ property real rightMargin: 88
+ property real topMargin: 45
+ property real bottomMargin: 16
+ property bool centered: false
+
+ property int titleBarHeight: 56
+ property color titleBarColor: "white"
+ property int titleElideMode: Text.ElideRight
+
+ property int buttonsTopMargin: 10
+ property int buttonsBottomMargin: 0
+ property int buttonsColumnSpacing: 10
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // m
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+Qt.include("UIConstants.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("EditBubble.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared edit bubble for a given input item.
+
+ All operations and changes will be binded to the
+ given item.
+*/
+function open(input,position)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ // Position when text not selected.
+ popup.position = position;
+
+ // need to set before checking capabilities
+ popup.textInput = input;
+
+ if (popup.valid)
+ popup.state = "opened";
+ else
+ popup.textInput = null;
+
+ return popup.textInput != null;
+}
+
+/*
+ Close the shared edit bubble for a given input item.
+*/
+function close(input)
+{
+ if (!popup || !input || popup.textInput != input)
+ return false;
+
+ return closePopup(popup);
+}
+
+/*
+ Check if the shared edit bubble is opened for the
+ given input item.
+*/
+function isOpened(input)
+{
+ return (popup && popup.textInput == input);
+}
+
+/*
+ Check if the bubble is in the middle of a text
+ change operation.
+*/
+function isChangingInput()
+{
+ return (popup && popup.privateRect.changingText);
+}
+
+/*
+ Close a given edit bubble.
+*/
+function closePopup(bubble)
+{
+ if (bubble == null || bubble.textInput == null)
+ return false;
+
+ bubble.state = "closed";
+ bubble.textInput = null;
+ return true;
+}
+
+/*
+ Adjust EditBubble position to fit in the visible area.
+
+ If no argument is passed, it will adjust the shared
+ bubble position if already initialized.
+*/
+function adjustPosition(bubble)
+{
+ if (bubble === undefined)
+ bubble = popup;
+
+ if (bubble == null)
+ return;
+
+ var input = bubble.textInput;
+ var rect = bubble.privateRect;
+ var viewport = rect.parent;
+
+ if (viewport == null || input == null)
+ return;
+
+ var irect = input.positionToRectangle(input.selectionStart);
+ var frect = input.positionToRectangle(input.selectionEnd);
+ var mid = rect.width / 2;
+
+ if (input.selectionStart == input.selectionEnd) {
+ irect.x = popup.position.x;
+ irect.y = popup.position.y;
+ frect.x = popup.position.x;
+ frect.y = popup.position.y;
+ }
+
+ var ipoint = viewport.mapFromItem(input, irect.x, irect.y);
+ var fpoint = viewport.mapFromItem(input, frect.x, frect.y);
+
+ var px = ipoint.x + (fpoint.x - ipoint.x) / 2 - mid;
+ var py = ipoint.y - rect.height;
+
+ var SHADOW_SIZE = 6
+
+ rect.x = Math.min(Math.max(px, MARGIN_XLARGE - SHADOW_SIZE), viewport.width - rect.width);
+
+ if (py > SHADOW_SIZE) {
+ rect.y = py - SHADOW_SIZE;
+ rect.arrowDown = true;
+ } else {
+ rect.y = Math.min(Math.max(ipoint.y + irect.height, 0),
+ fpoint.y + frect.height);
+ rect.arrowDown = false;
+ }
+
+ var boundX = mid - rect.arrowBorder;
+ rect.arrowOffset = Math.min(Math.max(-boundX, px - rect.x), boundX);
+}
+
+function updateButtons(row)
+{
+ var children = row.children;
+ var visibleItems = new Array();
+
+ for (var i = 0, j = 0; i < children.length; i++) {
+ var child = children[i];
+
+ if (child.visible)
+ visibleItems[j++] = child;
+ }
+
+ for (var i = 0; i < visibleItems.length; i++) {
+ if (visibleItems.length == 1)
+ visibleItems[i].platformStyle.position = "";
+ else {
+ if (i == 0)
+ visibleItems[i].platformStyle.position = "horizontal-left";
+ else if (i == visibleItems.length - 1)
+ visibleItems[i].platformStyle.position = "horizontal-right";
+ else
+ visibleItems[i].platformStyle.position = "horizontal-center";
+ }
+ }
+}
+
+function geometry()
+{
+ if (popup == null)
+ return;
+
+ var bubbleContent = popup.privateRect;
+ var rect = {"left": bubbleContent.pos.x,
+ "right": bubbleContent.pos.x + bubbleContent.width,
+ "top": bubbleContent.pos.y,
+ "bottom": bubbleContent.pos.y + bubbleContent.height};
+
+ return rect;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "Utils.js" as Utils
+import "EditBubble.js" as Private
+
+Item {
+ id: bubble
+
+ property Item textInput: null
+ property bool valid: rect.canCut || rect.canCopy || rect.canPaste
+
+ property alias privateRect: rect
+
+ property Style platformStyle: EditBubbleStyle {}
+
+ property variant position: Qt.point(0,0)
+
+ anchors.fill: parent
+
+ Item {
+ id: rect
+ visible: false
+ width: row.width
+ height: row.height
+
+ property int arrowOffset: 0
+ property int arrowBorder: platformStyle.arrowMargin
+ property bool arrowDown: true
+ property bool changingText: false
+ property bool pastingText: false
+
+ property bool validInput: textInput != null
+ property bool canCut: rect.canCopy && !textInput.readOnly
+
+ // TextEdit will have echoMode == null
+ property bool canCopy: textSelected && (textInput.echoMode == null || textInput.echoMode == TextInput.Normal)
+ property bool canPaste: validInput && (textInput.canPaste && !textInput.readOnly)
+ property bool textSelected: validInput && (textInput.selectedText != "")
+
+ z: 1020
+
+ onWidthChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ onHeightChanged: {
+ if (rect.visible)
+ Private.adjustPosition(bubble);
+ }
+
+ BasicRow {
+ id: row
+ Component.onCompleted: Private.updateButtons(row);
+
+ EditBubbleButton {
+ id: buttonCut
+ text: textTranslator.translate("qtn_comm_cut");
+ visible: rect.canCut
+ onClicked: {
+ rect.changingText = true;
+ textInput.cut();
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonCopy
+ text: textTranslator.translate("qtn_comm_copy");
+ visible: rect.canCopy
+ onClicked: {
+ textInput.copy();
+ Private.closePopup(bubble);
+ }
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ EditBubbleButton {
+ id: buttonPaste
+ text: textTranslator.translate("qtn_comm_paste");
+ visible: rect.canPaste
+ onClicked: {
+ rect.changingText = true;
+ if (textInput.inputMethodComposing) {
+ var cursorAdjust = textInput.preedit.length - textInput.preeditCursorPosition;
+ inputContext.reset();
+ textInput.cursorPosition -= cursorAdjust;
+ }
+ rect.pastingText = true;
+ var text = textInput.text;
+ textInput.paste();
+ // PastingText is set to false and clipboard is cleared if we catch onTextChanged
+ if (rect.pastingText && text == textInput.text) {
+ var root = Utils.findRootItemNotificationBanner(textInput);
+
+ // create notification banner
+ var bannerInstance = notificationBanner.createObject(root);
+ bannerInstance.show();
+ bannerInstance.timerEnabled = true;
+ rect.pastingText = false;
+ }
+ rect.changingText = false;
+ Private.closePopup(bubble);
+ }
+
+ onVisibleChanged: Private.updateButtons(row);
+ }
+
+ Component {
+ id : notificationBanner
+ NotificationBanner{
+ id: errorBannerPrivate
+ text: textTranslator.translate("qtn_comm_cantpaste");
+ timerShowTime: 5*1000
+ topMargin: 8
+ leftMargin: 8
+ }
+ }
+ }
+
+ Image {
+ source: platformStyle.bottomTailBackground
+ visible: rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.bottom
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+
+ Image {
+ source: platformStyle.topTailBackground
+ visible: !rect.arrowDown && bubble.valid
+
+ anchors.bottom: row.top
+ anchors.bottomMargin: -platformStyle.backgroundMarginBottom - 2
+
+ anchors.horizontalCenter: row.horizontalCenter
+ anchors.horizontalCenterOffset: rect.arrowOffset
+ }
+ }
+
+ state: "closed"
+
+ states: [
+ State {
+ name: "opened"
+ ParentChange { target: rect; parent: Utils.findRootItem(textInput); }
+ PropertyChanges { target: rect; visible: true; }
+ },
+ State {
+ name: "closed"
+ ParentChange { target: rect; parent: bubble; }
+ PropertyChanges { target: rect; visible: false; }
+ }
+ ]
+
+ Connections {
+ target: Utils.findFlickable(textInput)
+ onContentYChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: screen
+ onCurrentOrientationChanged: Private.adjustPosition(bubble)
+ }
+
+ Connections {
+ target: textInput
+ onTextChanged: {
+ if (rect.pastingText) {
+ inputContext.clearClipboard();
+ rect.pastingText = false;
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+BorderImage {
+ id: button
+
+ signal clicked()
+ property alias text: label.text
+ property bool selected: false
+
+ property Style platformStyle: EditBubbleButtonStyle {}
+
+ width: label.width + platformStyle.buttonPaddingLeft +
+ platformStyle.buttonPaddingRight +
+ platformStyle.backgroundMarginLeft +
+ platformStyle.backgroundMarginRight
+ height: platformStyle.buttonHeight +
+ platformStyle.backgroundMarginTop +
+ platformStyle.backgroundMarginBottom
+
+ source: {
+ if (mouseArea.pressed)
+ return platformStyle.pressedBackground;
+
+ // XXX: meegotouch-text-editor-selected image is missing
+ if (selected && platformStyle.position != "")
+ return platformStyle.checkedBackground;
+ else
+ return platformStyle.background;
+ }
+
+ border {
+ left: platformStyle.backgroundMarginLeft
+ top: platformStyle.backgroundMarginTop
+ right: platformStyle.backgroundMarginRight
+ bottom: platformStyle.backgroundMarginBottom
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+
+ color: platformStyle.textColor
+
+ font.family: platformStyle.fontFamily
+ font.weight: platformStyle.fontWeight
+ font.pixelSize: platformStyle.fontPixelSize
+ font.capitalization: platformStyle.fontCapitalization
+
+ style: platformStyle.textStyle
+ styleColor: platformStyle.textStyleColor
+ }
+
+ MouseArea {
+ id: mouseArea
+ enabled: button.enabled
+ anchors {
+ fill: parent
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ rightMargin: platformStyle.mouseMarginRight
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+ }
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Normal
+
+ // Text
+ property color textColor: "black"
+ property int textStyle: Text.Sunken
+ property color textStyleColor: "#111111"
+
+ // Dimensions
+ property int buttonWidth: 40 // DEPRECATED
+ property int buttonPaddingLeft: 8
+ property int buttonPaddingRight: 8
+ property int buttonHeight: 56
+
+ // Mouse
+ property real mouseMarginLeft: (position == "horizontal-left") ? 6 : 0
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: (position == "horizontal-right") ? 6 : 0
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 19
+ property int backgroundMarginTop: 15
+ property int backgroundMarginRight: 19
+ property int backgroundMarginBottom: 15
+
+ // Position can take one of the following values:
+ // [horizontal-left] [horizontal-center] [horizontal-right]
+ property string position: ""
+
+ property string __suffix: (position ? "-" + position : "")
+
+ property url background: "image://theme/meegotouch-text-editor" + __suffix
+ property url pressedBackground: "image://theme/meegotouch-text-editor-pressed" + __suffix
+ property url checkedBackground: "image://theme/meegotouch-text-editor-selected" + __suffix
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Mouse
+ property real mouseMarginLeft: 6
+ property real mouseMarginTop: 8
+ property real mouseMarginRight: 6
+ property real mouseMarginBottom: 10
+
+ // Background
+ property int backgroundMarginLeft: 0
+ property int backgroundMarginTop: 0
+ property int backgroundMarginRight: 0
+ property int backgroundMarginBottom: 14 // XXX: need to crop images
+
+ property int arrowMargin: 16 // XXX: need to crop images
+
+ // Images
+ property url topTailBackground: "image://theme/meegotouch-text-editor-top-tail"
+ property url bottomTailBackground: "image://theme/meegotouch-text-editor-bottom-tail"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+// Background dimming
+Rectangle {
+ id: faderBackground
+
+ property double dim: 0.9
+ property int fadeInDuration: 250
+ property int fadeOutDuration: 250
+
+ property int fadeInDelay: 0
+ property int fadeOutDelay: 0
+
+ property int fadeInEasingType: Easing.InQuint
+ property int fadeOutEasingType: Easing.OutQuint
+
+ property url background: ""
+
+ property Item visualParent: null
+ property Item originalParent: parent
+
+ // widen the edges to avoid artefacts during rotation
+ anchors.topMargin: -1
+ anchors.rightMargin: -1
+ anchors.bottomMargin: -1
+ anchors.leftMargin: -1
+
+ // opacity is passed to child elements - that is not, what we want
+ // so we need to use alpha value here
+ property double alpha: dim
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ // we need the possibility to fetch the red, green, blue components from a color
+ // see http://bugreports.qt.nokia.com/browse/QTBUG-14731
+ color: background != "" ? "transparent" : Qt.rgba(0.0, 0.0, 0.0, alpha)
+ state: 'hidden'
+
+ anchors.fill: parent
+
+ // eat mouse events
+ MouseArea {
+ id: mouseEventEater
+ anchors.fill: parent
+ enabled: faderBackground.alpha != 0.0
+ onClicked: { parent.privateClicked() }
+ }
+
+ Component {
+ id: backgroundComponent
+ BorderImage {
+ id: backgroundImage
+ source: background
+
+ width: faderBackground.width
+ height: faderBackground.height
+
+ opacity: faderBackground.alpha
+ }
+ }
+ Loader {id: backgroundLoader}
+
+ onAlphaChanged: {
+ if (background && faderBackground.alpha && backgroundLoader.sourceComponent == undefined) {
+ backgroundLoader.sourceComponent = backgroundComponent;
+ }
+ if (!faderBackground.alpha) {
+ backgroundLoader.sourceComponent = undefined;
+ }
+ }
+
+ function findRoot() {
+ var next = parent;
+
+ if (next != null) {
+ while (next.parent) {
+ if(next.objectName == "appWindowContent" || next.objectName == "windowContent"){
+ break
+ }
+
+ next = next.parent;
+ }
+ }
+ return next;
+ }
+
+
+ states: [
+ State {
+ name: "visible"
+ PropertyChanges {
+ target: faderBackground
+ alpha: dim
+ }
+ },
+ State {
+ name: "hidden"
+ PropertyChanges {
+ target: faderBackground
+ alpha: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "hidden"; to: "visible"
+ //reparent fader whenever it is going to be visible
+ SequentialAnimation {
+ ScriptAction {script: {
+ //console.log("=============00=============");
+ // the algorithm works in the following way:
+ // First: Check if visualParent property is set; if yes, center the fader in visualParent
+ // Second: If not, center inside window content element
+ // Third: If no window was found, use root window
+ originalParent = faderBackground.parent;
+ if (visualParent != null) {
+ faderBackground.parent = visualParent
+ } else {
+ var root = findRoot();
+ if (root != null) {
+ faderBackground.parent = root;
+ } else {
+ // console.log("Error: Cannot find root");
+ }
+ }
+ }
+ }
+ PauseAnimation { duration: fadeInDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeInDuration
+ easing.type: faderBackground.fadeInEasingType;
+ }
+ }
+ },
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ PauseAnimation { duration: fadeOutDelay }
+
+ NumberAnimation {
+ properties: "alpha"
+ duration: faderBackground.fadeOutDuration
+ easing.type: faderBackground.fadeOutEasingType;
+ }
+ ScriptAction {script: {
+ faderBackground.parent = originalParent;
+ }
+ }
+ }
+ }
+ ]
+}
+
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ // This style is deprecated and will be removed
+ Component.onCompleted: print("GroupButtonStyle has been deprecated, please use ButtonStyle instead.")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Text {
+ id: root
+
+ // Styling for the Button
+ property Style platformStyle: LabelStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ font.family: platformStyle.fontFamily
+ font.pixelSize: platformStyle.fontPixelSize
+ color: platformStyle.textColor
+
+ wrapMode: Text.Wrap
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Color
+ property color textColor: inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+Qt.include("Utils.js");
+
+var popup = null;
+
+function init(item)
+{
+ if (popup != null)
+ return true;
+
+ var root = findRootItem(item);
+
+ // create root popup
+ var component = Qt.createComponent("Magnifier.qml");
+
+ // due the pragma we cannot access Component.Ready
+ if (component)
+ popup = component.createObject(root);
+
+ return popup != null;
+}
+
+/*
+ Open a shared magnifier for a given input item.
+
+ input item will be used as a sourceItem for the shader
+ effect
+*/
+function open(input)
+{
+ if (!input)
+ return false;
+
+ if (!init(input))
+ return false;
+
+ popup.sourceItem = input;
+ popup.active = true;
+ return true;
+}
+
+/*
+ Check if the shared magnifier is opened
+*/
+function isOpened()
+{
+ return (popup && popup.active);
+}
+
+/*
+ Close and destroy the magnifier.
+*/
+function close()
+{
+ if (popup){
+ popup.active = false;
+ popup.destroy();
+ popup = null;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias sourceItem: effectSource.sourceItem
+ property real xCenter: 0 // in source item coordinates
+ property real yCenter: 0 // in source item coordinates
+
+ // Source rect is not as small as it can be as there is drawing problems
+ // with small source rect/texture size.
+ property real _realScaleFactor: 1.25
+ property real _sourceRectMultiplier: 2
+
+ property bool active: false
+
+ visible: active
+ width: 182
+ height: 211
+ z: Number.MAX_VALUE
+
+ function __rootElement() {
+ var ret = parent
+ while (ret.parent) {
+ ret = ret.parent
+ }
+ return ret
+ }
+
+ Component.onCompleted: {
+ sourceItem = parent;
+ declarativeView.setFullViewportMode(root);
+ }
+
+ ShaderEffectSource {
+ id: effectSource
+ sourceRect: Qt.rect(root.xCenter - textureSize.width / 2,
+ root.yCenter - textureSize.height / 2,
+ textureSize.width,
+ textureSize.height);
+ textureSize: Qt.size(root._sourceRectMultiplier * root.width,
+ root._sourceRectMultiplier * root.height);
+
+ hideSource: false
+ smooth: true
+
+ property real scaleFactor: root._sourceRectMultiplier * root._realScaleFactor
+ }
+
+ Image {
+ id: magnifierFrameImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierFrame
+ sourceItem: magnifierFrameImage
+ hideSource: true
+ live: false
+ }
+
+ Image {
+ id: magnifierMaskImage
+ source: "/usr/share/themes/blanco/meegotouch/images/theme/basement/meegotouch-virtual-keyboard/meegotouch-seattle-magnifier-frame-mask.png"
+ }
+
+ ShaderEffectSource {
+ id: magnifierMask
+ sourceItem: magnifierMaskImage
+ hideSource: true
+ live: false
+ }
+
+ ShaderEffectItem {
+ id: magnifier
+ anchors.fill:parent
+ visible: root.visible
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float scaleFactor;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ void main() {
+ qt_TexCoord0.x = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.x / scaleFactor;
+ qt_TexCoord0.y = 0.5 - 1. / (2. * scaleFactor) + qt_MultiTexCoord0.y / scaleFactor;
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
+ }";
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D frame;
+ uniform lowp sampler2D mask;
+ void main() {
+ lowp vec4 frame_c = texture2D(frame, qt_TexCoord1);
+ lowp vec4 mask_c = texture2D(mask, qt_TexCoord1);
+ lowp vec4 color_c = texture2D(source, qt_TexCoord0);
+ bool outsideElement=(qt_TexCoord0.s<0. || qt_TexCoord0.s>1. || qt_TexCoord0.t<0. || qt_TexCoord0.t>1.);
+ bool onGlass=(mask_c.a==1.);
+
+ if (outsideElement) {
+ // make white outside the element
+ color_c=vec4(1.,1.,1.,1.);
+ } else if (onGlass) {
+ // blend premultiplied texture with pure white (background)
+ color_c = color_c + vec4(1.,1.,1.,1.) * (1.-color_c.a);
+ }
+
+ if ( qt_TexCoord1.y >= 0.98 ) {
+ // Top part of item above visible magnifier frame is made
+ // transparent explicitly to prevent showing of wrongly
+ // colored pixels, which would otherwise appear sometimes
+ // when using sourceRect functionality.
+ gl_FragColor = vec4(0.,0.,0.,0.);
+ } else {
+ gl_FragColor = onGlass ? color_c : frame_c;
+ }
+ }";
+
+ property variant source: effectSource
+ property variant frame: magnifierFrame
+ property variant mask: magnifierMask
+ property real scaleFactor: effectSource.scaleFactor;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+AbstractMenu {
+ id: root
+/*
+ platformTitle: BorderImage {
+ id: topDivider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 2
+ source: "" // "image://theme/meegotouch-button-objectmenu-background-vertical-top"
+ border { top: 2; bottom: 1; left: 1; right: 1 }
+ }
+*/
+
+ __statesWrapper.transitions: [
+ Transition {
+ from: "visible"; to: "hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+ root.status = DialogStatus.Closing;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ to: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ from: 0; duration: 350}
+
+ NumberAnimation {target: __menuPane; property: "opacity";
+ from: 1.0; to: 0.0; duration: 0}
+
+ ScriptAction {script: {
+ status = DialogStatus.Closed;
+ }
+ }
+ }
+ },
+ Transition {
+ from: "hidden"; to: "visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+ root.status = DialogStatus.Opening;
+ __menuPane.anchors.rightMargin = 0;
+ __menuPane.anchors.bottomMargin = 0;
+ }
+ }
+
+ NumberAnimation {target: __menuPane;
+ property: screen.currentOrientation == Screen.Portrait ? "anchors.bottomMargin" : "anchors.rightMargin";
+ easing.type: Easing.InOutQuint;
+ from: screen.currentOrientation == Screen.Portrait ? -__menuPane.height : -__menuPane.width;
+ to: 0; duration: 350}
+
+ ScriptAction {script: {
+ status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// MenuItem is a component that is used in menus.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ // Common API
+ property string text
+ signal clicked
+ property alias pressed: mouseArea.pressed
+
+ // platformStyle API
+ property Style platformStyle: MenuItemStyle{
+ position: root.parent.children.length == 1 ? ""
+ : root.parent.children[0] == root ? "vertical-top"
+ : root.parent.children[root.parent.children.length-1] == root ? "vertical-bottom"
+ : "vertical-center"
+ }
+ property alias style: root.platformStyle // Deprecated
+
+ width: parent ? parent.width: 0
+ height: ( root.platformStyle.height == 0 ) ?
+ root.platformStyle.topMargin + menuText.paintedHeight + root.platformStyle.bottomMargin :
+ root.platformStyle.topMargin + root.platformStyle.height + root.platformStyle.bottomMargin
+/*
+ Rectangle {
+ id: backgroundRec
+ // ToDo: remove hardcoded values
+ color: pressed ? "darkgray" : "transparent"
+ anchors.fill : root
+ opacity : 0.5
+ }
+*/
+ BorderImage {
+ id: backgroundImage
+ source: // !enabled ? root.platformStyle.disabledBackground :
+ pressed ? root.platformStyle.pressedBackground
+ : root.platformStyle.background
+ anchors.fill : root
+ border { left: 22; top: 22;
+ right: 22; bottom: 22 }
+ }
+
+ Text {
+ id: menuText
+ text: parent.text
+ elide: Text.ElideRight
+ font.family : root.platformStyle.fontFamily
+ font.pixelSize : root.platformStyle.fontPixelSize
+ font.weight: root.platformStyle.fontWeight
+ color: !root.enabled ? root.platformStyle.disabledTextColor :
+ root.pressed ? root.platformStyle.pressedTextColor :
+ root.platformStyle.textColor
+
+ anchors.topMargin : root.platformStyle.topMargin
+ anchors.bottomMargin : root.platformStyle.bottomMargin
+ anchors.leftMargin : root.platformStyle.leftMargin
+ anchors.rightMargin : root.platformStyle.rightMargin
+
+ anchors.top : root.platformStyle.centered ? undefined : root.top
+ anchors.bottom : root.platformStyle.centered ? undefined : root.bottom
+ anchors.left : root.left
+ anchors.right : root.right
+// anchors.centerIn : parent.centerIn
+ anchors.verticalCenter : root.platformStyle.centered ? parent.verticalCenter : undefined
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: { if (parent.enabled) parent.clicked();}
+ }
+
+ onClicked: if (parent) parent.closeLayout();
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ id: root
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: 26 // UI.FONT_DEFAULT_SIZE
+ property int fontCapitalization: Font.MixedCase
+ property int fontWeight: Font.Bold
+ property int height: 80
+
+ // Text Color
+ property color textColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color pressedTextColor: inverted ? UI.COLOR_BUTTON_INVERTED_FOREGROUND : UI.COLOR_BUTTON_FOREGROUND
+ property color disabledTextColor: "#797979"
+ property color checkedTextColor: UI.COLOR_INVERTED_FOREGROUND
+
+ property real leftMargin: 24
+ property real rightMargin: 24
+ property real topMargin: 0
+ property real bottomMargin: 0
+ property bool centered: true
+
+ property string position: ""
+
+ property url background: "image://theme/meegotouch-list" + __invertedString + "-background" + (position ? "-" + position : "")
+ property url pressedBackground: "image://theme/meegotouch-list" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+// TODO: Add disabled state once the graphics are available
+// property url disabledBackground: "image://theme/meegotouch-list" + __invertedString + "-background-disabled" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "."
+
+Item {
+ id: root
+ anchors.left: parent!==undefined?parent.left:undefined
+ anchors.right: parent!==undefined?parent.right:undefined
+ height: menuItemColumn.height
+
+ default property alias menuChildren: menuItemColumn.children
+
+ Column {
+ id: menuItemColumn
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: childrenRect.height
+
+ function closeLayout() {
+ root.parent.closeMenu();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+
+Style {
+ id: root
+
+ property real leftMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 427
+ property real rightMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 0 : 0
+ property real topMargin: ( (screen.currentOrientation == 1) ||
+ (screen.currentOrientation == 4) ) ? 246 : 0
+
+ property real bottomMargin: 0
+
+ property real leftPadding: 16
+ property real rightPadding: 16
+ property real topPadding: 16
+ property real bottomPadding: 16
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 350 // ms
+ property int fadeOutDuration: 350 // ms
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 0 // ms
+ property int fadeInEasingType: Easing.InOutQuint
+ property int fadeOutEasingType: Easing.InOutQuint
+ property url faderBackground: "image://theme/meegotouch-menu-dimmer"
+
+ property int pressDelay: 0 // ms
+
+ property url background: "image://theme/meegotouch-menu-background" + __invertedString
+// property url pressedBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-pressed"
+// property url disabledBackground: "image://theme/meegotouch-menu" + __invertedString + "-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ color: "#FCBD00"
+ opacity: 0.5
+ anchors {
+ fill: parent
+ topMargin: parent.platformMouseAnchors.topMargin
+ bottomMargin: parent.platformMouseAnchors.bottomMargin
+ leftMargin: parent.platformMouseAnchors.leftMargin
+ rightMargin: parent.platformMouseAnchors.rightMargin
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function __isSelected( index ){
+ return __selectedIndexesHash[index]==true;
+}
+
+function __syncHash(){
+ var selectedIndexesHash = new Array()
+ var il = selectedIndexes.length;
+ for( var it = 0; it < il; ++it ){
+ selectedIndexesHash[selectedIndexes[it]]=true;
+ }
+ __selectedIndexesHash = selectedIndexesHash
+}
+
+function __toggleIndex( index ){
+ // A QML list can not be modified, so let's create a new array
+ var selectedArray = new Array;
+
+ var il = selectedIndexes.length;
+
+ // If selectedIndexes is empty then add the index and return.
+ if ( il == 0 ){
+ selectedArray.push(index);
+ selectedIndexes = selectedArray;
+ return;
+ }
+
+ // Check whether the list is sorted.
+ var isSorted = true;
+ var previousIndex = -1;
+
+ for( var it = 0; it < il; ++it ){
+ if ( previousIndex > selectedIndexes[it] ){
+ isSorted = false;
+ break;
+ }
+ previousIndex = selectedIndexes[it];
+ }
+
+ if (!isSorted){
+ // For unsorted selectedIndexes just append the index if it's not present yet.
+ var indexAvailable = false;
+ for( var it = 0; it < il; ++it ) {
+ if ( index == selectedIndexes[it] ){
+ indexAvailable = true;
+ }
+ else {
+ selectedArray.push(selectedIndexes[it]);
+ }
+ }
+ if (!indexAvailable){
+ selectedArray.push(index);
+ }
+ }
+ else{
+ previousIndex = -1;
+ // insert the index in a sorted way in between the existing indexes
+ for( var it = 0; it < il; ++it ) {
+ if ( previousIndex < index && index < selectedIndexes[it] ) {
+ selectedArray.push(index);
+ }
+ if ( index != selectedIndexes[it] ) {
+ selectedArray.push(selectedIndexes[it]);
+ }
+
+ previousIndex = selectedIndexes[it];
+ }
+ // If the index is the highest one append it
+ if (index > selectedIndexes[selectedIndexes.length - 1]){
+ selectedArray.push(index);
+ }
+ }
+ // Assign the new built array to selectedIndexes
+ selectedIndexes = selectedArray;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "MultiSelectionDialog.js" as MultiSelectionDialog
+
+CommonDialog {
+ id: root
+
+ property alias model: selectionListView.model
+ // Common API: property list<int> selectedIndexes (currently not possible due to QTBUG-10822)
+ property variant selectedIndexes: [] // read & write, variant is supposed to be list<int>
+ property alias acceptButtonText: acceptButton.text //Convenience wrapper on top of the buttons
+ property alias rejectButtonText: rejectButton.text //Convenience wrapper on top of the buttons
+ //property alias titleText: titleLabel.text
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: MultiSelectionDialog.__toggleIndex(index);
+ }
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: MultiSelectionDialog.__isSelected(index) ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+ property variant __selectedIndexesHash: []
+
+ QtObject {
+ id: backup
+ property variant oldSelectedIndexes: []
+ }
+ onStatusChanged: {
+ if (status == DialogStatus.Opening) {
+ selectionListView.positionViewAtIndex(selectedIndexes[0], ListView.Center)
+ }
+ if (status == DialogStatus.Open)
+ backup.oldSelectedIndexes = selectedIndexes
+ }
+ onRejected: { selectedIndexes = backup.oldSelectedIndexes }
+
+ onSelectedIndexesChanged: {
+ MultiSelectionDialog.__syncHash();
+ }
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText: "Multi-Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : root.parent
+ ? root.parent.height * 0.87
+ - buttonRow.childrenRect.height - root.platformStyle.contentSpacing - root.platformStyle.buttonsTopMargin
+ - root.platformStyle.titleBarHeight
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+
+ buttons: Item {
+ id: buttonRowFiller
+ width: parent.width
+ height: childrenRect.height //+ root.platformStyle.buttonsTopMargin
+ y: root.platformStyle.buttonsTopMargin
+
+ onWidthChanged: {
+ if (acceptButton.width + rejectButton.width > width) {
+ acceptButton.width = width / 2
+ rejectButton.width = width / 2
+ } else {
+ acceptButton.width = acceptButton.implicitWidth
+ rejectButton.width = rejectButton.implicitWidth
+ }
+ }
+
+ Row {
+ id: buttonRow
+ height: childrenRect.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ Button {
+ id: acceptButton
+ height: implicitHeight
+ objectName: "acceptButton"
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ height: implicitHeight
+ objectName: "rejectButton"
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+//import com.nokia.meego 1.0
+
+/*
+ Class: InfoBanner
+ The InfoBanner component is used to display information to the user. The number of lines of text
+ shouldn't exceed 3.
+*/
+
+Item {
+ id: root
+
+ /*
+ * Property: iconSource
+ * [url] The path to the icon image
+ */
+ property url iconSource: ""
+
+ /*
+ * Property: text
+ * [string] Text to be displayed in InfoBanner
+ */
+ property alias text: text.text
+
+ /*
+ * Property: timerEnabled
+ * [bool=true] Enable/disable timer that dismisses InfoBanner
+ */
+ property bool timerEnabled: true
+
+ /*
+ * Property: timerShowTime
+ * [int=3000ms] For setting how long InfoBanner stays visible to user before being dismissed
+ */
+ property alias timerShowTime: sysBannerTimer.interval
+
+ /*
+ * Property: topMargin
+ * [int=8 pix] Allows user to customize top margin if needed
+ */
+ property alias topMargin: root.y
+
+ /*
+ * Property: leftMargin
+ * [int=8 pix] Allows user to customize left margin if needed
+ */
+ property alias leftMargin: root.x
+
+ /*
+ * Function: show
+ * Show InfoBanner
+ */
+ function show() {
+ parent = __findParent();
+ animationShow.running = true;
+ if (root.timerEnabled)
+ sysBannerTimer.restart();
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent && next.objectName != "appWindowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ /*
+ * Function: hide
+ * Hide InfoBanner
+ */
+ function hide() {
+ animationHide.running = true;
+ }
+
+ implicitHeight: internal.getBannerHeight()
+ implicitWidth: internal.getBannerWidth()
+ x:8; y:8
+ scale: 0
+
+ BorderImage {
+ source: "image://theme/meegotouch-notification-system-background"
+ anchors.fill: root
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ opacity: 1
+ }
+
+ Image {
+ id: image
+ anchors { left: parent.left; leftMargin: 16; top: parent.top; topMargin: 16 }
+ source: root.iconSource
+ visible: root.iconSource != ""
+ }
+
+ Text {
+ id: text
+ width: internal.getTextWidth()
+ anchors { left: (image.visible ? image.right : parent.left); leftMargin: (image.visible ? 14:16);
+ top: parent.top; topMargin: internal.getTopMargin(); bottom: parent.bottom }
+ color: "white"
+ wrapMode: Text.Wrap
+ verticalAlignment: Text.AlignHCenter
+ font.pixelSize: 24
+ font.family: "Nokia Pure"
+ font.letterSpacing: -1.2
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ }
+
+ QtObject {
+ id: internal
+
+ function getBannerHeight() {
+ if (image.visible) {
+ if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ } else {
+ if (text.lineCount <= 1)
+ return 80; //64
+ else if (text.lineCount <= 2)
+ return 80;
+ else
+ return 80; //106
+ }
+ }
+
+ function getBannerWidth() {
+ if ( screen.currentOrientation==Screen.Portrait || screen.currentOrientation==Screen.PortraitInverted ) {
+ // In portrait mode, the width of the banner is equal to the width of parent minus left
+ // and right margins in-between banner and parent.
+ return parent.width-root.x*2;
+ } else {
+ if (image.visible) {
+ // If an icon image is specified...
+ if ((image.width+text.paintedWidth+46) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 46 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of icon, text, and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width*0.54;
+ } else {
+ return parent.width-root.x*2;
+ }
+ } else {
+ // If no icon image specified...
+ if ((text.paintedWidth+32) <= parent.width*0.54 && text.lineCount <= 1) {
+ // 32 is the sum of all horizontal margins within the banner. The above condition basically
+ // says that if there's only one line of text, and the sum of width of text and required
+ // margins is less then 54% of the screen width, banner width should be 54% of the screen.
+ return parent.width-root.x*2;
+ } else {
+ return parent.width-root.x*2;
+ }
+ }
+ }
+ }
+
+ function getTopMargin() {
+ if (text.lineCount <= 1 && !image.visible) {
+ // If there's only one line of text and no icon image, top and bottom margins are equal.
+ return (root.height-text.paintedHeight)/2;
+ } else {
+ // In all other cases, top margin is 4 px more than bottom margin.
+ return (root.height-text.paintedHeight)/2 + 2;
+ }
+ }
+
+ function getTextWidth() {
+ // 46(32 when there's no icon) is sum of all margins within banner. root.x*2 is sum of margins outside banner.
+ // Text element width is dertermined by substracting parent width(screen width) by all the margins and
+ // icon width(if applicable).
+ return image.visible ? (parent.width-root.x*2-46-image.width) : (parent.width-root.x*2-32);
+ }
+
+ function getScaleValue() {
+ // When banner is displayed, as part of transition effect, it'll first be enlarged to the point where its width
+ // is equal to screen width. root.x*2/root.width calculates the amount of expanding required, where root.x*2 is
+ // equal to screen.displayWidth minus banner.width
+ return root.x*2/root.width + 1;
+ }
+ }
+
+ Timer {
+ id: sysBannerTimer
+ repeat: false
+ running: false
+ interval: 3000
+ onTriggered: hide()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide()
+ }
+
+ SequentialAnimation {
+ id: animationShow
+ NumberAnimation { target: root; property: "scale"; from: 0; to: internal.getScaleValue(); duration: 200; easing.type: Easing.OutQuad}
+ NumberAnimation { target: root; property: "scale"; from: internal.getScaleValue(); to: 1; duration: 200 }
+ }
+
+ NumberAnimation {
+ id: animationHide
+ target: root; property: "scale"; to: 0; duration: 200; easing.type: Easing.InExpo
+ }
+
+ Component.onCompleted: {
+ //__owner = parent;
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The Page item is intended for use as a root item in QML items that make
+// up pages to use with the PageStack.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Item {
+ id: root
+
+ visible: false
+
+ // Note we do not use anchor fill here because it will force us to relayout
+ // hidden children when rotating the screen as well
+ width: visible && parent ? parent.width - anchors.leftMargin - anchors.rightMargin : __prevWidth
+ height: visible && parent ? parent.height - anchors.topMargin - anchors.bottomMargin : __prevHeight
+ x: parent ? anchors.leftMargin : 0
+ y: parent ? anchors.topMargin : 0
+
+ onWidthChanged: __prevWidth = visible ? width : __prevWidth
+ onHeightChanged: __prevHeight = visible ? height : __prevHeight
+
+ property int __prevWidth: 0
+ property int __prevHeight: 0
+
+ property bool __isPage: true
+
+ anchors.margins: 0 // Page margins should generally be 16 pixels as defined by UI.MARGIN_XLARGE
+
+ // The status of the page. One of the following:
+ // PageStatus.Inactive - the page is not visible
+ // PageStatus.Activating - the page is transitioning into becoming the active page
+ // PageStatus.Active - the page is the current active page
+ // PageStatus.Deactivating - the page is transitioning into becoming inactive
+ property int status: PageStatus.Inactive
+
+ // Defines the tools for the page; null for none.
+ property Item tools: null
+
+ // The page stack that the page is in.
+ property PageStack pageStack
+
+ // Defines if page is locked in landscape.
+ property bool lockInLandscape: false // Deprecated
+ onLockInLandscapeChanged: console.log("warning: Page.lockInLandscape is deprecated, use Page.orientationLock")
+
+ // Defines if page is locked in portrait.
+ property bool lockInPortrait: false // Deprecated
+ onLockInPortraitChanged: console.log("warning: Page.lockInPortrait is deprecated, use Page.orientationLock")
+
+ // Defines orientation lock for a page
+ property int orientationLock: PageOrientation.Automatic
+
+ onStatusChanged: {
+ if (status == PageStatus.Activating) {
+ __updateOrientationLock()
+ }
+ }
+
+ onOrientationLockChanged: {
+ __updateOrientationLock()
+ }
+
+ function __updateOrientationLock() {
+ switch (orientationLock) {
+ case PageOrientation.Automatic:
+ screen.setAllowedOrientations(Screen.Portrait | Screen.Landscape);
+ break
+ case PageOrientation.LockPortrait:
+ screen.setAllowedOrientations(Screen.Portrait);
+ break
+ case PageOrientation.LockLandscape:
+ screen.setAllowedOrientations(Screen.Landscape);
+ break
+ case PageOrientation.LockPrevious:
+ // Allowed orientation should be changed to current
+ // if previously it was locked, it will remain locked
+ // if previously it was not locked, it will be locked to current
+ screen.setAllowedOrientations(screen.currentOrientation);
+ break
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Page stack. Items are page containers.
+var pageStack = [];
+
+// Page component cache map. Key is page url, value is page component.
+var componentCache = {};
+
+// Returns the page stack depth.
+function getDepth() {
+ return pageStack.length;
+}
+
+// Pushes a page on the stack.
+function push(page, properties, replace, immediate) {
+ // page order sanity check
+ if ((!replace && page == currentPage) ||
+ (replace && pageStack.length > 1 && page == pageStack[pageStack.length - 2].page)) {
+ throw new Error("Cannot navigate so that the resulting page stack has two consecutive entries of the same page instance.");
+ }
+
+ // figure out if more than one page is being pushed
+ var pages;
+ if (page instanceof Array) {
+ pages = page;
+ page = pages.pop();
+ if (page.createObject === undefined && page.parent === undefined && typeof page != "string") {
+ properties = properties || page.properties;
+ page = page.page;
+ }
+ }
+
+ // get the current container
+ var oldContainer = pageStack[pageStack.length - 1];
+
+ // pop the old container off the stack if this is a replace
+ if (oldContainer && replace) {
+ pageStack.pop();
+ }
+
+ // push any extra defined pages onto the stack
+ if (pages) {
+ var i;
+ for (i = 0; i < pages.length; i++) {
+ var tPage = pages[i];
+ var tProps;
+ if (tPage.createObject === undefined && tPage.parent === undefined && typeof tPage != "string") {
+ tProps = tPage.properties;
+ tPage = tPage.page;
+ }
+ pageStack.push(initPage(tPage, tProps));
+ }
+ }
+
+ // initialize the page
+ var container = initPage(page, properties);
+
+ // push the page container onto the stack
+ pageStack.push(container);
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ immediate = immediate || !oldContainer;
+ if (oldContainer) {
+ oldContainer.pushExit(replace, immediate);
+ }
+ container.pushEnter(replace, immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : replace ? "replace" : "push");
+ }
+
+ return container.page;
+}
+
+// Initializes a page and its container.
+function initPage(page, properties) {
+ var container = containerComponent.createObject(root);
+
+ var pageComp;
+ if (page.createObject) {
+ // page defined as component
+ pageComp = page;
+ } else if (typeof page == "string") {
+ // page defined as string (a url)
+ pageComp = componentCache[page];
+ if (!pageComp) {
+ pageComp = componentCache[page] = Qt.createComponent(page);
+ }
+ }
+ if (pageComp) {
+ if (pageComp.status == Component.Error) {
+ throw new Error("Error while loading page: " + pageComp.errorString());
+ } else {
+ // instantiate page from component
+ page = pageComp.createObject(container, properties || {});
+ }
+ } else {
+ // copy properties to the page
+ for (var prop in properties) {
+ if (properties.hasOwnProperty(prop)) {
+ page[prop] = properties[prop];
+ }
+ }
+ }
+
+ container.page = page;
+ container.owner = page.parent;
+
+ // the page has to be reparented if
+ if (page.parent != container) {
+ page.parent = container;
+ }
+
+ if (page.pageStack !== undefined) {
+ page.pageStack = root;
+ }
+
+ return container;
+}
+
+// Pops a page off the stack.
+function pop(page, immediate) {
+ // make sure there are enough pages in the stack to pop
+ if (pageStack.length > 1) {
+ // pop the current container off the stack and get the next container
+ var oldContainer = pageStack.pop();
+ var container = pageStack[pageStack.length - 1];
+ if (page !== undefined) {
+ // an unwind target has been specified - pop until we find it
+ while (page != container.page && pageStack.length > 1) {
+ container.cleanup();
+ pageStack.pop();
+ container = pageStack[pageStack.length - 1];
+ }
+ }
+
+ depth = pageStack.length;
+ currentPage = container.page;
+
+ // perform page transition
+ oldContainer.popExit(immediate);
+ container.popEnter(immediate);
+
+ // sync tool bar
+ var tools = container.page.tools || null;
+ if (toolBar) {
+ toolBar.setTools(tools, immediate ? "set" : "pop");
+ }
+
+ return oldContainer.page;
+ } else {
+ return null;
+ }
+}
+
+// Clears the page stack.
+function clear() {
+ var container;
+ while (container = pageStack.pop()) {
+ container.cleanup();
+ }
+ depth = 0;
+ currentPage = null;
+}
+
+// Iterates through all pages in the stack (top to bottom) to find a page.
+function find(func) {
+ for (var i = pageStack.length - 1; i >= 0; i--) {
+ var page = pageStack[i].page;
+ if (func(page)) {
+ return page;
+ }
+ }
+ return null;
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The PageStack item defines a container for pages and a stack-based
+// navigation model. Pages can be defined as QML items or components.
+
+import QtQuick 1.1
+import "." 1.0
+import "PageStack.js" as Engine
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // Page stack depth.
+ property int depth: Engine.getDepth()
+
+ // The currently active page.
+ property Item currentPage: null
+
+ // The application tool bar.
+ property ToolBar toolBar
+
+ // Indicates whether there is an ongoing page transition.
+ property bool busy: __ongoingTransitionCount > 0
+
+ // The number of ongoing transitions.
+ property int __ongoingTransitionCount: 0
+
+ // Pushes a page on the stack.
+ // The page can be defined as a component, item or string.
+ // If an item is used then the page will get re-parented.
+ // If a string is used then it is interpreted as a url that is used to load a page component.
+ //
+ // The page can also be given as an array of pages. In this case all those pages will be pushed
+ // onto the stack. The items in the stack can be components, items or strings just like for single
+ // pages. Additionally an object can be used, which specifies a page and an optional properties
+ // property. This can be used to push multiple pages while still giving each of them properties.
+ // When an array is used the transition animation will only be to the last page.
+ //
+ // The properties argument is optional and allows defining a map of properties to set on the page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance.
+ function push(page, properties, immediate) {
+ return Engine.push(page, properties, false, immediate);
+ }
+
+ // Pops a page off the stack.
+ // If page is specified then the stack is unwound to that page; null to unwind the to first page.
+ // If the immediate argument is true then no transition animation is performed.
+ // Returns the page instance that was popped off the stack.
+ function pop(page, immediate) {
+ return Engine.pop(page, immediate);
+ }
+
+ // Replaces a page on the stack.
+ // See push() for details.
+ function replace(page, properties, immediate) {
+ return Engine.push(page, properties, true, immediate);
+ }
+
+ // Clears the page stack.
+ function clear() {
+ return Engine.clear();
+ }
+
+ // Iterates through all pages (top to bottom) and invokes the specified function.
+ // If the specified function returns true the search stops and the find function
+ // returns the page that the iteration stopped at. If the search doesn't result
+ // in any page being found then null is returned.
+ function find(func) {
+ return Engine.find(func);
+ }
+
+ // Called when the page stack visibility changes.
+ onVisibleChanged: {
+ if (currentPage) {
+ __setPageStatus(currentPage, visible ? PageStatus.Active : PageStatus.Inactive);
+ if (visible) {
+ currentPage.visible = currentPage.parent.visible = true;
+ }
+ }
+ }
+
+ // Sets the page status.
+ function __setPageStatus(page, status) {
+ if (page.status !== undefined) {
+ if (status == PageStatus.Active && page.status == PageStatus.Inactive) {
+ page.status = PageStatus.Activating;
+ } else if (status == PageStatus.Inactive && page.status == PageStatus.Active) {
+ page.status = PageStatus.Deactivating;
+ }
+ page.status = status;
+ }
+ }
+
+ // Component for page containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The page held by this container.
+ property Item page: null
+
+ // The owner of the page.
+ property Item owner: null
+
+ // Duration of transition animation (in ms)
+ property int transitionDuration: 500
+
+ // Flag that indicates the container should be cleaned up after the transition has ended.
+ property bool cleanupAfterTransition: false
+
+ // Performs a push enter transition.
+ function pushEnter(replace, immediate) {
+ if (!immediate) {
+ state = replace ? "front" : "right";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a push exit transition.
+ function pushExit(replace, immediate) {
+ state = immediate ? "hidden" : (replace ? "back" : "left");
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (replace) {
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+ }
+
+ // Performs a pop enter transition.
+ function popEnter(immediate) {
+ if (!immediate) {
+ state = "left";
+ }
+ state = "";
+ page.visible = true;
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Active);
+ }
+ }
+
+ // Performs a pop exit transition.
+ function popExit(immediate) {
+ state = immediate ? "hidden" : "right";
+ if (root.visible && immediate) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (immediate) {
+ cleanup();
+ } else {
+ cleanupAfterTransition = true;
+ }
+ }
+
+ // Called when a transition has started.
+ function transitionStarted() {
+ __ongoingTransitionCount++;
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Activating : PageStatus.Deactivating);
+ }
+ }
+
+ // Called when a transition has ended.
+ function transitionEnded() {
+ if (state != "") {
+ state = "hidden";
+ }
+ if (root.visible) {
+ __setPageStatus(page, (state == "") ? PageStatus.Active : PageStatus.Inactive);
+ }
+ __ongoingTransitionCount--;
+ if (cleanupAfterTransition) {
+ cleanup();
+ }
+ }
+
+ states: [
+ // Explicit properties for default state.
+ State {
+ name: ""
+ PropertyChanges { target: container; visible: true }
+ },
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -width }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: width }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.5; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.5; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "left") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "left") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ ScriptAction { script: if (state == "right") { transitionStarted(); } else { transitionEnded(); } }
+ PropertyAnimation { properties: "x"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: if (state == "right") { transitionEnded(); } else { transitionStarted(); } }
+ }
+ },
+ // Replace entry transition.
+ Transition {
+ from: "front"; to: "";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ },
+ // Replace exit transition.
+ Transition {
+ from: ""; to: "back";
+ SequentialAnimation {
+ ScriptAction { script: transitionStarted(); }
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: transitionDuration }
+ ScriptAction { script: transitionEnded(); }
+ }
+ }
+ ]
+
+ // Cleans up the container and then destroys it.
+ function cleanup() {
+ if (page.status == PageStatus.Active) {
+ __setPageStatus(page, PageStatus.Inactive);
+ }
+ if (owner != container) {
+ // container is not the owner of the page - re-parent back to original owner
+ page.visible = false;
+ page.parent = owner;
+ }
+ container.destroy();
+ }
+
+ }
+ }
+
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import "." 1.0
+
+Window {
+ id: window
+
+ property bool showStatusBar: true
+ property bool showToolBar: true
+ property bool toolBarOnTop: false
+ property variant initialPage
+ property alias pageStack: stack
+ property Style platformStyle: PageStackWindowStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: window.platformStyle
+
+ //private api
+ property int __statusBarHeight: showStatusBar ? statusBar.height : 0
+
+ objectName: "pageStackWindow"
+
+ StatusBar {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+ showStatusBar: window.showStatusBar
+ }
+
+ onOrientationChangeStarted: {
+ statusBar.orientation = screen.currentOrientation
+ }
+
+ Rectangle {
+ id: background
+ visible: platformStyle.background == ""
+ color: platformStyle.backgroundColor
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Image {
+ id: backgroundImage
+ visible: platformStyle.background != ""
+ source: window.inPortrait ? platformStyle.portraitBackground : platformStyle.landscapeBackground
+ fillMode: platformStyle.backgroundFillMode
+ width: window.inPortrait ? screen.displayHeight : screen.displayWidth
+ height: window.inPortrait ? screen.displayWidth : screen.displayHeight
+ anchors { top: statusBar.bottom; left: parent.left; }
+ }
+
+ Item {
+ objectName: "appWindowContent"
+ width: parent.width
+ anchors.top: statusBar.bottom
+ anchors.bottom: parent.bottom
+
+ // content area
+ Item {
+ id: contentArea
+ anchors { top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; }
+ anchors.bottomMargin: !toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ anchors.topMargin: toolBarOnTop && (toolBar.visible || (toolBar.opacity==1))? toolBar.height : 0
+ PageStack {
+ id: stack
+ anchors.fill: parent
+ toolBar: toolBar
+ }
+ }
+
+ Item {
+ id: roundedCorners
+ visible: platformStyle.cornersVisible
+ anchors.fill: parent
+ z: 10001
+
+ Image {
+ anchors.top : parent.top
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-top-left"
+ }
+ Image {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-top-right"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.left: parent.left
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-left"
+ }
+ Image {
+ anchors.bottom : parent.bottom
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-applicationwindow-corner-bottom-right"
+ }
+ }
+
+ ToolBar {
+ id: toolBar
+ anchors.top: toolBarOnTop ? parent.top: undefined
+ anchors.bottom: !toolBarOnTop ? parent.bottom: undefined
+ privateVisibility: (inputContext.softwareInputPanelVisible==true || inputContext.customSoftwareInputPanelVisible == true)
+ ? ToolBarVisibility.HiddenImmediately : (window.showToolBar ? ToolBarVisibility.Visible : ToolBarVisibility.Hidden)
+ }
+ }
+
+ // event preventer when page transition is active
+ MouseArea {
+ anchors.fill: parent
+ enabled: pageStack.busy
+ }
+
+ Component.onCompleted: {
+ if (initialPage) pageStack.push(initialPage);
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ property bool cornersVisible: true
+
+ // Background
+ property url background: ""
+
+ // Background color is used when no background is set.
+ property color backgroundColor: theme.inverted ? "#000000" : "#E0E1E2"
+
+ property url landscapeBackground: background
+ property url portraitBackground: background
+ property url portraiteBackground: background
+
+ property int backgroundFillMode: Image.Tile
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ // api
+ property alias visualParent: fader.visualParent
+
+ // possible states: Opening, Open, Closing, Closed
+ // Opening and Closing are used during animation (when the dialog fades/moves/pops/whatever in)
+ property int status: DialogStatus.Closed
+
+ // private api
+ property double __dim: 0.9
+ property int __fadeInDuration
+ property int __fadeOutDuration
+ property int __fadeInDelay
+ property int __fadeOutDelay
+ property int __fadeInEasingType
+ property int __fadeOutEasingType
+ property string __faderBackground
+
+ function open() {
+ if (status == DialogStatus.Closed)
+ status = DialogStatus.Opening;
+ }
+
+ function close() {
+ if (status == DialogStatus.Open)
+ status = DialogStatus.Closing;
+ }
+
+ signal privateClicked
+
+ //Deprecated, TODO Remove the following two lines on w13
+ signal clicked
+ onClicked: privateClicked()
+
+ QtObject {
+ id: parentCache
+ property QtObject oldParent: null
+ }
+
+ Component.onCompleted: {
+ parentCache.oldParent = parent;
+ fader.parent = parent;
+ parent = fader;
+ }
+
+ //if this is not given, application may crash in some cases
+ Component.onDestruction: {
+ if (parentCache.oldParent != null) {
+ parent = parentCache.oldParent
+ fader.parent = root
+ }
+ }
+
+ Fader {
+ id: fader
+ dim: root.__dim
+ fadeInDuration: root.__fadeInDuration
+ fadeOutDuration: root.__fadeOutDuration
+ fadeInDelay: root.__fadeInDelay
+ fadeOutDelay: root.__fadeOutDelay
+ fadeInEasingType: root.__fadeInEasingType
+ fadeOutEasingType: root.__fadeOutEasingType
+
+
+ background: root.__faderBackground
+ onPrivateClicked: root.privateClicked();
+
+ MouseArea {
+ anchors.fill: parent
+ enabled: root.status == DialogStatus.Opening || root.status == DialogStatus.Closing
+ z: Number.MAX_VALUE
+ }
+ }
+
+ function __fader() {
+ return fader;
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+import "TextAreaHelper.js" as AreaHelper
+
+ImplicitSizeItem {
+ id: container
+
+ property alias minimumValue: progressModel.minimumValue
+ property alias maximumValue: progressModel.maximumValue
+ property alias value: progressModel.value
+ property bool indeterminate: false
+
+ // Styling for the ProgressBar
+ property Style platformStyle: ProgressBarStyle{}
+
+ //Deprecated, can be removed on W13
+ property alias style: container.platformStyle
+
+ implicitWidth: platformStyle.sizeButton
+ implicitHeight: background.height
+
+ QtObject {
+ id: internal
+ property Flickable flick
+ property bool offScreen: false
+ }
+
+ BorderImage {
+ id: background
+ width: parent.width
+ horizontalTileMode: BorderImage.Repeat
+ source: platformStyle.barBackground
+
+ border {
+ left: 6
+ top: 4
+ right: 6
+ bottom: 4
+ }
+ }
+
+ MaskedItem {
+ id: foreground
+ width: parent.width
+ height: parent.height
+
+ mask: BorderImage {
+ width: indeterminate ? container.width : progressModel.position
+ height: foreground.height
+ source: platformStyle.barMask
+
+ border {
+ left: 4
+ top: 4
+ right: 4
+ bottom: 4
+ }
+ }
+
+ Image {
+ id: texture
+ width: foreground.width + sourceSize.width + 25
+ height: foreground.height
+ fillMode: Image.Tile
+
+ property real xTemp;
+
+ source: indeterminate ? platformStyle.unknownTexture : platformStyle.knownTexture
+
+ onXTempChanged: {
+ // Control the animation speed with this multiplier and the NumberAnimation duration divider
+ texture.x = Math.round(texture.xTemp) * 4;
+ }
+
+ NumberAnimation on xTemp {
+ running: indeterminate && container.visible && Qt.application.active && !internal.offScreen
+ loops: Animation.Infinite
+ from: -texture.sourceSize.width
+ to: 0
+ // time = distance / speed, where speed = 10 from the platformStyle
+ duration: (1000 * texture.sourceSize.width / 10)
+ }
+ }
+ }
+
+ RangeModel {
+ id: progressModel
+ positionAtMinimum: 0
+ positionAtMaximum: background.width
+
+ // Defaults from Common API specification
+ minimumValue: 0
+ maximumValue: 1.0
+ }
+
+ Connections {
+ target: internal.flick
+
+ onMovementStarted: internal.offScreen = false
+
+ onMovementEnded: {
+ var pos = mapToItem(internal.flick, 0, 0)
+ internal.offScreen = (pos.y + container.height <= 0) || (pos.y >= internal.flick.height) || (pos.x + container.width <= 0) || (pos.x >= internal.flick.width)
+ }
+ }
+
+ Component.onCompleted: {
+ var flick = AreaHelper.findFlickable()
+ if (flick)
+ internal.flick = flick
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int sizeButton: UI.SIZE_BUTTON
+
+ // Images
+ property url barBackground: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-background"
+ property url barMask: "image://theme/meegotouch-progressindicator"+__invertedString+"-bar-mask"
+ property url unknownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-unknown-texture"
+ property url knownTexture: "image://theme/" + __colorString + "meegotouch-progressindicator"+__invertedString+"-bar-known-texture"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Dialog {
+ id: root
+ objectName: "queryDialog"
+
+ property string titleText
+ property string message
+
+ //are they necessary?
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ //ToDo
+ property alias icon: iconImage.source
+
+ property Style platformStyle: QueryDialogStyle {}
+
+ //__centerContentField: true
+
+ __dim: platformStyle.dim
+ __fadeInDuration: platformStyle.fadeInDuration
+ __fadeOutDuration: platformStyle.fadeOutDuration
+ __fadeInDelay: platformStyle.fadeInDelay
+ __fadeOutDelay: platformStyle.fadeOutDelay
+
+ __animationChief: "queryDialog"
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ title: Item {
+ id: titleField
+ width: parent.width
+ height: titleText == "" ? titleBarIconField.height :
+ titleBarIconField.height + titleLabel.height + root.platformStyle.titleColumnSpacing
+ Column {
+ id: titleFieldCol
+ spacing: root.platformStyle.titleColumnSpacing
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ width: root.width
+
+ Item {
+ id: titleBarIconField
+ height: iconImage.height
+ width: parent.width
+ Image {
+ id: iconImage
+ anchors.horizontalCenter: titleBarIconField.horizontalCenter
+ source: ""
+ }
+
+ }
+
+
+ Item {
+ id: titleBarTextField
+ height: titleLabel.height
+ width: parent.width
+
+ Text {
+ id: titleLabel
+ width: parent.width
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: root.platformStyle.titleFontFamily
+ font.pixelSize: root.platformStyle.titleFontPixelSize
+ font.bold: root.platformStyle.titleFontBold
+ font.capitalization: root.platformStyle.titleFontCapitalization
+ elide: root.platformStyle.titleElideMode
+ wrapMode: elide == Text.ElideNone ? Text.Wrap : Text.NoWrap
+ color: root.platformStyle.titleTextColor
+ text: root.titleText
+
+ }
+ }
+
+ // needed for animation
+ transform: Scale {
+ id: titleScale
+ xScale: 1.0; yScale: 1.0
+ origin.x: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).x
+ origin.y: mapFromItem(queryContent, queryContent.width / 2, queryContent.height / 2).y
+ }
+
+ }
+ }
+
+ // the content field which contains the message text
+ content: Item {
+ id: queryContentWrapper
+
+ property int upperBound: visualParent ? visualParent.height - titleField.height - buttonColFiller.height - 64
+ : root.parent.height - titleField.height - buttonColFiller.height - 64
+ property int __sizeHint: Math.min(Math.max(root.platformStyle.contentFieldMinSize, queryText.height), upperBound)
+
+ height: __sizeHint + root.platformStyle.contentTopMargin
+ width: root.width
+
+ Item {
+ id: queryContent
+ width: parent.width
+
+ y: root.platformStyle.contentTopMargin
+
+ Flickable {
+ id: queryFlickable
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ //anchors.bottom: parent.bottom
+ height: queryContentWrapper.__sizeHint
+
+ contentHeight: queryText.height
+ flickableDirection: Flickable.VerticalFlick
+ clip: true
+
+ interactive: queryText.height > queryContentWrapper.__sizeHint
+
+ Text {
+ id: queryText
+ width: queryFlickable.width
+ horizontalAlignment: Text.AlignHCenter
+ font.family: root.platformStyle.messageFontFamily
+ font.pixelSize: root.platformStyle.messageFontPixelSize
+ color: root.platformStyle.messageTextColor
+ wrapMode: Text.WordWrap
+ text: root.message
+ }
+
+ }
+
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: queryFlickable
+ anchors.rightMargin: - UI.SCROLLDECORATOR_LONG_MARGIN - 10 //ToDo: Don't use a hard-coded gap
+ }
+
+ }
+ }
+
+
+ buttons: Item {
+ id: buttonColFiller
+ width: parent.width
+ height: childrenRect.height
+
+ anchors.top: parent.top
+
+ //ugly hack to assure, that we're always evaluating the correct height
+ //otherwise the topMargin wouldn't be considered
+ Item {id: dummy; anchors.fill: parent}
+
+ Column {
+ id: buttonCol
+ anchors.top: parent.top
+ anchors.topMargin: root.platformStyle.buttonTopMargin
+ spacing: root.platformStyle.buttonsColumnSpacing
+
+ height: (acceptButton.text == "" ? 0 : acceptButton.height)
+ + (rejectButton.text == "" ? 0 : rejectButton.height)
+ + anchors.buttonTopMargin + spacing
+
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Button {
+ id: acceptButton
+ text: ""
+ onClicked: accept()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ Button {
+ id: rejectButton
+ text: ""
+ onClicked: reject()
+ visible: text != ""
+ __dialogButton: true
+ platformStyle: ButtonStyle {inverted: true}
+ }
+ }
+ }
+
+ StateGroup {
+ id: statesWrapper
+
+ state: "__query__hidden"
+
+ // needed for button animation
+ // without resetting the button row's coordinate system would be translated
+ property int __buttonSaver: buttonColFiller.y
+
+ states: [
+ State {
+ name: "__query__visible"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Opening || root.status == DialogStatus.Open)
+ PropertyChanges {
+ target: root
+ opacity: 1.0
+ }
+ },
+ State {
+ name: "__query__hidden"
+ when: root.__animationChief == "queryDialog" && (root.status == DialogStatus.Closing || root.status == DialogStatus.Closed)
+ PropertyChanges {
+ target: root
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "__query__visible"; to: "__query__hidden"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "hidden";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+ root.status = DialogStatus.Closing;
+
+ }
+ }
+
+ NumberAnimation { target: root; properties: "opacity"; from: 0.0; to: 1.0; duration: 0 }
+
+ // With a 100ms delay the background
+ // fades to alpha 0% (500ms, quint ease out).
+ // ---> done in the fader
+
+ ParallelAnimation {
+ // The closing transition starts with the message dimming to alpha 0% and
+ // scaling to 80% (anchorpoint in the middle of the message, 100ms, quint
+ // ease in).
+
+ // With no delay the buttons fade to alpha 0% and translate 30
+ // pixels upwards (100ms, quint ease in).
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: queryContent; property: "scale"; from: 1.0 ; to: 0.8; duration: 100; easing.type: Easing.InQuint}
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 1.0; to: 0.0; duration: 100}
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y
+ to: buttonColFiller.y-30
+ duration: 100
+ easing.type: Easing.InQuint
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ // make sure, root isn't visible:
+ root.opacity = 0.0;
+ status = DialogStatus.Closed;
+
+ }
+ }
+
+ }
+ },
+ Transition {
+ from: "__query__hidden"; to: "__query__visible"
+ SequentialAnimation {
+ ScriptAction {script: {
+ __fader().state = "visible";
+
+ statesWrapper.__buttonSaver = buttonColFiller.y
+
+ root.status = DialogStatus.Opening;
+ // UPPERCASE-UGLY, but necessary to avoid flicker
+ root.opacity = 1.0
+ titleField.opacity = 0.0
+ queryContent.opacity = 0.0
+ buttonColFiller.opacity = 0.0
+ }
+ }
+
+ // The opening transition starts by dimming the background to 90% (250ms,
+ // quint ease in).
+ // ---> done in the fader
+ ParallelAnimation {
+ SequentialAnimation {
+
+ // With a 200ms delay from the beginning the message fades
+ // from alpha 0% to 100% and scales from 80% to 100% (anchorpoint in the
+ // middle of the message, 550ms, custom ease).
+ PauseAnimation { duration: 200 }
+ ParallelAnimation {
+ NumberAnimation {target: queryContent; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleField; properties: "opacity"; from: 0.0; to: 1.0; duration: 550}
+ NumberAnimation {target: titleScale; properties: "xScale,yScale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ NumberAnimation {target: queryContent; property: "scale"; from: 0.8 ; to: 1.0; duration: 550; easing.type: Easing.OutBack}
+ }
+ }
+ SequentialAnimation {
+ // With a 250ms delay from the
+ // beginning the buttons fade from alpha 0% to 100% and translate 25 pixels
+ // in Y axis away from their final destination (400ms, custom ease).
+ PauseAnimation { duration: 250 }
+ ParallelAnimation {
+ NumberAnimation {target: buttonColFiller; properties: "opacity"; from: 0.0; to: 1.0; duration: 400; }
+ NumberAnimation {target: buttonColFiller
+ properties: "y"
+ from: buttonColFiller.y-25
+ to: buttonColFiller.y
+ duration: 400
+ easing.type: Easing.OutBack
+ }
+ }
+ }
+ }
+
+ ScriptAction {script: {
+
+ // reset button
+ buttonColFiller.y = statesWrapper.__buttonSaver
+
+ root.status = DialogStatus.Open;
+ }
+ }
+ }
+ }
+ ]
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property string titleFontFamily: UI.FONT_FAMILY
+ property int titleFontPixelSize: UI.FONT_XLARGE
+ property int titleFontCapitalization: Font.MixedCase
+ property bool titleFontBold: true
+ property color titleTextColor: "white"
+
+ property int contentFieldMinSize: 24
+
+ //spacing
+ property int contentTopMargin: 21
+ property int buttonTopMargin: 38
+
+ property int titleColumnSpacing: 17
+
+ //properties inherited by DialogStyle
+ buttonsColumnSpacing: 16
+ leftMargin: 33
+ rightMargin: 33
+ titleElideMode: Text.ElideNone
+
+ property string messageFontFamily: UI.FONT_FAMILY
+ property int messageFontPixelSize: UI.FONT_DEFAULT
+ property color messageTextColor: "#ffffff"
+
+ // fader properties
+ property double dim: 0.9
+ property int fadeInDuration: 250 // ms
+ property int fadeOutDuration: 250 // ms
+
+ property int fadeInDelay: 0 // ms
+ property int fadeOutDelay: 100 // ms
+
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+CheckBox {
+ id: radioButton
+
+ property Style platformStyle: RadioButtonStyle{}
+ property alias style: radioButton.platformStyle
+
+ __imageSource: !radioButton.enabled ? platformStyle.backgroundDisabled :
+ radioButton.pressed ? platformStyle.backgroundPressed :
+ radioButton.checked ? platformStyle.backgroundSelected :
+ platformStyle.background
+
+ function __handleChecked() {
+ if (!radioButton.checked)
+ radioButton.checked = true;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-button-radiobutton"+__invertedString+"-background"
+ property url backgroundSelected: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-selected"
+ property url backgroundPressed: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-pressed"
+ property url backgroundDisabled: "image://theme/" + __colorString + "meegotouch-button-radiobutton"+__invertedString+"-background-disabled"
+
+ // Mouse area margins
+ property int mouseMarginTop: 0
+ property int mouseMarginLeft: 0
+ property int mouseMarginRight: 0
+ property int mouseMarginBottom: 0
+ property int elideMode: Text.ElideNone
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+/**
+ * Class: ScrollDecorator
+ * A ScrollDecorator shows the current position in a scrollable area.
+ */
+Item {
+ id: root
+
+ /**
+ * Property: flickableItem
+ * [Flickable] The Item that should show the ScrollDecorator
+ */
+ property Flickable flickableItem
+
+ property int __topPageMargin: 0
+ property int __bottomPageMargin: 0
+ property int __leftPageMargin: 0
+ property int __rightPageMargin: 0
+ property bool __hasPageWidth : false
+ property bool __hasPageHeight: false
+
+ // These can also be modified (but probably shouldn't)
+ property int __minIndicatorSize: 20
+ property int __hideTimeout: 500
+
+ property bool __alwaysShowIndicator: true
+
+ property Style platformStyle: ScrollDecoratorStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // This function ensures that we allways anchor the decorator correctly according
+ // to the page margins.
+ function __updatePageMargin() {
+ if (!flickableItem)
+ return
+ var p = flickableItem.parent
+ while (p) {
+ if (p.hasOwnProperty("__isPage")) {
+ __hasPageHeight = function() { return p.height == flickableItem.height }
+ __hasPageWidth = function() { return p.width == flickableItem.width }
+ __topPageMargin = function() { return p.anchors.topMargin }
+ __bottomPageMargin = function() { return p.anchors.bottomMargin }
+ __leftPageMargin = function() { return p.anchors.leftMargin }
+ __rightPageMargin = function() { return p.anchors.rightMargin }
+ return;
+ } else {
+ p = p.parent;
+ }
+ }
+ }
+
+ onFlickableItemChanged: { __updatePageMargin() }
+
+ QtObject {
+ id: privateApi
+ function canFlick(direction) {
+ return flickableItem.flickableDirection === direction
+ || flickableItem.flickableDirection === Flickable.HorizontalAndVerticalFlick
+ || flickableItem.flickableDirection === Flickable.AutoFlickDirection;
+ }
+ }
+
+ // Private stuff
+ anchors.fill: flickableItem
+
+ Timer {
+ // Hack to have the indicators flash when the view is shown the first time.
+ // Ideally we would wait until the Flickable is complete, but it doesn't look
+ // possible given the current limitations of QML.
+ interval: 100
+ running: true
+ repeat: false
+ onTriggered: {
+ if (verticalIndicator.shouldShow) {
+ verticalIndicator.state = "visible";
+ verticalIndicator.state = "";
+ }
+ if (horizontalIndicator.shouldShow) {
+ horizontalIndicator.state = "visible";
+ horizontalIndicator.state = "";
+ }
+ }
+ }
+
+ Component {
+ id: verticalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: verticalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.yPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.heightRatio : 0
+ maxPosition: flickableItem ? flickableItem.height : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Component {
+ id: horizontalSizerWrapper
+ ScrollDecoratorSizerCPP {
+ id: horizontalSizer
+ positionRatio: flickableItem ? flickableItem.visibleArea.xPosition : 0
+ sizeRatio: flickableItem ? flickableItem.visibleArea.widthRatio : 0
+ maxPosition: flickableItem ? flickableItem.width : 0
+ minSize: __minIndicatorSize
+ }
+ }
+
+ Loader {id: verticalSizerLoader}
+ Loader {id: horizontalSizerLoader}
+
+ Item {
+ id: verticalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.VerticalFlick)) && (flickableItem.height > 0 && flickableItem.contentHeight > flickableItem.height))
+ opacity: 0
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageWidth ? __rightPageMargin : 0)
+ anchors.top: parent.top
+ anchors.topMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __topPageMargin : 0)
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageWidth ? __bottomPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ verticalSizerLoader.sourceComponent = verticalSizerWrapper;
+ else
+ verticalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.background
+ height: parent.height
+ anchors.right: parent.right
+ }
+ BorderImage {
+ source: platformStyle.indicator
+ border { left: 2; top: 4; right: 2; bottom: 4 }
+ anchors.right: parent.right
+ y: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ? verticalSizerLoader.item.position : 0
+ height: verticalIndicator.shouldShow && verticalSizerLoader.status == Loader.Ready ?
+ verticalSizerLoader.item.size - parent.anchors.topMargin - parent.anchors.bottomMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: verticalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: verticalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+
+ Item {
+ id: horizontalIndicator
+ property bool shouldShow: flickableItem != null && ((__alwaysShowIndicator && privateApi.canFlick(Flickable.HorizontalFlick)) && (flickableItem.width > 0 && flickableItem.contentWidth > flickableItem.width))
+ opacity: 0
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: UI.SCROLLDECORATOR_LONG_MARGIN - (__hasPageHeight ? __bottomPageMargin : 0)
+ anchors.right: parent.right
+ anchors.rightMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __rightPageMargin : 0)
+ anchors.left: parent.left
+ anchors.leftMargin: UI.SCROLLDECORATOR_SHORT_MARGIN - (__hasPageHeight ? __leftPageMargin : 0)
+
+ onShouldShowChanged: {
+ if (shouldShow)
+ horizontalSizerLoader.sourceComponent = horizontalSizerWrapper;
+ else
+ horizontalSizerLoader.sourceComponent = undefined;
+ }
+
+ Image {
+ source: platformStyle.backgroundHorizontal
+ width: parent.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+ BorderImage {
+ source: platformStyle.indicatorHorizontal
+ border { left: 4; top: 2; right: 4; bottom: 2 }
+ anchors.bottom: parent.bottom
+ x: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ? horizontalSizerLoader.item.position : 0
+ width: horizontalIndicator.shouldShow && horizontalSizerLoader.status == Loader.Ready ?
+ horizontalSizerLoader.item.size - parent.anchors.leftMargin - parent.anchors.rightMargin : 0
+ }
+
+ states: State {
+ name: "visible"
+ when: horizontalIndicator.shouldShow && flickableItem.moving
+ PropertyChanges {
+ target: horizontalIndicator
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation {
+ properties: "opacity"
+ duration: root.__hideTimeout
+ }
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ // relative (0..1) position of top and bottom
+ property real positionRatio
+ property real sizeRatio
+
+ // max position and min size
+ property real maxPosition
+ property real minSize
+
+ // size underflow
+ property real sizeUnderflow: (sizeRatio * maxPosition) < minSize ? minSize - (sizeRatio * maxPosition) : 0
+
+ // raw start and end position considering minimum size
+ property real rawStartPos: positionRatio * (maxPosition - sizeUnderflow)
+ property real rawEndPos: (positionRatio + sizeRatio) * (maxPosition - sizeUnderflow) + sizeUnderflow
+
+ // overshoot amount at start and end
+ property real overshootStart: rawStartPos < 0 ? -rawStartPos : 0
+ property real overshootEnd: rawEndPos > maxPosition ? rawEndPos - maxPosition : 0
+
+ // overshoot adjusted start and end
+ property real adjStartPos: rawStartPos + overshootStart
+ property real adjEndPos: rawEndPos - overshootStart - overshootEnd
+
+ // final position and size of thumb
+ property int position: 0.5 + (adjStartPos + minSize > maxPosition ? maxPosition - minSize : adjStartPos)
+ property int size: 0.5 + ((adjEndPos - position) < minSize ? minSize : (adjEndPos - position))
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-positionindicator"+__invertedString+"-background"
+ property url indicator: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator"
+ property url backgroundHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-background-horizontal"
+ property url indicatorHorizontal: "image://theme/meegotouch-positionindicator"+__invertedString+"-indicator-horizontal"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var sectionData = [];
+var _sections = [];
+
+function initialize(list) {
+ initSectionData(list);
+}
+
+function initSectionData(list) {
+ if (!list || !list.model) return;
+ sectionData = [];
+ _sections = [];
+ var current = "",
+ prop = list.section.property,
+ item;
+
+ for (var i = 0, count = list.model.count; i < count; i++) {
+ item = list.model.get(i);
+ if (item[prop] !== current) {
+ current = item[prop];
+ _sections.push(current);
+ sectionData.push({ index: i, header: current });
+ }
+ }
+}
+
+function getSectionPositionString(name) {
+ var val = _sections.indexOf(name);
+ return val === 0 ? "first" :
+ val === _sections.length - 1 ? "last" : false;
+}
+
+function getAt(pos) {
+ return _sections[pos] ? _sections[pos] : "";
+}
+
+function getRelativeSections(current) {
+ var val = _sections.indexOf(current),
+ sect = [],
+ sl = _sections.length;
+
+ val = val < 1 ? 1 : val >= sl-1 ? sl-2 : val;
+ sect = [getAt(val - 1), getAt(val), getAt(val + 1)];
+
+ return sect;
+}
+
+function getClosestSection(pos, down) {
+ var tmp = (_sections.length) * pos;
+ var val = Math.ceil(tmp) // TODO: better algorithm
+ val = val < 2 ? 1 : val;
+ return _sections[val-1];
+}
+
+function getNextSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val < _sections.length - 1 ? val + 1 : val)] : _sections[0]) || "";
+}
+
+function getPreviousSection(current) {
+ var val = _sections.indexOf(current);
+ return (val > -1 ? _sections[(val > 0 ? val - 1 : val)] : _sections[0]) || "";
+}
+
+function getIndexFor(sectionName) {
+ var val = sectionData[_sections.indexOf(sectionName)].index;
+ return val === 0 || val > 0 ? val : -1;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "SectionScroller.js" as Sections
+
+Item {
+ id: root
+
+ property ListView listView
+
+ onListViewChanged: {
+ if (listView && listView.model) {
+ internal.initDirtyObserver();
+ } else if (listView) {
+ listView.modelChanged.connect(function() {
+ if (listView.model) {
+ internal.initDirtyObserver();
+ }
+ });
+ }
+ }
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Rectangle {
+ id: container
+ color: "transparent"
+ width: 35
+ height: listView.height
+ x: listView.x + listView.width - width
+ property bool dragging: false
+
+ MouseArea {
+ id: dragArea
+ objectName: "dragArea"
+ anchors.fill: parent
+ drag.target: tooltip
+ drag.axis: Drag.YAxis
+ drag.minimumY: listView.y
+ drag.maximumY: listView.y + listView.height - tooltip.height
+
+ onPressed: {
+ mouseDownTimer.restart()
+ }
+
+ onReleased: {
+ container.dragging = false;
+ mouseDownTimer.stop()
+ }
+
+ onPositionChanged: {
+ internal.adjustContentPosition(dragArea.mouseY);
+ }
+
+ Timer {
+ id: mouseDownTimer
+ interval: 150
+
+ onTriggered: {
+ container.dragging = true;
+ internal.adjustContentPosition(dragArea.mouseY);
+ tooltip.positionAtY(dragArea.mouseY);
+ }
+ }
+ }
+ Item {
+ id: tooltip
+ objectName: "popup"
+ opacity: container.dragging ? 1 : 0
+ anchors.right: parent.right
+ anchors.rightMargin: 50
+ width: childrenRect.width
+ height: childrenRect.height
+
+ function positionAtY(yCoord) {
+ tooltip.y = Math.max(dragArea.drag.minimumY, Math.min(yCoord - tooltip.height/2, dragArea.drag.maximumY));
+ }
+
+ BorderImage {
+ id: background
+ width: childrenRect.width// + 20
+ height: childrenRect.height// + 20
+ anchors.left: parent.left
+ source: platformStyle.backgroundImage
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+
+ Column {
+ width: Math.max(previousSectionLabel.width, currentSectionLabel.width, nextSectionLabel.width)
+ height: childrenRect.height
+
+ SectionScrollerLabel {
+ id: previousSectionLabel
+ objectName: "previousSectionLabel"
+ text: internal.prevSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider1"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: currentSectionLabel
+ objectName: "currentSectionLabel"
+ text: internal.currentSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+
+ Image {
+ objectName: "divider2"
+ source: platformStyle.dividerImage
+ width: parent.width
+ height: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SectionScrollerLabel {
+ id: nextSectionLabel
+ objectName: "nextSectionLabel"
+ text: internal.nextSection
+ highlighted: internal.curSect === text
+ up: !internal.down
+ }
+ }
+ }
+
+ Image {
+ id: arrow
+ objectName: "arrow"
+ width: 8
+ height: 16
+ anchors.left: background.right
+ property int threshold: currentSectionLabel.height
+ property int yInitial: background.y + background.height/2 - height/2
+ y: getYPosition()
+ source: platformStyle.arrowImage
+
+ function getYPosition() {
+ var v = internal.curPos;
+ var adjust = v === "first" ? -threshold :
+ v === "last" ? threshold : 0;
+
+ return yInitial + adjust;
+ }
+
+ states: [
+ State {
+ when: root.dragging && dragArea.mouseY < (root.listView.y + threshold)
+ PropertyChanges {
+ target: arrow
+ y: yInitial - threshold
+ }
+ }
+ ]
+
+ Behavior on y {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "visible"
+ when: container.dragging
+ },
+
+ State {
+ extend: "visible"
+ name: "atTop"
+ when: internal.curPos === "first"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: internal.currentSection
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.nextSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: Sections.getNextSection(internal.nextSection)
+ }
+ },
+
+ State {
+ extend: "visible"
+ name: "atBottom"
+ when: internal.curPos === "last"
+ PropertyChanges {
+ target: previousSectionLabel
+ text: Sections.getPreviousSection(internal.prevSection)
+ }
+ PropertyChanges {
+ target: currentSectionLabel
+ text: internal.prevSection
+ }
+ PropertyChanges {
+ target: nextSectionLabel
+ text: internal.currentSection
+ }
+ }
+ ]
+
+ Behavior on opacity {
+ NumberAnimation { duration: 100 }
+ }
+ }
+ }
+
+ Timer {
+ id: dirtyTimer
+ interval: 100
+ running: false
+ onTriggered: {
+ Sections.initSectionData(listView);
+ internal.modelDirty = false;
+ }
+ }
+
+ Connections {
+ target: root.listView
+ onCurrentSectionChanged: internal.curSect = container.dragging ? internal.curSect : ""
+ }
+
+ QtObject {
+ id: internal
+
+ property string prevSection: ""
+ property string currentSection: listView.currentSection
+ property string nextSection: ""
+ property string curSect: ""
+ property string curPos: "first"
+ property int oldY: 0
+ property bool modelDirty: false
+ property bool down: true
+
+ function initDirtyObserver() {
+ Sections.initialize(listView);
+ function dirtyObserver() {
+ if (!internal.modelDirty) {
+ internal.modelDirty = true;
+ dirtyTimer.running = true;
+ }
+ }
+
+ if (listView.model.countChanged)
+ listView.model.countChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsChanged)
+ listView.model.itemsChanged.connect(dirtyObserver);
+
+ if (listView.model.itemsInserted)
+ listView.model.itemsInserted.connect(dirtyObserver);
+
+ if (listView.model.itemsMoved)
+ listView.model.itemsMoved.connect(dirtyObserver);
+
+ if (listView.model.itemsRemoved)
+ listView.model.itemsRemoved.connect(dirtyObserver);
+ }
+
+ function adjustContentPosition(y) {
+ if (y < 0 || y > dragArea.height) return;
+
+ internal.down = (y > internal.oldY);
+ var sect = Sections.getClosestSection((y / dragArea.height), internal.down);
+ internal.oldY = y;
+ if (internal.curSect != sect) {
+ internal.curSect = sect;
+ internal.curPos = Sections.getSectionPositionString(internal.curSect);
+ var sec = Sections.getRelativeSections(internal.curSect);
+ internal.prevSection = sec[0];
+ internal.currentSection = sec[1];
+ internal.nextSection = sec[2];
+ var idx = Sections.getIndexFor(sect);
+ listView.positionViewAtIndex(idx, ListView.Beginning);
+ }
+ }
+
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Item {
+ id: root
+
+ property alias text: label.current
+ property alias up: label.up
+ property bool highlighted: false
+
+ width: wrapper.width
+ height: wrapper.height
+
+ property Style platformStyle: SectionScrollerStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ Item {
+ id: wrapper
+
+ clip: true
+ height: label.height
+
+ Text {
+ id: label
+
+ property string current: ""
+ property bool up: true
+ property int shift: 30
+
+ height: 60
+ width: parent.width - 40
+ text: ""
+ x: 20
+ color: root.highlighted ? root.platformStyle.textColorHighlighted : root.platformStyle.textColor
+ font {
+ bold: root.platformStyle.fontBoldProperty
+ pixelSize: root.platformStyle.fontPixelSize
+ }
+ verticalAlignment: Text.AlignVCenter
+ onCurrentChanged: {
+ text = current;
+ }
+ onTextChanged: {
+ var w = paintedWidth
+ parent.width = w + 40;
+ }
+
+ Behavior on current {
+ SequentialAnimation {
+ NumberAnimation { target: label; property: "y"; to: label.up ? label.shift : -label.shift; duration: 50 }
+ PropertyAction { target: label; property: "y"; value: label.up ? -label.shift : label.shift }
+ NumberAnimation { target: label; property: "y"; to: 0; duration: 50 }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+
+ // Font
+ property int fontPixelSize: UI.FONT_XXSMALL
+ property bool fontBoldProperty: true
+
+ // Color
+ property color textColorHighlighted: "#fff"
+ property color textColor: "#888"
+
+ property url dividerImage: "image://theme/meegotouch-scroll-bubble-divider"+__invertedString
+ property url backgroundImage: "image://theme/meegotouch-scroll-bubble-background"+__invertedString
+ property url arrowImage: "image://theme/meegotouch-scroll-bubble-arrow"+__invertedString
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+CommonDialog {
+ id: root
+
+ // Common API
+ property alias model: selectionListView.model
+ property int selectedIndex: -1 // read & write
+ //property string titleText: "Selection Dialog"
+
+ property Component delegate: // Note that this is the default delegate for the list
+ Component {
+ id: defaultDelegate
+
+ Item {
+ id: delegateItem
+ property bool selected: index == selectedIndex;
+
+ height: root.platformStyle.itemHeight
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ MouseArea {
+ id: delegateMouseArea
+ anchors.fill: parent;
+ onPressed: selectedIndex = index;
+ onClicked: accept();
+ }
+
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: delegateItem.selected ? root.platformStyle.itemSelectedBackgroundColor : root.platformStyle.itemBackgroundColor
+ }
+
+ BorderImage {
+ id: background
+ anchors.fill: parent
+ border { left: UI.CORNER_MARGINS; top: UI.CORNER_MARGINS; right: UI.CORNER_MARGINS; bottom: UI.CORNER_MARGINS }
+ source: delegateMouseArea.pressed ? root.platformStyle.itemPressedBackground :
+ delegateItem.selected ? root.platformStyle.itemSelectedBackground :
+ root.platformStyle.itemBackground
+ }
+
+ Text {
+ id: itemText
+ elide: Text.ElideRight
+ color: delegateItem.selected ? root.platformStyle.itemSelectedTextColor : root.platformStyle.itemTextColor
+ anchors.verticalCenter: delegateItem.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: root.platformStyle.itemLeftMargin
+ anchors.rightMargin: root.platformStyle.itemRightMargin
+ text: modelData
+ font: root.platformStyle.itemFont
+ }
+ Component.onCompleted: {
+ try {
+ // Legacy. "name" used to be the role which was used by delegate
+ itemText.text = name
+ } catch(err) {
+ try {
+ // "modelData" available for JS array and for models with one role
+ itemText.text = modelData
+ } catch (err) {
+ try {
+ // C++ models have "display" role available always
+ itemText.text = display
+ } catch(err) {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ onStatusChanged: {
+ if (status == DialogStatus.Opening && selectedIndex >= 0) {
+ selectionListView.positionViewAtIndex(selectedIndex, ListView.Center)
+ }
+ }
+
+ // Style API
+ property Style platformStyle: SelectionDialogStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ // private api
+ property int __pressDelay: platformStyle.pressDelay
+
+ // the title field consists of the following parts: title string and
+ // a close button (which is in fact an image)
+ // it can additionally have an icon
+ titleText:"Selection Dialog"
+
+ // the content field which contains the selection content
+ content: Item {
+
+ id: selectionContent
+ property int listViewHeight
+ property int maxListViewHeight : visualParent
+ ? visualParent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : root.parent
+ ? root.parent.height * 0.87
+ - root.platformStyle.titleBarHeight - root.platformStyle.contentSpacing - 50
+ : 350
+ height: listViewHeight > maxListViewHeight ? maxListViewHeight : listViewHeight
+ width: root.width
+ y : root.platformStyle.contentSpacing
+
+ ListView {
+ id: selectionListView
+ model: ListModel {}
+
+ currentIndex : -1
+ anchors.fill: parent
+ delegate: root.delegate
+ focus: true
+ clip: true
+ pressDelay: __pressDelay
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: selectionListView
+ platformStyle.inverted: true
+ }
+ onModelChanged: selectionContent.listViewHeight = model.count * platformStyle.itemHeight
+ }
+
+ }
+}
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+DialogStyle {
+ property alias titleBarFont: titleText.font
+ property int titleBarHeight: 44
+ property color titleBarColor: "white"
+ property int titleBarIndent: 17
+ property int titleBarLineMargin: 10
+
+ property bool __portrait: (screen.currentOrientation == 1) || (screen.currentOrientation == 4)
+
+ property int leftMargin: __portrait ? 11 : 160
+ property int rightMargin: __portrait ? 11 : 160
+
+ property alias itemFont: itemText.font
+ property int fontXLarge: 32
+ property int fontLarge: 28
+ property int fontDefault: 24
+ property int fontSmall: 20
+ property int fontXSmall: 18
+ property int fontXXSmall: 16
+
+ property color colorForeground: "#191919"
+ property color colorSecondaryForeground: "#8c8c8c"
+ property color colorBackground: "#ffffff"
+ property color colorSelect: "#7fb133"
+
+ property color commonLabelColor: "white"
+
+ property int itemHeight: 64
+ property color itemTextColor: "white"
+ property color itemSelectedTextColor: "white"
+ property int itemLeftMargin: 16
+ property int itemRightMargin: 16
+
+ property int contentSpacing: 10
+
+ property int pressDelay: 350 // ms
+
+ // Background
+ property url itemBackground: ""
+ property color itemBackgroundColor: "transparent"
+ property color itemSelectedBackgroundColor: "#3D3D3D"
+ property url itemSelectedBackground: "" // "image://theme/" + __colorString + "meegotouch-list-fullwidth-background-selected"
+ property url itemPressedBackground: "image://theme/" + __colorString + "meegotouch-panel-inverted-background-pressed"
+
+ property int buttonsTopMargin: 30 // ToDo: evaluate correct value
+
+ Text {
+ id: titleText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_XLARGE
+ font.capitalization: Font.MixedCase
+ font.bold: false
+ }
+
+ Text {
+ id: itemText
+ font.family: UI.FONT_FAMILY
+ font.pixelSize: UI.FONT_DEFAULT_SIZE
+ font.capitalization: Font.MixedCase
+ font.bold: true
+ }
+ }
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ property alias title: titleBar.children
+ property alias content: contentField.children
+ property alias buttons: buttonRow.children
+ property Item visualParent
+ property int status: DialogStatus.Closed
+
+ property alias acceptButtonText: acceptButton.text
+ property alias rejectButtonText: rejectButton.text
+
+ property alias acceptButton: acceptButton
+ property alias rejectButton: rejectButton
+
+ signal accepted
+ signal rejected
+
+ property QtObject platformStyle: SheetStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ function reject() {
+ close();
+ rejected();
+ }
+
+ function accept() {
+ close();
+ accepted();
+ }
+
+ visible: status != DialogStatus.Closed;
+
+ function open() {
+ parent = visualParent || __findParent();
+ sheet.state = "";
+ }
+
+ function close() {
+ sheet.state = "closed";
+ }
+
+ function __findParent() {
+ var next = parent;
+ while (next && next.parent
+ && next.objectName != "appWindowContent"
+ && next.objectName != "windowContent") {
+ next = next.parent;
+ }
+ return next;
+ }
+
+ function getButton(name) {
+ for (var i=0; i<buttons.length; ++i) {
+ if (buttons[i].objectName == name)
+ return buttons[i];
+ }
+ return undefined;
+ }
+
+ MouseArea {
+ id: blockMouseInput
+ anchors.fill: parent
+ }
+
+ Item {
+ id: sheet
+
+ //when the sheet is part of a page do nothing
+ //when the sheet is a direct child of a PageStackWindow, consider the status bar
+ property int statusBarOffset: (typeof __isPage != "undefined") ? 0
+ : (typeof __statusBarHeight == "undefined") ? 0
+ : __statusBarHeight
+
+ width: parent.width
+ height: parent.height - statusBarOffset
+
+ y: statusBarOffset
+
+ clip: true
+
+ property int transitionDurationIn: 300
+ property int transitionDurationOut: 450
+
+ state: "closed"
+
+ function transitionStarted() {
+ status = (state == "closed") ? DialogStatus.Closing : DialogStatus.Opening;
+ }
+
+ function transitionEnded() {
+ status = (state == "closed") ? DialogStatus.Closed : DialogStatus.Open;
+ }
+
+ states: [
+ // Closed state.
+ State {
+ name: "closed"
+ PropertyChanges { target: sheet; y: height; }
+ }
+ ]
+
+ transitions: [
+ // Transition between open and closed states.
+ Transition {
+ from: ""; to: "closed"; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.InOutQuint; duration: sheet.transitionDurationOut }
+ ScriptAction { script: if (sheet.state == "closed") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ },
+ Transition {
+ from: "closed"; to: ""; reversible: false
+ SequentialAnimation {
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionStarted(); } else { sheet.transitionEnded(); } }
+ PropertyAnimation { properties: "y"; easing.type: Easing.OutQuint; duration: sheet.transitionDurationIn }
+ ScriptAction { script: if (sheet.state == "") { sheet.transitionEnded(); } else { sheet.transitionStarted(); } }
+ }
+ }
+ ]
+
+ BorderImage {
+ source: platformStyle.background
+ width: parent.width
+ anchors.top: header.bottom
+ anchors.bottom: parent.bottom
+ Item {
+ id: contentField
+ anchors.fill: parent
+ }
+ }
+
+ Item {
+ id: header
+ width: parent.width
+ height: headerBackground.height
+ BorderImage {
+ id: headerBackground
+ border {
+ left: platformStyle.headerBackgroundMarginLeft
+ right: platformStyle.headerBackgroundMarginRight
+ top: platformStyle.headerBackgroundMarginTop
+ bottom: platformStyle.headerBackgroundMarginBottom
+ }
+ source: platformStyle.headerBackground
+ width: header.width
+ }
+ Item {
+ id: buttonRow
+ anchors.fill: parent
+ SheetButton {
+ id: rejectButton
+ objectName: "rejectButton"
+ anchors.left: parent.left
+ anchors.leftMargin: root.platformStyle.rejectButtonLeftMargin
+ anchors.verticalCenter: parent.verticalCenter
+ visible: text != ""
+ onClicked: close()
+ }
+ SheetButton {
+ id: acceptButton
+ objectName: "acceptButton"
+ anchors.right: parent.right
+ anchors.rightMargin: root.platformStyle.acceptButtonRightMargin
+ anchors.verticalCenter: parent.verticalCenter
+ platformStyle: SheetButtonAccentStyle { }
+ visible: text != ""
+ onClicked: close()
+ }
+ Component.onCompleted: {
+ acceptButton.clicked.connect(accepted)
+ rejectButton.clicked.connect(rejected)
+ }
+ }
+ Item {
+ id: titleBar
+ anchors.fill: parent
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: root
+
+ property Style platformStyle: SheetButtonStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ property color textColor: UI.COLOR_BUTTON_INVERTED_FOREGROUND
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background"
+ pressedBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/" + __colorString + "meegotouch-sheet-button-accent"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 150
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 20
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 22
+ backgroundMarginLeft: 22
+ backgroundMarginTop: 21
+ backgroundMarginBottom: 21
+
+ background: "image://theme/meegotouch-sheet-button"+__invertedString+"-background"
+ pressedBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-pressed"
+ disabledBackground: "image://theme/meegotouch-sheet-button"+__invertedString+"-background-disabled"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int acceptButtonRightMargin: 15
+ property int rejectButtonLeftMargin: 15
+
+ property url background: "image://theme/meegotouch-applicationpage-background" + __invertedString;
+ property url headerBackground: "image://theme/meegotouch-sheet-header" + __invertedString + "-background";
+
+ property int headerBackgroundMarginLeft: 10
+ property int headerBackgroundMarginRight: 10
+ property int headerBackgroundMarginTop: 10
+ property int headerBackgroundMarginBottom: 2
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+Rectangle {
+ id: root
+ width: parent ? parent.width : 0
+ height: 250
+ color: "black"
+ opacity: 0.9
+
+ Text {
+ id: label
+ font.pixelSize: 43
+ text: "Software Input Panel"
+ anchors.centerIn: parent
+ color: "white"
+ opacity: 0.0
+ }
+
+ MouseArea {
+ // Block clicks from falling through the simulator
+ anchors.fill: parent
+ onClicked: {
+ root.parent.focus = true;
+ inputContext.simulateSipClose();
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+
+SliderTemplate {
+ id: slider
+
+ property Style platformStyle: SliderStyle{}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: slider.platformStyle
+
+ opacity: enabled ? UI.OPACITY_ENABLED : UI.OPACITY_DISABLED
+
+ __handleItem: Image {
+ source: pressed? platformStyle.handleBackgroundPressed : platformStyle.handleBackground;
+ }
+
+ __grooveItem: BorderImage {
+ source: platformStyle.grooveItemBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueTrackItem: BorderImage {
+ source: platformStyle.grooveItemElapsedBackground
+ border { left: 6; top: 4; right: 6; bottom: 4 }
+ height: 10
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ __valueIndicatorItem: BorderImage {
+ id: indicatorBackground
+ source: platformStyle.valueBackground
+ border { left: 12; top: 12; right: 12; bottom: 12 }
+
+ width: label.width + 28
+ height: 40
+
+ Image {
+ id: arrow
+ }
+
+ state: slider.valueIndicatorPosition
+ states: [
+ State {
+ name: "Top"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowDown
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.top: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowUp
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.bottom: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ AnchorChanges {
+ target: indicatorBackground
+// anchors.
+ }
+ },
+ State {
+ name: "Left"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowLeft
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.left: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ },
+ State {
+ name: "Right"
+ PropertyChanges {
+ target: arrow
+ source: platformStyle.labelArrowRight
+ }
+ AnchorChanges {
+ target: arrow
+ anchors.right: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ ]
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: slider.valueIndicatorText
+ color: slider.platformStyle.textColor
+ font.pixelSize: slider.platformStyle.fontPixelSize
+ font.family: slider.platformStyle.fontFamily
+ }
+
+ // Native libmeegotouch slider value indicator pops up 100ms after pressing
+ // the handle... but hiding happens without delay.
+ visible: slider.valueIndicatorVisible && slider.pressed
+ Behavior on visible {
+ enabled: !indicatorBackground.visible
+ PropertyAnimation {
+ duration: 100
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Font
+ property string fontFamily: UI.FONT_FAMILY
+ property int fontPixelSize: UI.FONT_DEFAULT_SIZE
+
+ // Color
+ property color textColor: !inverted? UI.COLOR_INVERTED_FOREGROUND : UI.COLOR_FOREGROUND
+
+ // Background
+ property url valueBackground: "image://theme/meegotouch-slider-handle-value"+__invertedString+"-background"
+ property url labelArrowDown: "image://theme/meegotouch-slider-handle-label-arrow-down"+__invertedString
+ property url labelArrowUp: "image://theme/meegotouch-slider-handle-label-arrow-up"+__invertedString
+ property url labelArrowLeft: "image://theme/meegotouch-slider-handle-label-arrow-left"+__invertedString
+ property url labelArrowRight: "image://theme/meegotouch-slider-handle-label-arrow-right"+__invertedString
+ property url handleBackground: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-horizontal"
+ property url handleBackgroundPressed: "image://theme/meegotouch-slider-handle"+__invertedString+"-background-pressed-horizontal"
+ property url grooveItemBackground: "image://theme/meegotouch-slider"+__invertedString+"-background-horizontal"
+ property url grooveItemElapsedBackground: "image://theme/" + __colorString + "meegotouch-slider-elapsed"+__invertedString+"-background-horizontal"
+
+ // Mouse
+ property real mouseMarginRight: 0.0
+ property real mouseMarginLeft: 0.0
+ property real mouseMarginTop: 0.0
+ property real mouseMarginBottom: 0.0
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import Qt.labs.components 1.1
+
+Item {
+ id: slider
+
+ //
+ // Common API
+ //
+ property int orientation: Qt.Horizontal
+ property alias minimumValue: range.minimumValue
+ property alias maximumValue: range.maximumValue
+ property alias pressed: mouseArea.pressed
+ property alias stepSize: range.stepSize
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ // NOTE: this property is in/out, the user can set it, create bindings to it, and
+ // at the same time the slider wants to update. There's no way in QML to do this kind
+ // of updates AND allow the user bind it (without a Binding object). That's the
+ // reason this is an alias to a C++ property in range model.
+ property alias value: range.value
+
+ //
+ // Public extensions
+ //
+ property alias inverted: range.inverted
+
+ // Value indicator displays the current value near the slider
+ // if valueIndicatorText == "", a default formating will be applied
+ property string valueIndicatorText: formatValue(range.value)
+ property bool valueIndicatorVisible: false
+
+ property int valueIndicatorMargin: 1
+ property string valueIndicatorPosition: __isVertical ? "Left" : "Top"
+
+ // The default implementation for label hides decimals until it hits a
+ // floating point value at which point it keeps decimals
+ property bool __useDecimals: false
+ function formatValue(v) {
+ return __useDecimals ? (v.toFixed(2)) : v;
+ }
+
+ //
+ // "Protected" properties
+ //
+
+ // Hooks for customizing the pieces of the slider
+ property Item __grooveItem
+ property Item __valueTrackItem
+ property Item __handleItem
+ property Item __valueIndicatorItem
+
+ property bool __isVertical: orientation == Qt.Vertical
+
+ implicitWidth: 400
+ implicitHeight: handle.height
+
+ width: __isVertical ? implicitHeight : implicitWidth
+ height: __isVertical ? implicitWidth : implicitHeight
+
+ // This is a template slider, so every piece can be modified by passing a
+ // different Component. The main elements in the implementation are
+ //
+ // - the 'range' does the calculations to map position to/from value,
+ // it also serves as a data storage for both properties;
+ //
+ // - the 'fakeHandle' is what the mouse area drags on the screen, it feeds
+ // the 'range' position and also reads it when convenient;
+ //
+ // - the real 'handle' it is the visual representation of the handle, that
+ // just follows the 'fakeHandle' position.
+ //
+ // Everything is encapsulated in a contents Item, so for the
+ // vertical slider, we just swap the height/width, make it
+ // horizontal, and then use rotation to make it vertical again.
+
+ Component.onCompleted: {
+ __grooveItem.parent = groove;
+ __valueTrackItem.parent = valueTrack;
+ __handleItem.parent = handle;
+ __valueIndicatorItem.parent = valueIndicator;
+ }
+
+ Item {
+ id: contents
+
+ width: __isVertical ? slider.height : slider.width
+ height: __isVertical ? slider.width : slider.height
+ rotation: __isVertical ? -90 : 0
+
+ anchors.centerIn: slider
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ onValueChanged: {
+ // XXX: Moved that outside formatValue to get rid of binding loop warnings
+ var v = range.value
+ if (parseInt(v) != v)
+ __useDecimals = true;
+ }
+ positionAtMinimum: handle.width / 2
+ positionAtMaximum: contents.width - handle.width / 2
+ onMaximumChanged: __useDecimals = false;
+ onMinimumChanged: __useDecimals = false;
+ onStepSizeChanged: __useDecimals = false;
+ }
+
+ Item {
+ id: groove
+ anchors.fill: parent
+ anchors.leftMargin: handle.width / 2
+ anchors.rightMargin: handle.width / 2
+ }
+
+ Item {
+ id: valueTrack
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: groove.left
+ anchors.right: handle.horizontalCenter
+ anchors.rightMargin: handle.width / 2
+
+ states: State {
+ when: slider.inverted
+ PropertyChanges {
+ target: valueTrack
+ anchors.rightMargin: 0
+ anchors.leftMargin: - handle.width / 2
+ }
+ AnchorChanges {
+ target: valueTrack
+ anchors.left: handle.horizontalCenter
+ anchors.right: groove.right
+ }
+ }
+ }
+
+ Item {
+ id: handle
+ transform: Translate { x: - handle.width / 2 }
+ rotation: __isVertical ? 90 : 0
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ width: __handleItem.width
+ height: __handleItem.height
+
+ x: fakeHandle.x
+ Behavior on x {
+ id: behavior
+ enabled: !mouseArea.drag.active
+
+ PropertyAnimation {
+ duration: behavior.enabled ? 150 : 0
+ easing.type: Easing.OutSine
+ }
+ }
+ }
+
+ Item {
+ id: fakeHandle
+ width: handle.width
+ height: handle.height
+ transform: Translate { x: - handle.width / 2 }
+ }
+
+ MouseArea {
+ id: mouseArea
+ property real oldPosition: 0
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ drag.target: fakeHandle
+ drag.axis: Drag.XAxis
+ drag.minimumX: range.positionAtMinimum
+ drag.maximumX: range.positionAtMaximum
+
+ onPressed: {
+ oldPosition = range.position;
+ // Clamp the value
+ var newX = Math.max(mouse.x + anchors.leftMargin, drag.minimumX);
+ newX = Math.min(newX, drag.maximumX);
+
+ // Debounce the press: a press event inside the handler will not
+ // change its position, the user needs to drag it.
+ if (Math.abs(newX - fakeHandle.x) > handle.width / 2)
+ range.position = newX;
+ }
+
+ onCanceled: {
+ range.position = oldPosition;
+ }
+ }
+
+ Item {
+ id: valueIndicator
+
+ transform: Translate {
+ x: - handle.width / 2;
+ y: __isVertical? -(__valueIndicatorItem.width/2)+20 : y ;
+ }
+
+ rotation: __isVertical ? 90 : 0
+ visible: valueIndicatorVisible
+
+ width: __valueIndicatorItem.width //+ (__isVertical? (handle.width/2) : 0 )
+ height: __valueIndicatorItem.height
+
+ state: {
+ if (!__isVertical)
+ return slider.valueIndicatorPosition;
+
+ if (valueIndicatorPosition == "Right")
+ return "Bottom";
+ if (valueIndicatorPosition == "Top")
+ return "Right";
+ if (valueIndicatorPosition == "Bottom")
+ return "Left";
+
+ return "Top";
+ }
+
+ anchors.margins: valueIndicatorMargin
+
+ states: [
+ State {
+ name: "Top"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.bottom: handle.top
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Bottom"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.top: handle.bottom
+ anchors.horizontalCenter: handle.horizontalCenter
+ }
+ },
+ State {
+ name: "Right"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.left: handle.right
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ },
+ State {
+ name: "Left"
+ AnchorChanges {
+ target: valueIndicator
+ anchors.right: handle.left
+ anchors.verticalCenter: handle.verticalCenter
+ }
+ }
+ ]
+ }
+ }
+
+ // when there is no mouse interaction, the handle's position binds to the value
+ Binding {
+ when: !mouseArea.drag.active
+ target: fakeHandle
+ property: "x"
+ value: range.position
+ }
+
+ // when the slider is dragged, the value binds to the handle's position
+ Binding {
+ when: mouseArea.drag.active
+ target: range
+ property: "position"
+ value: fakeHandle.x
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Item {
+ id: root
+ width: parent.width
+ height: 0
+
+ objectName: "softwareInputPanel"
+
+ property bool active: false
+
+ states: State {
+ when: active
+ PropertyChanges { target: root; height: childrenRect.height; }
+ }
+
+ transitions: Transition {
+ reversible: true
+ NumberAnimation { properties: "opacity"; easing.type: Easing.InOutCubic; duration: 200 }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+
+StatusBarInternal {
+ id: statusBar
+ anchors.top: parent.top
+ width: parent.width
+
+ property bool showStatusBar: true
+ property bool __completed: false
+
+ states: State {
+ name: "hide"; when: showStatusBar==false
+ PropertyChanges { target: statusBar; anchors.topMargin: -statusBar.height; visible: false}
+ }
+
+ Component.onCompleted: {
+ statusBar.orientation = screen.currentOrientation
+ screen.updatePlatformStatusBarRect(statusBar)
+ __completed = true;
+ }
+
+ onWidthChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+
+ Timer {
+ // Timer is used to update statusbarrect to avoid duplicated calls during animation,
+ // also onActiveChanged coming too early
+ id: updatePlatformStatusBarTimer
+ repeat: false
+ interval: 50
+ onTriggered: {
+ screen.updatePlatformStatusBarRect(statusBar);
+ }
+ }
+
+ Connections {
+ target: platformWindow
+ onActiveChanged: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+
+ transitions: Transition {
+ from: __completed ? "" : "invalid"
+ to: __completed ? "hide" : "invalid"
+ reversible: true
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true
+ }
+ }
+ PropertyAnimation { target: statusBar; properties: "anchors.topMargin"; easing.type: Easing.InOutExpo; duration: 500 }
+ PropertyAnimation { target: statusBar; properties: "visible"; }
+ ScriptAction {
+ script: {
+ updatePlatformStatusBarTimer.running = true;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+QtObject {
+ id: styleClass
+ // Settings
+ property bool inverted: theme.inverted
+ property string __invertedString: inverted? "-inverted" : ""
+ property string __colorString: theme.colorString
+
+ // some style classes like SelectionDialogStyle are using nested elements (for example Text),
+ // which isn't allowed by QtObject; this fix makes this possible
+ default property alias children: styleClass.__defaultPropertyFix
+ property list<QtObject> __defaultPropertyFix: [Item {}] //QML doesn't allow an empty list here
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+/*
+Class: Switch
+ The Switch component is similar to the CheckBox component but instead of
+ selecting items it should be used when setting options to On/Off.
+*/
+Item {
+ id: root
+
+ width: slider.width
+ height: slider.height
+
+ /*
+ * Property: checked
+ * [bool=false] The checked state of switch
+ */
+ property bool checked: false
+
+ // Styling for the Switch
+ property Style platformStyle: SwitchStyle {}
+
+ //Deprecated, TODO Remove this on w13
+ property alias style: root.platformStyle
+
+ property alias platformMouseAnchors: mouseArea.anchors
+
+ /*
+ * Property: enabled
+ * [bool=true] Enables/Disables the component. Notice that the disable state is not Toolkit compliant
+ * and not present inside the qt-components
+ */
+
+ Item {
+ id: slider
+
+ width: 66
+ height: 42
+
+ state: root.checked ? "checked" : "unchecked"
+
+ property real knobPos: (knob.x - platformStyle.minKnobX) / (platformStyle.maxKnobX - platformStyle.minKnobX)
+
+ Image {
+ source: platformStyle.switchOn
+ opacity: slider.knobPos
+ }
+ Image {
+ source: platformStyle.switchOff
+ opacity: 1.0 - slider.knobPos
+ }
+
+ states: [
+ State {
+ name: "unchecked"
+ PropertyChanges { target: knob; x: platformStyle.minKnobX }
+ },
+ State {
+ name: "checked"
+ PropertyChanges { target: knob; x: platformStyle.maxKnobX }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ SmoothedAnimation { properties: "x"; velocity: 500; maximumEasingTime: 0 }
+ }
+ ]
+
+ // thumb (shadow)
+ Image {
+ id: knob
+
+ // thumb (inline)
+ Image {
+ width: 30
+ height: 30
+ x: 0
+ y: -2
+ source: (slider.enabled ? (mouseArea.pressed ? platformStyle.thumbPressed : platformStyle.thumb) : platformStyle.thumbDisabled)
+ }
+
+ source: platformStyle.shadow
+
+ y: 8
+
+ width: 30
+ height: 30
+ }
+
+ MouseArea {
+ id: mouseArea
+ property int downMouseX
+ property int downKnobX
+ anchors {
+ fill: parent
+ rightMargin: platformStyle.mouseMarginRight
+ leftMargin: platformStyle.mouseMarginLeft
+ topMargin: platformStyle.mouseMarginTop
+ bottomMargin: platformStyle.mouseMarginBottom
+ }
+
+ function snap() {
+ if (knob.x < (platformStyle.maxKnobX + platformStyle.minKnobX) / 2) {
+ if (root.checked) {
+ root.checked = false;
+ } else {
+ knob.x = platformStyle.minKnobX;
+ }
+ } else {
+ if (!root.checked) {
+ root.checked = true;
+ } else {
+ knob.x = platformStyle.maxKnobX;
+ }
+ }
+ }
+
+ onPressed: {
+ downMouseX = mouseX;
+ downKnobX = knob.x;
+ }
+
+ onPositionChanged: {
+ var newKnobX = downKnobX - (downMouseX - mouseX);
+ knob.x = newKnobX < platformStyle.minKnobX ? platformStyle.minKnobX : newKnobX > platformStyle.maxKnobX ? platformStyle.maxKnobX : newKnobX;
+ }
+
+ onReleased: {
+ if (Math.abs(downMouseX - mouseX) < 5)
+ root.checked = !root.checked;
+ else
+ snap();
+ }
+
+ onCanceled: {
+ snap();
+ }
+
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ property int minKnobX: 6
+ property int maxKnobX: 30
+
+ // Slider
+ property url switchOn: "image://theme/" + __colorString + "meegotouch-switch-on"+__invertedString
+ property url switchOff: "image://theme/meegotouch-switch-off"+__invertedString
+
+ // Knob
+ property url thumb: "image://theme/meegotouch-switch-thumb"+__invertedString
+ property url thumbPressed: "image://theme/meegotouch-switch-thumb-pressed"+__invertedString
+ property url thumbDisabled: "image://theme/meegotouch-switch-thumb-disabled"+__invertedString
+ property url shadow: "image://theme/meegotouch-switch-shadow"+__invertedString
+
+ // Mouse
+ property real mouseMarginRight: -UI.MARGIN_XLARGE
+ property real mouseMarginLeft: -UI.MARGIN_XLARGE
+ property real mouseMarginTop: -UI.MARGIN_XLARGE
+ property real mouseMarginBottom: -UI.MARGIN_XLARGE
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ Component.onCompleted: {
+ __layout()
+ print("Warning, TabBarLayout has been deprecated from the API.")
+ print("To fix your code, please use:")
+ print(" tools: ToolBarLayout { ToolItem{} ButtonRow{TabButton{} ... } } instead.")
+ }
+ onChildrenChanged: __layout()
+ onWidthChanged: __layout()
+ onHeightChanged: __layout()
+
+ function __layout() {
+ if (parent == null || width == 0)
+ return;
+
+ var orientation = screen.currentOrientation == Screen.Landscape || screen.currentOrientation == Screen.LandscapeInverted ? "landscape" : "portrait",
+ padding = orientation == "landscape" ? 80 : 15;
+
+ for (var i = 0, childCount = children.length, tabCount = 0, widthOthers = 0; i < childCount; i++) {
+ if (children[i].tab !== undefined) {
+ children[i].platformStyle.position = (tabCount++ === 0) ? "horizontal-left" : "horizontal-center";
+ children[i].platformStyle.screenOrientation = orientation;
+ } else {
+ widthOthers += children[i].width;
+ children[i].y = (height - children[i].height) / 2;
+ }
+ }
+ // Check if last item is a tab button and set appropriate position
+ tabCount && (children[children[0].tab ? tabCount - 1 : tabCount].platformStyle.position = "horizontal-right");
+
+ widthOthers += children[0].tab ? padding : 0;
+ widthOthers += children[childCount - 1].tab ? padding : 0;
+
+ var tabWidth = Math.round((width - widthOthers) / tabCount),
+ offset = children[0].tab ? padding : children[0].width;
+
+ for (var i = children[0].tab ? 0 : 1, index = 0; i < childCount; i++, index++) {
+ children[i].x = tabWidth * index + offset;
+ children[i].tab && (children[i].width = tabWidth);
+ }
+ }
+}
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+
+Button {
+ id: tabButton
+
+ // Common public API
+ property Item tab
+ property QtObject platformStyle: TabButtonStyle {}
+
+ //Deprecated: TODO, remove this!
+ property alias style: tabButton.platformStyle
+
+ property Item __tabGroup: tab !== null ? tab.parent : null
+
+ Connections {
+ target: __tabGroup
+ onCurrentTabChanged: checked = __tabGroup.currentTab == tab;
+ }
+
+ onClicked: privatePressed()
+
+ function privatePressed() {
+ if (tabButton.checkable) {
+ tabButton.checked = !tabButton.checked;
+ }
+
+ if (__tabGroup != null &&
+ tab != null) {
+ __tabGroup.currenTab == tab ? __tabGroup.currentTab.pop(): __tabGroup.currentTab = tab;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ /* The orientation of the button which can take one of the two values:
+ [portrait] [landscape]
+ */
+ property string screenOrientation: (screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape"
+
+ fontCapitalization: Font.MixedCase
+ fontPixelSize: 24
+ fontWeight: Font.Normal
+ checkedFontWeight: Font.Bold
+
+ buttonHeight: screenOrientation == "portrait"? 72 : 56
+
+ textColor: inverted ? "#CDCDCD" : "#505050"
+ pressedTextColor: inverted ? "#ffffff" : "#505050"
+ checkedTextColor: inverted ? "#ffffff" : "#000000"
+
+ background: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+
+ pressedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-pressed" + (position ? "-" + position : "")
+ disabledBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+ checkedBackground: "image://theme/meegotouch-tab-" + screenOrientation + "-bottom" + __invertedString + "-background-selected" + (position ? "-" + position : "")
+ checkedDisabledBackground: "image://theme/meegotouch-tab" + screenOrientation + "-bottom" + __invertedString + "-background" + (position ? "-" + position : "")
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The TabGroup item defines a set of tabs consisting of page stacks or
+// pages that can be switched between to implement a tabbed user interface.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+
+ // The currently selected tab.
+ property Item currentTab
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ onVisibleChanged: __update()
+ onChildrenChanged: __update()
+ onCurrentTabChanged: __update()
+
+ function __update() {
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var newVis = child == currentTab;
+ if (child.visible != newVis) {
+ child.visible = newVis;
+ if (child.status !== undefined) {
+ if (newVis) {
+ child.status = PageStatus.Activating;
+ child.status = PageStatus.Active;
+ } else {
+ child.status = PageStatus.Deactivating;
+ child.status = PageStatus.Inactive;
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import Qt.labs.components 1.1
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textEdit.text
+ property alias placeholderText: prompt.text
+
+ property alias font: textEdit.font
+ property alias cursorPosition: textEdit.cursorPosition
+ property alias readOnly: textEdit.readOnly
+
+ property alias horizontalAlignment: textEdit.horizontalAlignment
+ property alias verticalAlignment: textEdit.verticalAlignment
+
+ property alias selectedText: textEdit.selectedText
+ property alias selectionStart: textEdit.selectionStart
+ property alias selectionEnd: textEdit.selectionEnd
+
+ property alias wrapMode: textEdit.wrapMode
+ property alias textFormat: textEdit.textFormat
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textEdit.activeFocusOnPress
+
+ property alias inputMethodHints: textEdit.inputMethodHints
+
+ property bool errorHighlight: false
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextAreaStyle {}
+ property alias style: root.platformStyle
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textEdit)
+ }
+
+ function copy() {
+ textEdit.copy()
+ }
+
+ function paste() {
+ textEdit.paste()
+ }
+
+ function cut() {
+ textEdit.cut()
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textEdit.forceActiveFocus()
+ }
+
+ function select(start, end) {
+ textEdit.select(start, end)
+ }
+
+ function selectAll() {
+ textEdit.selectAll()
+ }
+
+ function selectWord() {
+ textEdit.selectWord()
+ }
+
+ function positionAt(x, y) {
+ var p = mapToItem(textEdit, x, y);
+ return textEdit.positionAt(p.x, p.y)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textEdit.positionToRectangle(pos)
+ var point = mapFromItem(textEdit, rect.x, rect.y)
+ rect.x = point.x; rect.y = point.y
+ return rect;
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextArea's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ textEdit.closeSoftwareInputPanel();
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextArea's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ textEdit.openSoftwareInputPanel();
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textEdit);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+ // private
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: Math.max (UI.FIELD_DEFAULT_HEIGHT,
+ textEdit.height + (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize))
+
+ onActiveFocusChanged: {
+ if (activeFocus &&
+ !readOnly) {
+ platformOpenSoftwareInputPanel();
+ repositionTimer.running = true;
+ } else if (!activeFocus) {
+ if (!readOnly)
+ platformCloseSoftwareInputPanel();
+
+ Popup.close(textEdit);
+ }
+ }
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textEdit.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors.fill: parent
+ anchors.leftMargin: UI.PADDING_XLARGE
+ anchors.rightMargin: UI.PADDING_XLARGE
+ anchors.topMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textEdit.cursorPosition == 0 && !textEdit.text && prompt.text && !textEdit.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textEdit.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var mappedMousePos = mapToItem(textEdit, mouseX, mouseY);
+ var newCursorPosition = textEdit.positionAt(mappedMousePos.x, mappedMousePos.y, TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextEdit {
+ id: textEdit
+
+ // Exposed for the edit bubble
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ x: UI.PADDING_XLARGE
+ y: (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ width: parent.width - UI.PADDING_XLARGE * 2
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ wrapMode: TextEdit.Wrap
+ persistentSelection: false
+ focus: true
+
+ function updateMagnifierPosition(posX, posY) {
+ var yAdjustment = 0
+ var magnifier = MagnifierPopup.popup;
+ var cursorHeight = textEdit.positionToRectangle(0,0).height;
+ var mappedPos = mapToItem(magnifier.parent, posX - magnifier.width / 2,
+ posY - magnifier.height / 2 - cursorHeight - 70);
+
+ magnifier.xCenter = mapToItem(magnifier.sourceItem, posX, 0).x;
+ magnifier.x = mappedPos.x;
+ if (-root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight) < (magnifier.height / 1.5)) {
+ yAdjustment = Math.max(0,(magnifier.height / 1.5) + root.mapFromItem(magnifier.__rootElement(), 0,0).y - (posY - cursorHeight));
+ } else {
+ yAdjustment = 0;
+ }
+ magnifier.yCenter = mapToItem(magnifier.sourceItem, 0, posY - cursorHeight + 50).y
+ magnifier.y = mappedPos.y + yAdjustment;
+ }
+
+ Component.onDestruction: {
+ Popup.close(textEdit);
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (textEdit.preedit == "" && Popup.isOpened(textEdit) && !Popup.isChangingInput())
+ Popup.close(textEdit);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelVisibleChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus)
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+
+ onCursorPositionChanged: {
+ if(!MagnifierPopup.isOpened() && activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textEdit.cursorPosition == textEdit.text.length) &&
+ Popup.isOpened(textEdit)) {
+ Popup.close(textEdit);
+ Popup.open(textEdit,
+ textEdit.positionToRectangle(textEdit.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if (Popup.isOpened(textEdit) && !Popup.isChangingInput()) {
+ Popup.close(textEdit);
+ }
+ }
+
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_XLARGE
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - UI.PADDING_MEDIUM
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - (UI.FIELD_DEFAULT_HEIGHT - font.pixelSize) / 2
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ pressOnPreedit = textEdit.cursorPosition==mousePosition
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be committed before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ parent.selectByMouse = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ parent.cursorPosition = parent.positionAt(mouse.x,mouse.y)
+ parent.updateMagnifierPosition(mouse.x,mouse.y)
+ root.z = Number.MAX_VALUE
+ }
+ }
+
+ onReleased:{
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ editBubblePosition = textEdit.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textEdit.text;
+
+ textEdit.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textEdit.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textEdit.preedit.length >=1 && textEdit.preedit.length <= 4)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ } else {
+ textEdit.text=beforeText;
+ textEdit.cursorPosition=newCursorPosition;
+ }
+ attemptToActivate = false;
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textEdit.cursorPosition = textEdit.positionAt(mouse.x,mouse.y,TextEdit.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textEdit.preedit.length == 0)
+ editBubblePosition = textEdit.positionToRectangle(textEdit.cursorPosition);
+ Popup.open(textEdit,editBubblePosition);
+ }
+ }
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ var pos = textEdit.positionAt (mouse.x,mouse.y)
+ var posNextLine = textEdit.positionAt (mouse.x, mouse.y + 1)
+ var posPrevLine = textEdit.positionAt (mouse.x, mouse.y - 1)
+ if (!(Math.abs(posNextLine - pos) > 1 ||
+ Math.abs(posPrevLine - pos) > 1)) {
+ parent.cursorPosition = pos
+ }
+ parent.updateMagnifierPosition(mouse.x,mouse.y);
+ }
+ }
+ onDoubleClicked: {
+ // possible pre-edit word have to be committed before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: root.activeFocus
+
+ onClickedOutside: {
+ if (Popup.isOpened(textEdit) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function findFlickable(component) {
+ var nextParent = component
+ var flickableItem = null
+ while(nextParent) {
+ if(nextParent.flicking !== undefined && nextParent.flickableDirection !== undefined)
+ flickableItem = nextParent
+
+ nextParent = nextParent.parent
+ }
+ if (flickableItem) return flickableItem
+ return null
+}
+
+function animateContentY(animation, flickable, newContentY) {
+ animation.target = flickable
+ animation.to = newContentY
+ animation.running = true
+}
+
+function locateFlickableY(flickable) {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ return flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.LandscapeInverted:
+ return screen.displayHeight - flickable.mapToItem(null, flickable.x, flickable.y).y
+
+ case Screen.Portrait:
+ return flickable.mapToItem(null, flickable.x, flickable.y).x
+
+ case Screen.PortraitInverted:
+ return screen.displayWidth - flickable.mapToItem(null, flickable.x, flickable.y).x
+ }
+}
+
+function getMargin() {
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ case Screen.LandscapeInverted:
+ return 40
+ case Screen.Portrait:
+ case Screen.PortraitInverted:
+ return 48
+ }
+
+ return 0
+}
+
+function repositionFlickable(animation) {
+ inputContext.updateMicroFocus()
+ var mf = inputContext.microFocus
+
+ if(mf.x == -1 && mf.y == -1)
+ return
+
+ var object = findFlickable(parent)
+
+ if(object){
+ var flickable = object
+
+ // Specifies area from bottom and top when repositioning should be triggered
+ var margin = getMargin()
+ var newContentY = flickable.contentY
+ var flickableY = locateFlickableY(flickable)
+
+ switch(screen.currentOrientation) {
+ case Screen.Landscape:
+ if(flickableY + flickable.height - mf.height - margin < mf.y) {
+ // Find dY just to make textfield visible
+ var dY = mf.y - flickableY - flickable.height
+ // Center textfield
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.y) {
+ var dY = flickableY - mf.y
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.LandscapeInverted:
+ // In inverted screen we need to compensate for the focus height
+ var invertedMfY = screen.displayHeight - mf.y - mf.height
+
+ if(flickableY + flickable.height - mf.height - margin < invertedMfY) {
+ var dY = invertedMfY - flickableY - flickable.height
+ dY += flickable.height / 2 + mf.height / 2
+ } else if(flickableY + margin > invertedMfY){
+ var dY = flickableY - invertedMfY
+ dY += flickable.height / 2 - mf.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.Portrait:
+ if(flickableY + flickable.height - mf.width - margin < mf.x) {
+ var dY = mf.x - flickableY - flickable.height
+ dY += flickable.height / 2
+ newContentY += dY
+ } else if(flickableY + margin > mf.x){
+ var dY = flickableY - mf.x
+ dY += flickable.height / 2
+ newContentY -= dY
+ }
+
+ break
+
+ case Screen.PortraitInverted:
+ var invertedMfX = screen.displayWidth - mf.x - mf.width
+
+ if(flickableY + flickable.height - mf.width - margin < invertedMfX) {
+ var dY = invertedMfX - flickableY - flickable.height + mf.height
+ dY += flickable.height / 2 + mf.height
+ newContentY += dY
+ } else if(flickableY + margin > invertedMfX){
+ var dY = flickableY - invertedMfX
+ dY += flickable.height / 2 - mf.height
+ newContentY -= dY
+ }
+
+ break
+ }
+
+ // If overpanned, set contentY to max possible value (reached bottom)
+ if(newContentY > flickable.contentHeight - flickable.height)
+ newContentY = flickable.contentHeight - flickable.height
+
+ // If overpanned, set contentY to min possible value (reached top)
+ if(newContentY < 0)
+ newContentY = 0
+
+ if(newContentY != flickable.contentY) {
+ animateContentY(animation, flickable, newContentY)
+ }
+ }
+}
+
+function injectWordToPreedit(newCursorPosition) {
+ var preeditStart = previousWordStart(newCursorPosition);
+ var preeditEnd = nextWordEnd(newCursorPosition);
+
+ // copy word to preedit text
+ var preeditText = root.text.substring(preeditStart,preeditEnd);
+
+ // inject preedit
+ cursorPosition = preeditStart;
+
+ var eventCursorPosition = newCursorPosition-preeditStart;
+
+ return inputContext.setPreeditText(preeditText, eventCursorPosition, 0, preeditText.length);
+}
+
+function previousWordStart(pos) {
+ var ret = pos;
+
+ if (ret && atWordSeparator(ret - 1)) {
+ ret--;
+ while (ret && atWordSeparator(ret - 1))
+ ret--;
+ } else {
+ while (ret && !atSpace(ret - 1) && !atWordSeparator(ret - 1))
+ ret--;
+ }
+
+ return ret;
+}
+
+function nextWordEnd(pos) {
+ var ret = pos;
+ var len = root.text.length;
+
+ if (ret < len && atWordSeparator(ret)) {
+ ret++;
+ while (ret < len && atWordSeparator(ret))
+ ret++;
+ } else {
+ while (ret < len && !atSpace(ret) && !atWordSeparator(ret))
+ ret++;
+ }
+
+ return ret;
+}
+
+function atSpace(pos) {
+ var c = root.text.charAt(pos);
+ return c == ' '
+ || c == '\t'
+ || c == '\n'
+ ;
+}
+
+function atWordSeparator(pos) {
+ switch (root.text.charAt(pos)) {
+ case '.':
+ case ',':
+ case '?':
+ case '!':
+ case '@':
+ case '#':
+ case '$':
+ case ':':
+ case ';':
+ case '-':
+ case '<':
+ case '>':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '{':
+ case '}':
+ case '=':
+ case '/':
+ case '+':
+ case '%':
+ case '&':
+ case '^':
+ case '*':
+ case '\'':
+ case '"':
+ case '`':
+ case '~':
+ case '|':
+ return true;
+ default:
+ return false;
+ }
+}
+
+var MIN_UPDATE_INTERVAL = 30
+var lastUpdateTime
+function filteredInputContextUpdate() {
+ if (Date.now() - lastUpdateTime > MIN_UPDATE_INTERVAL || !lastUpdateTime) {
+ inputContext.update();
+ lastUpdateTime = Date.now();
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+
+TextFieldStyle {}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "EditBubble.js" as Popup
+import "TextAreaHelper.js" as TextAreaHelper
+import "Magnifier.js" as MagnifierPopup
+FocusScope {
+ id: root
+
+ // Common public API
+ property alias text: textInput.text
+ property alias placeholderText: prompt.text
+
+ property alias inputMethodHints: textInput.inputMethodHints
+ property alias font: textInput.font
+ property alias cursorPosition: textInput.cursorPosition
+ property alias maximumLength: textInput.maximumLength
+ property alias readOnly: textInput.readOnly
+ property alias acceptableInput: textInput.acceptableInput
+ property alias inputMask: textInput.inputMask
+ property alias validator: textInput.validator
+
+ property alias selectedText: textInput.selectedText
+ property alias selectionStart: textInput.selectionStart
+ property alias selectionEnd: textInput.selectionEnd
+
+ property alias echoMode: textInput.echoMode // ### TODO: declare own enum { Normal, Password }
+
+ property bool errorHighlight: !acceptableInput
+ // Property enableSoftwareInputPanel is DEPRECATED
+ property alias enableSoftwareInputPanel: textInput.activeFocusOnPress
+
+ property Item platformSipAttributes
+
+ property bool platformEnableEditBubble: true
+
+ property Item platformStyle: TextFieldStyle {}
+
+ property alias style: root.platformStyle
+
+ property Component customSoftwareInputPanel
+
+ property Component platformCustomSoftwareInputPanel
+
+ property alias platformPreedit: inputMethodObserver.preedit
+
+ signal accepted
+
+ onPlatformSipAttributesChanged: {
+ platformSipAttributes.registerInputElement(textInput)
+ }
+
+ onCustomSoftwareInputPanelChanged: {
+ console.log("TextField's property customSoftwareInputPanel is deprecated. Use property platformCustomSoftwareInputPanel instead.")
+ platformCustomSoftwareInputPanel = customSoftwareInputPanel
+ }
+
+ onPlatformCustomSoftwareInputPanelChanged: {
+ textInput.activeFocusOnPress = platformCustomSoftwareInputPanel == null
+ }
+
+
+
+ function copy() {
+ textInput.copy()
+ }
+
+ Connections {
+ target: platformWindow
+
+ onActiveChanged: {
+ if(platformWindow.active) {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+ repositionTimer.running = true;
+ }
+ }
+ } else {
+ if (activeFocus) {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ onAnimatingChanged: {
+ if (!platformWindow.animating && root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation);
+ }
+ }
+ }
+
+
+ function paste() {
+ textInput.paste()
+ }
+
+ function cut() {
+ textInput.cut()
+ }
+
+ function select(start, end) {
+ textInput.select(start, end)
+ }
+
+ function selectAll() {
+ textInput.selectAll()
+ }
+
+ function selectWord() {
+ textInput.selectWord()
+ }
+
+ function positionAt(x) {
+ var p = mapToItem(textInput, x, 0);
+ return textInput.positionAt(p.x)
+ }
+
+ function positionToRectangle(pos) {
+ var rect = textInput.positionToRectangle(pos)
+ rect.x = mapFromItem(textInput, rect.x, 0).x
+ return rect;
+ }
+
+ // ensure propagation of forceActiveFocus
+ function forceActiveFocus() {
+ textInput.forceActiveFocus()
+ }
+
+ function closeSoftwareInputPanel() {
+ console.log("TextField's function closeSoftwareInputPanel is deprecated. Use function platformCloseSoftwareInputPanel instead.")
+ platformCloseSoftwareInputPanel()
+ }
+
+ function platformCloseSoftwareInputPanel() {
+ inputContext.simulateSipClose();
+ if (inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelVisible = false
+ inputContext.customSoftwareInputPanelComponent = null
+ inputContext.customSoftwareInputPanelTextField = null
+ } else {
+ textInput.closeSoftwareInputPanel();
+ }
+ }
+
+ function openSoftwareInputPanel() {
+ console.log("TextField's function openSoftwareInputPanel is deprecated. Use function platformOpenSoftwareInputPanel instead.")
+ platformOpenSoftwareInputPanel()
+ }
+
+ function platformOpenSoftwareInputPanel() {
+ inputContext.simulateSipOpen();
+ if (platformCustomSoftwareInputPanel != null && !inputContext.customSoftwareInputPanelVisible) {
+ inputContext.customSoftwareInputPanelTextField = root
+ inputContext.customSoftwareInputPanelComponent = platformCustomSoftwareInputPanel
+ inputContext.customSoftwareInputPanelVisible = true
+ } else {
+ textInput.openSoftwareInputPanel();
+ }
+ }
+
+ // private
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ property int __preeditDisabledMask: Qt.ImhHiddenText|
+ Qt.ImhNoPredictiveText|
+ Qt.ImhDigitsOnly|
+ Qt.ImhFormattedNumbersOnly|
+ Qt.ImhDialableCharactersOnly|
+ Qt.ImhEmailCharactersOnly|
+ Qt.ImhUrlCharactersOnly
+
+ implicitWidth: platformStyle.defaultWidth
+ implicitHeight: UI.FIELD_DEFAULT_HEIGHT
+
+ onActiveFocusChanged: {
+ if (!readOnly) {
+ if (activeFocus) {
+ if (platformCustomSoftwareInputPanel != null) {
+ platformOpenSoftwareInputPanel();
+ } else {
+ inputContext.simulateSipOpen();
+ }
+
+ repositionTimer.running = true;
+ } else {
+ platformCloseSoftwareInputPanel();
+ Popup.close(textInput);
+ }
+ }
+ }
+
+
+ BorderImage {
+ id: background
+ source: errorHighlight?
+ platformStyle.backgroundError:
+ readOnly?
+ platformStyle.backgroundDisabled:
+ textInput.activeFocus?
+ platformStyle.backgroundSelected:
+ platformStyle.background
+
+ anchors.fill: parent
+ border.left: root.platformStyle.backgroundCornerMargin; border.top: root.platformStyle.backgroundCornerMargin
+ border.right: root.platformStyle.backgroundCornerMargin; border.bottom: root.platformStyle.backgroundCornerMargin
+ }
+
+ Text {
+ id: prompt
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ font: root.platformStyle.textFont
+ color: root.platformStyle.promptTextColor
+ elide: Text.ElideRight
+
+ // opacity for default state
+ opacity: 0.0
+
+ states: [
+ State {
+ name: "unfocused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: !root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 1.0; }
+ },
+ State {
+ name: "focused"
+ // memory allocation optimization: cursorPosition is checked to minimize displayText evaluations
+ when: root.activeFocus && textInput.cursorPosition == 0 && !textInput.text && prompt.text && !textInput.inputMethodComposing
+ PropertyChanges { target: prompt; opacity: 0.6; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "unfocused"; to: "focused";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 150 }
+ }
+ },
+ Transition {
+ from: "focused"; to: "";
+ reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 60 }
+ NumberAnimation { target: prompt; properties: "opacity"; duration: 100 }
+ }
+ }
+ ]
+ }
+
+ MouseArea {
+ enabled: !textInput.activeFocus
+ z: enabled?1:0
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ onClicked: {
+ if (!textInput.activeFocus) {
+ textInput.forceActiveFocus();
+
+ // activate to preedit and/or move the cursor
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+ var injectionSucceeded = false;
+ var newCursorPosition = textInput.positionAt(mapToItem(textInput, mouseX, mouseY).x,TextInput.CursorOnCharacter);
+ if (!preeditDisabled
+ && !TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length
+ && !(newCursorPosition == 0 || TextAreaHelper.atSpace(newCursorPosition - 1))) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (!injectionSucceeded) {
+ textInput.cursorPosition=newCursorPosition;
+ }
+ }
+ }
+ }
+
+ TextInput {
+ id: textInput
+
+ property alias preedit: inputMethodObserver.preedit
+ property alias preeditCursorPosition: inputMethodObserver.preeditCursorPosition
+
+ anchors {verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right}
+ anchors.leftMargin: root.platformStyle.paddingLeft
+ anchors.rightMargin: root.platformStyle.paddingRight
+ anchors.verticalCenterOffset: root.platformStyle.baselineOffset
+
+ passwordCharacter: "\u2022"
+ font: root.platformStyle.textFont
+ color: root.platformStyle.textColor
+ selectByMouse: false
+ selectedTextColor: root.platformStyle.selectedTextColor
+ selectionColor: root.platformStyle.selectionColor
+ mouseSelectionMode: TextInput.SelectWords
+ focus: true
+
+ onAccepted: { root.accepted() }
+
+ Component.onDestruction: {
+ Popup.close(textInput);
+ }
+
+ Connections {
+ target: TextAreaHelper.findFlickable(root.parent)
+
+ onContentYChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onContentXChanged: if (root.activeFocus) TextAreaHelper.filteredInputContextUpdate();
+ onMovementEnded: inputContext.update();
+ }
+
+ Connections {
+ target: inputContext
+
+ onSoftwareInputPanelRectChanged: {
+ if (activeFocus) {
+ repositionTimer.running = true
+ }
+ }
+ }
+
+ onTextChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput())
+ Popup.close(textInput);
+ }
+
+ onCursorPositionChanged: {
+ if (MagnifierPopup.isOpened() &&
+ Popup.isOpened()) {
+ Popup.close(textInput);
+ } else if ((!mouseFilter.attemptToActivate ||
+ textInput.cursorPosition == textInput.text.length) &&
+ Popup.isOpened(textInput) &&
+ !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ Popup.open(textInput,
+ textInput.positionToRectangle(textInput.cursorPosition));
+ }
+ }
+
+ onSelectedTextChanged: {
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+
+ InputMethodObserver {
+ id: inputMethodObserver
+
+ onPreeditChanged: {
+ if(root.activeFocus) {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+
+ if (Popup.isOpened(textInput) && !Popup.isChangingInput()) {
+ Popup.close(textInput);
+ }
+ }
+ }
+
+ Timer {
+ id: repositionTimer
+ interval: 350
+ onTriggered: {
+ TextAreaHelper.repositionFlickable(contentMovingAnimation)
+ }
+ }
+
+ PropertyAnimation {
+ id: contentMovingAnimation
+ property: "contentY"
+ duration: 200
+ easing.type: Easing.InOutCubic
+ }
+
+ MouseFilter {
+ id: mouseFilter
+ anchors.fill: parent
+ anchors.leftMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingLeft
+ anchors.rightMargin: UI.TOUCH_EXPANSION_MARGIN - root.platformStyle.paddingRight
+ anchors.topMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+ anchors.bottomMargin: UI.TOUCH_EXPANSION_MARGIN - ((root.height - parent.height) / 2)
+
+ property bool attemptToActivate: false
+ property bool pressOnPreedit: false
+ property int oldCursorPosition: 0
+
+ property variant editBubblePosition: Qt.point(0,0)
+
+ onPressed: {
+ var mousePosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ pressOnPreedit = textInput.cursorPosition==mousePosition
+ oldCursorPosition = textInput.cursorPosition;
+ var preeditDisabled = root.inputMethodHints &
+ root.__preeditDisabledMask
+
+ attemptToActivate = !pressOnPreedit && !root.readOnly && !preeditDisabled && root.activeFocus &&
+ !(mousePosition == 0 || TextAreaHelper.atSpace(mousePosition - 1) || TextAreaHelper.atSpace(mousePosition));
+ mouse.filtered = true;
+ }
+
+ onDelayedPressSent: {
+ if (textInput.preedit) {
+ textInput.cursorPosition = oldCursorPosition;
+ }
+ }
+
+ onHorizontalDrag: {
+ // possible pre-edit word have to be commited before selection
+ if (root.activeFocus || root.readOnly) {
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+
+ onPressAndHold:{
+ // possible pre-edit word have to be commited before showing the magnifier
+ if ((root.text != "" || inputMethodObserver.preedit != "") && root.activeFocus) {
+ inputContext.reset()
+ attemptToActivate = false
+ MagnifierPopup.open(root);
+ var magnifier = MagnifierPopup.popup;
+ var cursorPos = textInput.positionToRectangle(0);
+ var mappedPosMf = mapFromItem(parent,mouse.x,cursorPos.y+cursorPos.height);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ var mappedPos = mapToItem(magnifier.parent, mappedPosMf.x - magnifier.width / 2,
+ textInput.y - 120 - UI.MARGIN_XLARGE - (height / 2));
+ var yAdjustment = -mapFromItem(magnifier.__rootElement(), 0, 0).y < magnifier.height / 2.5 ? magnifier.height / 2.5 + mapFromItem(magnifier.__rootElement(), 0,0).y : 0
+ magnifier.x = mappedPos.x;
+ magnifier.y = mappedPos.y + yAdjustment;
+ magnifier.yCenter = mapToItem(magnifier.sourceItem,0,mappedPosMf.y).y;
+ parent.cursorPosition = textInput.positionAt(mouse.x)
+ }
+ }
+
+ onReleased: {
+ if (MagnifierPopup.isOpened()) {
+ MagnifierPopup.close();
+ }
+
+ if (attemptToActivate)
+ inputContext.reset();
+
+ var newCursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ editBubblePosition = textInput.positionToRectangle(newCursorPosition);
+
+ if (attemptToActivate) {
+ var beforeText = textInput.text;
+
+ textInput.cursorPosition = newCursorPosition;
+ var injectionSucceeded = false;
+
+ if (!TextAreaHelper.atSpace(newCursorPosition)
+ && newCursorPosition != textInput.text.length) {
+ injectionSucceeded = TextAreaHelper.injectWordToPreedit(newCursorPosition);
+ }
+ if (injectionSucceeded) {
+ mouse.filtered=true;
+ if (textInput.preedit.length >=1 && textInput.preedit.length <= 4)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition+1)
+ } else {
+ textInput.text=beforeText;
+ textInput.cursorPosition=newCursorPosition;
+ }
+ } else if (!parent.selectByMouse) {
+ if (!pressOnPreedit) inputContext.reset();
+ textInput.cursorPosition = textInput.positionAt(mouse.x,TextInput.CursorOnCharacter);
+ }
+ parent.selectByMouse = false;
+ }
+
+ onFinished: {
+ if (root.activeFocus && platformEnableEditBubble) {
+ if (textInput.preedit.length == 0)
+ editBubblePosition = textInput.positionToRectangle(textInput.cursorPosition);
+ Popup.open(textInput,editBubblePosition);
+
+ }
+ attemptToActivate = false
+ }
+
+ onMousePositionChanged: {
+ if (MagnifierPopup.isOpened() && !parent.selectByMouse) {
+ textInput.cursorPosition = textInput.positionAt(mouse.x)
+ var magnifier = MagnifierPopup.popup;
+ var mappedPosMf = mapFromItem(parent,mouse.x,0);
+ var mappedPos = mapToItem(magnifier.parent,mappedPosMf.x - magnifier.width / 2.0, 0);
+ magnifier.xCenter = mapToItem(magnifier.sourceItem,mappedPosMf.x,0).x;
+ magnifier.x = mappedPos.x;
+ }
+ }
+
+ onDoubleClicked: {
+ // possible pre-edit word have to be commited before selection
+ inputContext.reset()
+ parent.selectByMouse = true
+ attemptToActivate = false
+ }
+ }
+ }
+
+ InverseMouseArea {
+ anchors.fill: parent
+ anchors.margins: UI.TOUCH_EXPANSION_MARGIN
+ enabled: textInput.activeFocus
+ onClickedOutside: {
+ if (Popup.isOpened(textInput) && ((mouseX > Popup.geometry().left && mouseX < Popup.geometry().right) &&
+ (mouseY > Popup.geometry().top && mouseY < Popup.geometry().bottom))) {
+ return;
+ }
+ root.parent.focus = true;
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ property alias textFont: textProperties.font
+ property color textColor: UI.COLOR_FOREGROUND
+ property color selectedTextColor: UI.COLOR_INVERTED_FOREGROUND
+ property color selectionColor: theme.selectionColor
+
+ property color promptTextColor: UI.COLOR_SECONDARY_FOREGROUND
+
+ property url background: "image://theme/meegotouch-textedit-background"
+ property url backgroundSelected: "image://theme/" + theme.colorString + "meegotouch-textedit-background-selected"
+ property url backgroundDisabled: "image://theme/meegotouch-textedit-background-disabled"
+ property url backgroundError: "image://theme/meegotouch-textedit-background-error"
+ property real backgroundCornerMargin: UI.CORNER_MARGINS
+
+ property real paddingLeft: UI.PADDING_XLARGE
+ property real paddingRight: UI.PADDING_XLARGE
+ property real paddingTop // DEPRECATED
+ property real paddingBottom // DEPRECATED
+
+ property real baselineOffset: 2
+ property real defaultWidth: 250
+
+ property real touchExpansionMargin: UI.TOUCH_EXPANSION_MARGIN
+
+ Text {
+ id: textProperties
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.pixelSize: UI.FONT_DEFAULT
+ visible: false
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// The ToolBar is a container for toolbar items such as ToolItem or ToolButton.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+
+ width: parent ? parent.width : 0
+ height: bgImage.height
+
+ // Dummy property to allow qt component deprecated API clients to fail more gracefully
+ property bool __hidden: false
+
+ property int privateVisibility: ToolBarVisibility.Visible
+
+ // Styling for the ToolBar
+ property Style platformStyle: ToolBarStyle {}
+
+ // Deprecated, TODO remove
+ property alias style: root.platformStyle
+
+ // Shadows:
+ Image {
+ anchors.top : bgImage.top
+ anchors.right: bgImage.left
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-left"
+ }
+ Image {
+ anchors.bottom : bgImage.top
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-top"
+ }
+ Image {
+ anchors.top : bgImage.top
+ anchors.left: bgImage.right
+ anchors.bottom : bgImage.bottom
+ source: "image://theme/meegotouch-menu-shadow-right"
+ }
+ Image {
+ anchors.top : bgImage.bottom
+ anchors.left: bgImage.left
+ anchors.right : bgImage.right
+ source: "image://theme/meegotouch-menu-shadow-bottom"
+ }
+ // Toolbar background.
+ BorderImage {
+ id: bgImage
+ width: root.width
+ border.left: 10
+ border.right: 10
+ border.top: 10
+ border.bottom: 10
+ source: platformStyle.background
+
+ // Mousearea that eats clicks so they don't go through the toolbar to content
+ // that may exist below it in z-order, such as unclipped listview items.
+ MouseArea { anchors.fill: parent }
+ }
+
+ states: [
+ // Inactive state.
+ State {
+ name: "hidden"
+ when: privateVisibility == ToolBarVisibility.Hidden || tools == null
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: "HiddenImmediately"
+ when: privateVisibility == ToolBarVisibility.HiddenImmediately
+ PropertyChanges { target: root; height: 0; }
+ },
+ State {
+ name: ""
+ when: !(privateVisibility == ToolBarVisibility.Visible || tools == null)
+ PropertyChanges { target: root; height: bgImage.height }
+ }
+
+ ]
+
+ transitions: [
+ // Transition between active and inactive states.
+ Transition {
+ from: ""; to: "hidden"; reversible: true
+ ParallelAnimation {
+ PropertyAnimation { properties: "height"; easing.type: Easing.InOutExpo; duration: platformStyle.visibilityTransitionDuration }
+ }
+ }
+ ]
+
+ // The current set of tools.
+ property Item tools: null
+
+ onToolsChanged: {
+ __performTransition(__transition || transition);
+ __transition = undefined;
+ }
+
+ // The transition type. One of the following:
+ // set an instantaneous change (default)
+ // push follows page stack push animation
+ // pop follows page stack pop animation
+ // replace follows page stack replace animation
+ property string transition: "set"
+
+ // The currently displayed container; null if none.
+ property Item __currentContainer: null
+
+ // Alternating containers used for transitions.
+ property Item __containerA: null
+ property Item __containerB: null
+
+ // The transition to perform next.
+ property variant __transition
+
+ // Sets the tools with a transition.
+ function setTools(tools, transition) {
+ __transition = transition;
+ root.tools = tools;
+ }
+
+ // Performs a transition between tools in the toolbar.
+ function __performTransition(transition) {
+ // lazily create containers if they have not been created
+ if (!__currentContainer) {
+ // Parent is bgImage because it doesn't change height when toolbar gets hidden
+ __containerA = containerComponent.createObject(bgImage);
+ __containerB = containerComponent.createObject(bgImage);
+ __currentContainer = __containerB;
+ }
+
+ // no transition if the tools are unchanged
+ if (__currentContainer.tools == tools) {
+ return;
+ }
+
+ // select container states based on the transition animation
+ var transitions = {
+ "set": { "new": "", "old": "hidden" },
+ "push": { "new": "right", "old": "left" },
+ "pop": { "new": "left", "old": "right" },
+ "replace": { "new": "front", "old": "back" }
+ };
+ var animation = transitions[transition];
+
+ // initialize the free container
+ var container = __currentContainer == __containerA ? __containerB : __containerA;
+ container.state = "hidden";
+ if (tools) {
+ container.tools = tools;
+ container.owner = tools.parent;
+ tools.parent = container;
+ tools.visible = true;
+ }
+
+ // perform transition
+ __currentContainer.state = animation["old"];
+ if (tools) {
+ container.state = animation["new"];
+ container.state = "";
+ }
+
+ __currentContainer = container;
+ }
+
+ // Component for toolbar containers.
+ Component {
+ id: containerComponent
+
+ Item {
+ id: container
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ // The states correspond to the different possible positions of the container.
+ state: "hidden"
+
+ // The tools held by this container.
+ property Item tools: null
+ // The owner of the tools.
+ property Item owner: null
+
+ states: [
+ // Start state for pop entry, end state for push exit.
+ State {
+ name: "left"
+ PropertyChanges { target: container; x: -30; opacity: 0.0 }
+ },
+ // Start state for push entry, end state for pop exit.
+ State {
+ name: "right"
+ PropertyChanges { target: container; x: 30; opacity: 0.0 }
+ },
+ // Start state for replace entry.
+ State {
+ name: "front"
+ PropertyChanges { target: container; scale: 1.25; opacity: 0.0 }
+ },
+ // End state for replace exit.
+ State {
+ name: "back"
+ PropertyChanges { target: container; scale: 0.85; opacity: 0.0 }
+ },
+ // Inactive state.
+ State {
+ name: "hidden"
+ PropertyChanges { target: container; visible: false }
+ StateChangeScript {
+ script: {
+ if (container.tools) {
+ // re-parent back to original owner
+ tools.visible = false;
+ tools.parent = owner;
+
+ // reset container
+ container.tools = container.owner = null;
+ }
+ }
+ }
+ }
+ ]
+
+ transitions: [
+ // Pop entry and push exit transition.
+ Transition {
+ from: ""; to: "left"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "left") state = "hidden"; }
+ }
+ },
+ // Push entry and pop exit transition.
+ Transition {
+ from: ""; to: "right"; reversible: true
+ SequentialAnimation {
+ PropertyAnimation { properties: "x,opacity"; easing.type: Easing.InCubic; duration: platformStyle.contentTransitionDuration / 2 }
+ PauseAnimation { duration: platformStyle.contentTransitionDuration / 2 }
+ ScriptAction { script: if (state == "right") state = "hidden"; }
+ }
+ },
+ Transition {
+ // Replace entry transition.
+ from: "front"; to: "";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ }
+ },
+ Transition {
+ // Replace exit transition.
+ from: ""; to: "back";
+ SequentialAnimation {
+ PropertyAnimation { properties: "scale,opacity"; easing.type: Easing.InOutExpo; duration: platformStyle.contentTransitionDuration }
+ ScriptAction { script: if (state == "back") state = "hidden"; }
+ }
+ }
+ ]
+
+ }
+ }
+
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/// Helper code that is needed by ToolBarLayout.
+
+var connectedItems = [];
+
+// Find item in an array
+function contains(container, obj) {
+ for (var i = 0 ; i < container.length; i++) {
+ if (container[i] == obj)
+ return true;
+ }
+ return false
+}
+
+// Remove item from an array
+function remove(container, obj)
+{
+ for (var i = 0 ; i < container.length ; i++ )
+ if (container[i] == obj)
+ container.splice(i,1);
+}
+
+// Helper function to give us the sender id on slots
+// This is needed to remove connectens on a reparent
+Function.prototype.bind = function() {
+ var func = this;
+ var thisObject = arguments[0];
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ return func.apply(thisObject, args);
+ }
+}
+
+// Called whenever a child is added or removed in the toolbar
+function childrenChanged() {
+ for (var i = 0; i < children.length; i++) {
+ if (!contains(connectedItems, children[i])) {
+ connectedItems.push(children[i]);
+ children[i].visibleChanged.connect(layout);
+ children[i].parentChanged.connect(cleanup.bind(children[i]));
+ }
+ }
+}
+
+// Disconnects signals connected by this layout
+function cleanup() {
+ remove(connectedItems, this);
+ this.visibleChanged.disconnect(layout);
+ this.parentChanged.disconnect(arguments.callee);
+}
+
+// Main layout function
+function layout() {
+
+ if (parent === null || width === 0)
+ return;
+
+ var i;
+ var items = new Array(); // Keep track of visible items
+ var expandingItems = new Array(); // Keep track of expandingItems for tabs
+ var widthOthers = 0;
+
+ for (i = 0; i < children.length; i++) {
+ if (children[i].visible) {
+ items.push(children[i])
+
+ // Center all items vertically
+ items[0].y = (function() {return height / 2 - items[0].height / 2})
+ // Find out which items are expanding
+ if (children[i].__expanding) {
+ expandingItems.push(children[i])
+ } else {
+ // Calculate the space that fixed size items take
+ widthOthers += children[i].width;
+ }
+ }
+ }
+
+ if (items.length === 0)
+ return;
+
+ // Extra padding is applied if the leftMost or rightmost widget is expanding (note** removed on new design)
+ var leftPadding = 0
+ var rightPadding = 0
+
+ // In LandScape mode we add extra margin to keep contents centered
+ // for two basic cases
+ if (items.length == 2 && screen.currentOrientation == Screen.Landscape) {
+ // expanding item on left
+ if (expandingItems.length > 0 && items[0].__expanding && !items[items.length-1].__expanding)
+ leftPadding += items[items.length-1].width
+
+ // expanding item is on right
+ if (expandingItems.length > 0 && items[items.length-1].__expanding && !items[0].__expanding)
+ rightPadding += items[0].width
+ }
+
+ var width = toolbarLayout.width - leftPadding - rightPadding
+
+ // Calc expandingItems and tabrows
+ for (i = 0; i < expandingItems.length; i++)
+ expandingItems[i].width = (width - widthOthers) / expandingItems.length
+
+ var lastItem = items[items.length-1] ? items[items.length-1] : undefined;
+
+ // Space to be divided between first and last items
+ var toolBox = width - (items[0] ? items[0].width : 0) -
+ (lastItem ? lastItem.width : 0);
+
+ // |X X X| etc.
+ var spacingBetween = toolBox;
+ for (i = 1; i < items.length - 1; i++)
+ spacingBetween -= items[i].width;
+ items[0].x = leftPadding
+
+ // Calculate spacing between items
+ spacingBetween /= items.length - 1;
+
+ // Starting after first item
+ var dX = items[0].width + spacingBetween;
+ for (i = 1; i < items.length; i++) {
+ items[i].x = dX + leftPadding;
+ dX += spacingBetween + items[i].width;
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolBarLayout is a container for items on a toolbar that automatically
+// implements an appropriate layout for its children.
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+import "ToolBarLayout.js" as Layout
+
+Item {
+ id: toolbarLayout
+
+ width: visible && parent ? parent.width : 0
+ height: visible && parent ? parent.height : 0
+
+ onWidthChanged: Layout.layout()
+ onHeightChanged: Layout.layout()
+ onChildrenChanged: Layout.childrenChanged()
+ Component.onCompleted: Layout.layout()
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url background: "image://theme/meegotouch-toolbar-" +
+ ((screen.currentOrientation == Screen.Portrait || screen.currentOrientation == Screen.PortraitInverted) ? "portrait" : "landscape") +
+ __invertedString + "-background"
+
+ property int visibilityTransitionDuration: 250
+ property int contentTransitionDuration: 400
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolButton is a push-button style button intended for use with toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Button {
+ id: toolButton
+
+ //Removes button background if set to true
+ property bool flat: false
+
+ property QtObject platformStyle: ToolButtonStyle { backgroundVisible: !toolButton.flat}
+
+ //Deprecated item, REMOVE THIS
+ property QtObject style: toolButton.platformStyle
+
+ implicitWidth: platformStyle.buttonWidth
+ implicitHeight: platformStyle.buttonHeight
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Item {
+ default property alias children: row.children
+ property bool __expanding: true // Layout hint used but ToolBarLayout
+ Row{
+ id: row
+ width: Math.min(parent.width, childrenRect.width)
+ spacing: UI.PADDING_LARGE
+ anchors.centerIn: parent
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+ButtonStyle {
+ buttonWidth: 186
+ buttonHeight: 42
+
+ // Font
+ fontPixelSize: 22
+ fontCapitalization: Font.MixedCase
+ fontWeight: Font.Bold
+ horizontalAlignment: Text.AlignHCenter
+
+ // Background
+ backgroundMarginRight: 15
+ backgroundMarginLeft: 15
+ backgroundMarginTop: 15
+ backgroundMarginBottom: 15
+ property bool backgroundVisible: true
+
+ background: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background" : ""
+ pressedBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-pressed" : ""
+ disabledBackground: backgroundVisible ? "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-disabled" : ""
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ property url iconSource
+ property string platformIconId
+
+ // TODO: deprecated
+ property alias iconId: root.platformIconId
+ width: 80; height: 64
+ signal clicked
+
+ // Styling for the ToolItem
+ property Style platformStyle: ToolItemStyle{}
+
+ // TODO: deprecated
+ property Style style: root.platformStyle
+
+ Image {
+ source: mouseArea.pressed ? platformStyle.pressedBackground : ""
+ anchors.centerIn: parent
+
+ Image {
+ function handleIconSource(iconId) {
+ if (iconSource != "")
+ return iconSource;
+
+ var prefix = "icon-m-"
+ // check if id starts with prefix and use it as is
+ // otherwise append prefix and use the inverted version if required
+ if (iconId.indexOf(prefix) !== 0)
+ iconId = prefix.concat(iconId).concat(theme.inverted ? "-white" : "");
+ return "image://theme/" + iconId;
+ }
+
+ source: handleIconSource(iconId)
+ anchors.centerIn: parent
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Component.onCompleted: mouseArea.clicked.connect(clicked)
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ToolItem is a component that is used to add actions to toolbars.
+
+import QtQuick 1.1
+import "." 1.0
+
+ToolIcon {
+ Component.onCompleted: {
+ print("Warning: ToolItem is deprecated, use ToolIcon instead")
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "UIConstants.js" as UI
+
+Style {
+ // Background
+ property url pressedBackground: "image://theme/meegotouch-button-navigationbar-button"+__invertedString+"-background-pressed"
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+var FONT_FAMILY = "Nokia Pure Text";
+var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
+var FONT_DEFAULT_SIZE = 24; // DEPRECATED
+
+var FONT_XLARGE = 32;
+var FONT_LARGE = 28;
+var FONT_SLARGE = 26;
+var FONT_DEFAULT = 24;
+var FONT_LSMALL = 22;
+var FONT_SMALL = 20;
+var FONT_XSMALL = 18;
+var FONT_XXSMALL = 16;
+
+var COLOR_FOREGROUND = "#191919"; // Text color
+var COLOR_SECONDARY_FOREGROUND = "#a6a8ab"; // Secondary text
+var COLOR_BACKGROUND = "#E0E1E2"; // Background
+var COLOR_SELECT = "#4591ff"; //Selected item background
+
+var COLOR_INVERTED_FOREGROUND = "#ffffff"; // Text color
+var COLOR_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Secondary text
+var COLOR_INVERTED_BACKGROUND = "#000000"; // Background
+
+var COLOR_DISABLED_FOREGROUND = "#b2b2b4";
+
+var COLOR_BUTTON_FOREGROUND = "#000000" //text color
+var COLOR_BUTTON_INVERTED_FOREGROUND = "#ffffff" //inverted text color
+var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c" //secondary text
+var COLOR_BUTTON_DISABLED_FOREGROUND = "#B2B2B4" //disabled text
+var COLOR_BUTTON_BACKGROUND = "#000000" //background
+
+var SIZE_ICON_DEFAULT = 32;
+var SIZE_ICON_LARGE = 48;
+
+var CORNER_MARGINS = 22;
+
+var MARGIN_DEFAULT = 0;
+var MARGIN_XLARGE = 16;
+
+// Distance in pixels from the widget bounding box inside which a release
+// event would still be accepted and trigger the widget
+var RELEASE_MISS_DELTA = 30;
+
+var OPACITY_ENABLED = 1.0;
+var OPACITY_DISABLED = 0.5;
+var SIZE_BUTTON = 64;
+
+var PADDING_XSMALL = 2;
+var PADDING_SMALL = 4;
+var PADDING_MEDIUM = 6;
+var PADDING_LARGE = 8;
+var PADDING_DOUBLE = 12;
+var PADDING_XLARGE = 16;
+var PADDING_XXLARGE = 24;
+
+var SCROLLDECORATOR_SHORT_MARGIN = 8;
+var SCROLLDECORATOR_LONG_MARGIN = 4;
+
+var TOUCH_EXPANSION_MARGIN = -12;
+
+var BUTTON_WIDTH = 322;
+var BUTTON_HEIGHT = 51;
+var BUTTON_LABEL_MARGIN = 10;
+
+var FIELD_DEFAULT_HEIGHT = 52;
+
+//Common UI layouts
+var DEFAULT_MARGIN = 16;
+var BUTTON_SPACING = 6;
+var HEADER_DEFAULT_HEIGHT_PORTRAIT = 72;
+var HEADER_DEFAULT_HEIGHT_LANDSCAPE = 46;
+var HEADER_DEFAULT_TOP_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_BOTTOM_SPACING_PORTRAIT = 20;
+var HEADER_DEFAULT_TOP_SPACING_LANDSCAPE = 16;
+var HEADER_DEFAULT_BOTTOM_SPACING_LANDSCAPE = 14;
+var LIST_ITEM_HEIGHT_SMALL = 64;
+var LIST_ITEM_HEIGHT_DEFAULT = 80;
+
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+/*
+ Get the first flickable in hierarchy.
+*/
+function findFlickable(item)
+{
+ var next = item;
+
+ while (next) {
+ if (next.flicking !== undefined && next.flickableDirection !== undefined)
+ return next;
+
+ next = next.parent;
+ }
+
+ return null;
+}
+
+/*
+ Get the root item given an element and root item's name.
+ If root item name is not given, default is 'windowContent'.
+*/
+function findRootItem(item, objectName)
+{
+ var next = item;
+
+ var rootItemName = "windowContent";
+ if (typeof(objectName) != 'undefined') {
+ rootItemName = objectName;
+ }
+
+ if (next) {
+ while (next.parent) {
+ next = next.parent;
+
+ if (rootItemName == next.objectName) {
+ break;
+ }
+ }
+ }
+
+ return next;
+}
+
+/*
+ Get the root item for Notification banner
+ It will return 'appWindowContent' or 'windowContent' element if found.
+*/
+function findRootItemNotificationBanner(item)
+{
+ var next = item;
+
+ if (next) {
+ while (next.parent) {
+ if (next.objectName == "appWindowContent")
+ break;
+
+ if (next.objectName == "windowContent")
+ break;
+
+ next = next.parent;
+ }
+ }
+
+ return next;
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Components project.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "." 1.0
+
+Item {
+ id: root
+ width: screen.displayWidth
+ height: screen.displayHeight
+
+ property alias color: background.color
+
+ default property alias content: windowContent.data
+
+ // Read only property true if window is in portrait
+ property alias inPortrait: window.portrait
+
+ signal orientationChangeAboutToStart
+ signal orientationChangeStarted
+ signal orientationChangeFinished
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "black"
+ }
+
+ Item {
+ id: window
+ property bool portrait
+
+ width: window.portrait ? screen.displayHeight : screen.displayWidth
+ height: window.portrait ? screen.displayWidth : screen.displayHeight
+
+ anchors.centerIn : parent
+ transform: Rotation { id: windowRotation;
+ origin.x: 0;
+ origin.y: 0;
+ angle: 0
+ }
+
+ Item {
+ id: windowContent
+ width: parent.width
+ height: parent.height - heightDelta
+
+ // Used for resizing windowContent when virtual keyboard appears
+ property int heightDelta: 0
+
+ objectName: "windowContent"
+ clip: true
+
+ Connections {
+ id: inputContextConnection
+ target: inputContext
+ onSoftwareInputPanelVisibleChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ onSoftwareInputPanelRectChanged: inputContextConnection.updateWindowContentHeightDelta();
+
+ function updateWindowContentHeightDelta() {
+ if(inputContext.customSoftwareInputPanelVisible)
+ return
+
+ if (root.inPortrait)
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.width
+ else
+ windowContent.heightDelta = inputContext.softwareInputPanelRect.height
+ }
+ }
+ }
+
+ SoftwareInputPanel {
+ id: softwareInputPanel
+ active: inputContext.customSoftwareInputPanelVisible
+ anchors.bottom: parent.bottom
+
+ onHeightChanged: {
+ windowContent.heightDelta = height
+ }
+
+ Loader {
+ id: softwareInputPanelLoader
+ width: parent.width
+ sourceComponent: inputContext.customSoftwareInputPanelComponent
+ }
+ }
+
+ Snapshot {
+ id: snapshot
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: screen.displayWidth
+ height: screen.displayHeight
+ snapshotWidth: screen.displayWidth
+ snapshotHeight: screen.displayHeight
+ opacity: 0
+ transform: Rotation { id: snapshotRotation;
+ origin.x: screen.displayHeight / 2; origin.y: screen.displayHeight / 2;
+ angle: 0 }
+ }
+
+ state: screen.orientationString
+
+ states: [
+ State {
+ name: "Landscape"
+ PropertyChanges { target: window; rotation: 0; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "Portrait"
+ PropertyChanges { target: window; rotation: 270; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 0 }
+ },
+ State {
+ name: "LandscapeInverted"
+ PropertyChanges { target: window; rotation: 180; portrait: false; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height / 2;
+ origin.y: root.height / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 374; anchors.topMargin: 0 }
+ },
+ State {
+ name: "PortraitInverted"
+ PropertyChanges { target: window; rotation: 90; portrait: true; }
+ PropertyChanges { target: windowRotation;
+ origin.x: root.height - root.width / 2;
+ origin.y: root.width / 2; }
+ PropertyChanges { target: snapshot; anchors.leftMargin: 0; anchors.topMargin: 374 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ // use this transition when sip is visible
+ from: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ to: (inputContext.softwareInputPanelVisible ? "*" : "disabled")
+ PropertyAction { target: window; properties: "rotation"; }
+ ScriptAction {
+ script: {
+ root.orientationChangeAboutToStart();
+ platformWindow.startSipOrientationChange(window.rotation);
+ // note : we should really connect these signals to MInputMethodState
+ // signals so that they are emitted at the appropriate time
+ // but there aren't any
+ root.orientationChangeStarted();
+ root.orientationChangeFinished();
+ }
+ }
+ },
+ Transition {
+ // use this transition when sip is not visible
+ from: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ to: (screen.minimized ? "disabled" : (inputContext.softwareInputPanelVisible ? "disabled" : "*"))
+ SequentialAnimation {
+ alwaysRunToEnd: true
+
+ ScriptAction {
+ script: {
+ snapshot.take();
+ snapshot.opacity = 1.0;
+ snapshotRotation.angle = -window.rotation;
+ snapshot.smooth = false; // Quick & coarse rotation consistent with MTF
+ platformWindow.animating = true;
+ root.orientationChangeAboutToStart();
+ }
+ }
+ PropertyAction { target: window; properties: "portrait"; }
+ ScriptAction {
+ script: {
+ windowContent.opacity = 0.0;
+ root.orientationChangeStarted();
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { target: windowContent; property: "opacity";
+ to: 1.0; easing.type: Easing.InOutExpo; duration: 600; }
+ NumberAnimation { target: snapshot; property: "opacity";
+ to: 0.0; easing.type: Easing.InOutExpo; duration: 600; }
+ PropertyAction { target: windowRotation; properties: "origin.x"; }
+ PropertyAction { target: windowRotation; properties: "origin.y"; }
+ RotationAnimation { target: windowRotation; property: "angle";
+ from: -screen.rotationDirection * 90;
+ to: 0;
+ direction: RotationAnimation.Shortest;
+ easing.type: Easing.InOutExpo; duration: 600; }
+ }
+ ScriptAction {
+ script: {
+ windowRotation.angle = 0
+ snapshot.free();
+ root.orientationChangeFinished();
+ platformWindow.animating = false;
+ }
+ }
+ }
+ }
+ ]
+
+ focus: true
+ Keys.onReleased: {
+ if (event.key == Qt.Key_I && event.modifiers == Qt.AltModifier) {
+ theme.inverted = !theme.inverted;
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.AltModifier) {
+ if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.Landscape;
+ }
+ }
+ if (event.key == Qt.Key_E && event.modifiers == Qt.ControlModifier ) {
+ if(screen.currentOrientation == Screen.Portrait) {
+ screen.allowedOrientations = Screen.Landscape;
+ } else if(screen.currentOrientation == Screen.LandscapeInverted) {
+ screen.allowedOrientations = Screen.Portrait;
+ } else if(screen.currentOrientation == Screen.PortraitInverted) {
+ screen.allowedOrientations = Screen.LandscapeInverted;
+ } else if(screen.currentOrientation == Screen.Landscape) {
+ screen.allowedOrientations = Screen.PortraitInverted;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+plugin meegoplugin
+ApplicationWindow 1.0 ApplicationWindow.qml
+ApplicationWindowStyle 1.0 ApplicationWindowStyle.qml
+BusyIndicator 1.0 BusyIndicator.qml
+BusyIndicatorStyle 1.0 BusyIndicatorStyle.qml
+Button 1.0 Button.qml
+ButtonStyle 1.0 ButtonStyle.qml
+GroupButtonStyle 1.0 GroupButtonStyle.qml
+ButtonColumn 1.0 ButtonColumn.qml
+ButtonRow 1.0 ButtonRow.qml
+CheckBox 1.0 CheckBox.qml
+CheckBoxStyle 1.0 CheckBoxStyle.qml
+ContextMenu 1.0 ContextMenu.qml
+ContextMenuStyle 1.0 ContextMenuStyle.qml
+Dialog 1.0 Dialog.qml
+DialogStyle 1.0 DialogStyle.qml
+EditBubble 1.0 EditBubble.qml
+QueryDialog 1.0 QueryDialog.qml
+QueryDialogStyle 1.0 QueryDialogStyle.qml
+SelectionDialog 1.0 SelectionDialog.qml
+MultiSelectionDialog 1.0 MultiSelectionDialog.qml
+SelectionDialogStyle 1.0 SelectionDialogStyle.qml
+Label 1.0 Label.qml
+LabelStyle 1.0 LabelStyle.qml
+Menu 1.0 Menu.qml
+MenuLayout 1.0 MenuLayout.qml
+MenuItem 1.0 MenuItem.qml
+MenuStyle 1.0 MenuStyle.qml
+MenuItemStyle 1.0 MenuItemStyle.qml
+MouseAreaDebug 1.0 MouseAreaDebug.qml
+Page 1.0 Page.qml
+PageStack 1.0 PageStack.qml
+PageStackWindow 1.0 PageStackWindow.qml
+PageStackWindowStyle 1.0 PageStackWindowStyle.qml
+ProgressBar 1.0 ProgressBar.qml
+ProgressBarStyle 1.0 ProgressBarStyle.qml
+RadioButton 1.0 RadioButton.qml
+RadioButtonStyle 1.0 RadioButtonStyle.qml
+ScrollDecorator 1.0 ScrollDecorator.qml
+ScrollDecoratorStyle 1.0 ScrollDecoratorStyle.qml
+SectionScroller 1.0 SectionScroller.qml
+SectionScrollerStyle 1.0 SectionScrollerStyle.qml
+Sheet 1.0 Sheet.qml
+SheetStyle 1.0 SheetStyle.qml
+SheetButton 1.0 SheetButton.qml
+SheetButtonStyle 1.0 SheetButtonStyle.qml
+SheetButtonAccentStyle 1.0 SheetButtonAccentStyle.qml
+Slider 1.0 Slider.qml
+SliderStyle 1.0 SliderStyle.qml
+SliderTemplate 1.0 SliderTemplate.qml
+StatusBar 1.0 StatusBar.qml
+Style 1.0 Style.qml
+Switch 1.0 Switch.qml
+SwitchStyle 1.0 SwitchStyle.qml
+TabBarLayout 1.0 TabBarLayout.qml
+TabButton 1.0 TabButton.qml
+TabButtonStyle 1.0 TabButtonStyle.qml
+TabGroup 1.0 TabGroup.qml
+TextArea 1.0 TextArea.qml
+TextAreaStyle 1.0 TextAreaStyle.qml
+TextField 1.0 TextField.qml
+TextFieldStyle 1.0 TextFieldStyle.qml
+ToolBar 1.0 ToolBar.qml
+ToolBarLayout 1.0 ToolBarLayout.qml
+ToolBarStyle 1.0 ToolBarStyle.qml
+ToolButton 1.0 ToolButton.qml
+ToolButtonRow 1.0 ToolButtonRow.qml
+ToolButtonStyle 1.0 ToolButtonStyle.qml
+ToolItem 1.0 ToolItem.qml
+ToolIcon 1.0 ToolIcon.qml
+ToolItemStyle 1.0 ToolItemStyle.qml
+Window 1.0 Window.qml
+
+ApplicationWindow 1.1 ApplicationWindow.qml
+ApplicationWindowStyle 1.1 ApplicationWindowStyle.qml
+BusyIndicator 1.1 BusyIndicator.qml
+BusyIndicatorStyle 1.1 BusyIndicatorStyle.qml
+Button 1.1 Button.qml
+ButtonStyle 1.1 ButtonStyle.qml
+GroupButtonStyle 1.1 GroupButtonStyle.qml
+ButtonColumn 1.1 ButtonColumn.qml
+ButtonRow 1.1 ButtonRow.qml
+CheckBox 1.1 CheckBox.qml
+CheckBoxStyle 1.1 CheckBoxStyle.qml
+ContextMenu 1.1 ContextMenu.qml
+ContextMenuStyle 1.1 ContextMenuStyle.qml
+Dialog 1.1 Dialog.qml
+DialogStyle 1.1 DialogStyle.qml
+EditBubble 1.1 EditBubble.qml
+QueryDialog 1.1 QueryDialog.qml
+QueryDialogStyle 1.1 QueryDialogStyle.qml
+SelectionDialog 1.1 SelectionDialog.qml
+MultiSelectionDialog 1.1 MultiSelectionDialog.qml
+SelectionDialogStyle 1.1 SelectionDialogStyle.qml
+Label 1.1 Label.qml
+LabelStyle 1.1 LabelStyle.qml
+Menu 1.1 Menu.qml
+MenuLayout 1.1 MenuLayout.qml
+MenuItem 1.1 MenuItem.qml
+MenuStyle 1.1 MenuStyle.qml
+MenuItemStyle 1.1 MenuItemStyle.qml
+MouseAreaDebug 1.1 MouseAreaDebug.qml
+Page 1.1 Page.qml
+PageStack 1.1 PageStack.qml
+PageStackWindow 1.1 PageStackWindow.qml
+PageStackWindowStyle 1.1 PageStackWindowStyle.qml
+ProgressBar 1.1 ProgressBar.qml
+ProgressBarStyle 1.1 ProgressBarStyle.qml
+RadioButton 1.1 RadioButton.qml
+RadioButtonStyle 1.1 RadioButtonStyle.qml
+ScrollDecorator 1.1 ScrollDecorator.qml
+ScrollDecoratorStyle 1.1 ScrollDecoratorStyle.qml
+SectionScroller 1.1 SectionScroller.qml
+SectionScrollerStyle 1.1 SectionScrollerStyle.qml
+Sheet 1.1 Sheet.qml
+SheetStyle 1.1 SheetStyle.qml
+SheetButton 1.1 SheetButton.qml
+SheetButtonStyle 1.1 SheetButtonStyle.qml
+SheetButtonAccentStyle 1.1 SheetButtonAccentStyle.qml
+Slider 1.1 Slider.qml
+SliderStyle 1.1 SliderStyle.qml
+SliderTemplate 1.1 SliderTemplate.qml
+StatusBar 1.1 StatusBar.qml
+Style 1.1 Style.qml
+Switch 1.1 Switch.qml
+SwitchStyle 1.1 SwitchStyle.qml
+TabBarLayout 1.1 TabBarLayout.qml
+TabButton 1.1 TabButton.qml
+TabButtonStyle 1.1 TabButtonStyle.qml
+TabGroup 1.1 TabGroup.qml
+TextArea 1.1 TextArea.qml
+TextAreaStyle 1.1 TextAreaStyle.qml
+TextField 1.1 TextField.qml
+TextFieldStyle 1.1 TextFieldStyle.qml
+ToolBar 1.1 ToolBar.qml
+ToolBarLayout 1.1 ToolBarLayout.qml
+ToolBarStyle 1.1 ToolBarStyle.qml
+ToolButton 1.1 ToolButton.qml
+ToolButtonRow 1.1 ToolButtonRow.qml
+ToolButtonStyle 1.1 ToolButtonStyle.qml
+ToolItem 1.1 ToolItem.qml
+ToolIcon 1.1 ToolIcon.qml
+ToolItemStyle 1.1 ToolItemStyle.qml
+Window 1.1 Window.qml