void FlatWaitMod::notify(Widget * sender, notify_event_t event) { switch (event) { case NOTIFY_SUBMIT: this->accepted(); break; case NOTIFY_CANCEL: this->refused(); break; case NOTIFY_TEXT_CHANGED: this->confirm(); break; case NOTIFY_PASTE: case NOTIFY_COPY: case NOTIFY_CUT: if (this->copy_paste) { copy_paste_process_event(this->copy_paste, *reinterpret_cast<WidgetEdit *>(sender), event); }; break; default:; } }
void notify(Widget2* widget, notify_event_t event) override { if (NOTIFY_CANCEL == event) { if (this->waiting_for_next_module) { LOG(LOG_INFO, "FlatSelector2Mod::notify: NOTIFY_CANCEL - Waiting for next module."); return; } this->vars.ask<cfg::globals::auth_user>(); this->vars.ask<cfg::context::password>(); this->vars.set<cfg::context::selector>(false); this->event.signal = BACK_EVENT_NEXT; this->event.set(); this->waiting_for_next_module = true; } else if (NOTIFY_SUBMIT == event) { if (this->waiting_for_next_module) { LOG(LOG_INFO, "FlatSelector2Mod::notify: NOTIFY_SUBMIT - Waiting for next module."); return; } if (widget == &this->selector.connect) { char buffer[1024] = {}; uint16_t row_index = 0; uint16_t column_index = 0; this->selector.selector_lines.get_selection(row_index, column_index); const char * target = this->selector.selector_lines.get_cell_text(row_index, WidgetSelectorFlat2::IDX_TARGET); const char * groups = this->selector.selector_lines.get_cell_text(row_index, WidgetSelectorFlat2::IDX_TARGETGROUP); int pos = 0; while (groups[pos] && (groups[pos] != ';')) { pos++; } char group_buffer[512] = {}; snprintf(group_buffer, sizeof(group_buffer), "%s", groups); group_buffer[pos] = 0; snprintf(buffer, sizeof(buffer), "%s:%s:%s", target, group_buffer, this->vars.get<cfg::globals::auth_user>().c_str()); this->vars.set_acl<cfg::globals::auth_user>(buffer); this->vars.ask<cfg::globals::target_user>(); this->vars.ask<cfg::globals::target_device>(); this->vars.ask<cfg::context::target_protocol>(); this->event.signal = BACK_EVENT_NEXT; this->event.set(); this->waiting_for_next_module = true; } else if (widget->group_id == this->selector.apply.group_id) { this->ask_page(); } else if (widget == &this->selector.first_page) { if (this->current_page > 1) { this->current_page = 1; this->ask_page(); } } else if (widget == &this->selector.prev_page) { if (this->current_page > 1) { --this->current_page; this->ask_page(); } } else if (widget == &this->selector.current_page) { int page = atoi(this->selector.current_page.get_text()); if (page != this->current_page) { this->current_page = page; this->ask_page(); } } else if (widget == &this->selector.next_page) { if (this->current_page < this->number_page) { ++this->current_page; this->ask_page(); } } else if (widget == &this->selector.last_page) { if (this->current_page < this->number_page) { this->current_page = this->number_page; this->ask_page(); } } } else if (this->copy_paste) { copy_paste_process_event(this->copy_paste, *reinterpret_cast<WidgetEdit*>(widget), event); } }
virtual void notify(Widget2 * sender, notify_event_t event) { BOOST_REQUIRE(sender); copy_paste_process_event(this->copy_paste, *reinterpret_cast<WidgetEdit*>(sender), event); }