projects
/
timedsilencer
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dfe97bc
)
Some week days picker behavior fixes
author
Christophe Dumez
<dchris@gmail.com>
Sat, 10 Jul 2010 21:03:31 +0000
(23:03 +0200)
committer
Christophe Dumez
<dchris@gmail.com>
Sat, 10 Jul 2010 21:03:31 +0000
(23:03 +0200)
qmaemo5weekdayspickwidget.cpp
patch
|
blob
|
history
diff --git
a/qmaemo5weekdayspickwidget.cpp
b/qmaemo5weekdayspickwidget.cpp
index
00a3746
..
6d2b22b
100644
(file)
--- a/
qmaemo5weekdayspickwidget.cpp
+++ b/
qmaemo5weekdayspickwidget.cpp
@@
-88,13
+88,18
@@
void QMaemo5WeekDaysPickWidget::emitSelectionAndClose() {
QList<int> selected_rows;
QModelIndexList selected_indexes = daysList->selectionModel()->selectedRows();
foreach(QModelIndex index, selected_indexes) {
QList<int> selected_rows;
QModelIndexList selected_indexes = daysList->selectionModel()->selectedRows();
foreach(QModelIndex index, selected_indexes) {
- selected_rows << index.row();
+ // Insert sort
+ int i = 0;
+ const int row = index.row();
+ while(selected_rows.at(i) < row) ++i;
+ selected_rows.insert(i, row);
}
emit selectedDays(selected_rows);
close();
}
void QMaemo5WeekDaysPickWidget::ensureConsistentSelection(QModelIndex index) {
}
emit selectedDays(selected_rows);
close();
}
void QMaemo5WeekDaysPickWidget::ensureConsistentSelection(QModelIndex index) {
+
qDebug("Received a click");
switch(index.row()) {
case NEVER:
qDebug("Received a click");
switch(index.row()) {
case NEVER:
@@
-135,6
+140,17
@@
void QMaemo5WeekDaysPickWidget::ensureConsistentSelection(QModelIndex index) {
// Select NEVER item
daysList->selectionModel()->select(daysList->model()->index(NEVER, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
// Select NEVER item
daysList->selectionModel()->select(daysList->model()->index(NEVER, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
+ } else {
+ // If all days are selected, select EVERY_DAY
+ bool all_days_selected = true;
+ for(int i=MON; i<EVERY_DAY; ++i) {
+ if(!daysList->selectionModel()->isRowSelected(i, daysList->rootIndex())) {
+ all_days_selected = false;
+ break;
+ }
+ }
+ if(all_days_selected)
+ daysList->selectionModel()->select(daysList->model()->index(EVERY_DAY, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
}
}
}
}