Do a more complete reset of timetable state when clearing
Also reset timetable state when toggling enabled state
void TimetableDialog::enabled_toggled(bool value)
{
timetable.set_enabled(value);
+ timetable.reset();
}
void TimetableDialog::on_response(int code)
{
if(code)
{
- timetable.clear();
vector<string> lines = split(ent_timetable->get_text(), '\n');
vector<Timetable::Row> rows;
rows.reserve(lines.size());
{
for(vector<string>::const_iterator i=lines.begin(); i!=lines.end(); ++i)
rows.push_back(Timetable::Row::parse(*i));
+ timetable.clear();
for(vector<Timetable::Row>::const_iterator i=rows.begin(); i!=rows.end(); ++i)
timetable.append(*i);
}
enabled = e;
}
+void Timetable::reset()
+{
+ current_row = 0;
+ wait_timeout = Time::TimeStamp();
+ pending_block = 0;
+ executing = true;
+}
+
void Timetable::clear()
{
rows.clear();
- current_row = 0;
+ reset();
}
void Timetable::append(const Row &row)
void set_enabled(bool);
bool is_enabled() const { return enabled; }
+ void reset();
void clear();
void append(const Row &);