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.
627 qCDebug(MESSAGELIST_LOG) << "Resize event enter (viewport width is " << viewport()->width() << ")";
862 selectionModel()->select(currentIndex(), QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
875 selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
880 selectionModel()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Current | QItemSelectionModel::Clear);
1000 if (!static_cast<MessageItem *>(item)->parent() || (static_cast<MessageItem *>(item)->parent()->type() != Item::Message)) {
1122Item *View::messageItemAfter(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
1133 if ((referenceItem->childItemCount() > 0) && ((messageTypeFilter != MessageTypeAny) || isExpanded(d->mModel->index(referenceItem, 0)))) {
1134 // the current item had children: either expanded or we want unread/new messages (and so we'll expand it if it isn't)
1177 (!message_type_matches(below, messageTypeFilter)) || // is hidden (and we don't want hidden items as they aren't "officially" in the view)
1179 ((d->mModel->flags(belowIndex) & (Qt::ItemIsSelectable | Qt::ItemIsEnabled)) != (Qt::ItemIsSelectable | Qt::ItemIsEnabled))) {
1181 if ((below->childItemCount() > 0) && ((messageTypeFilter != MessageTypeAny) || isExpanded(belowIndex))) {
1182 // the current item had children: either expanded or we want unread messages (and so we'll expand it if it isn't)
1194 if (referenceItem) { // <-- this means "we have started from something that is not the top: looping makes sense"
1238Item *View::messageItemBefore(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
1251 if ((siblingAbove && siblingAbove != referenceItem && siblingAbove != parent) && (siblingAbove->childItemCount() > 0)
1252 && ((messageTypeFilter != MessageTypeAny) || (isExpanded(d->mModel->index(siblingAbove, 0))))) {
1253 // the current item had children: either expanded or we want unread/new messages (and so we'll expand it if it isn't)
1297 (!message_type_matches(above, messageTypeFilter)) || // we don't expand items but the item has parents unexpanded (so should be skipped)
1304 ((d->mModel->flags(aboveIndex) & (Qt::ItemIsSelectable | Qt::ItemIsEnabled)) != (Qt::ItemIsSelectable | Qt::ItemIsEnabled))) {
1311 if (referenceItem) { // <-- this means "we have started from something that is not the beginning: looping makes sense"
1398 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1411 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1424 selectionModel()->select(newSelectedIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
1428bool View::selectNextMessageItem(MessageTypeFilter messageTypeFilter, ExistingSelectionBehaviour existingSelectionBehaviour, bool centerItem, bool loop)
1465bool View::selectPreviousMessageItem(MessageTypeFilter messageTypeFilter, ExistingSelectionBehaviour existingSelectionBehaviour, bool centerItem, bool loop)
1502bool View::focusNextMessageItem(MessageTypeFilter messageTypeFilter, bool centerItem, bool loop)
1526bool View::focusPreviousMessageItem(MessageTypeFilter messageTypeFilter, bool centerItem, bool loop)
1561 selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows);
1775 selectionModel()->select(aMessageIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
1911 qCDebug(MESSAGELIST_LOG) << "View message selected [" << static_cast<MessageItem *>(it)->subject() << "]";
2007void View::changeMessageStatus(MessageItem *it, Akonadi::MessageStatus set, Akonadi::MessageStatus unset)
2010 // visible to the user even if the Model is actually in the middle of a long job (maybe it's loading)
2013 // d->mWidget->viewMessageStatusChangeRequest() will really perform the status change on the storage.
2061 if ((e->pos() - d->mMousePressPosition).manhattanLength() <= QApplication::startDragDistance()) {
2095 d->mWidget->viewGroupHeaderContextPopupRequest(static_cast< GroupHeaderItem * >(item), viewport()->mapToGlobal(pos));
2097 d->mWidget->viewMessageListContextPopupRequest(selectionAsMessageItemList(), viewport()->mapToGlobal(pos));
2203 const QString textDirection = textIsLeftToRight ? QStringLiteral("left") : QStringLiteral("right");
2205 QString tip = QStringLiteral("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">");
2240 tip += htmlCodeForStandardRow.arg(i18nc("Receiver of the email", "To"), mi->displayReceiver().toHtmlEscaped());
2244 tip += htmlCodeForStandardRow.arg(mi->displayReceiver().toHtmlEscaped(), i18nc("Receiver of the email", "To"));
2269 tip += htmlCodeForStandardRow.arg(i18n("Note"), mi->annotation().replace(QLatin1Char('\n'), QStringLiteral("<br>")));
2271 tip += htmlCodeForStandardRow.arg(mi->annotation().replace(QLatin1Char('\n'), QStringLiteral("<br>"))).arg(i18n("Note"));
2278 tip += htmlCodeForStandardRow.arg(i18n("Preview"), content.replace(QLatin1Char('\n'), QStringLiteral("<br>")));
2280 tip += htmlCodeForStandardRow.arg(content.replace(QLatin1Char('\n'), QStringLiteral("<br>"))).arg(i18n("Preview"));
2337 description = i18nc("@info:tooltip Formats to something like 'Threads started on 2008-12-21'", "Threads started on %1", ghi->label());
2339 description = i18nc("@info:tooltip Formats to something like 'Threads started Yesterday'", "Threads started %1", ghi->label());
2353 description = i18nc("@info:tooltip Formats to something like 'Messages sent on 2008-12-21'", "Messages sent on %1", ghi->label());
2356 i18nc("@info:tooltip Formats to something like 'Messages received on 2008-12-21'", "Messages received on %1", ghi->label());
2360 description = i18nc("@info:tooltip Formats to something like 'Messages sent Yesterday'", "Messages sent %1", ghi->label());
2362 description = i18nc("@info:tooltip Formats to something like 'Messages received Yesterday'", "Messages received %1", ghi->label());
2462 i18np("<b>%1</b> message (<b>%2</b> unread)", "<b>%1</b> messages (<b>%2</b> unread)", stats.mTotalChildCount, stats.mUnreadChildCount);
2620 qCDebug(MESSAGELIST_LOG) << "Left hit with selectedIndexes().count() == " << q->selectedIndexes().count();
2635 it->status().isImportant() ? Akonadi::MessageStatus() : Akonadi::MessageStatus::statusImportant(),
2636 it->status().isImportant() ? Akonadi::MessageStatus::statusImportant() : Akonadi::MessageStatus());
2639 q->changeMessageStatusRead(static_cast<MessageItem *>(it), it->status().isRead() ? false : true);
2646 : (it->status().isHam() ? Akonadi::MessageStatus::statusSpam() : Akonadi::MessageStatus::statusHam()),
2655 : (it->status().isWatched() ? Akonadi::MessageStatus::statusIgnored() : Akonadi::MessageStatus::statusWatched()),
2658 : (it->status().isWatched() ? Akonadi::MessageStatus::statusWatched() : Akonadi::MessageStatus()));
2667 // Let QTreeView handle the selection and Q_EMIT the appropriate signals (slotSelectionChanged() may be called)
2672 // Let QTreeView handle the selection and Q_EMIT the appropriate signals (slotSelectionChanged() may be called)
2675 mWidget->viewMessageListContextPopupRequest(q->selectionAsMessageItemList(), q->viewport()->mapToGlobal(e->pos()));
2708 mWidget->viewGroupHeaderContextPopupRequest(groupHeaderItem, q->viewport()->mapToGlobal(e->pos()));
2746 } else if (mScroller->state() == QScroller::Pressed || mScroller->state() == QScroller::Inactive) {
2754 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
2788 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
2809 QMouseEvent fakeMousePress(QEvent::MouseButtonPress, tapViewportPos, tapViewportPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
2827 // with touch you can touch multiple widgets at the same time, but only one widget will get a mousePressEvent.
void fromQInt32(qint32 status)
void setRead(bool read=true)
bool isRead() const
qint32 toQInt32() const
A set of aggregation options that can be applied to the MessageList::Model in a single shot.
Definition aggregation.h:29
@ GroupByDateRange
Use smart (thread leader) date ranges ("Today","Yesterday","Last Week"...)
Definition aggregation.h:39
@ GroupBySenderOrReceiver
Group by sender (incoming) or receiver (outgoing) field.
Definition aggregation.h:40
@ TopmostMessage
The thread grouping is computed from the topmost message (very similar to least recent,...
Definition aggregation.h:79
@ MostRecentMessage
The thread grouping is computed from the most recent message.
Definition aggregation.h:81
A structure used with MessageList::Item::childItemStats().
Definition item.h:173
A single item of the MessageList tree managed by MessageList::Model.
Definition item.h:36
const Akonadi::MessageStatus & status() const
Returns the status associated to this Item.
Definition item.cpp:447
Item * itemAbove()
Returns the item that is visually above this item in the tree.
Definition item.cpp:144
Item * itemBelowChild(Item *child)
Returns the item that is visually below the specified child if this item.
Definition item.cpp:83
Item * parent() const
Returns the parent Item in the tree, or 0 if this item isn't attached to the tree.
Definition item.cpp:437
Item * deepestItem()
Returns the deepest item in the subtree originating at this item.
Definition item.cpp:118
Item * itemBelow()
Returns the item that is visually below this item in the tree.
Definition item.cpp:103
void subTreeToList(QList< MessageItem * > &list)
Appends the whole subtree originating at this item to the specified list.
Definition messageitem.cpp:571
This class manages the huge tree of displayable objects: GroupHeaderItems and MessageItems.
Definition model.h:54
void statusMessage(const QString &message)
Notify the outside when updating the status bar with a message could be useful.
A class which holds information about sorting, e.g.
Definition sortorder.h:23
MessageSorting messageSorting() const
Returns the current message sorting option.
Definition sortorder.cpp:40
@ SortMessagesByDateTimeOfMostRecent
Sort the messages by date and time of the most recent message in subtree.
Definition sortorder.h:63
SortDirection messageSortDirection() const
Returns the current message SortDirection.
Definition sortorder.cpp:50
The QAbstractItemModel based interface that you need to provide for your storage to work with Message...
Definition storagemodelbase.h:29
The Column class defines a view column available inside this theme.
Definition theme.h:506
void setCurrentWidth(double currentWidth)
Sets the current shared width setting for this column.
Definition theme.cpp:713
bool currentlyVisible() const
Returns the current shared visibility state for this column.
Definition theme.cpp:698
void setCurrentlyVisible(bool currentlyVisible)
Sets the current shared visibility state for this column.
Definition theme.cpp:703
bool containsTextItems() const
Returns true if this column contains text items.
Definition theme.cpp:780
The Theme class defines the visual appearance of the MessageList.
Definition theme.h:48
Provides a widget which has the messagelist and the most important helper widgets,...
Definition widgetbase.h:41
void statusMessage(const QString &message)
Notify the outside when updating the status bar with a message could be useful.
bool visible() const
Q_SCRIPTABLE CaptureState status()
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
ExistingSelectionBehaviour
This enum is used in the view message selection functions (for instance View::selectNextMessage())
Definition messagelist/src/core/enums.h:47
PreSelectionMode
Pre-selection is the action of automatically selecting a message just after the folder has finished l...
Definition messagelist/src/core/enums.h:28
MessageTypeFilter
This enum is used in the view message selection functions (for instance View::nextMessageItem()).
Definition messagelist/src/core/enums.h:39
PositionAtCenter
ScrollPerPixel
ExtendedSelection
virtual bool event(QEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
QWidget * viewport() const const
void triggered(bool checked)
startDragDistance
const QColor & color() const const
void setAlpha(int alpha)
FontChange
void accept()
Type type() const const
void setItalic(bool enable)
QGesture * gesture(Qt::GestureType type) const const
Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer)
layoutDirection
Interactive
void sectionResized(int logicalIndex, int oldSize, int newSize)
QModelIndexList indexes() const const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
bool contains(const AT &value) const const
qsizetype count() const const
T & first()
bool isEmpty() const const
T & last()
void * internalPointer() const const
bool isValid() const const
QPoint pos() const const
Qt::MouseEventSource source() const const
const QObjectList & children() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
virtual bool event(QEvent *e)
QObject * parent() const const
T qobject_cast(QObject *object)
ToolTipBase
const QColor & color(ColorGroup group, ColorRole role) const const
const QBrush & text() const const
Rectangle
Scrolling
QScroller * scroller(QObject *target)
AcceleratingFlickMaximumTime
void setScrollMetric(ScrollMetric metric, const QVariant &value)
Qt::MouseButton button() const const
Qt::MouseButtons buttons() const const
QString arg(Args &&... args) const const
bool isEmpty() const const
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QString trimmed() const const
AlignCenter
UniqueConnection
CustomContextMenu
GestureStarted
GestureType
ItemIsSelectable
NoModifier
LeftToRight
LeftButton
MouseEventSource
ScrollBarAsNeeded
WA_AcceptTouchEvents
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void timeout()
void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)
virtual void changeEvent(QEvent *event) override
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void paintEvent(QPaintEvent *event) override
void setRowHidden(int row, const QModelIndex &parent, bool hide)
virtual void updateGeometries() override
void customContextMenuRequested(const QPoint &pos)
palette
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.