| 1 | /* |
| 2 | This file is part of the KDE libraries |
| 3 | |
| 4 | SPDX-FileCopyrightText: 2007 Aaron Seigo <aseigo@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef KLINEEDIT_P_H |
| 10 | #define KLINEEDIT_P_H |
| 11 | |
| 12 | #include "klineedit.h" |
| 13 | |
| 14 | class KCompletionBox; |
| 15 | class KLineEditUrlDropEventFilter; |
| 16 | |
| 17 | class KLineEditPrivate |
| 18 | { |
| 19 | public: |
| 20 | explicit KLineEditPrivate(KLineEdit *parent) |
| 21 | : q_ptr(parent) |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | ~KLineEditPrivate(); |
| 26 | |
| 27 | void _k_textChanged(const QString &text); |
| 28 | void (QAction *act); |
| 29 | void _k_tripleClickTimeout(); // resets possibleTripleClick |
| 30 | void _k_restoreSelectionColors(); |
| 31 | void _k_completionBoxTextChanged(const QString &text); |
| 32 | |
| 33 | void updateUserText(const QString &text); |
| 34 | |
| 35 | /*! |
| 36 | * Checks whether we should/should not consume a key used as a shortcut. |
| 37 | * This makes it possible to handle shortcuts in the focused widget before any |
| 38 | * window-global QAction is triggered. |
| 39 | */ |
| 40 | bool overrideShortcut(const QKeyEvent *e); |
| 41 | |
| 42 | void init(); |
| 43 | |
| 44 | bool copySqueezedText(bool copy) const; |
| 45 | |
| 46 | /*! |
| 47 | * Properly sets the squeezed text whenever the widget is |
| 48 | * created or resized. |
| 49 | */ |
| 50 | void setSqueezedText(); |
| 51 | |
| 52 | QMap<KCompletion::CompletionMode, bool> disableCompletionMap; |
| 53 | |
| 54 | QColor previousHighlightColor; |
| 55 | QColor previousHighlightedTextColor; |
| 56 | |
| 57 | QPalette::ColorRole bgRole; |
| 58 | |
| 59 | QString squeezedText; |
| 60 | QString userText; |
| 61 | QString lastStyleClass; |
| 62 | |
| 63 | QMetaObject::Connection m_matchesConnection; |
| 64 | KCompletionBox *completionBox; |
| 65 | |
| 66 | KLineEditUrlDropEventFilter *urlDropEventFilter; |
| 67 | |
| 68 | QAction *noCompletionAction; |
| 69 | QAction *shellCompletionAction; |
| 70 | QAction *autoCompletionAction; |
| 71 | QAction *; |
| 72 | QAction *shortAutoCompletionAction; |
| 73 | QAction *; |
| 74 | QAction *defaultAction; |
| 75 | |
| 76 | KLineEdit *const q_ptr; |
| 77 | |
| 78 | int squeezedEnd; |
| 79 | int squeezedStart; |
| 80 | |
| 81 | static bool s_initialized; |
| 82 | static bool s_backspacePerformsCompletion; // Configuration option |
| 83 | |
| 84 | bool userSelection : 1; |
| 85 | bool autoSuggest : 1; |
| 86 | bool disableRestoreSelection : 1; |
| 87 | bool handleURLDrops : 1; |
| 88 | bool trapReturnKeyEvents : 1; |
| 89 | bool enableSqueezedText : 1; |
| 90 | bool completionRunning : 1; |
| 91 | bool italicizePlaceholder : 1; |
| 92 | bool threeStars : 1; |
| 93 | bool possibleTripleClick : 1; // set in mousePressEvent, deleted in tripleClickTimeout |
| 94 | Q_DECLARE_PUBLIC(KLineEdit) |
| 95 | }; |
| 96 | |
| 97 | #endif |
| 98 | |