diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3b36ab..6ac427d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,120 +1,120 @@ ecm_create_qm_loader(kcompletion_QM_LOADER kcompletion5_qt) set(kcompletion_SRCS kcombobox.cpp kcompletion.cpp kcompletionbase.cpp kcompletionbox.cpp klineedit.cpp khistorycombobox.cpp kpixmapprovider.cpp kzoneallocator.cpp kcompletionbase.cpp kcompletionmatches.cpp ${kcompletion_QM_LOADER} ) add_library(KF5Completion ${kcompletion_SRCS}) add_library(KF5::Completion ALIAS KF5Completion) ecm_generate_export_header(KF5Completion BASE_NAME KCompletion GROUP_BASE_NAME KF VERSION ${KF5_VERSION} DEPRECATED_BASE_VERSION 0 - DEPRECATION_VERSIONS 4.0 4.5 5.0 5.46 + DEPRECATION_VERSIONS 4.0 4.5 5.0 5.46 5.66 EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} ) target_include_directories(KF5Completion INTERFACE "$") target_link_libraries(KF5Completion PUBLIC Qt5::Widgets PRIVATE KF5::ConfigCore # KConfigGroup, used in many places KF5::ConfigGui # KStandardShortcut KF5::WidgetsAddons # KCursor ) set_target_properties(KF5Completion PROPERTIES VERSION ${KCOMPLETION_VERSION_STRING} SOVERSION ${KCOMPLETION_SOVERSION} EXPORT_NAME Completion ) ecm_generate_headers(KCompletion_HEADERS HEADER_NAMES KComboBox KCompletion KCompletionBase KCompletionBox KLineEdit KHistoryComboBox KPixmapProvider KSortableList KCompletionMatches REQUIRED_HEADERS KCompletion_HEADERS ) find_package(PythonModuleGeneration) if (PythonModuleGeneration_FOUND) ecm_generate_python_binding( TARGET KF5::Completion PYTHONNAMESPACE PyKF5 MODULENAME KCompletion RULES_FILE "${CMAKE_SOURCE_DIR}/cmake/rules_PyKF5.py" SIP_DEPENDS QtWidgets/QtWidgetsmod.sip HEADERS kcombobox.h kcompletion.h kcompletionbase.h kcompletionbox.h klineedit.h khistorycombobox.h kpixmapprovider.h ksortablelist.h kcompletionmatches.h ) endif() install(TARGETS KF5Completion EXPORT KF5CompletionTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kcompletion_export.h ${KCompletion_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCompletion COMPONENT Devel ) if(BUILD_DESIGNERPLUGIN) add_subdirectory(designer) endif() if(BUILD_QCH) ecm_add_qch( KF5Completion_QCH NAME KCompletion BASE_NAME KF5Completion VERSION ${KF5_VERSION} ORG_DOMAIN org.kde SOURCES # using only public headers, to cover only public API ${KCompletion_HEADERS} MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md" IMAGE_DIRS "${CMAKE_SOURCE_DIR}/docs/pics" LINK_QCHS Qt5Core_QCH Qt5Gui_QCH Qt5Widgets_QCH INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} BLANK_MACROS KCOMPLETION_EXPORT KCOMPLETION_DEPRECATED "KCOMPLETION_DEPRECATED_VERSION(x, y, t)" TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} COMPONENT Devel ) endif() include(ECMGeneratePriFile) ecm_generate_pri_file(BASE_NAME KCompletion LIB_NAME KF5Completion DEPS "widgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KCompletion) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff --git a/src/khistorycombobox.cpp b/src/khistorycombobox.cpp index 9858bbd..c988e6a 100644 --- a/src/khistorycombobox.cpp +++ b/src/khistorycombobox.cpp @@ -1,498 +1,514 @@ /* This file is part of the KDE libraries Copyright (c) 2000,2001 Dawit Alemayehu Copyright (c) 2000,2001 Carsten Pfeiffer Copyright (c) 2000 Stefan Schimanski <1Stein@gmx.de> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "khistorycombobox.h" #include #include #include #include #include #include #include class KHistoryComboBoxPrivate { public: KHistoryComboBoxPrivate(KHistoryComboBox *parent): q_ptr(parent) {} void init(bool useCompletion); void rotateUp(); void rotateDown(); /** * Called from the popupmenu, * calls clearHistory() and emits cleared() */ void _k_clear(); /** * Appends our own context menu entry. */ void _k_addContextMenuItems(QMenu *); /** * Used to emit the activated(QString) signal when enter is pressed */ void _k_simulateActivated(const QString &); /** * The text typed before Up or Down was pressed. */ QString typedText; KPixmapProvider *pixmapProvider = nullptr; KHistoryComboBox * const q_ptr; /** * The current index in the combobox, used for Up and Down */ int currentIndex; /** * Indicates that the user at least once rotated Up through the entire list * Needed to allow going back after rotation. */ bool rotated = false; + std::function iconProvider; + Q_DECLARE_PUBLIC(KHistoryComboBox) }; void KHistoryComboBoxPrivate::init(bool useCompletion) { Q_Q(KHistoryComboBox); // Set a default history size to something reasonable, Qt sets it to INT_MAX by default q->setMaxCount(50); if (useCompletion) { q->completionObject()->setOrder(KCompletion::Weighted); } q->setInsertPolicy(KHistoryComboBox::NoInsert); currentIndex = -1; rotated = false; pixmapProvider = nullptr; // obey HISTCONTROL setting QByteArray histControl = qgetenv("HISTCONTROL"); if (histControl == "ignoredups" || histControl == "ignoreboth") { q->setDuplicatesEnabled(false); } q->connect(q, SIGNAL(aboutToShowContextMenu(QMenu*)), SLOT(_k_addContextMenuItems(QMenu*))); QObject::connect(q, QOverload::of(&QComboBox::activated), q, &KHistoryComboBox::reset); QObject::connect(q, QOverload::of(&KComboBox::returnPressed), q, &KHistoryComboBox::reset); // We want _k_simulateActivated to be called _after_ QComboBoxPrivate::_q_returnPressed // otherwise there's a risk of emitting activated twice (_k_simulateActivated will find // the item, after some app's slotActivated inserted the item into the combo). q->connect(q, SIGNAL(returnPressed(QString)), SLOT(_k_simulateActivated(QString)), Qt::QueuedConnection); } // we are always read-write KHistoryComboBox::KHistoryComboBox(QWidget *parent) : KComboBox(true, parent), d_ptr(new KHistoryComboBoxPrivate(this)) { Q_D(KHistoryComboBox); d->init(true); // using completion } // we are always read-write KHistoryComboBox::KHistoryComboBox(bool useCompletion, QWidget *parent) : KComboBox(true, parent), d_ptr(new KHistoryComboBoxPrivate(this)) { Q_D(KHistoryComboBox); d->init(useCompletion); } KHistoryComboBox::~KHistoryComboBox() { Q_D(KHistoryComboBox); delete d->pixmapProvider; } void KHistoryComboBox::setHistoryItems(const QStringList &items) { setHistoryItems(items, false); } void KHistoryComboBox::setHistoryItems(const QStringList &items, bool setCompletionList) { QStringList insertingItems = items; KComboBox::clear(); // limit to maxCount() const int itemCount = insertingItems.count(); const int toRemove = itemCount - maxCount(); if (toRemove >= itemCount) { insertingItems.clear(); } else { for (int i = 0; i < toRemove; ++i) { insertingItems.pop_front(); } } insertItems(insertingItems); if (setCompletionList && useCompletion()) { // we don't have any weighting information here ;( KCompletion *comp = completionObject(); comp->setOrder(KCompletion::Insertion); comp->setItems(insertingItems); comp->setOrder(KCompletion::Weighted); } clearEditText(); } QStringList KHistoryComboBox::historyItems() const { QStringList list; const int itemCount = count(); list.reserve(itemCount); for (int i = 0; i < itemCount; ++i) { list.append(itemText(i)); } return list; } bool KHistoryComboBox::useCompletion() const { return compObj(); } void KHistoryComboBox::clearHistory() { const QString temp = currentText(); KComboBox::clear(); if (useCompletion()) { completionObject()->clear(); } setEditText(temp); } void KHistoryComboBoxPrivate::_k_addContextMenuItems(QMenu *menu) { Q_Q(KHistoryComboBox); if (menu) { menu->addSeparator(); QAction *clearHistory = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-clear-history")), KHistoryComboBox::tr("Clear &History"), q, SLOT(_k_clear())); if (!q->count()) { clearHistory->setEnabled(false); } } } void KHistoryComboBox::addToHistory(const QString &item) { Q_D(KHistoryComboBox); if (item.isEmpty() || (count() > 0 && item == itemText(0))) { return; } bool wasCurrent = false; // remove all existing items before adding if (!duplicatesEnabled()) { int i = 0; int itemCount = count(); while (i < itemCount) { if (itemText(i) == item) { if (!wasCurrent) { wasCurrent = (i == currentIndex()); } removeItem(i); --itemCount; } else { ++i; } } } // now add the item - if (d->pixmapProvider) { + if (d->iconProvider) { + insertItem(0, d->iconProvider(item), item); + } else if (d->pixmapProvider) { insertItem(0, d->pixmapProvider->pixmapFor(item, iconSize().height()), item); } else { insertItem(0, item); } if (wasCurrent) { setCurrentIndex(0); } const bool useComp = useCompletion(); const int last = count() - 1; // last valid index const int mc = maxCount(); const int stopAt = qMax(mc, 0); for (int rmIndex = last; rmIndex >= stopAt; --rmIndex) { // remove the last item, as long as we are longer than maxCount() // remove the removed item from the completionObject if it isn't // anymore available at all in the combobox. const QString rmItem = itemText(rmIndex); removeItem(rmIndex); if (useComp && !contains(rmItem)) { completionObject()->removeItem(rmItem); } } if (useComp) { completionObject()->addItem(item); } } bool KHistoryComboBox::removeFromHistory(const QString &item) { if (item.isEmpty()) { return false; } bool removed = false; const QString temp = currentText(); int i = 0; int itemCount = count(); while (i < itemCount) { if (item == itemText(i)) { removed = true; removeItem(i); --itemCount; } else { ++i; } } if (removed && useCompletion()) { completionObject()->removeItem(item); } setEditText(temp); return removed; } // going up in the history, rotating when reaching QListBox::count() // // Note: this differs from QComboBox because "up" means ++index here, // to simulate the way shell history works (up goes to the most // recent item). In QComboBox "down" means ++index, to match the popup... // void KHistoryComboBoxPrivate::rotateUp() { Q_Q(KHistoryComboBox); // save the current text in the lineedit // (This is also where this differs from standard up/down in QComboBox, // where a single keypress can make you lose your typed text) if (currentIndex == -1) { typedText = q->currentText(); } ++currentIndex; // skip duplicates/empty items const int last = q->count() - 1; // last valid index const QString currText = q->currentText(); while (currentIndex < last && (currText == q->itemText(currentIndex) || q->itemText(currentIndex).isEmpty())) { ++currentIndex; } if (currentIndex >= q->count()) { rotated = true; currentIndex = -1; // if the typed text is the same as the first item, skip the first if (q->count() > 0 && typedText == q->itemText(0)) { currentIndex = 0; } q->setEditText(typedText); } else { q->setCurrentIndex(currentIndex); } } // going down in the history, no rotation possible. Last item will be // the text that was in the lineedit before Up was called. void KHistoryComboBoxPrivate::rotateDown() { Q_Q(KHistoryComboBox); // save the current text in the lineedit if (currentIndex == -1) { typedText = q->currentText(); } --currentIndex; const QString currText = q->currentText(); // skip duplicates/empty items while (currentIndex >= 0 && (currText == q->itemText(currentIndex) || q->itemText(currentIndex).isEmpty())) { --currentIndex; } if (currentIndex < 0) { if (rotated && currentIndex == -2) { rotated = false; currentIndex = q->count() - 1; q->setEditText(q->itemText(currentIndex)); } else { // bottom of history currentIndex = -1; if (q->currentText() != typedText) { q->setEditText(typedText); } } } else { q->setCurrentIndex(currentIndex); } } void KHistoryComboBox::keyPressEvent(QKeyEvent *e) { Q_D(KHistoryComboBox); int event_key = e->key() | e->modifiers(); if (KStandardShortcut::rotateUp().contains(event_key)) { d->rotateUp(); } else if (KStandardShortcut::rotateDown().contains(event_key)) { d->rotateDown(); } else { KComboBox::keyPressEvent(e); } } void KHistoryComboBox::wheelEvent(QWheelEvent *ev) { Q_D(KHistoryComboBox); // Pass to poppable listbox if it's up QAbstractItemView *const iv = view(); if (iv && iv->isVisible()) { QApplication::sendEvent(iv, ev); return; } // Otherwise make it change the text without emitting activated if (ev->angleDelta().y() > 0) { d->rotateUp(); } else { d->rotateDown(); } ev->accept(); } +#if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 66) void KHistoryComboBox::setPixmapProvider(KPixmapProvider *provider) { Q_D(KHistoryComboBox); if (d->pixmapProvider == provider) { return; } delete d->pixmapProvider; d->pixmapProvider = provider; // re-insert all the items with/without pixmap // I would prefer to use changeItem(), but that doesn't honor the pixmap // when using an editable combobox (what we do) if (count() > 0) { QStringList items(historyItems()); clear(); insertItems(items); } } +#endif + +void KHistoryComboBox::setIconProvider(std::function providerFunction) +{ + Q_D(KHistoryComboBox); + d->iconProvider = providerFunction; +} void KHistoryComboBox::insertItems(const QStringList &items) { Q_D(KHistoryComboBox); for (const QString item : items) { if (item.isEmpty()) { continue; } - if (d->pixmapProvider) { + if (d->iconProvider) { + addItem(d->iconProvider(item), item); + } else if (d->pixmapProvider) { addItem(d->pixmapProvider->pixmapFor(item, iconSize().height()), item); } else { addItem(item); } } } void KHistoryComboBoxPrivate::_k_clear() { Q_Q(KHistoryComboBox); q->clearHistory(); emit q->cleared(); } void KHistoryComboBoxPrivate::_k_simulateActivated(const QString &text) { Q_Q(KHistoryComboBox); /* With the insertion policy NoInsert, which we use by default, Qt doesn't emit activated on typed text if the item is not already there, which is perhaps reasonable. Generate the signal ourselves if that's the case. */ if ((q->insertPolicy() == q->NoInsert && q->findText(text, Qt::MatchFixedString | Qt::MatchCaseSensitive) == -1)) { #if QT_DEPRECATED_SINCE(5, 15) || QT_VERSION < QT_VERSION_CHECK(5, 14, 0) emit q->activated(text); #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) emit q->textActivated(text); #endif } /* Qt also doesn't emit it if the box is full, and policy is not InsertAtCurrent */ else if (q->insertPolicy() != q->InsertAtCurrent && q->count() >= q->maxCount()) { #if QT_DEPRECATED_SINCE(5, 15) || QT_VERSION < QT_VERSION_CHECK(5, 14, 0) emit q->activated(text); #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) emit q->textActivated(text); #endif } } +#if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 66) KPixmapProvider *KHistoryComboBox::pixmapProvider() const { Q_D(const KHistoryComboBox); return d->pixmapProvider; } +#endif void KHistoryComboBox::reset() { Q_D(KHistoryComboBox); d->currentIndex = -1; d->rotated = false; } #include "moc_khistorycombobox.cpp" diff --git a/src/khistorycombobox.h b/src/khistorycombobox.h index a3eb9ee..d500ccb 100644 --- a/src/khistorycombobox.h +++ b/src/khistorycombobox.h @@ -1,262 +1,277 @@ /* This file is part of the KDE libraries Copyright (c) 2000,2001 Dawit Alemayehu Copyright (c) 2000,2001 Carsten Pfeiffer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KHistoryComboBoxBOX_H #define KHistoryComboBoxBOX_H #include #include +#include + class KPixmapProvider; class KHistoryComboBoxPrivate; /** * @class KHistoryComboBox khistorycombobox.h KHistoryComboBox * * @short A combobox for offering a history and completion * * A combobox which implements a history like a unix shell. You can navigate * through all the items by using the Up or Down arrows (configurable of * course). Additionally, weighted completion is available. So you should * load and save the completion list to preserve the weighting between * sessions. * * KHistoryComboBox obeys the HISTCONTROL environment variable to determine * whether duplicates in the history should be tolerated in * addToHistory() or not. During construction of KHistoryComboBox, * duplicates will be disabled when HISTCONTROL is set to "ignoredups" or * "ignoreboth". Otherwise, duplicates are enabled by default. * * \image html khistorycombobox.png "KHistoryComboBox widget" * * @author Carsten Pfeiffer */ class KCOMPLETION_EXPORT KHistoryComboBox : public KComboBox { Q_OBJECT Q_DECLARE_PRIVATE(KHistoryComboBox) Q_PROPERTY(QStringList historyItems READ historyItems WRITE setHistoryItems) public: /** * Constructs a "read-write" combobox. A read-only history combobox * doesn't make much sense, so it is only available as read-write. * Completion will be used automatically for the items in the combo. * * The insertion-policy is set to NoInsert, you have to add the items * yourself via the slot addToHistory. If you want every item added, * use * * \code * connect( combo, SIGNAL( activated( const QString& )), * combo, SLOT( addToHistory( const QString& ))); * \endcode * * Use QComboBox::setMaxCount() to limit the history. * * @p parent the parent object of this widget. */ explicit KHistoryComboBox(QWidget *parent = nullptr); /** * Same as the previous constructor, but additionally has the option * to specify whether you want to let KHistoryComboBox handle completion * or not. If set to @c true, KHistoryComboBox will sync the completion to the * contents of the combobox. */ explicit KHistoryComboBox(bool useCompletion, QWidget *parent = nullptr); /** * Destructs the combo, the completion-object and the pixmap-provider */ ~KHistoryComboBox() override; /** * Inserts @p items into the combobox. @p items might get * truncated if it is longer than maxCount() * * @see historyItems */ void setHistoryItems(const QStringList &items); /** * Inserts @p items into the combobox. @p items might get * truncated if it is longer than maxCount() * * Set @c setCompletionList to true, if you don't have a list of * completions. This tells KHistoryComboBox to use all the items for the * completion object as well. * You won't have the benefit of weighted completion though, so normally * you should do something like * \code * KConfigGroup config(KSharedConfig::openConfig(), "somegroup"); * * // load the history and completion list after creating the history combo * QStringList list; * list = config.readEntry("Completion list", QStringList()); * combo->completionObject()->setItems(list); * list = config.readEntry("History list", QStringList()); * combo->setHistoryItems(list); * * [...] * * // save the history and completion list when the history combo is * // destroyed * QStringList list; * KConfigGroup config(KSharedConfig::openConfig(), "somegroup"); * list = combo->completionObject()->items(); * config.writeEntry("Completion list", list); * list = combo->historyItems(); * config.writeEntry("History list", list); * \endcode * * Be sure to use different names for saving with KConfig if you have more * than one KHistoryComboBox. * * Note: When @c setCompletionList is true, the items are inserted into the * KCompletion object with mode KCompletion::Insertion and the mode is set * to KCompletion::Weighted afterwards. * * @see historyItems * @see KComboBox::completionObject * @see KCompletion::setItems * @see KCompletion::items */ void setHistoryItems(const QStringList &items, bool setCompletionList); /** * Returns the list of history items. Empty, when this is not a read-write * combobox. * * @see setHistoryItems */ QStringList historyItems() const; /** * Removes all items named @p item. * * @return @c true if at least one item was removed. * * @see addToHistory */ bool removeFromHistory(const QString &item); /** * Sets a pixmap provider, so that items in the combobox can have a pixmap. * KPixmapProvider is just an abstract class with the one pure virtual * method KPixmapProvider::pixmapFor(). This method is called whenever * an item is added to the KHistoryComboBoxBox. Implement it to return your * own custom pixmaps, or use the KUrlPixmapProvider from KIO, * which uses KMimeType::pixmapForUrl to resolve icons. * * Set @p provider to nullptr if you want to disable pixmaps. Default no pixmaps. * * @see pixmapProvider + * @deprecated since 5.66, use setIconProvider */ +#if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 66) + KCOMPLETION_DEPRECATED_VERSION(5, 66, "Use setIconProvider") void setPixmapProvider(KPixmapProvider *provider); /** * @returns the current pixmap provider. * @see setPixmapProvider * @see KPixmapProvider + * @deprecated since 5.66, unused */ + KCOMPLETION_DEPRECATED_VERSION(5, 66, "unused") KPixmapProvider *pixmapProvider() const; +#endif + + /** + * Sets an icon provider, so that items in the combobox can have an icon. + * The provider is a function that takes a QString and returns a QIcon + * @since 5.66 + */ + void setIconProvider(std::function providerFunction); using QComboBox::insertItems; public Q_SLOTS: /** * Adds an item to the end of the history list and to the completion list. * If maxCount() is reached, the first item of the list will be * removed. * * If the last inserted item is the same as @p item, it will not be * inserted again. * * If duplicatesEnabled() is false, any equal existing item will be * removed before @p item is added. * * Note: By using this method and not the Q and KComboBox insertItem() * methods, you make sure that the combobox stays in sync with the * completion. It would be annoying if completion would give an item * not in the combobox, and vice versa. * * @see removeFromHistory * @see QComboBox::setDuplicatesEnabled */ void addToHistory(const QString &item); /** * Clears the history and the completion list. */ void clearHistory(); /** * Resets the current position of the up/down history. Call this * when you manually call setCurrentItem() or clearEdit(). */ void reset(); Q_SIGNALS: /** * Emitted when the history was cleared by the entry in the popup menu. */ void cleared(); protected: /** * Handling key-events, the shortcuts to rotate the items. */ void keyPressEvent(QKeyEvent *) override; /** * Handling wheel-events, to rotate the items. */ void wheelEvent(QWheelEvent *ev) override; /** * Inserts @p items into the combo, honoring pixmapProvider() * Does not update the completionObject. * * Note: duplicatesEnabled() is not honored here. * * Called from setHistoryItems() and setPixmapProvider() */ void insertItems(const QStringList &items); /** * @returns if we can modify the completion object or not. */ bool useCompletion() const; private: const QScopedPointer d_ptr; Q_PRIVATE_SLOT(d_func(), void _k_clear()) Q_PRIVATE_SLOT(d_func(), void _k_addContextMenuItems(QMenu *)) Q_PRIVATE_SLOT(d_func(), void _k_simulateActivated(const QString &)) Q_DISABLE_COPY(KHistoryComboBox) }; #endif