This adds a lock icon on the right of the input widget when a key is
set for the current buffer. Encryption was isolated within CoreIrcUser
and CoreIrcChannel, so a new property on IrcUser and IrcChannel is
necessary to sync the current status.
if (ircUser) {
connect(ircUser, SIGNAL(quited()), this, SLOT(removeIrcUser()));
connect(ircUser, SIGNAL(awaySet(bool)), this, SIGNAL(dataChanged()));
if (ircUser) {
connect(ircUser, SIGNAL(quited()), this, SLOT(removeIrcUser()));
connect(ircUser, SIGNAL(awaySet(bool)), this, SIGNAL(dataChanged()));
+ connect(ircUser, SIGNAL(encryptedSet(bool)), this, SLOT(setEncrypted(bool)));
connect(ircChannel, SIGNAL(topicSet(QString)),
this, SLOT(setTopic(QString)));
connect(ircChannel, SIGNAL(topicSet(QString)),
this, SLOT(setTopic(QString)));
+ connect(ircChannel, SIGNAL(encryptedSet(bool)),
+ this, SLOT(setEncrypted(bool)));
connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
this, SLOT(join(QList<IrcUser *> )));
connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
this, SLOT(join(QList<IrcUser *> )));
connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
public slots:
virtual inline void setTopic(const QString &) { emit dataChanged(1); }
public slots:
virtual inline void setTopic(const QString &) { emit dataChanged(1); }
+ virtual inline void setEncrypted(bool) { emit dataChanged(); }
private:
BufferInfo _bufferInfo;
private:
BufferInfo _bufferInfo;
_initialized(false),
_name(channelname),
_topic(QString()),
_initialized(false),
_name(channelname),
_topic(QString()),
_network(network),
_codecForEncoding(0),
_codecForDecoding(0)
_network(network),
_codecForEncoding(0),
_codecForDecoding(0)
+void IrcChannel::setEncrypted(bool encrypted)
+{
+ _encrypted = encrypted;
+ SYNC(ARG(encrypted))
+ emit encryptedSet(encrypted);
+}
+
void IrcChannel::joinIrcUsers(const QList<IrcUser *> &users, const QStringList &modes)
{
void IrcChannel::joinIrcUsers(const QList<IrcUser *> &users, const QStringList &modes)
{
Q_PROPERTY(QString name READ name STORED false)
Q_PROPERTY(QString topic READ topic WRITE setTopic STORED false)
Q_PROPERTY(QString password READ password WRITE setPassword STORED false)
Q_PROPERTY(QString name READ name STORED false)
Q_PROPERTY(QString topic READ topic WRITE setTopic STORED false)
Q_PROPERTY(QString password READ password WRITE setPassword STORED false)
+ Q_PROPERTY(bool encrypted READ encrypted WRITE setEncrypted STORED false)
public :
IrcChannel(const QString &channelname, Network *network);
public :
IrcChannel(const QString &channelname, Network *network);
inline QString name() const { return _name; }
inline QString topic() const { return _topic; }
inline QString password() const { return _password; }
inline QString name() const { return _name; }
inline QString topic() const { return _topic; }
inline QString password() const { return _password; }
+ inline bool encrypted() const { return _encrypted; }
inline Network *network() const { return _network; }
inline QList<IrcUser *> ircUsers() const { return _userModes.keys(); }
inline Network *network() const { return _network; }
inline QList<IrcUser *> ircUsers() const { return _userModes.keys(); }
public slots:
void setTopic(const QString &topic);
void setPassword(const QString &password);
public slots:
void setTopic(const QString &topic);
void setPassword(const QString &password);
+ void setEncrypted(bool encrypted);
void joinIrcUsers(const QList<IrcUser *> &users, const QStringList &modes);
void joinIrcUsers(const QStringList &nicks, const QStringList &modes);
void joinIrcUsers(const QList<IrcUser *> &users, const QStringList &modes);
void joinIrcUsers(const QStringList &nicks, const QStringList &modes);
signals:
void topicSet(const QString &topic); // needed by NetworkModel
signals:
void topicSet(const QString &topic); // needed by NetworkModel
+ void encryptedSet(bool encrypted);
// void passwordSet(const QString &password);
// void userModesSet(QString nick, QString modes);
// void userModeAdded(QString nick, QString mode);
// void passwordSet(const QString &password);
// void userModesSet(QString nick, QString modes);
// void userModeAdded(QString nick, QString mode);
QString _name;
QString _topic;
QString _password;
QString _name;
QString _topic;
QString _password;
QHash<IrcUser *, QString> _userModes;
QHash<IrcUser *, QString> _userModes;
_ircOperator(),
_lastAwayMessage(0),
_whoisServiceReply(),
_ircOperator(),
_lastAwayMessage(0),
_whoisServiceReply(),
_network(network),
_codecForEncoding(0),
_codecForDecoding(0)
_network(network),
_codecForEncoding(0),
_codecForDecoding(0)
+void IrcUser::setEncrypted(bool encrypted)
+{
+ _encrypted = encrypted;
+ emit encryptedSet(encrypted);
+ SYNC(ARG(encrypted))
+}
+
+
void IrcUser::updateObjectName()
{
renameObject(QString::number(network()->networkId().toInt()) + "/" + _nick);
void IrcUser::updateObjectName()
{
renameObject(QString::number(network()->networkId().toInt()) + "/" + _nick);
Q_PROPERTY(int lastAwayMessage READ lastAwayMessage WRITE setLastAwayMessage STORED false)
Q_PROPERTY(QString whoisServiceReply READ whoisServiceReply WRITE setWhoisServiceReply STORED false)
Q_PROPERTY(QString suserHost READ suserHost WRITE setSuserHost STORED false)
Q_PROPERTY(int lastAwayMessage READ lastAwayMessage WRITE setLastAwayMessage STORED false)
Q_PROPERTY(QString whoisServiceReply READ whoisServiceReply WRITE setWhoisServiceReply STORED false)
Q_PROPERTY(QString suserHost READ suserHost WRITE setSuserHost STORED false)
+ Q_PROPERTY(bool encrypted READ encrypted WRITE setEncrypted STORED false)
Q_PROPERTY(QStringList channels READ channels STORED false)
Q_PROPERTY(QString userModes READ userModes WRITE setUserModes)
Q_PROPERTY(QStringList channels READ channels STORED false)
Q_PROPERTY(QString userModes READ userModes WRITE setUserModes)
inline int lastAwayMessage() const { return _lastAwayMessage; }
inline QString whoisServiceReply() const { return _whoisServiceReply; }
inline QString suserHost() const { return _suserHost; }
inline int lastAwayMessage() const { return _lastAwayMessage; }
inline QString whoisServiceReply() const { return _whoisServiceReply; }
inline QString suserHost() const { return _suserHost; }
+ inline bool encrypted() const { return _encrypted; }
inline Network *network() const { return _network; }
inline QString userModes() const { return _userModes; }
inline Network *network() const { return _network; }
inline QString userModes() const { return _userModes; }
void setLastAwayMessage(const int &lastAwayMessage);
void setWhoisServiceReply(const QString &whoisServiceReply);
void setSuserHost(const QString &suserHost);
void setLastAwayMessage(const int &lastAwayMessage);
void setWhoisServiceReply(const QString &whoisServiceReply);
void setSuserHost(const QString &suserHost);
+ void setEncrypted(bool encrypted);
void updateHostmask(const QString &mask);
void setUserModes(const QString &modes);
void updateHostmask(const QString &mask);
void setUserModes(const QString &modes);
// void lastAwayMessageSet(int lastAwayMessage);
// void whoisServiceReplySet(QString whoisServiceReply);
// void suserHostSet(QString suserHost);
// void lastAwayMessageSet(int lastAwayMessage);
// void whoisServiceReplySet(QString whoisServiceReply);
// void suserHostSet(QString suserHost);
+ void encryptedSet(bool encrypted);
void userModesSet(QString modes);
void userModesAdded(QString modes);
void userModesSet(QString modes);
void userModesAdded(QString modes);
int _lastAwayMessage;
QString _whoisServiceReply;
QString _suserHost;
int _lastAwayMessage;
QString _whoisServiceReply;
QString _suserHost;
// QSet<QString> _channels;
QSet<IrcChannel *> _channels;
// QSet<QString> _channels;
QSet<IrcChannel *> _channels;
void CoreIrcChannel::setEncrypted(bool e)
{
void CoreIrcChannel::setEncrypted(bool e)
{
+ IrcChannel::setEncrypted(e);
+
if (!Cipher::neededFeaturesAvailable())
return;
if (!Cipher::neededFeaturesAvailable())
return;
-void CoreIrcUser::setEncrypted(bool e)
-{
- Q_UNUSED(e);
- // TODO
-}
-
-
#ifdef HAVE_QCA2
Cipher *cipher() const;
#ifdef HAVE_QCA2
Cipher *cipher() const;
- void setEncrypted(bool);
ui.underlineButton->setIcon(SmallIcon("format-text-underline"));
ui.textcolorButton->setIcon(SmallIcon("format-text-color"));
ui.highlightcolorButton->setIcon(SmallIcon("format-fill-color"));
ui.underlineButton->setIcon(SmallIcon("format-text-underline"));
ui.textcolorButton->setIcon(SmallIcon("format-text-color"));
ui.highlightcolorButton->setIcon(SmallIcon("format-fill-color"));
+ ui.encryptionIconLabel->hide();
_colorMenu = new QMenu();
_colorFillMenu = new QMenu();
_colorMenu = new QMenu();
_colorFillMenu = new QMenu();
QItemSelectionRange changedArea(topLeft, bottomRight);
if (changedArea.contains(selectionModel()->currentIndex())) {
updateEnabledState();
QItemSelectionRange changedArea(topLeft, bottomRight);
if (changedArea.contains(selectionModel()->currentIndex())) {
updateEnabledState();
+
+ bool encrypted = false;
+
+ IrcChannel *chan = qobject_cast<IrcChannel *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcChannelRole).value<QObject *>());
+ if (chan)
+ encrypted = chan->encrypted();
+
+ IrcUser *user = qobject_cast<IrcUser *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcUserRole).value<QObject *>());
+ if (user)
+ encrypted = user->encrypted();
+
+ if (encrypted)
+ ui.encryptionIconLabel->show();
+ else
+ ui.encryptionIconLabel->hide();
void InputWidget::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
void InputWidget::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
</property>
</widget>
</item>
</property>
</widget>
</item>
+ <item>
+ <widget class="QLabel" name="encryptionIconLabel">
+ <property name="text">
+ <string><img src=":/icons/oxygen/16x16/actions/document-encrypt.png"></string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
</layout>
</widget>
<customwidgets>