Messagelib
view.cpp
73 bool mNeedToApplyThemeColumns = false; ///< Flag signaling a pending application of theme columns
76 bool mSaveThemeColumnStateOnSectionResize = true; ///< This is used to filter out programmatic column resizes in slotSectionResized().
110 scrollerProp.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.2); // QTBUG-88249
123 connect(header(), &QWidget::customContextMenuRequested, this, &View::slotHeaderContextMenuRequested);
128 header()->setMinimumSectionSize(2); // QTreeView overrides our sections sizes if we set them smaller than this value
129 header()->setDefaultSectionSize(2); // QTreeView overrides our sections sizes if we set them smaller than this value
136 connect(selectionModel(), &QItemSelectionModel::selectionChanged, this, &View::slotSelectionChanged, Qt::UniqueConnection);
155 // Zero out the theme, aggregation and ApplyThemeColumnsTimer so Model will not cause accesses to them in its destruction process
175 disconnect(selectionModel(), &QItemSelectionModel::selectionChanged, this, &View::slotSelectionChanged);
178 connect(selectionModel(), &QItemSelectionModel::selectionChanged, this, &View::slotSelectionChanged, Qt::UniqueConnection);
220 || (scrollBarPosition == scrollBarMaximum && sortOrder->messageSortDirection() == SortOrder::Ascending));
286 //////////////////////////////////////////////////////////////////////////////////////////////////////
290 // is quite unpredictable. This is due to the complex interaction with the model, with the QTreeView
301 // - Explicitly save the column state, used when the user changes the widths or visibility manually.
563 // qCDebug(MESSAGELIST_LOG) << "I've triggered the QHeaderView bug: trying to fix by calling myself again";
608 // qCDebug(MESSAGELIST_LOG) << "Section " << idx << " is visible and has size " << header()->sectionSize( idx );
627 qCDebug(MESSAGELIST_LOG) << "Resize event enter (viewport width is " << viewport()->width() << ")";
841 // then apply theme columns to re-compute proportional widths (so we hopefully stay in the view)
867 selectionModel()->select(currentIndex(), QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
880 selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
885 selectionModel()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Current | QItemSelectionModel::Clear);
1005 if (!static_cast<MessageItem *>(item)->parent() || (static_cast<MessageItem *>(item)->parent()->type() != Item::Message)) {
1127 Item *View::messageItemAfter(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
1138 if ((referenceItem->childItemCount() > 0) && ((messageTypeFilter != MessageTypeAny) || isExpanded(d->mModel->index(referenceItem, 0)))) {
1139 // the current item had children: either expanded or we want unread/new messages (and so we'll expand it if it isn't)
1182 (!message_type_matches(below, messageTypeFilter)) || // is hidden (and we don't want hidden items as they aren't "officially" in the view)
1184 ((d->mModel->flags(belowIndex) & (Qt::ItemIsSelectable | Qt::ItemIsEnabled)) != (Qt::ItemIsSelectable | Qt::ItemIsEnabled))) {
1186 if ((below->childItemCount() > 0) && ((messageTypeFilter != MessageTypeAny) || isExpanded(belowIndex))) {
1187 // the current item had children: either expanded or we want unread messages (and so we'll expand it if it isn't)
1199 if (referenceItem) { // <-- this means "we have started from something that is not the top: looping makes sense"
1202 // else mi == 0 and below == 0: we have started from the beginning and reached the end (it will fail the test below and exit)
1243 Item *View::messageItemBefore(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
1256 if ((siblingAbove && siblingAbove != referenceItem && siblingAbove != parent) && (siblingAbove->childItemCount() > 0)
1257 && ((messageTypeFilter != MessageTypeAny) || (isExpanded(d->mModel->index(siblingAbove, 0))))) {
1258 // the current item had children: either expanded or we want unread/new messages (and so we'll expand it if it isn't)
1302 (!message_type_matches(above, messageTypeFilter)) || // we don't expand items but the item has parents unexpanded (so should be skipped)
1309 ((d->mModel->flags(aboveIndex) & (Qt::ItemIsSelectable | Qt::ItemIsEnabled)) != (Qt::ItemIsSelectable | Qt::ItemIsEnabled))) {
1316 if (referenceItem) { // <-- this means "we have started from something that is not the beginning: looping makes sense"
1319 // else mi == 0 and above == 0: we have started from the end and reached the beginning (it will fail the test below and exit)
1403 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1416 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1429 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1433 bool View::selectNextMessageItem(MessageTypeFilter messageTypeFilter, ExistingSelectionBehaviour existingSelectionBehaviour, bool centerItem, bool loop)
1470 bool View::selectPreviousMessageItem(MessageTypeFilter messageTypeFilter, ExistingSelectionBehaviour existingSelectionBehaviour, bool centerItem, bool loop)
1507 bool View::focusNextMessageItem(MessageTypeFilter messageTypeFilter, bool centerItem, bool loop)
1531 bool View::focusPreviousMessageItem(MessageTypeFilter messageTypeFilter, bool centerItem, bool loop)
1566 selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
1780 selectionModel()->select(aMessageIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
1842 return false; // item not viewable (not attached to the viewable root or qt not yet aware of it)
1916 qCDebug(MESSAGELIST_LOG) << "View message selected [" << static_cast<MessageItem *>(it)->subject() << "]";
1960 if (d->mDelegate->hitContentItem()->isIcon() && d->mDelegate->hitContentItem()->isClickable()) {
2012 void View::changeMessageStatus(MessageItem *it, Akonadi::MessageStatus set, Akonadi::MessageStatus unset)
2015 // visible to the user even if the Model is actually in the middle of a long job (maybe it's loading)
2018 // d->mWidget->viewMessageStatusChangeRequest() will really perform the status change on the storage.
2019 // Well... in KMail it will unless something is really screwed. Anyway, if it will not, at the next
2066 if ((e->pos() - d->mMousePressPosition).manhattanLength() <= QApplication::startDragDistance()) {
2100 d->mWidget->viewGroupHeaderContextPopupRequest(static_cast< GroupHeaderItem * >(item), viewport()->mapToGlobal(pos));
2102 d->mWidget->viewMessageListContextPopupRequest(selectionAsMessageItemList(), viewport()->mapToGlobal(pos));
2208 const QString textDirection = textIsLeftToRight ? QStringLiteral("left") : QStringLiteral("right");
2210 QString tip = QStringLiteral("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">");
2245 tip += htmlCodeForStandardRow.arg(i18nc("Receiver of the email", "To"), mi->displayReceiver().toHtmlEscaped());
2249 tip += htmlCodeForStandardRow.arg(mi->displayReceiver().toHtmlEscaped(), i18nc("Receiver of the email", "To"));
2274 tip += htmlCodeForStandardRow.arg(i18n("Note"), mi->annotation().replace(QLatin1Char('\n'), QStringLiteral("<br>")));
2276 tip += htmlCodeForStandardRow.arg(mi->annotation().replace(QLatin1Char('\n'), QStringLiteral("<br>"))).arg(i18n("Note"));
2283 tip += htmlCodeForStandardRow.arg(i18n("Preview"), content.replace(QLatin1Char('\n'), QStringLiteral("<br>")));
2285 tip += htmlCodeForStandardRow.arg(content.replace(QLatin1Char('\n'), QStringLiteral("<br>"))).arg(i18n("Preview"));
2342 description = i18nc("@info:tooltip Formats to something like 'Threads started on 2008-12-21'", "Threads started on %1", ghi->label());
2344 description = i18nc("@info:tooltip Formats to something like 'Threads started Yesterday'", "Threads started %1", ghi->label());
2358 description = i18nc("@info:tooltip Formats to something like 'Messages sent on 2008-12-21'", "Messages sent on %1", ghi->label());
2361 i18nc("@info:tooltip Formats to something like 'Messages received on 2008-12-21'", "Messages received on %1", ghi->label());
2365 description = i18nc("@info:tooltip Formats to something like 'Messages sent Yesterday'", "Messages sent %1", ghi->label());
2367 description = i18nc("@info:tooltip Formats to something like 'Messages received Yesterday'", "Messages received %1", ghi->label());
2467 i18np("<b>%1</b> message (<b>%2</b> unread)", "<b>%1</b> messages (<b>%2</b> unread)", stats.mTotalChildCount, stats.mUnreadChildCount);
2625 qCDebug(MESSAGELIST_LOG) << "Left hit with selectedIndexes().count() == " << q->selectedIndexes().count();
2640 it->status().isImportant() ? Akonadi::MessageStatus() : Akonadi::MessageStatus::statusImportant(),
2641 it->status().isImportant() ? Akonadi::MessageStatus::statusImportant() : Akonadi::MessageStatus());
2644 q->changeMessageStatusRead(static_cast<MessageItem *>(it), it->status().isRead() ? false : true);
2651 : (it->status().isHam() ? Akonadi::MessageStatus::statusSpam() : Akonadi::MessageStatus::statusHam()),
2660 : (it->status().isWatched() ? Akonadi::MessageStatus::statusIgnored() : Akonadi::MessageStatus::statusWatched()),
2663 : (it->status().isWatched() ? Akonadi::MessageStatus::statusWatched() : Akonadi::MessageStatus()));
2672 // Let QTreeView handle the selection and Q_EMIT the appropriate signals (slotSelectionChanged() may be called)
2677 // Let QTreeView handle the selection and Q_EMIT the appropriate signals (slotSelectionChanged() may be called)
2680 mWidget->viewMessageListContextPopupRequest(q->selectionAsMessageItemList(), q->viewport()->mapToGlobal(e->pos()));
2713 mWidget->viewGroupHeaderContextPopupRequest(groupHeaderItem, q->viewport()->mapToGlobal(e->pos()));
2751 } else if (mScroller->state() == QScroller::Pressed || mScroller->state() == QScroller::Inactive) {
2759 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
2791 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
2812 QMouseEvent fakeMousePress(QEvent::MouseButtonPress, tapViewportPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
2830 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
2837 QMouseEvent fakeMousePress(QEvent::MouseButtonPress, tap->pos(), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
position
static const MessageStatus statusImportant()
void append(const T &value)
const QColor & color(QPalette::ColorGroup group, QPalette::ColorRole role) const const
T & first()
const QColor & color() const const
QPoint pos() const const
void showText(const QPoint &pos, const QString &text, QWidget *w)
AlignCenter
Item * itemBelow()
Returns the item that is visually below this item in the tree.
Definition: item.cpp:103
virtual void updateGeometries() override
void setScrollMetric(QScrollerProperties::ScrollMetric metric, const QVariant &value)
GestureStarted
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
position
FontChange
QPoint topLeft() const const
QString toHtmlEscaped() const const
void setCurrentWidth(double currentWidth)
Sets the current shared width setting for this column.
Definition: theme.cpp:713
void * internalPointer() const const
ToolTipBase
The MessageList::View is the real display of the message list.
Definition: view.h:47
Qt::MouseButton button() const const
A structure used with MessageList::Item::childItemStats().
Definition: item.h:184
Scrolling
void customContextMenuRequested(const QPoint &pos)
int count(const T &value) const const
QString trimmed() const const
QString name() const const
MessageSorting messageSorting() const
Returns the current message sorting option.
Definition: sortorder.cpp:40
void append(const T &value)
layoutDirection
int red() const const
static const MessageStatus statusWatched()
void setRead(bool read=true)
static const MessageStatus statusSpam()
CustomContextMenu
ScrollBarAsNeeded
Provides a widget which has the messagelist and the most important helper widgets,...
Definition: widgetbase.h:40
int y() const const
void setStatus(Akonadi::MessageStatus status)
Sets the status associated to this Item.
Definition: item.cpp:451
virtual bool event(QEvent *event) override
LeftButton
bool contains(const T &value) const const
bool isHam() const
Item * parent() const
Returns the parent Item in the tree, or 0 if this item isn't attached to the tree.
Definition: item.cpp:436
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setItalic(bool enable)
bool isToAct() const
bool isSpam() const
bool isWatched() const
int bottom() const const
virtual void changeEvent(QEvent *ev) override
int top() const const
virtual bool event(QEvent *e)
ItemIsSelectable
Interactive
QString i18n(const char *text, const TYPE &arg...)
int indexOfChildItem(Item *item) const
Returns the actual index of the child Item item or -1 if item is not a child of this Item.
Definition: item.cpp:168
void setCurrentlyVisible(bool currentlyVisible)
Sets the current shared visibility state for this column.
Definition: theme.cpp:703
virtual void showEvent(QShowEvent *event)
bool isIgnored() const
const T & at(int i) const const
void timeout()
bool isEmpty() const const
Qt::MouseButtons buttons() const const
state
QScroller * scroller(QObject *target)
bool isValid() const const
Item * childItem(int idx) const
Returns the child item at position idx or 0 if idx is out of the allowable range.
Definition: item.cpp:64
const T & at(int i) const const
Q_SCRIPTABLE CaptureState status()
ScrollPerPixel
void setAlpha(int alpha)
Qt::MouseEventSource source() const const
bool contains(const T &value) const const
virtual void mouseMoveEvent(QMouseEvent *event) override
static const MessageStatus statusIgnored()
UniqueConnection
int green() const const
bool isEmpty() const const
ExtendedSelection
PreSelectionMode
Pre-selection is the action of automatically selecting a message just after the folder has finished l...
Definition: messagelist/src/core/enums.h:40
A class which holds information about sorting, e.g.
Definition: sortorder.h:34
virtual void mousePressEvent(QMouseEvent *event) override
Item * itemAboveChild(Item *child)
Returns the item that is visually above the specified child if this item.
Definition: item.cpp:129
QPoint bottomLeft() const const
bool isRead() const
bool isValid() const const
void reserve(int size)
void setCheckable(bool)
QString & replace(int position, int n, QChar after)
GestureType
T & last()
const QBrush & text() const const
int row() const const
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
bool currentlyVisible() const
Returns the current shared visibility state for this column.
Definition: theme.cpp:698
void subTreeToList(QVector< MessageItem * > &list)
Appends the whole subtree originating at this item to the specified list.
Definition: messageitem.cpp:573
Definition: aggregation.h:21
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:48
void triggered(bool checked)
SortDirection messageSortDirection() const
Returns the current message SortDirection.
Definition: sortorder.cpp:50
void setEnabled(bool)
bool containsTextItems() const
Returns true if this column contains text items.
Definition: theme.cpp:780
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
PositionAtCenter
startDragDistance
QEvent::Type type() const const
int blue() const const
QPointF pos() const
virtual void resizeEvent(QResizeEvent *event) override
void setRowHidden(int row, const QModelIndex &parent, bool hide)
Rectangle
LeftToRight
ExistingSelectionBehaviour
This enum is used in the view message selection functions (for instance View::selectNextMessage())
Definition: messagelist/src/core/enums.h:59
The QAbstractItemModel based interface that you need to provide for your storage to work with Message...
Definition: storagemodelbase.h:28
QString i18nc(const char *context, const char *text, const TYPE &arg...)
const Akonadi::MessageStatus & status() const
Returns the status associated to this Item.
Definition: item.cpp:446
int count(const T &value) const const
qint32 toQInt32() const
MessageTypeFilter
This enum is used in the view message selection functions (for instance View::nextMessageItem()).
Definition: messagelist/src/core/enums.h:51
static const MessageStatus statusHam()
This class manages the huge tree of displayable objects: GroupHeaderItems and MessageItems.
Definition: model.h:66
void setChecked(bool)
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:47
Item * itemAbove()
Returns the item that is visually above this item in the tree.
Definition: item.cpp:144
MouseEventSource
NoModifier
Item * itemBelowChild(Item *child)
Returns the item that is visually below the specified child if this item.
Definition: item.cpp:83
virtual void paintEvent(QPaintEvent *event) override
AcceleratingFlickMaximumTime
A set of aggregation options that can be applied to the MessageList::Model in a single shot.
Definition: aggregation.h:28
bool isImportant() const
QObject * parent() const const
QString message
WA_AcceptTouchEvents
QGesture * gesture(Qt::GestureType type) const const
Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer)
Item * deepestItem()
Returns the deepest item in the subtree originating at this item.
Definition: item.cpp:118
The Column class defines a view column available inside this theme.
Definition: theme.h:506
void accept()
void sectionResized(int logicalIndex, int oldSize, int newSize)
int stat(const QString &path, KDE_struct_stat *buf)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Jan 28 2023 04:09:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Jan 28 2023 04:09:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.