X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2FBusinessLogic%2FEngine.cpp;h=aac84d44e2b3a2b405dc41f83e1efc099393a76d;hb=33edea90bd097065e8c6b63cabc6b4b22c6a5d2c;hp=3a5d24fb03fa8a17ea4c364be5a81153c08a37e8;hpb=f902a21a9d18bf6f92a114f86ac4c39d00fff4dc;p=qtmeetings diff --git a/src/BusinessLogic/Engine.cpp b/src/BusinessLogic/Engine.cpp index 3a5d24f..aac84d4 100644 --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@ -109,7 +109,7 @@ void Engine::checkStatusOfAllRooms() for (int i = 0; i < iConfiguration->rooms().count(); i++) { // and check the status - roomStatusInfoNeeded(iConfiguration->rooms().at(i) ); + roomStatusInfoNeeded( iConfiguration->rooms().at(i) ); } } @@ -166,31 +166,15 @@ void Engine::roomStatusInfoNeeded(Room *aRoom) ( ( indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay ); //currently works only for deafult room -// if( aRoom->equals( *(defaultRoom() ) ) ) -// iWindowManager->roomStatusChanged( aRoom, status, until ); -} - -/* -void Engine::fetchMeetings() -{ - qDebug() << "Engine::fetchMeetings for " << iCurrentRoom; - QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() ); - QDateTime to( from.addDays( 7 ) ); - // fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() ); - // Signal is connected to the currentRoomChanged slot which keeps the iCurrentRoom up to date - fetchMeetings( from, to, iCurrentRoom ); + if ( aRoom->equals( *(iCurrentRoom) ) ) + { + emit roomStatusChanged( status, until ); + } } -*/ 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); */ iCommunication->fetchMeetingDetails( *aMeeting ); } @@ -217,7 +201,7 @@ void Engine::meetingsFetched( const QList &aMeetings ) } // refresh room status info - roomStatusInfoNeeded( defaultRoom() ); + roomStatusInfoNeeded( iCurrentRoom /*defaultRoom()*/ ); } void Engine::errorHandler( int aCode, const QString &aAddInfo ) @@ -251,24 +235,19 @@ void Engine::shownWeekChanged( QDate aFrom ) QDateTime from( aFrom ); QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) ); qDebug() << "[Engine::shownWeekChanged] "; - iCommunication->fetchMeetings( from, to, *defaultRoom() ); -// fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() ); + iCommunication->fetchMeetings( from, to, *iCurrentRoom/*defaultRoom()*/ ); } -void Engine::changeDeviceMode( bool aChange ) +void Engine::changeDeviceMode() { - if ( aChange ) - { - connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( changeModeFailed() ) ); - iAutoRefresh->stop(); // Stop the meeting update - } - iDevice->changeMode( aChange ); + connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) ); + iAutoRefresh->stop(); // Stop the meeting update + iDevice->changeMode(); } void Engine::changeModeFailed() { qDebug() << "Engine::progressBarCancelled()"; - iDevice->changeMode( false ); iAutoRefresh->start(); //we start the metting updating } @@ -291,12 +270,15 @@ void Engine::initUserInterface() iWindowManager->show(); iUIManager->showMainView(); + // This triggers the meeting fetching + iUIManager->currentRoomChanged( this->iCurrentRoom ); + qDebug() << "[Engine::initUserInterface] "; } void Engine::handleViewEvent() { - if ( iIdleTimeCounter != 0 ) + if ( iIdleTimeCounter != 0 && iIdleTimeCounter->isActive()) { // Restart the idle time counter when view event is received iIdleTimeCounter->stop(); @@ -384,5 +366,7 @@ void Engine::startIdleTimeCounter() void Engine::currentRoomChanged(Room *aRoom) { + qDebug() << "[Engine::currentRoomChanged] "; iCurrentRoom = aRoom; -} \ No newline at end of file + roomStatusInfoNeeded( iCurrentRoom ); +}