X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2FBusinessLogic%2FUIManager.cpp;h=6adc9e50ddff0952242bc9ba50646022ab55754a;hb=663a2fc8ce3a0b8b987655fe709a831a3db9b315;hp=1c8345bf2bbe6ae77143440fb4ed69889b0edffc;hpb=b50201458e621351445d5930fd98d2a33558fdad;p=qtmeetings diff --git a/src/BusinessLogic/UIManager.cpp b/src/BusinessLogic/UIManager.cpp index 1c8345b..6adc9e5 100644 --- a/src/BusinessLogic/UIManager.cpp +++ b/src/BusinessLogic/UIManager.cpp @@ -37,8 +37,9 @@ UIManager::UIManager( Engine *aEngine, WindowManager *aWindowManager ) : if ( iEngine == 0 ) return; if ( iWindowManager == 0 ) return; + connect(iWindowManager, SIGNAL(showSettingsClicked()), this, SLOT(settingsViewRequest())); + createWeeklyView(); - createSettingsView(); createRoomStatusIndicator(); createPasswordDialog(); createProgressBar(); @@ -63,15 +64,6 @@ void UIManager::showMainView() iWindowManager->showView( iWeeklyView ); } -void UIManager::showProgressBar( QString aText ) -{ - if ( iProgressBar != 0 ) - { - iProgressBar->update( aText ); - iWindowManager->showDialog( iProgressBar ); - } -} - // =============================================== // INITIALIZE THE UIMANAGER void UIManager::createWeeklyView() @@ -94,24 +86,25 @@ void UIManager::createSettingsView() // Connect signals connect( iSettingsView, SIGNAL( okClicked() ), this, SLOT( settingsOkClicked() ) ); + connect( iSettingsView, SIGNAL( cancelClicked() ), this, SLOT( settingsCancelClicked() ) ); } void UIManager::createRoomStatusIndicator() { - iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime(), iEngine->iConfiguration->displaySettings()->dateFormat() ); + iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime(), iEngine->iConfiguration->displaySettings()->timeFormat() ); + connect( iEngine, SIGNAL( roomStatusChanged( Room::Status, QTime ) ), iRoomStatusIndicator, SLOT( statusChanged( Room::Status, QTime ) ) ); + connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iRoomStatusIndicator, SLOT( currentRoomChanged( Room * ) ) ); } void UIManager::createPasswordDialog() { - iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), tr("UIManager::createPasswordDialog"), tr("UIManager::createPasswordDialog") ); - + iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), "", tr("Enter password") ); connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) ); } void UIManager::createProgressBar() { iProgressBar = new ProgressBar( tr("CHANGE THIS"), true ); - // Connect to UIManager connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) ); // Connect to Engine @@ -142,12 +135,11 @@ void UIManager::connectCommunicationManager( CommunicationManager *aCommunicatio // UIMANAGER SLOTS void UIManager::settingsViewRequest() { + createSettingsView(); + // Show the settings view and stop the idle timer - if ( iSettingsView != 0 ) - { - iWindowManager->showView( static_cast( iSettingsView ) ); - iEngine->stopIdleTimeCounter(); - } + iWindowManager->showView( static_cast( iSettingsView ) ); + iEngine->stopIdleTimeCounter(); } void UIManager::settingsOkClicked() @@ -156,7 +148,9 @@ void UIManager::settingsOkClicked() if ( iWeeklyView != 0 ) { iWindowManager->showView( static_cast( iWeeklyView ) ); + QT_DELETE(iSettingsView); iEngine->startIdleTimeCounter(); + currentRoomChanged(iWeeklyView->currentRoom()); } } @@ -173,9 +167,9 @@ void UIManager::showMeetingProgressBar( Meeting *aMeeting ) { if ( iProgressBar != 0 ) { - iProgressBar->update( tr("Fetching meeting info...") ); + iProgressBar->update( tr( "Fetching meeting info..." ), tr( "Please wait" ) ); + iProgressBar->toggleCancellable( true ); iWindowManager->showDialog( static_cast( iProgressBar ), false, false ); - iEngine->stopIdleTimeCounter(); } } @@ -215,20 +209,18 @@ void UIManager::progressBarCancelled() if ( iProgressBar != 0 ) { iProgressBar->close(); - iEngine->startIdleTimeCounter(); } } void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode ) { qDebug() << "[UIManager::changeModeOrdered] "; - - QString message = tr( "You are about to change operation mode to %1." ) - .arg( iEngine->iDevice->operationModeToString( aMode ) ); if ( iPasswordDialog != 0 ) { - // TODO : Set the new text for password dialog + QString text = tr( "You are about to change operation mode to %1." ) + .arg( iEngine->iDevice->operationModeToString( aMode ) ); + iPasswordDialog->update( text ); iWindowManager->showDialog( static_cast( iPasswordDialog ) ); } } @@ -237,7 +229,6 @@ void UIManager::connectionLost() { qDebug() << "UIManager::connectionLost()"; iWeeklyView->connectionLost(); - iSettingsView->connectionLost(); iRoomStatusIndicator->connectionLost(); } @@ -245,7 +236,6 @@ void UIManager::connectionEstablished() { qDebug() << "UIManager::connectionEstablished()"; iWeeklyView->connectionEstablished(); - iSettingsView->connectionEstablished(); iRoomStatusIndicator->connectionEstablished(); } @@ -254,9 +244,8 @@ void UIManager::currentRoomChanged(Room *aRoom) qDebug() << "[UIManager::currentRoomChanged] "; if ( iWeeklyView != 0 ) { - QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() ); - QDateTime to = QDateTime( from.addDays( 8 ) ); - iEngine->fetchMeetings( from, to, aRoom ); + QDateTime shown = QDateTime( iWeeklyView->beginnigOfShownWeek() ); + iEngine->fetchMeetings( shown.date().weekNumber(), shown.date().year(), aRoom ); } } @@ -266,6 +255,10 @@ void UIManager::updateTime(QDateTime aDateTime) { iWeeklyView->setCurrentDateTime( aDateTime ); } + if ( iRoomStatusIndicator != 0 ) + { + iRoomStatusIndicator->setCurrentTime( aDateTime.time() ); + } } void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus ) @@ -276,15 +269,17 @@ void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus ) // Show the progress bar.. if ( iProgressBar != 0 ) { - iWindowManager->showDialog( static_cast( iProgressBar ), false ); + iProgressBar->update( tr( "" ), tr( "Changing operation mode" ) ); + iProgressBar->toggleCancellable( false ); + iWindowManager->showDialog( static_cast( iProgressBar ), false, false ); } // ... and initiate the mode changing - iEngine->changeDeviceMode( true ); + iEngine->changeDeviceMode(); break; case PasswordDialog::Incorrect: iWindowManager->error( tr("Incorrect Password") ); + break; case PasswordDialog::Canceled: - iEngine->changeDeviceMode( false ); break; } @@ -311,3 +306,14 @@ void UIManager::hideProgressBar() iProgressBar->close(); } } + +void UIManager::settingsCancelClicked() +{ + // Show the weekly view and restart the idle timer + if ( iWeeklyView != 0 ) + { + iWindowManager->showView( static_cast( iWeeklyView ) ); + QT_DELETE(iSettingsView); + iEngine->startIdleTimeCounter(); + } +}