{
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 ) );
+ iWindowManager->error(ErrorMapper::codeToString(aCode, aAddInfo) );
}
-void Engine::currentRoomChanged( Room *aCurrentRoom )
+void Engine::currentRoomChanged(Room *aCurrentRoom)
{
qDebug() << "Engine::currentRoomChanged to " << aCurrentRoom->name();
- QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() );
- QDateTime to( from.addDays( 8 ) );
- fetchMeetings( from, to, aCurrentRoom );
+ QDateTime from(iWindowManager->weeklyView()->beginnigOfShownWeek() );
+ QDateTime to(from.addDays( 8) );
+ fetchMeetings(from, to, aCurrentRoom);
}
-void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn )
+void Engine::fetchMeetings(const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn)
{
- qDebug() << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
- iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
+ qDebug()
+ << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
+ iCommunication->fetchMeetings(aFrom, aUntil, *aIn);
}
-void Engine::shownWeekChanged( QDate aFrom )
+void Engine::shownWeekChanged(QDate aFrom)
{
qDebug() << "Engine::shownWeekChanged( QDate )";
- QDateTime from( aFrom );
- QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) );
- qDebug() << "Engine::shownWeekChanged " << aFrom.toString( "d.m. h:mm" ) << " to " << to.toString( "d.m. h:mm" );
- fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
+ QDateTime from(aFrom);
+ QDateTime to(aFrom.addDays( 7), QTime( 23, 59) );
+ qDebug() << "Engine::shownWeekChanged " << aFrom.toString("d.m. h:mm")
+ << " to " << to.toString("d.m. h:mm");
+ fetchMeetings(from, to, iWindowManager->weeklyView()->currentRoom() );
}
-void Engine::changeModeOrdered( DeviceManager::OperationMode aMode )
-{
+void Engine::changeModeOrdered(DeviceManager::OperationMode aMode)
+{
qDebug() << "Engine::changeModeOrdered( DeviceManager::OperationMode )";
QString message = tr( "You are about to change operation mode to %1." )
- .arg( iDevice->operationModeToString( aMode ) );
-
- iWindowManager->showPasswordDialog( iConfiguration->adminPassword(), message );
+ .arg(iDevice->operationModeToString(aMode) );
+
+ iWindowManager->showPasswordDialog(iConfiguration->adminPassword(), message);
}
-void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+void Engine::passwordEntered(PasswordDialog::PasswordStatus aPasswordStatus)
{
qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
iWindowManager->closePasswordDialog();
-
- switch ( aPasswordStatus )
+
+ switch (aPasswordStatus)
{
- case PasswordDialog::Correct :
+ 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( changingMode( const QString & ) ),
+ iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+ connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
- iDevice->changeMode( true );
+ iDevice->changeMode( true);
break;
}
- case PasswordDialog::Incorrect :
+ case PasswordDialog::Incorrect:
{
- iWindowManager->error( tr( "Incorrect password." ) );
- iDevice->changeMode( false );
+ iWindowManager->error(tr("Incorrect password.") );
+ iDevice->changeMode( false);
break;
}
- default : //case PasswordDialog::Canceled
+ default: //case PasswordDialog::Canceled
{
- iDevice->changeMode( false );
+ iDevice->changeMode( false);
}
}
}