rollback to qtquick 1.0 to compatible with qtlib 4.7 maemo5 fremantle pr 1.3
[lichviet] / qml / LichViet / DateTimeDialog.qml
index e6eb564..62cbd87 100644 (file)
@@ -3,7 +3,7 @@ Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+the Free Software Foundation, either version 2 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
@@ -14,12 +14,27 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
-
 import QtQuick 1.0
 import "../DatePicker/component" as Comp
 
+import "Themes.js" as Themes
+import "main.js" as Script
+
 Item{
-    id: item1
+    id: datetimedlg
+
+    anchors.verticalCenter: parent.verticalCenter
+    width: parent.width; height: parent.height;
+    x:(parent.width * 1.5)
+
+    Loader {
+        id: theme_manager
+        property alias theme: theme_manager.item
+        source: Themes.default_theme()
+    }
+
+    signal toolbar
+    signal updatedate(int day, int month, int year)
 
     Rectangle {
         id: rectangle1
@@ -39,9 +54,9 @@ Item{
         Column {
             id: datePicker
             width: 260
-            property int mDay: screen.curDay
-            property int mMonth: screen.curMonth
-            property int mYear: screen.curYear
+            property int mDay: Script.curDay
+            property int mMonth: Script.curMonth
+            property int mYear: Script.curYear
             anchors.centerIn: parent
 
             Comp.DateReel {
@@ -57,13 +72,10 @@ Item{
             text: "OK"
             visible: true
             onClicked: {
+                datetimedlg.state="close";
+                datetimedlg.toolbar();
+                datetimedlg.updatedate(datePicker.mDay, datePicker.mMonth, datePicker.mYear)
 
-                LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.state="mainscreen"
-                screen.refresh()
-                maindatemodel.reset()
-                txtDATEpv.currentIndex = datePicker.mDay-1;
                 }
         }
 
@@ -75,7 +87,10 @@ Item{
             height: 40
             text: "X"
             anchors.rightMargin: 56
-            onClicked: {screen.state="mainscreen";screen.refresh();}
+            onClicked: {
+                datetimedlg.state="close";
+                datetimedlg.toolbar();
+            }
         }
     }
 
@@ -85,7 +100,19 @@ Item{
                 dateReel.year_reset()
     }
 
-    transitions: [
-        Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
+    states: [
+        State {
+            name: "show"
+            AnchorChanges { target: datetimedlg; anchors.right: parent.right }
+        },
+        State {
+            name: "close"
+            AnchorChanges { target: datetimedlg; anchors.right: parent.left }
+        }
     ]
+
+    transitions: Transition {
+        AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
+    }
+
 }