| 18 | } |
| 19 | |
| 20 | bool StatusTerminalController::tryTabClose( UITab* tab ) { |
| 21 | if ( !tab->getOwnedWidget()->isWidget() || tab->getOwnedWidget() == nullptr ) |
| 22 | return true; |
| 23 | |
| 24 | UIWidget* widget = tab->getOwnedWidget()->asType<UIWidget>(); |
| 25 | if ( widget == nullptr || widget->getData() == 0 ) |
| 26 | return true; |
| 27 | |
| 28 | if ( mContext->getConfig().term.warnBeforeClosingTab && widget->isType( UI_TYPE_TERMINAL ) ) { |
| 29 | UITerminal* term = widget->asType<UITerminal>(); |
| 30 | ProcessID pid = term->getTerm()->getTerminal()->getProcess()->pid(); |
| 31 | if ( Sys::processHasChildren( pid ) ) { |
| 32 | UIMessageBox* msgBox = |
| 33 | UIMessageBox::New( UIMessageBox::OK_CANCEL, |
| 34 | mContext->i18n( "terminal_close_warn", |
| 35 | "Are you sure you want to close this " |
| 36 | "terminal?\nIt's still running a process." ) ); |
| 37 | msgBox->on( Event::OnConfirm, [widget]( auto ) { |
| 38 | reinterpret_cast<UITab*>( widget->getData() )->removeTab(); |
| 39 | } ); |
| 40 | msgBox->on( Event::OnClose, [this]( const Event* ) { mContainer->setFocus(); } ); |
| 41 | msgBox->setTitle( "ecode" ); |
| 42 | msgBox->center(); |
| 43 | msgBox->showWhenReady(); |
| 44 | return false; |
| 45 | } |
| 46 | } |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | UIHLinearLayoutCommandExecuter* StatusTerminalController::createContainer() { |
| 51 | if ( mContainer ) |
nothing calls this directly
no test coverage detected