Commit cab81c4f authored by Thomas Lübking's avatar Thomas Lübking
Browse files

Sortorder woes

- triggers the save timer on swapping direction
- preserves scroll offset on swapping direction
- scrolls to unseen/recent (ie. actually top/bottom) when entering a mailbox

REVIEW: 118229
CCBUG: 335086
parent 7708aaa7
......@@ -33,6 +33,7 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QProgressBar>
#include <QScrollBar>
#include <QSplitter>
#include <QSslError>
#include <QSslKey>
......@@ -404,6 +405,9 @@ void MainWindow::createActions()
m_actionSortAscending->setChecked(true);
m_actionSortDescending = new QAction(tr("&Descending"), sortOrderGroup);
m_actionSortDescending->setCheckable(true);
// QActionGroup has no toggle signal, but connecting descending will implicitly catch the acscending complement ;-)
connect(m_actionSortDescending, SIGNAL(toggled(bool)), m_delayedStateSaving, SLOT(start()));
connect(m_actionSortDescending, SIGNAL(toggled(bool)), this, SLOT(slotScrollToCurrent()));
connect(sortOrderGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotSortingPreferenceChanged()));
QActionGroup *sortColumnGroup = new QActionGroup(this);
......@@ -1696,6 +1700,7 @@ void MainWindow::slotMailboxChanged(const QModelIndex &mailbox)
}
updateMessageFlags();
slotScrollToUnseenMessage(QModelIndex(), QModelIndex());
}
void MainWindow::showConnectionStatus(QObject *parser, Imap::ConnectionState state)
......@@ -1918,6 +1923,14 @@ void MainWindow::slotScrollToUnseenMessage(const QModelIndex &mailbox, const QMo
}
}
void MainWindow::slotScrollToCurrent()
{
// TODO: begs for lambda
if (QScrollBar *vs = msgListWidget->tree->verticalScrollBar()) {
vs->setValue(vs->maximum() - vs->value()); // implies vs->minimum() == 0
}
}
void MainWindow::slotThreadMsgList()
{
// We want to save user's preferences and not override them with "threading disabled" when the server
......
......@@ -188,6 +188,7 @@ private slots:
void slotDownloadTransferError(const QString &errorString);
void slotDownloadMessageFileNameRequested(QString *fileName);
void slotScrollToUnseenMessage(const QModelIndex &mailbox, const QModelIndex &message);
void slotScrollToCurrent();
void slotUpdateWindowTitle();
void slotLayoutCompact();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment