Engine::Engine() :
- iClock( 0 ), iConfiguration( 0 ), iCommunication( 0 )
+ iClock( 0 ), iConfiguration( 0 ), iCommunication( 0 ),
+ iWindowManager( 0 ), iUIManager( 0 )
{
qDebug() << "Engine::Engine()";
Meeting* m = new Meeting( *(aMeetings.at( i )) );
iMeetings.append(m);
// and signal the changes
-// iWeeklyView->insertMeeting( m );
}
}
{
Meeting* m = iMeetings.takeAt(i);
// signal the changes
-// iWeeklyView->deleteMeeting( m );
// delete the meeting from the local list
delete m;
}
void Engine::errorHandler( int aCode, const QString &aAddInfo )
{
- iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
+ if ( iWindowManager != 0 )
+ {
+ iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
+ }
}
void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn )
void Engine::fetchMeetingDetails(Meeting *aMeeting)
{
qDebug() << "[Engine::fetchMeetingDetails] <TODO : METHOD NOT IMPLEMENTED>";
+ Meeting tempMeeting(aMeeting->primaryId(), aMeeting->room(), aMeeting->startsAt(), aMeeting->endsAt() );
+ iCommunication->fetchMeetingDetails( tempMeeting );
// Meeting tempMeeting = aMeeting;
// iCommunication->fetchMeetingDetails( tempMeeting );
}
{
if ( iProgressBar != 0 )
{
- iProgressBar->update( tr("Changing current operation mode.") );
+ iProgressBar->update( aText );
iWindowManager->showDialog( iProgressBar );
}
}
void UIManager::createProgressBar()
{
- iProgressBar = new ProgressBar( tr("CHANGE THIS") );
+ iProgressBar = new ProgressBar( tr("CHANGE THIS"), true );
// Connect to UIManager
connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) );
connect( aDeviceManager, SIGNAL( changingMode( const QString & ) ), this, SLOT( updateProgressBarText( const QString & ) ) );
+ connect( aDeviceManager, SIGNAL( changeModeFailed() ), this, SLOT( hideProgressBar() ) );
}
void UIManager::connectCommunicationManager( CommunicationManager *aCommunicationManager )
{
connect( aCommunicationManager, SIGNAL( meetingDetailsFetched( Meeting & ) ), this, SLOT( meetingDetailsFetched( Meeting & ) ) );
+ connect( aCommunicationManager, SIGNAL( meetingsFetched( const QList<Meeting *> & ) ), this, SLOT( meetingsFetched( const QList<Meeting *> & ) ) );
}
// ============================================
void UIManager::meetingsFetched( const QList<Meeting*> &aMeetings )
{
-
+ qDebug() << "[UIManager::meetingsFetched] <SHOULD NOT SIMPLY INSERT MEETINGS TO WEEKLYVIEW !!!>";
+ for ( int i = 0; i < aMeetings.count(); i++ )
+ {
+ Meeting *m = new Meeting( *( aMeetings.at(i) ) );
+ iWeeklyView->insertMeeting( m );
+ }
}
void UIManager::showMeetingProgressBar( Meeting *aMeeting )
if ( iProgressBar != 0 )
{
iProgressBar->update( tr("Fetching meeting info...") );
- iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
+ iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
}
}
void UIManager::meetingDetailsFetched(Meeting &aDetailedMeeting)
{
+ qDebug() << "[UIManager::meetingDetailsFetched] <Invoked>";
if ( iMeetingInfo != 0 )
{
- if ( iProgressBar != 0 )
+ if ( iProgressBar != 0 && iProgressBar->isVisible() )
{
iProgressBar->close(); // Close it in case it's visible
}
- iMeetingInfo->setMeeting( &aDetailedMeeting );
- iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
+ // iMeetingInfo->setMeeting( &aDetailedMeeting );
+ MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
+ iWindowManager->showDialog( static_cast<QDialog *>( tmp/*iMeetingInfo*/ ) );
}
}
// Show the progress bar..
if ( iProgressBar != 0 )
{
- iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
+ iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
}
// ... and initiate the mode changing
iEngine->changeDeviceMode( true );
iProgressBar->update( aText );
}
}
+
+void UIManager::hideProgressBar()
+{
+ qDebug() << "[UIManager::hideProgressBar] <Invoked>";
+ if ( iProgressBar != 0 && iProgressBar->isVisible() )
+ {
+ iProgressBar->close();
+ }
+}
void passwordEntered( PasswordDialog::PasswordStatus aStatus );
void showMeetingProgressBar( Meeting *aMeeting );
void updateProgressBarText( const QString &aText );
+ void hideProgressBar();
private:
*/\r
void statusChanged( const Room::Status aStatus, const QTime aUntil );\r
\r
- void viewResized(const QSize &size) { }\r
+ void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
\r
private:\r
//! Translates the status into human readable text.\r
emit okClicked();
}
-void SettingsView::viewResized(const QSize &size)
+void SettingsView::viewResized(const QSize &newSize, const QSize &oldSize)
{
- qDebug() << "[SettingsView::viewResized] <Invoked>";
-
- qDebug() << "[SettingsView::viewResized] <Finished>";
+ if ( oldSize.height() > newSize.height() )
+ {
+ // Get the button's height and add that to the new size so that
+ // the ok button is hidden under the keyboard.
+ size().rheight() += iOkButton->size().height();
+ }
}
\ No newline at end of file
void okClicked();
public slots:
- void viewResized(const QSize &size);
+ void viewResized(const QSize &newSize, const QSize &oldSize);
private slots:
//! Slot to handle the Ok button pressing.
* after it has been resized, for example when the on screen keyboard is
* displayed.
*/
- virtual void viewResized(const QSize &size) = 0;
+ virtual void viewResized(const QSize &newSize, const QSize &oldSize) = 0;
signals:
/*!
* Handle possible resize changes after the view is resized\r
* to match the window managers client area.\r
*/\r
- void viewResized(const QSize &size) { }\r
+ void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
\r
private:\r
//! Displays the selectable meeting rooms.\r
// Make the new view visible and handle connections
iCurrentView = view;
connect( iCurrentView, SIGNAL( eventDetected() ), this, SLOT( viewEventDetected() ) );
- connect( this, SIGNAL( viewResized(const QSize &) ), iCurrentView, SLOT( viewResized( const QSize & ) ) );
+ connect( this, SIGNAL( viewResized(const QSize &, const QSize &) ), iCurrentView, SLOT( viewResized( const QSize &, const QSize & ) ) );
view->resize( this->size() );
view->show();
if ( oldView != 0 )
{
disconnect( oldView, SIGNAL( eventDetected() ), this, SLOT( viewEventDetected() ) );
- disconnect( this, SIGNAL( viewResized(const QSize &) ), oldView, SLOT( viewResized(const QSize &) ) );
+ disconnect( this, SIGNAL( viewResized(const QSize &, const QSize &) ), oldView, SLOT( viewResized(const QSize &, const QSize &) ) );
oldView->hide();
}
}
-void WindowManager::showDialog(QDialog *dialog)
+void WindowManager::showDialog(QDialog *aDialog, bool blocking, bool aSendSignal)
{
// Handle dialog displaying
- emit dialogActivated();
- dialog->exec();
- emit dialogDeactivated();
+ if ( aSendSignal ) emit dialogActivated();
+ if ( blocking )
+ {
+ aDialog->exec();
+ }
+ else
+ {
+ aDialog->show();
+ }
+ if ( aSendSignal ) emit dialogDeactivated();
}
void WindowManager::viewEventDetected()
{
if ( iCurrentView != 0 )
{
+ QSize currentSize = iCurrentView->size();
iCurrentView->setFixedSize( this->size() );
- emit viewResized( this->size() );
+ emit viewResized( this->size(), currentSize );
}
}
void WindowManager::error( const QString &aErrorMessage )
{
- qDebug() << "WindowManager::showErrorPopup";
+ qDebug() << "WindowManager::error ";
- showDialog( static_cast<QDialog *>( PopUpMessageBox::error( 0, aErrorMessage ) ) );
+ PopUpMessageBox *popup = PopUpMessageBox::error( 0, aErrorMessage );
+ if ( popup != 0 )
+ {
+ showDialog( static_cast<QDialog *>( popup ), false );
+ }
}
void WindowManager::setFullscreen()
* i.e. it received resized QEvent.\r
* \param The new view size.\r
*/\r
- void viewResized(const QSize &);\r
+ void viewResized(const QSize &newSize, const QSize &oldSize);\r
\r
//! Previous view is restored.\r
/*!\r
* QDialog's exec() method and emits dialogDeactivated signal when\r
* the exec() method returns.\r
*/\r
- void showDialog( QDialog *dialog );\r
+ void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );\r
\r
//! View event is detected.\r
/*!\r