Messagelib

composerlineedit.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
3 
4  Based on kmail/kmlineeditspell.h/cpp
5  SPDX-FileCopyrightText: 1997 Markus Wuebben <[email protected]>
6 
7  SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #include "composerlineedit.h"
11 #include <KCompletionBox>
12 #include <QKeyEvent>
13 
14 #include "settings/messagecomposersettings.h"
15 
16 using namespace MessageComposer;
17 
18 ComposerLineEdit::ComposerLineEdit(bool useCompletion, QWidget *parent)
19  : PimCommon::AddresseeLineEdit(parent, useCompletion)
20 {
21  allowSemicolonAsSeparator(MessageComposerSettings::allowSemicolonAsAddressSeparator());
22  setShowRecentAddresses(MessageComposerSettings::self()->showRecentAddressesInComposer());
23  setRecentAddressConfig(MessageComposerSettings::self()->config());
24  loadContacts();
25  setEnableBalooSearch(MessageComposerSettings::showBalooSearchInComposer());
26 }
27 
28 ComposerLineEdit::~ComposerLineEdit() = default;
29 
30 //-----------------------------------------------------------------------------
31 void ComposerLineEdit::keyPressEvent(QKeyEvent *e)
32 {
33  if ((e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && !completionBox()->isVisible()) {
34  Q_EMIT focusDown();
35  AddresseeLineEdit::keyPressEvent(e);
36  return;
37  } else if (e->key() == Qt::Key_Up) {
38  Q_EMIT focusUp();
39  return;
40  } else if (e->key() == Qt::Key_Down) {
41  Q_EMIT focusDown();
42  return;
43  }
44  AddresseeLineEdit::keyPressEvent(e);
45 }
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
Key_Enter
KSharedConfigPtr config()
int key() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Mar 22 2023 04:07:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.