Commit 46df75ba authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use new api

parent b602c1b0
......@@ -34,7 +34,7 @@ set(KMIME_LIB_VERSION "5.14.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.14.40")
set(KMAILTRANSPORT_LIB_VERSION "5.14.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.14.40")
set(LIBKDEPIM_LIB_VERSION "5.14.40")
set(LIBKDEPIM_LIB_VERSION "5.14.41")
set(PIMCOMMON_LIB_VERSION "5.14.40")
set(KIMAP_LIB_VERSION "5.14.40")
......
......@@ -12,7 +12,7 @@ macro(add_sieveeditor_autocreatescripts _source _extrasource)
ecm_add_test(${_test}
TEST_NAME ${_name}
NAME_PREFIX "sieveeditor-autocreatescripts-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets KF5::I18n KF5::Completion KF5::ConfigCore KF5::KSieveUi KF5::MailTransport
LINK_LIBRARIES Qt5::Test Qt5::Widgets KF5::I18n KF5::Completion KF5::ConfigCore KF5::KSieveUi KF5::MailTransport KF5::Libkdepim
)
endmacro()
......
......@@ -18,10 +18,11 @@
*/
#include "selectheadertypecombobox.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include <Libkdepim/LineEditCatchReturnKey>
#include <KLocalizedString>
#include <KLineEdit>
#include <QPushButton>
#include <QLineEdit>
#include <QPointer>
#include <QIcon>
#include <QVBoxLayout>
......@@ -67,7 +68,7 @@ SelectHeadersDialog::SelectHeadersDialog(QWidget *parent)
QHBoxLayout *hbox = new QHBoxLayout;
mNewHeader = new QLineEdit(this);
new LineEditCatchReturnKey(mNewHeader, this);
new KPIM::LineEditCatchReturnKey(mNewHeader, this);
mNewHeader->setObjectName(QStringLiteral("newheader"));
mNewHeader->setClearButtonEnabled(true);
//mNewHeader->setTrapReturnKey(true);
......@@ -323,33 +324,3 @@ void SelectHeaderTypeComboBox::setCode(const QString &code)
mCode = code;
changeReadOnlyStatus();
}
LineEditCatchReturnKey::LineEditCatchReturnKey(QLineEdit *lineEdit, QObject *parent)
: QObject(parent)
, mLineEdit(lineEdit)
{
mLineEdit->installEventFilter(this);
}
LineEditCatchReturnKey::~LineEditCatchReturnKey()
{
}
bool LineEditCatchReturnKey::eventFilter(QObject *obj, QEvent *event)
{
if (obj == mLineEdit) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *e = static_cast<QKeyEvent *>(event);
if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
const bool stopEvent = (e->modifiers() == Qt::NoButton ||
e->modifiers() == Qt::KeypadModifier);
if (stopEvent) {
Q_EMIT mLineEdit->returnPressed();
}
return true;
}
}
}
return QObject::eventFilter(obj, event);
}
......@@ -24,23 +24,10 @@
#include <QListWidget>
class KLineEdit;
class QLineEdit;
class QPushButton;
namespace KSieveUi {
class LineEditCatchReturnKey : public QObject
{
Q_OBJECT
public:
explicit LineEditCatchReturnKey(QLineEdit *lineEdit, QObject *parent = nullptr);
~LineEditCatchReturnKey();
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
QLineEdit *mLineEdit = nullptr;
};
class SelectHeadersWidget : public QListWidget
{
Q_OBJECT
......
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