[kde-doc-english] [trojita] src/Gui: GUI: fix column sizes of the message list
Jan Kundrát
jkt at flaska.net
Fri Jan 4 15:15:48 UTC 2013
Git commit 6f2f1f9962d3402556c411b4a2705302aeff7193 by Jan Kundrát.
Committed on 04/01/2013 at 05:00.
Pushed by jkt into branch 'master'.
GUI: fix column sizes of the message list
M +17 -6 src/Gui/MsgListView.cpp
M +0 -7 src/Gui/Window.cpp
M +0 -1 src/Gui/Window.h
http://commits.kde.org/trojita/6f2f1f9962d3402556c411b4a2705302aeff7193
diff --git a/src/Gui/MsgListView.cpp b/src/Gui/MsgListView.cpp
index 96cd788..1d7d4a1 100644
--- a/src/Gui/MsgListView.cpp
+++ b/src/Gui/MsgListView.cpp
@@ -79,9 +79,9 @@ int MsgListView::sizeHintForColumn(int column) const
//: (see Imap::Mailbox::PrettyMsgListModel::prettyFormatDate() for the string formats); the idea here
//: is to have a text which is "wide enough" in a typical UI font.
//: The English version uses "Mon" because of the M letter; you should use something similar.
- tr("Mon 10:33")).width();
+ tr("Mon 10")).width();
case Imap::Mailbox::MsgListModel::SIZE:
- return metric.size(Qt::TextSingleLine, tr("888.1 kB")).width();
+ return metric.size(Qt::TextSingleLine, tr("88.8 kB")).width();
default:
return QTreeView::sizeHintForColumn(column);
}
@@ -181,13 +181,24 @@ void MsgListView::slotFixSize()
return;
}
header()->setStretchLastSection(false);
+
+ for (int i = 0; i < Imap::Mailbox::MsgListModel::COLUMN_COUNT; ++i) {
+ QHeaderView::ResizeMode resizeMode = QHeaderView::Interactive;
+ switch (i) {
+ case Imap::Mailbox::MsgListModel::SUBJECT:
+ resizeMode = QHeaderView::Stretch;
+ break;
+ case Imap::Mailbox::MsgListModel::SEEN:
+ resizeMode = QHeaderView::Fixed;
+ break;
+ }
+ setColumnWidth(i, sizeHintForColumn(i));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- header()->setSectionResizeMode(Imap::Mailbox::MsgListModel::SUBJECT, QHeaderView::Stretch);
- header()->setSectionResizeMode(Imap::Mailbox::MsgListModel::SEEN, QHeaderView::Fixed);
+ header()->setSectionResizeMode(i, resizeMode);
#else
- header()->setResizeMode(Imap::Mailbox::MsgListModel::SUBJECT, QHeaderView::Stretch);
- header()->setResizeMode(Imap::Mailbox::MsgListModel::SEEN, QHeaderView::Fixed);
+ header()->setResizeMode(i, resizeMode);
#endif
+ }
}
void MsgListView::slotExpandWholeSubtree(const QModelIndex &rootIndex)
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index ba6fc67..36b3f44 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -572,7 +572,6 @@ void MainWindow::setupModels()
connect(mboxTree, SIGNAL(clicked(const QModelIndex &)), msgListModel, SLOT(setMailbox(const QModelIndex &)));
connect(mboxTree, SIGNAL(activated(const QModelIndex &)), msgListModel, SLOT(setMailbox(const QModelIndex &)));
- connect(msgListModel, SIGNAL(mailboxChanged()), this, SLOT(slotResizeMsgListColumns()));
connect(msgListModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(updateMessageFlags()));
connect(msgListModel, SIGNAL(messagesAvailable()), msgListWidget->tree, SLOT(scrollToBottom()));
connect(msgListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), msgListWidget, SLOT(slotAutoEnableDisableSearch()));
@@ -708,12 +707,6 @@ void MainWindow::msgListDoubleClicked(const QModelIndex &index)
widget->show();
}
-void MainWindow::slotResizeMsgListColumns()
-{
- for (int i = 0; i < msgListWidget->tree->header()->count(); ++i)
- msgListWidget->tree->resizeColumnToContents(i);
-}
-
void MainWindow::showContextMenuMboxTree(const QPoint &position)
{
QList<QAction *> actionList;
diff --git a/src/Gui/Window.h b/src/Gui/Window.h
index bdb7792..575039d 100644
--- a/src/Gui/Window.h
+++ b/src/Gui/Window.h
@@ -95,7 +95,6 @@ private slots:
void showContextMenuMsgListTree(const QPoint &position);
void slotReloadMboxList();
void slotResyncMbox();
- void slotResizeMsgListColumns();
void alertReceived(const QString &message);
void networkPolicyOffline();
void networkPolicyExpensive();
More information about the kde-doc-english
mailing list