[PATCH 2/3] MainTab: fix missing update for 'amount_selected'

Tomaz Canabrava tcanabrava at kde.org
Mon Dec 9 15:07:30 UTC 2013


I think we should look in the code for every appearance of 'd->selected =
true' and change it for void select_dive(int idx)
sounds a bit safer.


On Mon, Dec 9, 2013 at 9:02 PM, Lubomir I. Ivanov <neolit123 at gmail.com>wrote:

> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>
> MainTab::acceptChanges() is called when the user adds a new
> dive and then presses 'Save'. The function marks the new
> dive as selected but does not update the 'amount_selected'
> counter.
>
> Then if the user right clicks the same dive and selects
> 'upload to divelogs.de..' the webservice code will return
> a 'Cannot create DLD file', which is misleading
> but actually what happens is that the console
> reports 'no dives selected', which is triggered in
> prepare_dives_for_divelogs().
>
> As a side note, the point of the errors in
> subsurfacewebservices.cpp: prepare_dives_for_divelogs()
> is not to be descriptive to users, but rather to developers
> as we *never* should enter any of those for a normal user
> workflow scenario.
>
> Fixes #351
>
> Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> ---
> not sure how viable 'amounted_selected' is the new code base,
> but i see it being used in multiple locations.
>
> this fix works for me.
> ---
>  qt-ui/maintab.cpp | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> index 9810ab5..8b592cb 100644
> --- a/qt-ui/maintab.cpp
> +++ b/qt-ui/maintab.cpp
> @@ -641,6 +641,7 @@ void MainTab::acceptChanges()
>                 // HACK. this shouldn't be here. but apparently it's
>                 // how we can know what was the newly added dive.
>                 d->selected = true;
> +               amount_selected = 1;
>                 sort_table(&dive_table);
>                 int i = 0;
>                 for_each_dive(i,d){
> --
> 1.7.11.msysgit.0
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20131209/72116adf/attachment.html>


More information about the subsurface mailing list