| 53 | } |
| 54 | |
| 55 | Shell::Pointer Window::DefaultModalParent::GetShell() const |
| 56 | { |
| 57 | Shell::Pointer parent = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetActiveShell(); |
| 58 | |
| 59 | // Make sure we don't pick a parent that has a modal child (this can lock the app) |
| 60 | if (parent == 0) |
| 61 | { |
| 62 | // If this is a top-level window, then there must not be any open modal windows. |
| 63 | parent = Window::GetModalChild(Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetShells()); |
| 64 | } |
| 65 | else |
| 66 | { |
| 67 | // If we picked a parent with a modal child, use the modal child instead |
| 68 | Shell::Pointer modalChild = Window::GetModalChild(parent->GetShells()); |
| 69 | if (modalChild != 0) |
| 70 | { |
| 71 | parent = modalChild; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return parent; |
| 76 | } |
| 77 | |
| 78 | Shell::Pointer Window::GetModalChild(const QList<Shell::Pointer>& toSearch) |
| 79 | { |