Index: sources/view/confirm/VConfirm.cpp =================================================================== diff -u -rb9739918c71a21c181c8401f17ed05fb14996fec -r712b88374d635e38a9ef06ac19118c8a59bebd8c --- sources/view/confirm/VConfirm.cpp (.../VConfirm.cpp) (revision b9739918c71a21c181c8401f17ed05fb14996fec) +++ sources/view/confirm/VConfirm.cpp (.../VConfirm.cpp) (revision 712b88374d635e38a9ef06ac19118c8a59bebd8c) @@ -28,7 +28,6 @@ ACTION_VIEW_CONNECTION(DuetConfirmTDiData ); ACTION_VIEW_CONNECTION(PowerOffData ); ACTION_VIEW_CONNECTION(SettingsData ); - ADJUST_VIEW_CONNECTION(DuetConfirmUIrData ); } @@ -41,40 +40,41 @@ command ( vData.mCommand ); GuiConfirmCommand cmd = static_cast( _command ); - visible( ( cmd == GuiConfirmCommand::GENERIC_CONFIRM_CMD_REQUEST_OPEN || cmd == GuiConfirmCommand::GENERIC_CONFIRM_CMD_REJECT ) ); - switch ( cmd ) { case GuiConfirmCommand::GENERIC_CONFIRM_CMD_REQUEST_OPEN : adjustment_Reason ( GuiConfirmId::GENERIC_CONFIRM_ID_NONE ); adjustment_Accepted ( false ); // it has not been accepted yet. isTimeout ( false ); isReject ( false ); isAccept ( false ); - break; + visible ( true ); + break; case GuiConfirmCommand::GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE : adjustment_Reason ( GuiConfirmId::GENERIC_CONFIRM_ID_NONE ); // there is no need to display the timeout reason and just hides the dialog. adjustment_Accepted ( false ); isTimeout ( true ); isReject ( false ); isAccept ( false ); - break; + visible ( false ); + break; case GuiConfirmCommand::GENERIC_CONFIRM_CMD_REJECT : adjustment_Reason ( vData.mReason ); // there is no need to display the timeout reason and just hides the dialog. adjustment_Accepted ( false ); isTimeout ( false ); isReject ( true ); isAccept ( false ); - break; + visible ( false ); + break; case GuiConfirmCommand::GENERIC_CONFIRM_CMD_ACCEPT_CLOSE : adjustment_Reason ( GuiConfirmId::GENERIC_CONFIRM_ID_NONE ); // there is no need to display the timeout reason and just hides the dialog. adjustment_Accepted ( true ); isTimeout ( false ); isReject ( false ); isAccept ( true ); - break; + visible ( false ); + break; case GuiConfirmCommand::NUM_OF_GENERIC_CONFIRM_COMMAND : /* No code */ break; } - needConfirm ( cmd == GuiConfirmCommand::GENERIC_CONFIRM_CMD_REQUEST_OPEN ); } /*! @@ -94,46 +94,12 @@ } /*! - * \brief View::VConfirm::setPowerOffCommand - */ -void View::VConfirm::setPowerOffCommand() -{ - command ( 0 ); - adjustment_Reason ( GuiConfirmId::GENERIC_CONFIRM_ID_NONE ); - adjustment_Accepted ( false ); // it has not been accepted yet. - isTimeout ( false ); - isReject ( false ); - isAccept ( false ); -} - -/*! - * \brief View::VConfirm::setPowerOffId - */ -void View::VConfirm::setPowerOffId() -{ - titleByID ( false ); - messageByID ( false ); - confirmByID ( false ); - cancelByID ( false ); - - title ( tr("Shutdown") ); - message ( tr("Are you sure you want to Shutdown?") ); - adjustment_Reason ( GuiConfirmId::GENERIC_CONFIRM_ID_NONE ); // power off has no rejection reason on the dialog - confirm ( tr("SHUTDOWN") ); - cancel ( tr("CANCEL") ); - - id ( 0 ); -} - -/*! * \brief VConfirm::onActionReceive * \details received response model data handler * \param vData - model data */ void View::VConfirm::onActionReceive(const DuetConfirmTDiData &vData) { - isPowerOff(false ); - setConfirmCommand ( vData ); setConfirmId ( vData ); @@ -144,28 +110,18 @@ // DEBUG: qDebug() << _id << _command << adjustment_Reason() << _title << _message << _isReject; } -void View::VConfirm::onActionReceive(const PowerOffData &vData) +void View::VConfirm::onActionReceive(const PowerOffData &) { - isPowerOff(true ); - - setPowerOffCommand ( ); - setPowerOffId ( ); - - poweroff(vData.mStatus); - // *** has to be the last to let the information to be set and then emit the signal *** // *** otherwise will use the Previous values before being set. *** - adjustment ( true ); - - // DEBUG: qDebug() << _id << _command << adjustment_Reason() << _title << _message << _isReject; + powerOff ( true ); } /*! * \brief View::VConfirm::doConfirm * \details the invocable slot to send user's Confirmation */ void View::VConfirm::doConfirm(bool vConfirm) { - needConfirm ( false ); DuetConfirmUIrData data; data.mId = id(); data.mConfirm = vConfirm;