Planner: Make cylinder and time/depth boxes scale

When moving the horisontal splitter the cylinder and time/depth boxes
didn't scale down but got "stuck" on a certain height. This makes them
scale down when pulling the horisontal splitter up.

I would prefer if we could scale them individually, but i didn't manage
to get that going, but i didn't manage to get that going.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix wrong handling of Dive Table, and revert some wrong changes.

This patch just reverts some wrong changes that I'v done on a
past commit ( sorry ) and correctly handles the selectDive,
by using a IDX instead of the dive pointer, as dirk told me
it's extremely error-prone since the pointer can change.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do not break Dive Headings on trip mode when a delete dive is done.

When the dive is deleted, we force a recreation of the dive list,
this is done because we were broken by design on the first transition
to the Qt infrastructure - one thing to change for 4.1, but no time
for 4.0.

We forgot to ask the headers to 'please, span more than one row,
please' when we recreate the model. easy =)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Selects the dive before the deleted ones.

This patch makes a selection just after the dives that got deleted,
or nothing if the list is empty.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Expand the trip of the newly selected dive.

I hit this bug on deleting dives and the newly selected
one got inside a trip, that wasn't expanded. anyway, easy one.
:)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Small code cleanup.

This was bugging me for a while. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Removed duplicated method.

This patch removes a duplicated method: get_divenr and
get_index_for_dive. The two are exactly the same  ( if my
c is not broken, but I may be broken since I'm working like
crazy for almost 30h nonstop. ), so please take a good look
before applying this one.

[Dirk Hohndel: Tomaz took the slightly broken of the two implementations,
               so I switched that out for the correct one]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix dive merging

This limits merging dives to dives that have at most half an hour of
surface time between them. That "half hour" is kind of a random thing
to pick, but it's not horribly horribly wrong.

It also changes the semantics of "merge selected dives" to something
that actually works pretty well: you can select a whole range of
dives, and it will merge only the ones that makes sense to merge. I
tested it, and it's reasonable. I could select all my dives from one
dive trip, and then do "Merge selected dives", and it did the right
thing (Dirk: I selected the florida trip, and it merged the aborted
"missed the trench" dive with the _actual_ "trench" dive).

I'm _slightly_ hesitant about this in the sense that maybe some crazy
person actually would want to merge dives with more than half an hour
of surface time between them, but it really doesn't seem to make much
sense.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix a crash with trying to show the tooltip on the profile.

Fixed a crash with trying to show the tooltip on the profile,
with an empty profile. Since the widgets are not created yet,
we got a crash trying to access the toolBarProxy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix showing the tooltips on the profile.

We incorrectly mapped the profile's widget tooltip based on the
global screen coordinates.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when entering a dive via dive-add on a empty table.

We were selecting garbage, not anymore.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>