diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index c6ee8cbfe..0dc5d69a7 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -112,6 +112,7 @@ KMMainWidget::KMMainWidget(QWidget *parent, const char *name, KActionCollection *actionCollection, KConfig* config ) : QWidget(parent, name), mQuickSearchLine( 0 ), + mShowBusySplashTimer( 0 ), mAccel( 0 ) { // must be the first line of the constructor: @@ -1650,6 +1651,10 @@ void KMMainWidget::folderSelected() //----------------------------------------------------------------------------- void KMMainWidget::folderSelected( KMFolder* aFolder, bool forceJumpToUnread ) { + // Delete any pending timer, if needed it will be recreated below + delete mShowBusySplashTimer; + mShowBusySplashTimer = 0; + KCursorSaver busy(KBusyPtr::busy()); if (mMsgView) @@ -1700,9 +1705,23 @@ void KMMainWidget::folderSelected( KMFolder* aFolder, bool forceJumpToUnread ) mHeaders->setFolder( 0 ); updateFolderMenu(); mForceJumpToUnread = forceJumpToUnread; + + // Set a timer to show a splash screen if fetching folder contents + // takes more than half a second + mShowBusySplashTimer = new QTimer( this ); + connect( mShowBusySplashTimer, SIGNAL( timeout() ), this, SLOT( slotShowBusySplash() ) ); + mShowBusySplashTimer->start( 500, true ); return; } else { // the folder is complete now - so go ahead + // If needed, hide the busy splash and re-enable the widgets + if (mMsgView) { + mMsgView->enableMsgDisplay(); + mMsgView->clear(true); + } + if( mSearchAndHeaders && mHeaders ) + mSearchAndHeaders->show(); + disconnect( imap, SIGNAL( folderComplete( KMFolderImap*, bool ) ), this, SLOT( folderSelected() ) ); forceJumpToUnread = mForceJumpToUnread; @@ -1732,6 +1751,18 @@ void KMMainWidget::folderSelected( KMFolder* aFolder, bool forceJumpToUnread ) slotIntro(); } +//----------------------------------------------------------------------------- +void KMMainWidget::slotShowBusySplash() +{ + if ( mReaderWindowActive ) + { + mMsgView->displayBusyPage(); + // hide widgets that are in the way: + if ( mSearchAndHeaders && mHeaders && mLongFolderList ) + mSearchAndHeaders->hide(); + } +} + //----------------------------------------------------------------------------- void KMMainWidget::slotMsgSelected(KMMessage *msg) { diff --git a/kmmainwidget.h b/kmmainwidget.h index d47ea4a49..111b99f4b 100644 --- a/kmmainwidget.h +++ b/kmmainwidget.h @@ -393,6 +393,9 @@ protected slots: /** Remove the shortcut actions associated with a folder. */ void slotFolderRemoved( KMFolder *folder ); + /** Show a splash screen for the longer-lasting operation */ + void slotShowBusySplash(); + private: /** Get override character encoding. */ QString overrideEncoding() const; @@ -488,6 +491,7 @@ private: KToggleAction *mFolderAction, *mHeaderAction, *mMimeAction; QTimer *menutimer; + QTimer *mShowBusySplashTimer; QGuardedPtr mVacation; KActionCollection *mActionCollection; diff --git a/kmreaderwin.cpp b/kmreaderwin.cpp index c1183856e..02e35b044 100644 --- a/kmreaderwin.cpp +++ b/kmreaderwin.cpp @@ -1279,7 +1279,7 @@ QString KMReaderWin::newFeaturesMD5() } //----------------------------------------------------------------------------- -void KMReaderWin::displayAboutPage() +void KMReaderWin::displaySplashPage( const QString &info ) { mMsgDisplay = false; adjustLayout(); @@ -1293,6 +1293,32 @@ void KMReaderWin::displayAboutPage() content = content.arg( "" ); mViewer->begin(KURL( location )); + + QString fontSize = QString::number( pointsToPixel( mCSSHelper->bodyFont().pointSize() ) ); + QString appTitle = i18n("KMail"); + QString catchPhrase = ""; //not enough space for a catch phrase at default window size i18n("Part of the Kontact Suite"); + QString quickDescription = i18n("The email client for the K Desktop Environment."); + mViewer->write(content.arg(fontSize).arg(appTitle).arg(catchPhrase).arg(quickDescription).arg(info)); + mViewer->end(); +} + +void KMReaderWin::displayBusyPage() +{ + QString info = + i18n( "%1: KMail version; %2: help:// URL; %3: homepage URL; " + "%4: prior KMail version; %5: prior KDE version; " + "%6: generated list of new features; " + "%7: First-time user text (only shown on first start); " + "%8: generated list of important changes; " + "--- end of comment ---", + "

Retrieving Folder Contents

Please wait . . .

 " ); + + displaySplashPage( info ); +} + +//----------------------------------------------------------------------------- +void KMReaderWin::displayAboutPage() +{ QString info = i18n("%1: KMail version; %2: help:// URL; %3: homepage URL; " "%4: prior KMail version; %5: prior KDE version; " @@ -1352,12 +1378,7 @@ void KMReaderWin::displayAboutPage() else info = info.arg(""); // remove the %8 - QString fontSize = QString::number( pointsToPixel( mCSSHelper->bodyFont().pointSize() ) ); - QString appTitle = i18n("KMail"); - QString catchPhrase = ""; //not enough space for a catch phrase at default window size i18n("Part of the Kontact Suite"); - QString quickDescription = i18n("The email client for the K Desktop Environment."); - mViewer->write(content.arg(fontSize).arg(appTitle).arg(catchPhrase).arg(quickDescription).arg(info)); - mViewer->end(); + displaySplashPage( info ); } void KMReaderWin::enableMsgDisplay() { diff --git a/kmreaderwin.h b/kmreaderwin.h index d51c45469..479c5f75e 100644 --- a/kmreaderwin.h +++ b/kmreaderwin.h @@ -184,9 +184,15 @@ public: /** Returns the MD5 hash for the list of new features */ static QString newFeaturesMD5(); + /** Display a generic HTML splash page instead of a message */ + void displaySplashPage( const QString &info ); + /** Display the about page instead of a message */ void displayAboutPage(); + /** Display the 'please wait' page instead of a message */ + void displayBusyPage(); + /** Enable the displaying of messages again after an URL was displayed */ void enableMsgDisplay();