* Improved QML/JS.
[lichviet] / qml / LichViet / DateTimeDialog.qml
index 8b9df0f..3ebb54f 100644 (file)
@@ -17,8 +17,23 @@ 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
 
     Rectangle {
         id: rectangle1
@@ -38,9 +53,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,9 +72,9 @@ Item{
             visible: true
             onClicked: {
                 LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.state="mainscreen"
-                screen.refresh()
+                Script.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
+                Script.state="mainscreen"
+                Script.refresh()
                 maindatemodel.reset()
                 }
         }
@@ -72,7 +87,10 @@ Item{
             height: 40
             text: "X"
             anchors.rightMargin: 56
-            onClicked: {screen.state="mainscreen";screen.refresh();}
+            onClicked: {
+                datetimedlg.state="close";
+                datetimedlg.toolbar();
+            }
         }
     }
 
@@ -82,4 +100,19 @@ Item{
                 dateReel.year_reset()
     }
 
+    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 }
+    }
+
 }