Enabled the error sending from Operation Mode changing. And corrected some possible...
[qtmeetings] / src / BusinessLogic / Engine.cpp
index 2f9d3cd..25c3048 100644 (file)
@@ -207,6 +207,13 @@ void Engine::fetchMeetings()
 void Engine::fetchMeetingDetails( Meeting *aMeeting )
 {
        qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
+       iWindowManager->showProgressBar( tr("Please Wait"), true );
+       iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") );
+       connect( iWindowManager,
+                        SIGNAL( progressBarCancelled() ),
+                        this,
+                        SLOT( fetchMeetingDetailsCancelled() )
+                       );
        iCommunication->fetchMeetingDetails( *aMeeting );
 }
 
@@ -261,6 +268,7 @@ void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
 void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting )
 {
        qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
+       iWindowManager->closeProgressBar();
        iWindowManager->showMeetingInfo( &aDetailedMeeting );
 }
 
@@ -268,8 +276,11 @@ void Engine::errorHandler( int aCode, const QString &aAddInfo )
 {
        qDebug() << "Engine::ErrorHandler, aCode: " << aCode;
        // inform UI about the problem
-       if( aCode >= 100 && aCode <= 110 )
+       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->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
 }
 
@@ -314,10 +325,11 @@ void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
        {
                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;
                }
@@ -334,10 +346,15 @@ void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
        }
 }
 
-void Engine::progressBarCancelled()
+void Engine::changeModeFailed()
+{
+       qDebug() << "Engine::changeModeFailed()";
+       iWindowManager->closeProgressBar();
+       iAutoRefresh->start(); //we start the metting updating
+}
+
+void Engine::fetchMeetingDetailsCancelled()
 {
-       qDebug() << "Engine::progressBarCancelled()";
-       //TODO: cancel the on-going event
+       iCommunication->cancelFetchMeetingDetails();
        iWindowManager->closeProgressBar();
-       iDevice->changeMode( false );
 }