Merge branch 'develop'
[lichviet] / qml / LichViet / DateTimeDialog.qml
index 8b9df0f..398e975 100644 (file)
@@ -14,11 +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 QtQuick 1.1
 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
@@ -38,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 {
@@ -56,11 +72,10 @@ Item{
             text: "OK"
             visible: true
             onClicked: {
-                LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
-                screen.state="mainscreen"
-                screen.refresh()
-                maindatemodel.reset()
+                datetimedlg.state="close";
+                datetimedlg.toolbar();
+                datetimedlg.updatedate(datePicker.mDay, datePicker.mMonth, datePicker.mYear)
+
                 }
         }
 
@@ -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 }
+    }
+
 }