Browse Source

Now button in reminders edit window works.

Neal Wilson 9 years ago
parent
commit
fcbe4ffa2b
2 changed files with 14 additions and 0 deletions
  1. 4
    0
      config/Windows/editreminder.xml
  2. 10
    0
      src/typica.w

+ 4
- 0
config/Windows/editreminder.xml View File

72
             var batchesfield = findChildObject(this, 'batches');
72
             var batchesfield = findChildObject(this, 'batches');
73
             var hoursfield = findChildObject(this, 'roastingtime');
73
             var hoursfield = findChildObject(this, 'roastingtime');
74
             var time = new QTime();
74
             var time = new QTime();
75
+            var nowButton = findChildObject(this, 'now');
76
+            nowButton.clicked.connect(function() {
77
+                sincefield.setToCurrentTime();
78
+            });
75
             var deleteButton = findChildObject(this, 'delete');
79
             var deleteButton = findChildObject(this, 'delete');
76
             deleteButton.enabled = false;
80
             deleteButton.enabled = false;
77
             deleteButton.clicked.connect(function() {
81
             deleteButton.clicked.connect(function() {

+ 10
- 0
src/typica.w View File

6050
     value.setProperty("day", engine->newFunction(QDateTimeEdit_day));
6050
     value.setProperty("day", engine->newFunction(QDateTimeEdit_day));
6051
     value.setProperty("month", engine->newFunction(QDateTimeEdit_month));
6051
     value.setProperty("month", engine->newFunction(QDateTimeEdit_month));
6052
     value.setProperty("year", engine->newFunction(QDateTimeEdit_year));
6052
     value.setProperty("year", engine->newFunction(QDateTimeEdit_year));
6053
+    value.setProperty("setToCurrentTime",
6054
+                      engine->newFunction(QDateTimeEdit_setToCurrentTime));
6053
 }
6055
 }
6054
 
6056
 
6055
 @ Certain operations on a |QDateEdit| are easier with a few convenience
6057
 @ Certain operations on a |QDateEdit| are easier with a few convenience
6094
     return QScriptValue(self->date().year());
6096
     return QScriptValue(self->date().year());
6095
 }
6097
 }
6096
 
6098
 
6099
+QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext *context, QScriptEngine *)
6100
+{
6101
+    QDateTimeEdit *self = getself<QDateTimeEdit *>(context);
6102
+    self->setDateTime(QDateTime::currentDateTime());
6103
+    return QScriptValue();
6104
+}
6105
+
6097
 @ A few function prototypes are needed for this.
6106
 @ A few function prototypes are needed for this.
6098
 
6107
 
6099
 @<Function prototypes for scripting@>=
6108
 @<Function prototypes for scripting@>=
6105
 QScriptValue QDateTimeEdit_month(QScriptContext *context,
6114
 QScriptValue QDateTimeEdit_month(QScriptContext *context,
6106
                                  QScriptEngine *engine);
6115
                                  QScriptEngine *engine);
6107
 QScriptValue QDateTimeEdit_year(QScriptContext *context, QScriptEngine *engine);
6116
 QScriptValue QDateTimeEdit_year(QScriptContext *context, QScriptEngine *engine);
6117
+QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext *context, QScriptEngine *engine);
6108
 
6118
 
6109
 @ In order to get to objects created from the XML description, it is necessary
6119
 @ In order to get to objects created from the XML description, it is necessary
6110
 to provide a function that can be called to retrieve children of a given widget.
6120
 to provide a function that can be called to retrieve children of a given widget.

Loading…
Cancel
Save