Show a 'please wait' splash if opening an IMAP

folder takes more than 500 msec.

Approved by the usability crowd over here and by Ingo.



svn path=/trunk/KDE/kdepim/; revision=419246
wilder-work
Martijn Klingens 21 years ago
parent 81d68e0fc4
commit 8376771004
  1. 31
      kmmainwidget.cpp
  2. 4
      kmmainwidget.h
  3. 35
      kmreaderwin.cpp
  4. 6
      kmreaderwin.h

@ -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)
{

@ -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<KMail::Vacation> mVacation;
KActionCollection *mActionCollection;

@ -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 ---",
"<h2 style='margin-top: 0px;'>Retrieving Folder Contents</h2><p>Please wait . . .</p>&nbsp;" );
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() {

@ -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();

Loading…
Cancel
Save