From: Ossi Jormakka Date: Fri, 22 May 2009 07:17:31 +0000 (+0300) Subject: Task #1170 Progress bar for meeting details pop-up X-Git-Url: https://vcs.maemo.org/git/?p=qtmeetings;a=commitdiff_plain;h=bea7a9d65db861efdaf4fe2ac8a8e9dd9cda3d4c Task #1170 Progress bar for meeting details pop-up --- diff --git a/src/BusinessLogic/Engine.cpp b/src/BusinessLogic/Engine.cpp index 2f9d3cd..bbee693 100644 --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@ -207,6 +207,13 @@ void Engine::fetchMeetings() 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 ); } @@ -261,6 +268,7 @@ void Engine::meetingsFetched( const QList &aMeetings ) void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting ) { qDebug() << "Engine::meetingDetailsFetched( Meeting & )"; + iWindowManager->closeProgressBar(); iWindowManager->showMeetingInfo( &aDetailedMeeting ); } @@ -268,8 +276,9 @@ void Engine::errorHandler( int aCode, const QString &aAddInfo ) { qDebug() << "Engine::ErrorHandler, aCode: " << aCode; // inform UI about the problem - if( aCode >= 100 && aCode <= 110 ) + if( aCode >= 100 && aCode <= 150 ) qDebug() << "CommunicationManager signaled an error:" << aCode; + iWindowManager->closeProgressBar(); iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) ); } @@ -341,3 +350,9 @@ void Engine::progressBarCancelled() iWindowManager->closeProgressBar(); iDevice->changeMode( false ); } + +void Engine::fetchMeetingDetailsCancelled() +{ + iCommunication->cancelFetchMeetingDetails(); + iWindowManager->closeProgressBar(); +} diff --git a/src/BusinessLogic/Engine.h b/src/BusinessLogic/Engine.h index 457d6ba..461b437 100644 --- a/src/BusinessLogic/Engine.h +++ b/src/BusinessLogic/Engine.h @@ -125,6 +125,11 @@ private slots: * Slot. Receives the cancel event of the progress bar. */ void progressBarCancelled(); + //! Slot for receiving the cancel event of the progress bar. + /*! + * Receives the cancel event of the progress bar when meeting details requested. + */ + void fetchMeetingDetailsCancelled(); private: //! Provides the index of the Meeting instance which is at the specified time. diff --git a/src/IO/Communication/CommunicationManager.cpp b/src/IO/Communication/CommunicationManager.cpp index 0a2ce77..8174ef7 100644 --- a/src/IO/Communication/CommunicationManager.cpp +++ b/src/IO/Communication/CommunicationManager.cpp @@ -91,6 +91,17 @@ void CommunicationManager::fetchMeetingDetails( Meeting& aMeeting ) } } +void CommunicationManager::cancelFetchMeetingDetails() +{ + const RequestData *rd = NULL; + for( rd = findRequest( GetCalendarItem );rd != NULL; ) + { + int id = rd->requestId; + iCancelledRequests.append( id ); + rd = findRequest( GetCalendarItem ); + } +} + void CommunicationManager::getMeetingDetails( Meeting &aMeeting ) { ReqMsgGetCalendarItem msg( aMeeting.secondaryId() ); @@ -109,6 +120,12 @@ void CommunicationManager::getMeetingDetails( Meeting &aMeeting ) void CommunicationManager::requestFinished( int aRequestId, int aError ) { RequestData* rd = takeRequest( aRequestId ); + if( iCancelledRequests.contains( rd->requestId ) ) + { + iCancelledRequests.removeAll( rd->requestId ); + delete rd; + return; + } QByteArray* response = iFetchingCommunication->response( aRequestId ); qDebug() << "CommunicationManager::requestFinished: id: " << aRequestId << " error: " << aError; diff --git a/src/IO/Communication/CommunicationManager.h b/src/IO/Communication/CommunicationManager.h index a8d8185..6307c28 100644 --- a/src/IO/Communication/CommunicationManager.h +++ b/src/IO/Communication/CommunicationManager.h @@ -51,6 +51,8 @@ public: * \param aMeeting A meeting the detailed information is wanted. */ void fetchMeetingDetails( Meeting &aMeeting ); + //! Cancels all meeting detail requests. + void cancelFetchMeetingDetails(); /* Not supported member functions which are using the modifying communication void setModifyCredentials( const QString &aUsername, const QString &aPassword ) {}; void createMeeting( const Meeting &aMeeting ) {}; @@ -164,6 +166,8 @@ private: QList iMeetings; //! Additional information about requests made to the Exchange server QList iRequestInfos; + //! A flag that all meeting detail requests has been cancelled + QList iCancelledRequests; }; #endif /*COMMUNICATIONMANAGER_H_*/ diff --git a/src/UserInterface/Components/ScheduleWidget.cpp b/src/UserInterface/Components/ScheduleWidget.cpp index 425a26f..5318df7 100644 --- a/src/UserInterface/Components/ScheduleWidget.cpp +++ b/src/UserInterface/Components/ScheduleWidget.cpp @@ -151,6 +151,7 @@ void ScheduleTableWidget::mouseMoveEvent( QMouseEvent* /* aEvent */ ) void ScheduleTableWidget::mousePressEvent( QMouseEvent* aEvent ) { activateMeeting( aEvent->x(), aEvent->y() ); + iTabletBlocked = false; } void ScheduleTableWidget::populateMeetingList() diff --git a/src/UserInterface/Utils/ProgressBar.cpp b/src/UserInterface/Utils/ProgressBar.cpp index 30f6056..835e5eb 100755 --- a/src/UserInterface/Utils/ProgressBar.cpp +++ b/src/UserInterface/Utils/ProgressBar.cpp @@ -17,7 +17,8 @@ ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aPar iProgress = new QProgressBar(); iProgress->setMinimumWidth( 200 ); - iProgress->setMaximum( 0 ); + iProgress->setRange( 0, 0 ); + iProgress->reset(); iProgress->setTextVisible( false ); QVBoxLayout *mainLayout = new QVBoxLayout; @@ -31,7 +32,7 @@ ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aPar subLayout->addWidget( buttonCancel ); connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) ); } - + mainLayout->addLayout( subLayout ); setLayout( mainLayout ); } @@ -44,4 +45,4 @@ void ProgressBar::update( const QString &aMessage ) { qDebug() << "ProgressBar::update( const QString & )"; iLabel->setText( aMessage ); -} \ No newline at end of file +} diff --git a/src/UserInterface/WindowManager.cpp b/src/UserInterface/WindowManager.cpp index 45d8b72..535434b 100644 --- a/src/UserInterface/WindowManager.cpp +++ b/src/UserInterface/WindowManager.cpp @@ -183,11 +183,11 @@ void WindowManager::closePasswordDialog() iPasswordDialog = 0; } -void WindowManager::showProgressBar( const QString &aText ) +void WindowManager::showProgressBar( const QString &aText, bool aCancellable ) { qDebug() << "WindowManager::showProgressBar( const QString & )"; if( iProgressBar == 0 ) { - iProgressBar = new ProgressBar( aText ); + iProgressBar = new ProgressBar( aText, aCancellable ); iProgressBar->show(); connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) ); } @@ -198,9 +198,12 @@ void WindowManager::showProgressBar( const QString &aText ) void WindowManager::closeProgressBar() { qDebug() << "WindowManager::closeProgressBar()"; - iProgressBar->close(); - delete iProgressBar; - iProgressBar = 0; + if( iProgressBar ) + { + iProgressBar->close(); + delete iProgressBar; + iProgressBar = 0; + } } void WindowManager::updateProgressBar( const QString &aMessage ) diff --git a/src/UserInterface/WindowManager.h b/src/UserInterface/WindowManager.h index 1e460c0..f284192 100644 --- a/src/UserInterface/WindowManager.h +++ b/src/UserInterface/WindowManager.h @@ -1,185 +1,186 @@ -#ifndef WINDOWMANAGER_H_ -#define WINDOWMANAGER_H_ - -#include -#include -#include "Room.h" -#include "Meeting.h" -#include "PasswordDialog.h" -#include "DeviceManager.h" - -class QTimer; -class RoomStatusIndicatorWidget; -class WeeklyViewWidget; -class Engine; -class MeetingInfoDialog; -class SettingsView; -class ProgressBar; -class Configuration; - -//! UserInterface class. Behaves as a proxy between the user interface and application's business logic. -/*! - * UserInterface class. Controls the whole user interface, starting with displaying the appropriate - * views. It behaves as a proxy between the user interface and application's business logic, it connects - * the specified components together and forwards the data to the correct place. It also manages the correct - * appearance of current views on the screen. - */ -class WindowManager : public QObject -{ - Q_OBJECT - -public: - //! Constructor. - /*! - * Constructor of WindowManager. - * \param aConfiguration The pointer to configuration. - */ - WindowManager( Configuration *aConfiguration ); - //! Destructor. - virtual ~WindowManager(); - /*! - * Displays an error message - * \param aErrorMessage Message to be displayd - */ - void error( const QString &aErrorMessage ); - //! Updates the rooms status. - /*! - * Forwards the signal of changed status to current view. - * \param aRoom Room which status is changed. - * \param aStatus Current status of room. - * \param aTime Time when status is changed. - */ - void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime ); - //! Shows the password dialog. - /*! - * Shows the password dialog. - * \param aAdminPassword The correct password. - * \param aMessage The message to be shown in the password dialog. - */ - void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage ); - //! Closes the password dialog. - /*! - * Closes the password dialog. - */ - void closePasswordDialog(); - //! Displays the weekly view. - /*! - * Displays the weekly view. - */ - void showWeeklyView(); - //! Displays the meeting info dialog. - /*! - * Displays the meeting info dialog. - * \param aMeeting Meeting to be displayd - */ - void showMeetingInfo( Meeting *aMeeting ); - //! Returns the pointer to the weekly view. - /*! - * Returns the pointer to the weekly view. - */ - WeeklyViewWidget * weeklyView(); - //! Switches the views to full screen. - /*! - * Switches the views to full screen. - */ - void fullScreen(); - //! Shows the progress bar. - /*! - * Starts showing the progress bar. - * \param aText The text to be shown in progress bar. - */ - void showProgressBar( const QString &aText ); - //! Closes the progress bar. - /*! - * Closes the progress bar. - */ - void closeProgressBar(); - - void insertMeeting( Meeting *aMeeting ); - - void deleteMeeting( Meeting *aMeeting ); - -signals: - //! Request current status of the room. - /*! - * Signal is emitted when there is need to check current status of room aRoom. - * \param aRoom Meetingroom which status is requested. - */ - void roomStatusInfoNeeded( Room *aRoom ); - //! Indicate that some user event has happened. - /*! - * Signal is emitted if some user event has happened. - */ - void observedEventDetected(); - //! Meeting activated. - /*! - * Signal is emitted when a meeting is clicked by the user. - * \param aMeeting actived meeting. - */ - void meetingActivated( Meeting *aMeeting ); - //! Signals if the shown week has been changed. - /*! - * Signal. Emitted if the shown week has been changed. - * \param aDate The first date of the shown week. - */ - void shownWeekChanged( QDate aDate ); - //! Signals change of the meeting room. - /*! - * Signal is emitted when meeting room is changed. - * \param aRoom Selected meeting room. - */ - void currentRoomChanged( Room *aRoom ); - //! Signals when the password dialog buttons are clicked. - /*! - * Signal is emitted when the password dialog buttons are clicked. - * \param aPasswordStatus The status of the password. - */ - void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ); - //! Signals when the cancel button in the progress bar is clicked. - /*! - * Signal is emitted when the cancel button in the progress bar is clicked. - */ - void progressBarCancelled(); - -public slots: - //! Slot for displaying the screensaver (room status view). - /*! - * Slot. Displays the screensaver. - */ - void showRoomStatus(); - //! Slot for updating the time. - /*! - * Slot. Forwards the signal of changed time to current view. - * \param aCurrentDateTime Current date and time. - */ - void distributeDateTimeInfo( QDateTime aCurrentDateTime ); - - void updateProgressBar( const QString &aMessage ); - -private slots: - //! Displays the settings view - void showSettingsView(); - -private: - //! Name of the application. - QString iApplicationName; - //! Defines whether the views should be shown as full screen - bool iFullScreen; - //! Pointer to the configuration. - Configuration *iConfiguration; - //! Pointer to the weekly view. - WeeklyViewWidget *iWeeklyView; - //! Pointer to the screensaver (room status view). - RoomStatusIndicatorWidget *iRoomStatusView; - //! Pointer to the meeting info dialog - MeetingInfoDialog *iMeetingInfo; - //! Pointer to the settings view - SettingsView *iSettingsView; - //! Pointer to the progress bar - ProgressBar *iProgressBar; - //! Pointer to the password dialog. - PasswordDialog *iPasswordDialog; - -}; - -#endif /*WINDOWMANAGER_H_*/ +#ifndef WINDOWMANAGER_H_ +#define WINDOWMANAGER_H_ + +#include +#include +#include "Room.h" +#include "Meeting.h" +#include "PasswordDialog.h" +#include "DeviceManager.h" + +class QTimer; +class RoomStatusIndicatorWidget; +class WeeklyViewWidget; +class Engine; +class MeetingInfoDialog; +class SettingsView; +class ProgressBar; +class Configuration; + +//! UserInterface class. Behaves as a proxy between the user interface and application's business logic. +/*! + * UserInterface class. Controls the whole user interface, starting with displaying the appropriate + * views. It behaves as a proxy between the user interface and application's business logic, it connects + * the specified components together and forwards the data to the correct place. It also manages the correct + * appearance of current views on the screen. + */ +class WindowManager : public QObject +{ + Q_OBJECT + +public: + //! Constructor. + /*! + * Constructor of WindowManager. + * \param aConfiguration The pointer to configuration. + */ + WindowManager( Configuration *aConfiguration ); + //! Destructor. + virtual ~WindowManager(); + /*! + * Displays an error message + * \param aErrorMessage Message to be displayd + */ + void error( const QString &aErrorMessage ); + //! Updates the rooms status. + /*! + * Forwards the signal of changed status to current view. + * \param aRoom Room which status is changed. + * \param aStatus Current status of room. + * \param aTime Time when status is changed. + */ + void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime ); + //! Shows the password dialog. + /*! + * Shows the password dialog. + * \param aAdminPassword The correct password. + * \param aMessage The message to be shown in the password dialog. + */ + void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage ); + //! Closes the password dialog. + /*! + * Closes the password dialog. + */ + void closePasswordDialog(); + //! Displays the weekly view. + /*! + * Displays the weekly view. + */ + void showWeeklyView(); + //! Displays the meeting info dialog. + /*! + * Displays the meeting info dialog. + * \param aMeeting Meeting to be displayd + */ + void showMeetingInfo( Meeting *aMeeting ); + //! Returns the pointer to the weekly view. + /*! + * Returns the pointer to the weekly view. + */ + WeeklyViewWidget * weeklyView(); + //! Switches the views to full screen. + /*! + * Switches the views to full screen. + */ + void fullScreen(); + //! Shows the progress bar. + /*! + * Starts showing the progress bar. + * \param aText The text to be shown in progress bar. + * \param aCancellable Is the Cancel button visible. By default not visible. + */ + void showProgressBar( const QString &aText, bool aCancellable = false ); + //! Closes the progress bar. + /*! + * Closes the progress bar. + */ + void closeProgressBar(); + + void insertMeeting( Meeting *aMeeting ); + + void deleteMeeting( Meeting *aMeeting ); + +signals: + //! Request current status of the room. + /*! + * Signal is emitted when there is need to check current status of room aRoom. + * \param aRoom Meetingroom which status is requested. + */ + void roomStatusInfoNeeded( Room *aRoom ); + //! Indicate that some user event has happened. + /*! + * Signal is emitted if some user event has happened. + */ + void observedEventDetected(); + //! Meeting activated. + /*! + * Signal is emitted when a meeting is clicked by the user. + * \param aMeeting actived meeting. + */ + void meetingActivated( Meeting *aMeeting ); + //! Signals if the shown week has been changed. + /*! + * Signal. Emitted if the shown week has been changed. + * \param aDate The first date of the shown week. + */ + void shownWeekChanged( QDate aDate ); + //! Signals change of the meeting room. + /*! + * Signal is emitted when meeting room is changed. + * \param aRoom Selected meeting room. + */ + void currentRoomChanged( Room *aRoom ); + //! Signals when the password dialog buttons are clicked. + /*! + * Signal is emitted when the password dialog buttons are clicked. + * \param aPasswordStatus The status of the password. + */ + void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ); + //! Signals when the cancel button in the progress bar is clicked. + /*! + * Signal is emitted when the cancel button in the progress bar is clicked. + */ + void progressBarCancelled(); + +public slots: + //! Slot for displaying the screensaver (room status view). + /*! + * Slot. Displays the screensaver. + */ + void showRoomStatus(); + //! Slot for updating the time. + /*! + * Slot. Forwards the signal of changed time to current view. + * \param aCurrentDateTime Current date and time. + */ + void distributeDateTimeInfo( QDateTime aCurrentDateTime ); + + void updateProgressBar( const QString &aMessage ); + +private slots: + //! Displays the settings view + void showSettingsView(); + +private: + //! Name of the application. + QString iApplicationName; + //! Defines whether the views should be shown as full screen + bool iFullScreen; + //! Pointer to the configuration. + Configuration *iConfiguration; + //! Pointer to the weekly view. + WeeklyViewWidget *iWeeklyView; + //! Pointer to the screensaver (room status view). + RoomStatusIndicatorWidget *iRoomStatusView; + //! Pointer to the meeting info dialog + MeetingInfoDialog *iMeetingInfo; + //! Pointer to the settings view + SettingsView *iSettingsView; + //! Pointer to the progress bar + ProgressBar *iProgressBar; + //! Pointer to the password dialog. + PasswordDialog *iPasswordDialog; + +}; + +#endif /*WINDOWMANAGER_H_*/