diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 0ef930fc2..db8d32cf7 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -1110,10 +1110,16 @@ int pqissl::SSL_Connection_Complete() if(rsEvents) { X509 *x509 = SSL_get_peer_certificate(ssl_connection); - auto ev = std::make_shared(); - ev->mSslId = RsX509Cert::getCertSslId(*x509); - ev->mErrorCode = RsAuthSslError::PEER_REFUSED_CONNECTION; - rsEvents->postEvent(ev); + + if(x509) + { + auto ev = std::make_shared(); + ev->mSslId = RsX509Cert::getCertSslId(*x509); + ev->mErrorCode = RsAuthSslError::PEER_REFUSED_CONNECTION; + + if(!ev->mSslId.isNull()) + rsEvents->postEvent(ev); + } } std::string out; diff --git a/retroshare-gui/src/gui/FileTransfer/TransferUserNotify.h b/retroshare-gui/src/gui/FileTransfer/TransferUserNotify.h index f883ed33c..06d352487 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransferUserNotify.h +++ b/retroshare-gui/src/gui/FileTransfer/TransferUserNotify.h @@ -31,6 +31,7 @@ public: TransferUserNotify(QObject *parent = 0); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("completed transfer(s)"); } private: virtual QIcon getIcon(); diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index d66421243..53ea8bfe9 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -483,7 +483,7 @@ void MainWindow::initStackedPage() for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { UserNotify *userNotify = notifyIt->first->getUserNotify(); if (userNotify) { - userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second); + userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second,userNotify->textInfo()); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); userNotifyList.push_back(userNotify); } diff --git a/retroshare-gui/src/gui/Posted/PostedUserNotify.cpp b/retroshare-gui/src/gui/Posted/PostedUserNotify.cpp index 39fddd451..bbc58e436 100644 --- a/retroshare-gui/src/gui/Posted/PostedUserNotify.cpp +++ b/retroshare-gui/src/gui/Posted/PostedUserNotify.cpp @@ -21,6 +21,7 @@ #include "retroshare/rsposted.h" #include "PostedUserNotify.h" #include "gui/MainWindow.h" +#include "gui/common/FilesDefs.h" PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) : GxsUserNotify(ifaceImpl, g, parent) @@ -37,12 +38,12 @@ bool PostedUserNotify::hasSetting(QString *name, QString *group) QIcon PostedUserNotify::getIcon() { - return QIcon(":/icons/png/posted.png"); + return FilesDefs::getIconFromQtResourcePath(":/icons/png/posted.png"); } QIcon PostedUserNotify::getMainIcon(bool hasNew) { - return hasNew ? QIcon(":/icons/png/posted-notify.png") : QIcon(":/icons/png/posted.png"); + return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/posted-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/posted.png"); } void PostedUserNotify::iconClicked() diff --git a/retroshare-gui/src/gui/Posted/PostedUserNotify.h b/retroshare-gui/src/gui/Posted/PostedUserNotify.h index 2c12ac889..2541a9d39 100644 --- a/retroshare-gui/src/gui/Posted/PostedUserNotify.h +++ b/retroshare-gui/src/gui/Posted/PostedUserNotify.h @@ -31,6 +31,7 @@ public: PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("new board post(s)"); } private: virtual QIcon getIcon(); diff --git a/retroshare-gui/src/gui/chat/ChatUserNotify.h b/retroshare-gui/src/gui/chat/ChatUserNotify.h index f70b37a54..8f6502847 100644 --- a/retroshare-gui/src/gui/chat/ChatUserNotify.h +++ b/retroshare-gui/src/gui/chat/ChatUserNotify.h @@ -41,6 +41,7 @@ public: ~ChatUserNotify(); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("mention(s)"); } private slots: void chatMessageReceived(ChatMessage msg); diff --git a/retroshare-gui/src/gui/common/UserNotify.cpp b/retroshare-gui/src/gui/common/UserNotify.cpp index e030f9ccf..dc95127a8 100644 --- a/retroshare-gui/src/gui/common/UserNotify.cpp +++ b/retroshare-gui/src/gui/common/UserNotify.cpp @@ -88,11 +88,12 @@ void UserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink) Settings->endGroup(); } -void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem) +void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem,const QString& subtext) { mMainAction = mainAction; if (mMainAction) { mButtonText = mMainAction->text(); + mButtonText2 = subtext; if (mainToolBar) { mMainToolButton = dynamic_cast(mainToolBar->widgetForAction(mMainAction)); } @@ -165,7 +166,10 @@ void UserNotify::update() if (mMainAction) { mMainAction->setIcon(getMainIcon(count > 0)); - mMainAction->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText); + + + mMainAction->setText((count > 0) ? (!mButtonText2.isNull())?QString("%1 (%2)").arg(mButtonText).arg(count).arg(mButtonText2) : QString("%1 (%2 %3)").arg(mButtonText).arg(count) : mButtonText); + mMainAction->setToolTip((count > 0) ? (!mButtonText2.isNull())?QString("%1 %2").arg(count).arg(mButtonText2) : QString("%1").arg(count) : mButtonText); QFont font = mMainAction->font(); font.setBold(count > 0); diff --git a/retroshare-gui/src/gui/common/UserNotify.h b/retroshare-gui/src/gui/common/UserNotify.h index 500c26dc3..8c8f99e2d 100644 --- a/retroshare-gui/src/gui/common/UserNotify.h +++ b/retroshare-gui/src/gui/common/UserNotify.h @@ -37,12 +37,17 @@ public: UserNotify(QObject *parent = 0); virtual ~UserNotify(); - void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem); + void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem,const QString& subtext); void createIcons(QMenu *notifyMenu); QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;} QAction* getNotifyIcon(){ return mNotifyIcon;} virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; } + + // UserNotify is used to display tooltips when some services have no messages and so on, in the format of "Name (43242 new messages)" + // This method is used to pass the string that comes after the number. + virtual QString textInfo() const { return QString() ; } + bool notifyEnabled(); bool notifyCombined(); bool notifyBlink(); @@ -82,6 +87,7 @@ private: QAction *mNotifyIcon; unsigned int mNewCount; QString mButtonText; + QString mButtonText2; bool mLastBlinking; }; diff --git a/retroshare-gui/src/gui/feeds/NewsFeedUserNotify.h b/retroshare-gui/src/gui/feeds/NewsFeedUserNotify.h index 081053593..c5206f24f 100644 --- a/retroshare-gui/src/gui/feeds/NewsFeedUserNotify.h +++ b/retroshare-gui/src/gui/feeds/NewsFeedUserNotify.h @@ -29,6 +29,7 @@ class NewsFeedUserNotify : public UserNotify { Q_OBJECT + virtual QString textInfo() const override { return tr("logged event(s)"); } public: NewsFeedUserNotify(NewsFeed *newsFeed, QObject *parent = 0); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.cpp index eb54a39c3..ce88231fc 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.cpp @@ -21,6 +21,7 @@ #include "retroshare/rsgxschannels.h" #include "GxsChannelUserNotify.h" #include "gui/MainWindow.h" +#include "gui/common/FilesDefs.h" GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) : GxsUserNotify(ifaceImpl, g, parent) @@ -37,12 +38,12 @@ bool GxsChannelUserNotify::hasSetting(QString *name, QString *group) QIcon GxsChannelUserNotify::getIcon() { - return QIcon(":/icons/png/channel.png"); + return FilesDefs::getIconFromQtResourcePath(":/icons/png/channel.png"); } QIcon GxsChannelUserNotify::getMainIcon(bool hasNew) { - return hasNew ? QIcon(":/icons/png/channels-notify.png") : QIcon(":/icons/png/channel.png"); + return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/channels-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/channel.png"); } void GxsChannelUserNotify::iconClicked() diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.h b/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.h index df29a0202..8345b96d6 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelUserNotify.h @@ -32,6 +32,7 @@ public: GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("new message(s)"); } private: virtual QIcon getIcon(); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.cpp index 876aa3a95..b2e5bcc8e 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ #include "retroshare/rsgxsforums.h" +#include "gui/common/FilesDefs.h" #include "GxsForumUserNotify.h" #include "gui/MainWindow.h" @@ -38,12 +39,12 @@ bool GxsForumUserNotify::hasSetting(QString *name, QString *group) QIcon GxsForumUserNotify::getIcon() { - return QIcon(":/icons/png/forums.png"); + return FilesDefs::getIconFromQtResourcePath(":/icons/png/forums.png"); } QIcon GxsForumUserNotify::getMainIcon(bool hasNew) { - return hasNew ? QIcon(":/icons/png/forums-notify.png") : QIcon(":/icons/png/forums.png"); + return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/forums-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/forums.png"); } void GxsForumUserNotify::iconClicked() diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.h b/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.h index 172a327ae..9fbef1e5e 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumUserNotify.h @@ -31,6 +31,7 @@ public: GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("new message(s)"); } private: virtual QIcon getIcon(); diff --git a/retroshare-gui/src/gui/msgs/MessageUserNotify.h b/retroshare-gui/src/gui/msgs/MessageUserNotify.h index b032123a0..34c65dad6 100644 --- a/retroshare-gui/src/gui/msgs/MessageUserNotify.h +++ b/retroshare-gui/src/gui/msgs/MessageUserNotify.h @@ -31,6 +31,7 @@ public: MessageUserNotify(QObject *parent = 0); virtual bool hasSetting(QString *name, QString *group); + virtual QString textInfo() const override { return tr("new mail(s)"); } private: virtual QIcon getIcon();