qt4_wrap_cpp(MOC ${MOC_HDRS})
include_directories(${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/client)
+ ${CMAKE_SOURCE_DIR}/src/client
+ ${CMAKE_SOURCE_DIR}/src/qtui
+ ${CMAKE_SOURCE_DIR}/src/uisupport)
add_library(mod_uisupport STATIC ${SOURCES} ${MOC} ${HEADERS})
add_dependencies(mod_uisupport mod_common mod_client)
#include "network.h"
#include "networkmodel.h"
#include "uisettings.h"
+#include "action.h"
+#include "actioncollection.h"
+#include "qtui.h"
#include <QRegExp>
_enabled(false),
_nickSuffix(": ")
{
+ // use both an Action and generic eventFilter, to make the shortcut configurable
+ // yet still be able to reset() when required
_lineEdit->installEventFilter(this);
+ ActionCollection *coll = QtUi::actionCollection("General");
+ coll->addAction("TabCompletionKey", new Action(tr("Tab completion"), coll,
+ this, SLOT(onTabCompletionKey()), QKeySequence(Qt::Key_Tab)));
+}
+
+void TabCompleter::onTabCompletionKey() {
+ complete();
}
void TabCompleter::buildCompletionList() {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
- if(keyEvent->key() == Qt::Key_Tab) {
- complete();
- return true;
- } else {
+ if(keyEvent->key() != QtUi::actionCollection("General")->action("TabCompletionKey")->shortcut()) {
reset();
- return false;
}
+ return false;
}
// this determines the sort order