iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 )
{
qDebug() << "Engine::Engine()";
+ iCommunicationFailed = false;
// if reading of configuration fails, signal that initialization failed
if ( iConfiguration == 0 )
{
void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
{
qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
+ if( iCommunicationFailed )
+ {
+ iCommunicationFailed = false;
+ //iWindowManager->connectionEstablished();
+ }
+
// check if there is any new meeting in the list came from the server -> added
for ( int i = 0; i < aMeetings.count(); i++ )
{
{
qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
iWindowManager->closeProgressBar();
+ if( iCommunicationFailed )
+ {
+ iCommunicationFailed = false;
+ iWindowManager->connectionEstablished();
+ }
iWindowManager->showMeetingInfo( &aDetailedMeeting );
}
{
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;
+ if( !iCommunicationFailed )
+ {
+ // Only inform window manager when first error appears
+ iCommunicationFailed = true;
+ //iWindowManager->connectionLost();
+ }
+ }
- iWindowManager->closeProgressBar();
+ iWindowManager->closeProgressBar();
+ }
iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
}
{
case PasswordDialog::Correct :
{
+ iAutoRefresh->stop(); //we stop the metting updating
iWindowManager->showProgressBar( "Changing current operation mode." );
- connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
connect( iDevice, SIGNAL( changingMode( const QString & ) ),
iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+ 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.
QTimer *iAutoRefresh;
QList<Meeting*> iMeetings;
+
+ bool iCommunicationFailed;
};
#endif /*ENGINE_H_*/
qDebug() << "WindowManager::showProgressBar( const QString & )";
if( iProgressBar == 0 ) {
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() ) );
if( iProgressBar != 0 )
iProgressBar->update( aMessage );
}
+
+void WindowManager::connectionLost()
+{
+ //TODO: Inform all views
+ qDebug() << "WindowManager::connectionLost()";
+}
+
+void WindowManager::connectionEstablished()
+{
+ //TODO: Inform all views
+ qDebug() << "WindowManager::connectionEstablished()";
+}
+