From 24c72cb359e98eb22418789f397bd72e0a29919b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 26 Nov 2017 22:21:58 +0100 Subject: Inform LocationFilterModel of added dive site name If the user implicitly adds a dive site by editing a dive, and a location filter is active, check the new dive site in the location filter. This is done by informing the LocationFilterModel of the new dive site name prior to repopulation. The LocationFilterModel then adds a corresponding entry and marks it as checked. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/maintab.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'desktop-widgets/tab-widgets/maintab.cpp') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index adb73526c..244c6465a 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -21,8 +21,10 @@ #include "qt-models/weightmodel.h" #include "qt-models/divecomputerextradatamodel.h" #include "qt-models/divelocationmodel.h" +#include "qt-models/filtermodels.h" #include "core/divesite.h" #include "desktop-widgets/locationinformation.h" +#include "desktop-widgets/locationinformation.h" #include "TabDiveExtraInfo.h" #include "TabDiveInformation.h" @@ -201,6 +203,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(ui.diveNotesMessage, &KMessageWidget::showAnimationFinished, ui.location, &DiveLocationLineEdit::fixPopupPosition); + connect(this, SIGNAL(diveSiteAdded(const QString &)), LocationFilterModel::instance(), SLOT(addName(const QString &))); // enable URL clickability in notes: new TextHyperlinkEventFilter(ui.notes);//destroyed when ui.notes is destroyed @@ -703,8 +706,10 @@ uint32_t MainTab::updateDiveSite(uint32_t pickedUuid, int divenr) return origUuid; if (pickedUuid == RECENTLY_ADDED_DIVESITE) { - pickedUuid = create_dive_site(ui.location->text().isEmpty() ? qPrintable(tr("New dive site")) : qPrintable(ui.location->text()), displayed_dive.when); + QString name = ui.location->text().isEmpty() ? tr("New dive site") : ui.location->text(); + pickedUuid = create_dive_site(qPrintable(name), displayed_dive.when); createdNewDive = true; + emit diveSiteAdded(name); } newDs = get_dive_site_by_uuid(pickedUuid); -- cgit v1.2.3-70-g09d2