if ( iEngine == 0 ) return;
if ( iWindowManager == 0 ) return;
+ connect(iWindowManager, SIGNAL(showSettingsClicked()), this, SLOT(settingsViewRequest()));
+
createWeeklyView();
- createSettingsView();
createRoomStatusIndicator();
createPasswordDialog();
createProgressBar();
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( showMeetingProgressBar( Meeting * ) ) );
// Connect signals to engine
+ connect( iWeeklyView, SIGNAL( refreshButtonClicked() ), iEngine, SLOT( updateRoomInfo() ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting * ) ) );
connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), iEngine, SLOT( shownWeekChanged( QDate ) ) );
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iEngine, SLOT( currentRoomChanged( Room * ) ) );
// 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().addSecs(100000000), iEngine->iConfiguration->displaySettings()->timeFormat() );
-
- // Connect engine signals
+ 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::createProgressBar()
{
iProgressBar = new ProgressBar( tr("CHANGE THIS"), true );
-
// Connect to UIManager
connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
// Connect to Engine
// UIMANAGER SLOTS
void UIManager::settingsViewRequest()
{
+ createSettingsView();
+
// Show the settings view and stop the idle timer
- if ( iSettingsView != 0 )
- {
- iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
- iEngine->stopIdleTimeCounter();
- }
+ iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
+ iEngine->stopIdleTimeCounter();
}
void UIManager::settingsOkClicked()
if ( iWeeklyView != 0 )
{
iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
iEngine->startIdleTimeCounter();
+ currentRoomChanged(iWeeklyView->currentRoom());
}
}
}
}
-void UIManager::showMeetingProgressBar( Meeting *aMeeting )
+void UIManager::showMeetingProgressBar( Meeting */*aMeeting*/ )
{
if ( iProgressBar != 0 )
{
iProgressBar->update( tr( "Fetching meeting info..." ), tr( "Please wait" ) );
iProgressBar->toggleCancellable( true );
iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
- iEngine->stopIdleTimeCounter();
}
}
{
iProgressBar->close(); // Close it in case it's visible
}
- iEngine->stopIdleTimeCounter(); // Timer restarted when the dialog is dismissed.
MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
iWindowManager->showDialog( static_cast<QDialog *>( tmp ) );
-
// TODO : We should use the member variable and implement correctly the setMeeting() method !!!
// iMeetingInfo->setMeeting( &aDetailedMeeting );
// iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
if ( iProgressBar != 0 )
{
iProgressBar->close();
- iEngine->startIdleTimeCounter();
}
}
}
}
+void UIManager::connectionLost()
+{
+ qDebug() << "UIManager::connectionLost()";
+ iWeeklyView->connectionLost();
+ iRoomStatusIndicator->connectionLost();
+}
+
+void UIManager::connectionEstablished()
+{
+ qDebug() << "UIManager::connectionEstablished()";
+ iWeeklyView->connectionEstablished();
+ iRoomStatusIndicator->connectionEstablished();
+}
+
void UIManager::currentRoomChanged(Room *aRoom)
{
qDebug() << "[UIManager::currentRoomChanged] <Invoked>";
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 );
}
}
{
if ( iWeeklyView != 0 )
{
- iWeeklyView->setCurrentDateTime( aDateTime );
+ iWeeklyView->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
}
if ( iRoomStatusIndicator != 0 )
{
- iRoomStatusIndicator->setCurrentTime( aDateTime.time() );
+ iRoomStatusIndicator->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
}
}
{
iProgressBar->update( tr( "" ), tr( "Changing operation mode" ) );
iProgressBar->toggleCancellable( false );
- iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
+ iWindowManager->showDialog( static_cast<QDialog *>( 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;
}
iProgressBar->close();
}
}
+
+void UIManager::settingsCancelClicked()
+{
+ // Show the weekly view and restart the idle timer
+ if ( iWeeklyView != 0 )
+ {
+ iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
+ iEngine->startIdleTimeCounter();
+ }
+}