diff options
Diffstat (limited to 'Swift/QtUI/UserSearch/QtSuggestingJIDInput.h')
-rw-r--r-- | Swift/QtUI/UserSearch/QtSuggestingJIDInput.h | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h index 673621c..402667d 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h @@ -4,8 +4,16 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2014-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once +#include <boost/signals2.hpp> + #include <QLineEdit> #include <QTreeView> @@ -18,40 +26,44 @@ class SettingsProvider; class ContactListModel; class QtSuggestingJIDInput : public QLineEdit { - Q_OBJECT - public: - QtSuggestingJIDInput(QWidget* parent, SettingsProvider* settings); - virtual ~QtSuggestingJIDInput(); + Q_OBJECT + public: + QtSuggestingJIDInput(QWidget* parent, SettingsProvider* settings); + virtual ~QtSuggestingJIDInput(); + + Contact::ref getContact(); + + void setSuggestions(const std::vector<Contact::ref>& suggestions); - const Contact* getContact(); + void clear(); - void setSuggestions(const std::vector<Contact>& suggestions); + boost::signals2::signal<void (const Contact::ref&)> onUserSelected; - signals: - void editingDone(); + signals: + void editingDone(); - protected: - virtual void keyPressEvent(QKeyEvent* event); + protected: + virtual void keyPressEvent(QKeyEvent* event); + virtual void hideEvent(QHideEvent* event); - private: - void handleSettingsChanged(const std::string& setting); + private: + void handleSettingsChanged(const std::string& setting); - private slots: - void handleClicked(const QModelIndex& index); - void handleApplicationFocusChanged(QWidget* old, QWidget* now); + private slots: + void handleClicked(const QModelIndex& index); + void handleApplicationFocusChanged(QWidget* old, QWidget* now); - private: - void positionPopup(); - void showPopup(); - void hidePopup(); + private: + void positionPopup(); + void showPopup(); + void hidePopup(); - private: - SettingsProvider* settings_; - ContactListModel* contactListModel_; - QTreeView* treeViewPopup_; - ContactListDelegate* contactListDelegate_; - Contact manualContact_; - const Contact* currentContact_; + private: + SettingsProvider* settings_; + ContactListModel* contactListModel_; + QTreeView* treeViewPopup_; + ContactListDelegate* contactListDelegate_; + Contact::ref currentContact_; }; } |