Fix wrong source when creating new task or event

This commit is contained in:
Vyn 2024-11-05 16:55:13 +01:00
parent 893fcc11e3
commit ab2200ecc1
3 changed files with 18 additions and 1 deletions

View file

@ -93,6 +93,11 @@ std::optional<ui::Date> stringToDate(const std::string &dateStr)
void AppWindow::setupCallbacks()
{
models().on_get_source_id_from_name([&](slint::SharedString name) {
auto source = miraiInstance_->getSourceByName(std::string(name));
assert(source);
return source->id;
});
miraiInstance_->onSourceAdded([&](mirai::Source *source) {
refreshModels();
});