X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fclickable.h;h=2c760b943128aa3846ce400dfcdf4fa5cda1d043;hp=ce8d9a6d9cf4f33fbccd3f99c567d1039eb27206;hb=c27d5bfbe80bfeb583a25404f4ccee4b70b010e0;hpb=55579f53f3bd37f2a20d9be7458bdc54b345a052 diff --git a/src/uisupport/clickable.h b/src/uisupport/clickable.h index ce8d9a6d..2c760b94 100644 --- a/src/uisupport/clickable.h +++ b/src/uisupport/clickable.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef CLICKABLE_H_ @@ -23,38 +23,47 @@ #include -class Clickable { +#include "types.h" +class QModelIndex; + +class Clickable +{ public: - // Don't change these enums without also changing dependent methods! - enum Type { - Invalid = -1, - Url = 0, - Channel = 1, - Nick = 2 - }; + // Don't change these enums without also changing dependent methods! + enum Type { + Invalid = -1, + Url = 0, + Channel = 1, + Nick = 2 + }; + + explicit inline Clickable(Type type = Invalid, quint16 start = 0, quint16 length = 0) + : _type(type), _start(start), _length(length) + {} - explicit inline Clickable(Type type = Invalid, quint16 start = 0, quint16 length = 0) - : _type(type), _start(start), _length(length) - {} + inline Type type() const { return _type; } + inline quint16 start() const { return _start; } + inline quint16 length() const { return _length; } - inline Type type() const { return _type; } - inline quint16 start() const { return _start; } - inline quint16 length() const { return _length; } + inline bool isValid() const { return _type != Invalid; } - inline bool isValid() const { return _type != Invalid; } + void activate(NetworkId networkId, const QString &bufferName) const; private: - Type _type; - quint16 _start; - quint16 _length; + Type _type; + quint16 _start; + quint16 _length; }; -class ClickableList : public QList { +class ClickableList : public QList +{ public: - static ClickableList fromString(const QString &); + static ClickableList fromString(const QString &); + Clickable atCursorPos(int idx); }; + #endif // CLICKABLE_H_