From dc3d0ec73ff4bdc910165d280cbce10d9f644338 Mon Sep 17 00:00:00 2001
From: Marc Mutz
Date: Tue, 18 Dec 2001 13:34:11 +0000
Subject: [PATCH] Loop in the current folder when searching for unread
messages. Make this feature configurable, but default to on. Hope Don and the
others can live with it like this ;-)
svn path=/trunk/kdenetwork/kmail/; revision=127774
---
configuredialog.cpp | 21 ++++++++-
configuredialog_p.h | 1 +
kmheaders.cpp | 14 ++++++
kmheaders.h | 2 +
profiles/profile-default-rc.desktop | 70 ++++++++++++++++++++++++++++-
profiles/profile-html-rc.desktop | 17 +++++--
6 files changed, 118 insertions(+), 7 deletions(-)
diff --git a/configuredialog.cpp b/configuredialog.cpp
index a327ce8b3..2786b3f56 100644
--- a/configuredialog.cpp
+++ b/configuredialog.cpp
@@ -3495,11 +3495,15 @@ MiscPageFoldersTab::MiscPageFoldersTab( QWidget * parent, const char * name )
// "confirm before emptying folder" check box: stretch 0
mEmptyFolderConfirmCheck =
- new QCheckBox(i18n("Co&nfirm before emptying folders"), this );
+ new QCheckBox( i18n("Co&nfirm before emptying folders"), this );
vlay->addWidget( mEmptyFolderConfirmCheck );
mWarnBeforeExpire =
new QCheckBox( i18n("&Warn before expiring messages"), this );
vlay->addWidget( mWarnBeforeExpire );
+ mLoopOnGotoUnread =
+ new QCheckBox( i18n("&Loop in the current folder when trying to find "
+ "unread mail"), this );
+ vlay->addWidget( mLoopOnGotoUnread );
// "default mailbox format" combo + label: stretch 0
hlay = new QHBoxLayout( vlay ); // inherits spacing
@@ -3544,16 +3548,28 @@ MiscPageFoldersTab::MiscPageFoldersTab( QWidget * parent, const char * name )
"mails between folders.
");
QWhatsThis::add( mMailboxPrefCombo, msg );
QWhatsThis::add( label, msg );
+
+ msg = i18n( "what's this help",
+ "When jumping to the next unread message, it may occur "
+ "that no more unread messages are below the current message.
"
+ "When this option is checked, the search will start at the "
+ "top of the message list. Otherwise, it will do nothing.
"
+ "Similarly, when searching for the previous unread message, "
+ "the search will start from the bottom of the message list if "
+ "this option is checked.
" );
+ QWhatsThis::add( mLoopOnGotoUnread, msg );
}
void MiscPage::FoldersTab::setup() {
KConfigGroup general( kapp->config(), "General" );
+ KConfigGroup behaviour( kapp->config(), "Behaviour" );
mEmptyTrashCheck->setChecked( general.readBoolEntry( "empty-trash-on-exit", false ) );
mExpireAtExit->setChecked( general.readNumEntry( "when-to-expire", 0 ) ); // set if non-zero
mWarnBeforeExpire->setChecked( general.readBoolEntry( "warn-before-expire", true ) );
mCompactOnExitCheck->setChecked( general.readBoolEntry( "compact-all-on-exit", true ) );
mEmptyFolderConfirmCheck->setChecked( general.readBoolEntry( "confirm-before-empty", true ) );
+ mLoopOnGotoUnread->setChecked( behaviour.readBoolEntry( "LoopOnGotoUnread", true ) );
int num = general.readNumEntry("default-mailbox-format", 1 );
if ( num < 0 || num > 1 ) num = 1;
@@ -3562,13 +3578,14 @@ void MiscPage::FoldersTab::setup() {
void MiscPage::FoldersTab::apply() {
KConfigGroup general( kapp->config(), "General" );
+ KConfigGroup behaviour( kapp->config(), "Behaviour" );
general.writeEntry( "empty-trash-on-exit", mEmptyTrashCheck->isChecked() );
general.writeEntry( "compact-all-on-exit", mCompactOnExitCheck->isChecked() );
general.writeEntry( "confirm-before-empty", mEmptyFolderConfirmCheck->isChecked() );
general.writeEntry( "default-mailbox-format", mMailboxPrefCombo->currentItem() );
general.writeEntry( "warn-before-expire", mWarnBeforeExpire->isChecked() );
-
+ behaviour.writeEntry( "LoopOnGotoUnread", mLoopOnGotoUnread->isChecked() );
if ( mExpireAtExit->isChecked() )
general.writeEntry( "when-to-expire", expireAtExit );
else
diff --git a/configuredialog_p.h b/configuredialog_p.h
index fe8d063e2..084efae25 100644
--- a/configuredialog_p.h
+++ b/configuredialog_p.h
@@ -892,6 +892,7 @@ public:
protected:
QCheckBox *mEmptyFolderConfirmCheck;
QCheckBox *mWarnBeforeExpire;
+ QCheckBox *mLoopOnGotoUnread;
QComboBox *mMailboxPrefCombo;
QCheckBox *mCompactOnExitCheck;
QCheckBox *mEmptyTrashCheck;
diff --git a/kmheaders.cpp b/kmheaders.cpp
index 9dddf3729..5758b4f85 100644
--- a/kmheaders.cpp
+++ b/kmheaders.cpp
@@ -599,6 +599,12 @@ void KMHeaders::readConfig (void)
setFont(KGlobalSettings::generalFont());
}
+ // Behavior
+ {
+ KConfigGroupSaver saver(config, "Behaviour");
+ mLoopOnGotoUnread = config->readBoolEntry( "LoopOnGotoUnread", true );
+ }
+
}
@@ -1960,6 +1966,9 @@ int KMHeaders::findUnread(bool aDirNext, int aStartAt, bool onlyNew, bool accept
void KMHeaders::nextUnreadMessage(bool acceptCurrent)
{
int i = findUnread(TRUE, -1, false, acceptCurrent);
+ if ( i < 0 && mLoopOnGotoUnread )
+ // this assumes that (0 == firstChild()->msgId()) !
+ i = findUnread(TRUE, 0, false, acceptCurrent); // from top
setCurrentMsg(i);
ensureCurrentItemVisible();
}
@@ -1975,6 +1984,11 @@ void KMHeaders::ensureCurrentItemVisible()
void KMHeaders::prevUnreadMessage()
{
int i = findUnread(FALSE);
+ if ( i < 0 && mLoopOnGotoUnread ) {
+ KMHeaderItem * lastItem = static_cast(lastChild());
+ if ( lastItem )
+ i = findUnread(FALSE, lastItem->msgId() ); // from bottom
+ }
setCurrentMsg(i);
ensureCurrentItemVisible();
}
diff --git a/kmheaders.h b/kmheaders.h
index e8594dcec..715c1c7de 100644
--- a/kmheaders.h
+++ b/kmheaders.h
@@ -368,6 +368,8 @@ private:
static QDateTime *now;
static time_t now_time;
+ /** value of config key Behaviour/LoopOnGotoUnread */
+ bool mLoopOnGotoUnread;
};
#endif
diff --git a/profiles/profile-default-rc.desktop b/profiles/profile-default-rc.desktop
index 208c89d07..3b9e0fe45 100644
--- a/profiles/profile-default-rc.desktop
+++ b/profiles/profile-default-rc.desktop
@@ -1,8 +1,71 @@
[KMail Profile]
Name=Default
+Name[af]=verstek
+Name[ar]=افتراضي
+Name[az]=Əsas
+Name[bg]=По подразбиране
+Name[br]=Dre ziouer
+Name[bs]=Uobičajeno
+Name[ca]=Omissió
+Name[cs]=Implicitní
+Name[da]=Standard
+Name[de]=Standard
+Name[el]=Προκαθορισμένο
+Name[eo]=Apriora
+Name[es]=Predeterminado
+Name[et]=Vaikimisi
+Name[eu]=Aurremugatua
+Name[fi]=Oletus
+Name[fr]=Défaut
+Name[gl]=Por Omisión
+Name[he]=ברירת מחדל
+Name[hr]=Uobičajeno
+Name[hu]=Alapértelmezett
+Name[id]=Standar
+Name[is]=Sjálfgefið
+Name[it]=Predefinito
+Name[ja]=標準
+Name[ko]=기본
+Name[lt]=Nutylimos
+Name[lv]=Noklusētais
+Name[mi]=Hapa
+Name[mk]=Вообичаено
+Name[mt]=Normali
+Name[nb]=Standard
+Name[nl]=Standaard
+Name[nn]=Standard
+Name[oc]=Omission
+Name[pl]=Domyślnie
+Name[pt]=Por Omissão
+Name[pt_BR]=Padrão
+Name[ro]=Implicit
+Name[ru]=По умолчанию
+Name[sk]=Štandardný
+Name[sl]=Privzeto
+Name[sr]=Predefinisano
+Name[sv]=Förval
+Name[ta]=¦¸¡¼¡¿¢¨Ä
+Name[th]=ค่าปริยาย
+Name[tr]=Öntanımlı
+Name[uk]=Типовий
+Name[vi]=Mặc định
+Name[wa]=Prémetou
+Name[xh]=Engagqibekanga
Name[xx]=xx
+Name[zh_CN]=默认
+Name[zh_TW]=預設
+Name[zu]=Engaqedekanga
Comment=Standard profile
-Comment[xx]=xx
+Comment[az]=Standard profil
+Comment[da]=Standard-profil
+Comment[es]=Pérfil de estandár
+Comment[fr]=Profil standard
+Comment[he]=פרופיל סטנדרטי
+Comment[lv]=Standarta profils
+Comment[pt]=Perfil predefinido
+Comment[pt_BR]=Perfil predefinido
+Comment[sk]=Štandardný profil
+Comment[sv]=Standardprofil
[Reader]
BackgroundColor=255,255,255
@@ -44,4 +107,7 @@ longFolderList=true
[General]
dateDisplay=fancyDate
-showMessageSize=true
\ No newline at end of file
+showMessageSize=true
+
+[Behaviour]
+LoopOnGotoUnread=true
diff --git a/profiles/profile-html-rc.desktop b/profiles/profile-html-rc.desktop
index 8dafdcaad..ede85c33f 100644
--- a/profiles/profile-html-rc.desktop
+++ b/profiles/profile-html-rc.desktop
@@ -1,8 +1,16 @@
[KMail Profile]
Name=HTML
-Name[xx]=xx
Comment=Standard profile with HTML preview enabled - less secure!
-Comment[xx]=xx
+Comment[az]=HTML nümayişli standard - ən az etibarlı!
+Comment[da]=Standard-profil med HTML-forhåndsvisning aktiveret - mindre sikkert!
+Comment[es]=Perfil estándar con previsualizaión HTML activada - menos seguro
+Comment[fr]=Profil standard avec l'aperçu HTML activé - Moins sécurisé !
+Comment[he]=הפרופיל הסטנדרטי עם תצוגה מקדימה של HTML - פחות בטוח
+Comment[lv]=Standarta profils ar atļautu HTML apskati - nedrošāks!
+Comment[pt]=Perfil padrão com antevisão de HTML activada - menos segura!
+Comment[pt_BR]=Perfil padrão com antevisão de HTML activada - menos segura!
+Comment[sk]=Štandardný profil pre povolený náhlad HTML - menej bezpečné!
+Comment[sv]=Standardprofil med HTML-förhandsgranskning aktiverad - mindre säker!
[Reader]
BackgroundColor=255,255,255
@@ -45,4 +53,7 @@ longFolderList=true
[General]
dateDisplay=fancyDate
-showMessageSize=true
\ No newline at end of file
+showMessageSize=true
+
+[Behaviour]
+LoopOnGotoUnread=true