{
qDebug() << "Engine::ErrorHandler, aCode: " << aCode;
// inform UI about the problem
- if( aCode >= 100 && aCode <= 150 )
+ if( aCode >= 100 && aCode <= 150 ) { //communication errors
+ //we don't want these to close operation changing
qDebug() << "CommunicationManager signaled an error:" << aCode;
- iWindowManager->closeProgressBar();
+ iWindowManager->closeProgressBar();
+ }
iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
}
{
case PasswordDialog::Correct :
{
- iWindowManager->showProgressBar( "Changing current operation mode.", true );
- connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
+ iAutoRefresh->stop(); //we stop the metting updating
+ iWindowManager->showProgressBar( "Changing current operation mode." );
connect( iDevice, SIGNAL( changingMode( const QString & ) ),
iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
- connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( progressBarCancelled() ) );
+ connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
iDevice->changeMode( true );
break;
}
}
}
-void Engine::progressBarCancelled()
+void Engine::changeModeFailed()
{
- qDebug() << "Engine::progressBarCancelled()";
- //TODO: cancel the on-going event
+ qDebug() << "Engine::changeModeFailed()";
iWindowManager->closeProgressBar();
- iDevice->changeMode( false );
+ iAutoRefresh->start(); //we start the metting updating
}
void Engine::fetchMeetingDetailsCancelled()
* \param aPasswordStatus The status of the password.
*/
void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
- //! Slot for receiving the cancel event of the progress bar.
+ //! Slot for receiving the failure event of operation mode changing.
/*!
- * Slot. Receives the cancel event of the progress bar.
+ * Slot. Receives the failure event of operation mode changing.
*/
- void progressBarCancelled();
+ void changeModeFailed();
//! Slot for receiving the cancel event of the progress bar.
/*!
* Receives the cancel event of the progress bar when meeting details requested.
}
iModeToggler = new OperationModeToggler( iMode, iSettings, iAlarmSender, iConfigurator, iDataStorage );
connect( iModeToggler, SIGNAL( finished() ), this, SLOT( modeChanged() ) );
- connect( iModeToggler, SIGNAL( error( DeviceManager::ErrorCode ) ), this, SLOT( errorSender( DeviceManager::ErrorCode ) ) );
+ connect( iModeToggler, SIGNAL( error( DeviceManager::ErrorCode, const QString & ) ),
+ this, SLOT( errorSender( DeviceManager::ErrorCode, const QString & ) ) );
connect( iModeToggler, SIGNAL( changingMode( const QString & ) ), this, SIGNAL( changingMode( const QString & ) ) );
connect( iModeToggler, SIGNAL( toggleErrorSending( bool ) ), this, SLOT( toggleErrorSending( bool ) ) );
iModeToggler->start();
void DeviceManager::toggleErrorSending( bool aToggle )
{
+ qDebug() << "DeviceManager::toggleErrorSending( bool )";
iSendErrorMessages = aToggle;
}
void DeviceManager::modeChanged()
{
+ qDebug() << "DeviceManager::modeChanged()";
if( iModeToggler != 0 ) {
if ( iModeToggler->success() ) //mode changing went well
iConfigurator->restartDevice();
else
- emit changingModeFailed();
+ emit changeModeFailed();
delete iModeToggler;
iModeToggler = 0;
}
#include <QObject>
#include <QStringList>
+#include <QMetaType>
class AlarmSender;
class HWKeyListener;
/*!
* Enumeration of errors
*/
+
enum ErrorCode
{
FileCreationFailed, /*!< File couldn't be created. */
/*!
* Signal. Emitted if the operation mode change fails.
*/
- void changingModeFailed();
+ void changeModeFailed();
private slots:
//! Slot. Handles "full screen"-hardware key presses.
};
+Q_DECLARE_METATYPE( DeviceManager::ErrorCode )
+
#endif /*DEVICEMANAGER_H_*/
iSuccess( true )
{
qDebug() << "OperationModeToggler::OperationModeToggler( ... )";
+
+ qRegisterMetaType<DeviceManager::ErrorCode>("DeviceManager::ErrorCode");
+
+ connect( iAlarmSender, SIGNAL( alarmSendingFailed( DeviceManager::ErrorCode, const QString& ) ),
+ this, SIGNAL( error( DeviceManager::ErrorCode, const QString& ) ) );
+ connect( iConfigurator, SIGNAL( configuringError( DeviceManager::ErrorCode ) ),
+ this, SLOT( createError( DeviceManager::ErrorCode ) ) );
+ connect( iDataStorage, SIGNAL( dataStorageInitFailed( DeviceManager::ErrorCode ) ),
+ this, SLOT( createError( DeviceManager::ErrorCode ) ) );
}
OperationModeToggler::~OperationModeToggler()
{
case DeviceManager::EmptyMode:
// error occured. Mode cannot be changed
- emit error( DeviceManager::ModeNotFetched );
+ createError( DeviceManager::ModeNotFetched );
iSuccess = false;
return;
case DeviceManager::StandAloneMode:
emit changingMode( "Storing information about the new operation mode." );
sleep( 2 );
if( !storeOperationMode( DeviceManager::KioskMode, iDataStorage ) ) {
- emit error( DeviceManager::ModeNotStored );
+ createError( DeviceManager::ModeNotStored );
iSuccess = false;
}
}
emit changingMode( "Storing information about the new operation mode." );
sleep( 2 );
if( !storeOperationMode( DeviceManager::StandAloneModeInProgress, iDataStorage ) ) {
- emit error( DeviceManager::ModeNotStored );
+ createError( DeviceManager::ModeNotStored );
iSuccess = false;
}
}
bool OperationModeToggler::success()
{
+ qDebug() << "OperationModeToggler::success()";
return iSuccess;
}
return false;
return true;
}
+
+void OperationModeToggler::createError( DeviceManager::ErrorCode aCode )
+{
+ qDebug() << "OperationModeToggler::createError( DeviceManager::ErrorCode )";
+ QString empty = "";
+ emit error( aCode, empty );
+}
+
static bool storeOperationMode( DeviceManager::OperationMode aMode, DeviceDataStorage *aDataStorage );
signals:
- //! Signal. Emitted if an error occurs during operation mode fetching or reading.
+ //! Signal. Emitted if an error happens.
/*!
- * Signal. Emitted if an error occurs during operation mode fetching or reading. Note that other
- * possible errors are sent by the other instances e.g. alarm sender sents it's own errors.
- * \param aCode The error code.
+ * Signal. Emitted if an error happens.
+ * \param aCode An error code defined by DeviceManager.
+ * \param aAddInfo Possible additional information.
*/
- void error( DeviceManager::ErrorCode aCode );
+ void error( DeviceManager::ErrorCode aCode, const QString &aAddInfo );
//! Signal. Emitted if an error occurs during operation mode changing.
/*!
* Signal. Emitted if an error occurs during operation mode changing. If an error occurs, the operation
* \param aMessage Explains the sub-change
*/
void changingMode( const QString &aMessage );
+
+private slots:
+ //! Slot. Emits an error signal.
+ /*!
+ * Slot. Emits an error signal.
+ * \param aCode The error code.
+ */
+ void createError( DeviceManager::ErrorCode aCode );
private:
DeviceManager::OperationMode iMode;
iProgressBar = new ProgressBar( aText, aCancellable );
iProgressBar->setFixedSize( 600, 125 );
iProgressBar->show();
- connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
+ if( aCancellable )
+ connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
}
//TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );