From a5b28c1fdc7c969a5ad96d739d6c08acbe5496fe Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 17 Sep 2014 22:03:06 +1000 Subject: [PATCH] More on that last commit --- sleepyhead/SleepLib/machine.cpp | 6 ++++++ sleepyhead/preferencesdialog.ui | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index e09704a0..e164d07c 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -335,6 +335,8 @@ bool Machine::unlinkDay(Day * d) bool Machine::unlinkSession(Session * sess) { + MachineType mt = sess->type(); + // Remove the object from the machine object's session list bool b=sessionlist.remove(sess->session()); @@ -358,6 +360,10 @@ bool Machine::unlinkSession(Session * sess) d = days.at(i); if (d->sessions.removeAll(sess)) { b=true; + if (!d->searchMachine(mt)) { + d->machines.remove(mt); + } + if (d->size() == 0) { day.remove(dates[i]); p_profile->unlinkDay(d); diff --git a/sleepyhead/preferencesdialog.ui b/sleepyhead/preferencesdialog.ui index f90e6ebf..97def644 100644 --- a/sleepyhead/preferencesdialog.ui +++ b/sleepyhead/preferencesdialog.ui @@ -9,7 +9,7 @@ 0 0 - 809 + 824 610 @@ -51,7 +51,7 @@ - 6 + 0