Ver código fonte

Persist date range filter selection on the batch log.

Neal Wilson 9 anos atrás
pai
commit
e7f89da11a
2 arquivos alterados com 15 adições e 2 exclusões
  1. 4
    0
      config/Windows/history.xml
  2. 11
    2
      src/daterangeselector.w

+ 4
- 0
config/Windows/history.xml Ver arquivo

@@ -21,6 +21,7 @@
21 21
 			}
22 22
 			dateSelect.setLifetimeRange(lifetimeStartDate, lifetimeEndDate);
23 23
 			dateQuery.invalidate();
24
+			dateSelect.currentIndex = QSettings.value("script/history/dateIndex", 6);
24 25
 			var table = findChildObject(this, 'table');
25 26
 			table.openEntryRow.connect(function(arg) {
26 27
 				var details = createWindow("batchDetails");
@@ -35,6 +36,9 @@
35 36
 				table.hideColumn(1);
36 37
 			}
37 38
 			dateSelect.rangeUpdated.connect(function() {
39
+				if(dateSelect.currentIndex != 24) { // Custom date range
40
+					QSettings.setValue("script/history/dateIndex", dateSelect.currentIndex);
41
+				}
38 42
 				refresh();
39 43
 			});
40 44
 			refresh();

+ 11
- 2
src/daterangeselector.w Ver arquivo

@@ -41,10 +41,12 @@ access to the ISO 8601 string representation of these dates is provided.
41 41
 class DateRangeSelector : public QWidget
42 42
 {
43 43
 	@[Q_OBJECT@]@;
44
+	Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)@/
44 45
 	public:@/
45 46
 		DateRangeSelector(QWidget *parent = NULL);
46 47
 		void setCustomRange(QVariant range);
47
-		Q_INVOKABLE QVariant currentRange();@/
48
+		Q_INVOKABLE QVariant currentRange();
49
+		int currentIndex();@/
48 50
 	@[public slots@]:@/
49 51
 		void setCurrentIndex(int index);
50 52
 		void setLifetimeRange(QString startDate, QString endDate);
@@ -79,7 +81,9 @@ class DateRangeSelector : public QWidget
79 81
 @<CustomDateRangePopup implementation@>
80 82
 @<DateRangeSelector implementation@>
81 83
 
84
+#if 0
82 85
 #include "moc_daterangeselector.cpp"
86
+#endif
83 87
 
84 88
 @ The custom range pop up is represented as a separate class which is not to be
85 89
 instantiated except by |DateRangeSelector|.
@@ -403,7 +407,7 @@ QVariant DateRangeSelector::currentRange()
403 407
 	return quickSelector->itemData(lastIndex);
404 408
 }
405 409
 
406
-@ Similarly, a method is provided to set the current index of the combo box.
410
+@ Methods are provided to get and set the current index of the combo box.
407 411
 
408 412
 @<DateRangeSelector implementation@>=
409 413
 void DateRangeSelector::setCurrentIndex(int index)
@@ -411,6 +415,11 @@ void DateRangeSelector::setCurrentIndex(int index)
411 415
 	quickSelector->setCurrentIndex(index);
412 416
 }
413 417
 
418
+int DateRangeSelector::currentIndex()
419
+{
420
+	return quickSelector->currentIndex();
421
+}
422
+
414 423
 @ The Lifetime range is handled somewhat differently from other ranges as there
415 424
 is no general way to know what that range should be without making unsafe
416 425
 assumptions. As such, reports are expected to remove the option, provide a

Carregando…
Cancelar
Salvar