Git commit a77b78c18ab3a14a024711fe2883dab1e3c2926b by Jan Kundr?t, on behalf of Thomas L?bking. Committed on 11/01/2013 at 01:30. Pushed by jkt into branch 'master'.
GUI: Don't switch between the multipart/alternative parts by mouse wheel This prevents me from accidentally seeing ugly html mails ;-) Ported-by: Jan Kundr?t <jkt at flaska.net> M +13 -0 src/Gui/PartWidget.cpp M +2 -0 src/Gui/PartWidget.h http://commits.kde.org/trojita/a77b78c18ab3a14a024711fe2883dab1e3c2926b diff --git a/src/Gui/PartWidget.cpp b/src/Gui/PartWidget.cpp index 640a962..be7f41b 100644 --- a/src/Gui/PartWidget.cpp +++ b/src/Gui/PartWidget.cpp @@ -24,6 +24,7 @@ #include <QLabel> #include <QModelIndex> #include <QVBoxLayout> +#include <QTabBar> #include "PartWidgetFactory.h" #include "Rfc822HeaderView.h" @@ -78,6 +79,9 @@ MultipartAlternativeWidget::MultipartAlternativeWidget(QWidget *parent, addTab(item, mimeType); } setCurrentIndex(preferredIndex); + Q_FOREACH(QTabBar *tb, findChildren<QTabBar*>()) { + tb->installEventFilter(this); + } } QString MultipartAlternativeWidget::quoteMe() const @@ -98,6 +102,15 @@ void MultipartAlternativeWidget::reloadContents() } } +bool MultipartAlternativeWidget::eventFilter(QObject *o, QEvent *e) +{ + if (e->type() == QEvent::Wheel && qobject_cast<QTabBar*>(o)) { // don't alter part while wheeling + e->ignore(); + return true; + } + return false; +} + MultipartSignedWidget::MultipartSignedWidget(QWidget *parent, PartWidgetFactory *factory, const QModelIndex &partIndex, const int recursionDepth): diff --git a/src/Gui/PartWidget.h b/src/Gui/PartWidget.h index de90c2d..8d7ccee 100644 --- a/src/Gui/PartWidget.h +++ b/src/Gui/PartWidget.h @@ -43,6 +43,8 @@ public: const int recursionDepth, const QString &preferredMimeType); virtual QString quoteMe() const; virtual void reloadContents(); +protected: + bool eventFilter(QObject *o, QEvent *e); }; /** @short Message quoting support for multipart/signed MIME type */
