Moved the logicasl part of the progresbar/password dialog from WindowManager to Engin...
[qtmeetings] / src / BusinessLogic / Engine.cpp
index 6e677c4..e529799 100644 (file)
@@ -35,6 +35,9 @@ Engine::Engine() :
        connect( iWindowManager, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( fetchMeetingDetails( Meeting * ) ) );
        connect( iWindowManager, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
        connect( iWindowManager, SIGNAL( shownWeekChanged( QDate ) ), this, SLOT( shownWeekChanged( QDate ) ) );
+       connect( iWindowManager, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
+                       this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+       connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
        
        // initialize communication
        iCommunication = new CommunicationManager( *(iConfiguration->connectionSettings()) );
@@ -287,3 +290,35 @@ void Engine::changeModeOrdered( DeviceManager::OperationMode aMode )
        
        iWindowManager->showPasswordDialog( iConfiguration->adminPassword(), message );
 }
+
+void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+{
+       qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
+       iWindowManager->closePasswordDialog();
+       
+       switch ( aPasswordStatus )
+       {
+               case PasswordDialog::Correct :
+               {
+                       iWindowManager->showProgressBar( "Changing current operation mode." );
+                       break;
+               }
+               case PasswordDialog::Incorrect :
+               {
+                       iWindowManager->error( tr( "Incorrect password." ) );
+                       iDevice->handleKeyPresses( true );
+                       break;
+               }
+               default : //case PasswordDialog::Canceled
+               {
+                       iDevice->handleKeyPresses( true );
+               }
+       }
+}
+
+void Engine::progressBarCancelled()
+{
+       //TODO: cancel the on-going event
+       iWindowManager->closeProgressBar();
+       iDevice->handleKeyPresses( true );
+}