Added a new checbox in the settings (NotifyPage) to enable/disable the new SecurityItem. It is enabled by default, but all existing users need to enable it.

Added new buttons to SecurityItem to add/remove the peer and view peer details.
Added new call to notifyListChange with NOTIFY_LIST_FRIENDS in AuthGPGimpl::AllowConnection.
Fixed german language.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4572 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-08-21 22:28:19 +00:00
parent 2e9d5663c9
commit 01fa9eec3f
17 changed files with 419 additions and 1297 deletions

View File

@ -30,6 +30,7 @@
#ifdef WINDOWS_SYS
#include "retroshare/rsinit.h"
#endif
#include "pqi/pqinotify.h"
#include <util/rsdir.h>
#include <iostream>
@ -1520,9 +1521,11 @@ bool AuthGPGimpl::AllowConnection(const std::string &gpg_id, bool accept)
mAcceptToConnectMap[gpg_id] = accept;
}
IndicateConfigChanged();
IndicateConfigChanged();
return true;
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FRIENDS, accept ? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL);
return true;
}
/* These take PGP Ids */

View File

@ -55,14 +55,14 @@ const uint32_t RS_CHAT_OPEN = 0x0001;
const uint32_t RS_CHAT_FOCUS = 0x0004;
const uint32_t RS_CHAT_TABBED_WINDOW = 0x0008;
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;
const uint32_t RS_FEED_TYPE_FORUM = 0x0040;
const uint32_t RS_FEED_TYPE_BLOG = 0x0080;
const uint32_t RS_FEED_TYPE_CHAT = 0x0100;
const uint32_t RS_FEED_TYPE_MSG = 0x0200;
const uint32_t RS_FEED_TYPE_FILES = 0x0400;
const uint32_t RS_FEED_TYPE_SECURITY = 0x0800;
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;
const uint32_t RS_FEED_TYPE_FORUM = 0x0040;
const uint32_t RS_FEED_TYPE_BLOG = 0x0080;
const uint32_t RS_FEED_TYPE_CHAT = 0x0100;
const uint32_t RS_FEED_TYPE_MSG = 0x0200;
const uint32_t RS_FEED_TYPE_FILES = 0x0400;
const uint32_t RS_FEED_TYPE_SECURITY = 0x0800;
const uint32_t RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001;
const uint32_t RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002;

View File

@ -77,8 +77,6 @@ NewsFeed::NewsFeed(QWidget *parent)
timer->start(1000);
}
void NewsFeed::updateFeed()
{
if (!rsNotify)
@ -86,9 +84,6 @@ void NewsFeed::updateFeed()
uint flags = Settings->getNewsFeedFlags();
/* HACK until SECURITY is in feeds */
flags |= RS_FEED_TYPE_SECURITY;
/* check for new messages */
RsFeedItem fi;
if (rsNotify->GetFeedItem(fi))
@ -238,7 +233,6 @@ void NewsFeed::addFeedItemPeerConnect(RsFeedItem &fi)
}
void NewsFeed::addFeedItemPeerDisconnect(RsFeedItem &fi)
{
/* make new widget */
@ -255,7 +249,6 @@ void NewsFeed::addFeedItemPeerDisconnect(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemPeerHello(RsFeedItem &fi)
{
/* make new widget */
@ -272,7 +265,6 @@ void NewsFeed::addFeedItemPeerHello(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi)
{
/* make new widget */
@ -289,8 +281,6 @@ void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemSecurityConnectAttempt(RsFeedItem &fi)
{
/* make new widget */
@ -307,7 +297,6 @@ void NewsFeed::addFeedItemSecurityConnectAttempt(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemSecurityAuthDenied(RsFeedItem &fi)
{
/* make new widget */
@ -356,8 +345,6 @@ void NewsFeed::addFeedItemSecurityUnknownOut(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
{
/* make new widget */
@ -374,7 +361,6 @@ void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi)
{
/* make new widget */
@ -391,7 +377,6 @@ void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi)
{
/* make new widget */
@ -408,7 +393,6 @@ void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemForumNew(RsFeedItem &fi)
{
/* make new widget */
@ -426,7 +410,6 @@ void NewsFeed::addFeedItemForumNew(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemForumUpdate(RsFeedItem &fi)
{
/* make new widget */
@ -444,7 +427,6 @@ void NewsFeed::addFeedItemForumUpdate(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemForumMsg(RsFeedItem &fi)
{
/* make new widget */
@ -501,7 +483,6 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi)
#endif
}
void NewsFeed::addFeedItemChatNew(RsFeedItem &fi)
{
#ifdef NEWS_DEBUG
@ -555,9 +536,9 @@ void NewsFeed::deleteFeedItem(QWidget *item, uint32_t /*type*/)
std::cerr << std::endl;
#endif
if (item) {
item->close ();
}
if (item) {
item->close ();
}
}
void NewsFeed::openChat(std::string peerId)

View File

@ -64,7 +64,8 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
QMenu *msgmenu = new QMenu();
msgmenu->addAction(actionNew_Message);
@ -82,46 +83,44 @@ void PeerItem::updateItemStatic()
if (!rsPeers)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::updateItemStatic()";
std::cerr << std::endl;
#endif
QString title;
switch(mType)
{
case PEER_TYPE_STD:
title = tr("Friend");
break;
case PEER_TYPE_CONNECT:
title = tr("Friend Connected");
break;
case PEER_TYPE_HELLO:
title = tr("Connect Attempt");
break;
case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend");
break;
default:
title = tr("Peer");
break;
}
titleLabel->setText(title);
/* set textcolor for peer name */
QString nameStr("<span style=\"font-size:14pt; font-weight:500;color:#990033;\">%1</span>");
RsPeerDetails details;
if (rsPeers->getPeerDetails(mPeerId, details))
{
QString title;
switch(mType)
{
case PEER_TYPE_STD:
title = tr("Friend");
break;
case PEER_TYPE_CONNECT:
title = tr("Friend Connected");
break;
case PEER_TYPE_HELLO:
title = tr("Connect Attempt");
break;
case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend");
break;
default:
title = tr("Peer");
break;
}
titleLabel->setText(title);
/* set textcolor for peername */
QString nameStr("<span style=\"font-size:14pt; font-weight:500;"
"color:#990033;\">%1</span>");
/* set Blog name */
QString peername = QString::fromUtf8(details.name.c_str());
peernameLabel->setText(nameStr.arg(peername));
/* set peer name */
QString peername = QString::fromUtf8(details.name.c_str());
peernameLabel->setText(nameStr.arg(peername));
QDateTime date = QDateTime::fromTime_t(details.lastConnect);
QString stime = date.toString(Qt::LocalDate);
@ -134,33 +133,29 @@ void PeerItem::updateItemStatic()
}
else
{
statusLabel->setText(tr("Unknown Peer"));
titleLabel->setText(tr("Unknown Peer"));
trustLabel->setText(tr("Unknown Peer"));
nameLabel->setText(tr("Unknown Peer"));
idLabel->setText(tr("Unknown Peer"));
locLabel->setText(tr("Unknown Peer"));
ipLabel->setText(tr("Unknown Peer"));
connLabel->setText(tr("Unknown Peer"));
lastLabel->setText(tr("Unknown Peer"));
statusLabel->setText(tr("Unknown Peer"));
titleLabel->setText(tr("Unknown Peer"));
trustLabel->setText(tr("Unknown Peer"));
nameLabel->setText(tr("Unknown Peer"));
idLabel->setText(tr("Unknown Peer"));
locLabel->setText(tr("Unknown Peer"));
ipLabel->setText(tr("Unknown Peer"));
connLabel->setText(tr("Unknown Peer"));
lastLabel->setText(tr("Unknown Peer"));
chatButton->setEnabled(false);
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
/* disable buttons */
/* hide buttons */
clearButton->hide();
}
}
void PeerItem::updateItem()
{
if (!rsPeers)
@ -172,9 +167,15 @@ void PeerItem::updateItem()
std::cerr << std::endl;
#endif
if(!RsAutoUpdatePage::eventsLocked()) {
/* set textcolor for peer name */
QString nameStr("<span style=\"font-size:14pt; font-weight:500;color:#990033;\">%1</span>");
RsPeerDetails details;
if (!rsPeers->getPeerDetails(mPeerId, details))
{
chatButton->setEnabled(false);
quickmsgButton->setEnabled(false);
return;
}
@ -190,8 +191,7 @@ void PeerItem::updateItem()
}
#endif
statusLabel->setText(status);
trustLabel->setText(QString::fromStdString(
RsPeerTrustString(details.trustLvl)));
trustLabel->setText(QString::fromStdString(RsPeerTrustString(details.trustLvl)));
{
std::ostringstream out;
@ -208,14 +208,10 @@ void PeerItem::updateItem()
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
if (details.state & RS_PEER_STATE_FRIEND)
{
//addButton->setEnabled(false);
//removeButton->setEnabled(true);
quickmsgButton->setEnabled(true);
}
else
{
//addButton->setEnabled(true);
//removeButton->setEnabled(false);
quickmsgButton->setEnabled(false);
}
}
@ -238,13 +234,13 @@ void PeerItem::toggle()
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
expandButton->setToolTip(tr("Expand"));
}
}
@ -262,15 +258,6 @@ void PeerItem::removeItem()
}
}
void PeerItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void PeerItem::addFriend()
@ -281,8 +268,6 @@ void PeerItem::addFriend()
#endif
}
void PeerItem::removeFriend()
{
#ifdef DEBUG_ITEM
@ -291,8 +276,6 @@ void PeerItem::removeFriend()
#endif
}
void PeerItem::sendMsg()
{
#ifdef DEBUG_ITEM
@ -300,10 +283,6 @@ void PeerItem::sendMsg()
std::cerr << std::endl;
#endif
if (mParent)
{
//mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, "");
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
@ -314,7 +293,6 @@ void PeerItem::sendMsg()
nMsgDialog->activateWindow();
/* window will destroy itself! */
}
}
@ -332,32 +310,28 @@ void PeerItem::openChat()
void PeerItem::updateAvatar(const QString &peer_id)
{
if (peer_id.toStdString() != mPeerId) {
/* it 's not me */
return;
}
if (peer_id.toStdString() != mPeerId) {
/* it 's not me */
return;
}
unsigned char *data = NULL;
int size = 0 ;
rsMsgs->getAvatarData(mPeerId,data,size);
if(size != 0)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
avatar_label->setPixmap(pix);
delete[] data ;
}
else
{
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
}
unsigned char *data = NULL;
int size = 0 ;
rsMsgs->getAvatarData(mPeerId,data,size);
if(size != 0)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
avatar_label->setPixmap(pix);
delete[] data ;
}
else
{
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
}
}
void PeerItem::togglequickmessage()
@ -370,7 +344,6 @@ void PeerItem::togglequickmessage()
{
messageframe->setVisible(false);
}
}
void PeerItem::sendMessage()

View File

@ -48,7 +48,6 @@ public:
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();

View File

@ -421,7 +421,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>Location</string>
<string>Location:</string>
</property>
</widget>
</item>
@ -434,7 +434,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>IP Address</string>
<string>IP Address:</string>
</property>
</widget>
</item>
@ -447,7 +447,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>Connection Method</string>
<string>Connection Method:</string>
</property>
</widget>
</item>

View File

@ -21,12 +21,14 @@
#include <QDateTime>
#include <QTimer>
#include <QMessageBox>
#include "SecurityItem.h"
#include "FeedHolder.h"
#include "../RsAutoUpdatePage.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/common/StatusDefs.h"
#include "gui/connect/ConfCertDialog.h"
#include "gui/notifyqt.h"
@ -49,6 +51,12 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgI
messageframe->setVisible(false);
sendmsgButton->setEnabled(false);
quickmsgButton->setEnabled(false);
chatButton->setEnabled(false);
addFriendButton->setEnabled(false);
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
@ -62,9 +70,13 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgI
connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
connect(addFriendButton, SIGNAL(clicked()), this, SLOT(addFriend()));
connect(removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect(peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
QMenu *msgmenu = new QMenu();
msgmenu->addAction(actionNew_Message);
@ -73,7 +85,7 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgI
small();
updateItemStatic();
updateItem();
updateAvatar(QString::fromStdString(mGpgId));
updateAvatar(QString::fromStdString(mSslId));
}
@ -92,7 +104,6 @@ void SecurityItem::updateItemStatic()
if (!rsPeers)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::updateItemStatic()";
@ -121,63 +132,16 @@ void SecurityItem::updateItemStatic()
titleLabel->setText(title);
RsPeerDetails details;
if (rsPeers->getPeerDetails(mGpgId, details))
{
/* set textcolor for peername */
QString nameStr("<span style=\"font-size:14pt; font-weight:500;"
"color:#990033;\">%1</span>");
/* set Blog name */
QString peername = QString::fromStdString(details.name);
peernameLabel->setText(nameStr.arg(peername));
QDateTime date = QDateTime::fromTime_t(details.lastConnect);
QString stime = date.toString(Qt::LocalDate);
lastLabel-> setText(stime);
/* expanded Info */
nameLabel->setText(QString::fromUtf8(details.name.c_str()));
idLabel->setText(QString::fromStdString(details.id));
locLabel->setText(QString::fromUtf8(details.location.c_str()));
}
else
{
/* it is very likely that we will end up here for some of the
* Unknown peer cases.... so allow them here
*/
QDateTime date = QDateTime::currentDateTime();
QString stime = date.toString(Qt::LocalDate);
lastLabel-> setText(stime);
nameLabel->setText(QString::fromStdString(mGpgId));
idLabel->setText(QString::fromStdString(mSslId));
statusLabel->setText(tr("Unknown Peer"));
trustLabel->setText(tr("Unknown Peer"));
locLabel->setText(tr("Unknown Peer"));
ipLabel->setText(tr("Unknown Peer"));
connLabel->setText(tr("Unknown Peer"));
chatButton->setEnabled(false);
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
/* disable buttons */
/* hide buttons */
clearButton->hide();
}
}
void SecurityItem::updateItem()
{
if (!rsPeers)
@ -188,13 +152,58 @@ void SecurityItem::updateItem()
std::cerr << "SecurityItem::updateItem()";
std::cerr << std::endl;
#endif
QDateTime currentTime = QDateTime::currentDateTime();
timeLabel->setText(currentTime.toString(Qt::LocalDate));
if(!RsAutoUpdatePage::eventsLocked()) {
/* set textcolor for peer name */
QString nameStr("<span style=\"font-size:14pt; font-weight:500;color:#990033;\">%1</span>");
RsPeerDetails details;
if (!rsPeers->getPeerDetails(mGpgId, details))
/* first try sslid */
if (!rsPeers->getPeerDetails(mSslId, details))
{
return;
/* then gpgid */
if (!rsPeers->getPeerDetails(mGpgId, details))
{
/* it is very likely that we will end up here for some of the
* Unknown peer cases.... so allow them here
*/
/* set peer name */
peernameLabel->setText(nameStr.arg(tr("Unknown Peer")));
nameLabel->setText(QString::fromStdString(mGpgId));
idLabel->setText(QString::fromStdString(mSslId));
statusLabel->setText(tr("Unknown Peer"));
trustLabel->setText(tr("Unknown Peer"));
locLabel->setText(tr("Unknown Peer"));
ipLabel->setText(tr("Unknown Peer"));
connLabel->setText(tr("Unknown Peer"));
chatButton->setEnabled(false);
quickmsgButton->setEnabled(false);
addFriendButton->setEnabled(false);
addFriendButton->show();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
return;
}
}
/* set peer name */
QString peername = QString::fromUtf8(details.name.c_str());
peernameLabel->setText(nameStr.arg(peername));
/* expanded Info */
nameLabel->setText(QString::fromUtf8(details.name.c_str()));
idLabel->setText(QString::fromStdString(details.id));
locLabel->setText(QString::fromUtf8(details.location.c_str()));
/* top Level info */
QString status = StatusDefs::peerStateString(details.state);
@ -207,8 +216,7 @@ void SecurityItem::updateItem()
}
#endif
statusLabel->setText(status);
trustLabel->setText(QString::fromStdString(
RsPeerTrustString(details.trustLvl)));
trustLabel->setText(QString::fromStdString(RsPeerTrustString(details.trustLvl)));
{
std::ostringstream out;
@ -223,23 +231,36 @@ void SecurityItem::updateItem()
/* do buttons */
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
peerDetailsButton->setEnabled(true);
if (details.accept_connection)
{
addFriendButton->setEnabled(false);
addFriendButton->hide();
removeFriendButton->setEnabled(true);
removeFriendButton->show();
}
else
{
addFriendButton->setEnabled(true);
addFriendButton->show();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
}
if (details.state & RS_PEER_STATE_FRIEND)
{
//addButton->setEnabled(false);
//removeButton->setEnabled(true);
quickmsgButton->setEnabled(true);
}
else
{
//addButton->setEnabled(true);
//removeButton->setEnabled(false);
quickmsgButton->setEnabled(false);
}
}
/* slow Tick */
int msec_rate = 10129;
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
return;
}
@ -255,17 +276,16 @@ void SecurityItem::toggle()
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
expandButton->setToolTip(tr("Expand"));
}
}
void SecurityItem::removeItem()
{
#ifdef DEBUG_ITEM
@ -279,15 +299,6 @@ void SecurityItem::removeItem()
}
}
void SecurityItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void SecurityItem::addFriend()
@ -296,19 +307,44 @@ void SecurityItem::addFriend()
std::cerr << "SecurityItem::addFriend()";
std::cerr << std::endl;
#endif
ConfCertDialog::showIt(mGpgId, ConfCertDialog::PageTrust);
}
void SecurityItem::removeFriend()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::removeFriend()";
std::cerr << std::endl;
#endif
if ((QMessageBox::question(this, "RetroShare", tr("Do you want to remove this Friend?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes)
{
rsPeers->removeFriend(mGpgId);
}
}
void SecurityItem::peerDetails()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::peerDetails()";
std::cerr << std::endl;
#endif
RsPeerDetails details;
/* first try sslid */
if (rsPeers->getPeerDetails(mSslId, details))
{
ConfCertDialog::showIt(mSslId, ConfCertDialog::PageDetails);
return;
}
/* then gpgid */
if (rsPeers->getPeerDetails(mGpgId, details))
{
ConfCertDialog::showIt(mGpgId, ConfCertDialog::PageDetails);
}
}
void SecurityItem::sendMsg()
{
@ -317,23 +353,17 @@ void SecurityItem::sendMsg()
std::cerr << std::endl;
#endif
if (mParent)
{
//mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, "");
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
nMsgDialog->addRecipient(MessageComposer::TO, mGpgId, false);
nMsgDialog->show();
nMsgDialog->activateWindow();
/* window will destroy itself! */
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
}
nMsgDialog->addRecipient(MessageComposer::TO, mGpgId, false);
nMsgDialog->show();
nMsgDialog->activateWindow();
/* window will destroy itself! */
}
void SecurityItem::openChat()
{
@ -349,70 +379,65 @@ void SecurityItem::openChat()
void SecurityItem::updateAvatar(const QString &peer_id)
{
if (peer_id.toStdString() != mGpgId) {
/* it 's not me */
return;
}
if (peer_id.toStdString() != mSslId) {
/* it 's not me */
return;
}
unsigned char *data = NULL;
int size = 0 ;
rsMsgs->getAvatarData(mGpgId,data,size);
if(size != 0)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
avatar_label->setPixmap(pix);
delete[] data ;
}
else
{
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
}
unsigned char *data = NULL;
int size = 0 ;
rsMsgs->getAvatarData(mSslId, data, size);
if(size != 0)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
avatar_label->setPixmap(pix);
delete[] data ;
}
else
{
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
}
}
void SecurityItem::togglequickmessage()
{
if (messageframe->isHidden())
{
messageframe->setVisible(true);
}
messageframe->setVisible(true);
}
else
{
messageframe->setVisible(false);
}
messageframe->setVisible(false);
}
}
void SecurityItem::sendMessage()
{
/* construct a message */
MessageInfo mi;
mi.title = tr("Quick Message").toStdWString();
mi.msg = quickmsgText->toHtml().toStdWString();
mi.msgto.push_back(mGpgId);
rsMsgs->MessageSend(mi);
/* construct a message */
MessageInfo mi;
quickmsgText->clear();
messageframe->setVisible(false);
mi.title = tr("Quick Message").toStdWString();
mi.msg = quickmsgText->toHtml().toStdWString();
mi.msgto.push_back(mGpgId);
rsMsgs->MessageSend(mi);
quickmsgText->clear();
messageframe->setVisible(false);
}
void SecurityItem::on_quickmsgText_textChanged()
{
if (quickmsgText->toPlainText().isEmpty())
{
sendmsgButton->setEnabled(false);
}
else
{
sendmsgButton->setEnabled(true);
}
if (quickmsgText->toPlainText().isEmpty())
{
sendmsgButton->setEnabled(false);
}
else
{
sendmsgButton->setEnabled(true);
}
}

View File

@ -25,47 +25,44 @@
#include "ui_SecurityItem.h"
#include <stdint.h>
const uint32_t SEC_TYPE_CONNECT_ATTEMPT = 0x0001; /* failed Connect Attempt */
const uint32_t SEC_TYPE_AUTH_DENIED = 0x0002; /* failed outgoing attempt */
const uint32_t SEC_TYPE_UNKNOWN_IN = 0x0003; /* failed incoming with unknown peer */
const uint32_t SEC_TYPE_UNKNOWN_OUT = 0x0004; /* failed outgoing with unknown peer */
const uint32_t SEC_TYPE_CONNECT_ATTEMPT = 0x0001; /* failed Connect Attempt */
const uint32_t SEC_TYPE_AUTH_DENIED = 0x0002; /* failed outgoing attempt */
const uint32_t SEC_TYPE_UNKNOWN_IN = 0x0003; /* failed incoming with unknown peer */
const uint32_t SEC_TYPE_UNKNOWN_OUT = 0x0004; /* failed outgoing with unknown peer */
class FeedHolder;
class SecurityItem : public QWidget, private Ui::SecurityItem
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome);
/** Default Destructor */
/** Default Constructor */
SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome);
void updateItemStatic();
void small();
void small();
bool isSame(const std::string &sslId, uint32_t type);
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void removeItem();
void toggle();
void addFriend();
void removeFriend();
void peerDetails();
void sendMsg();
void openChat();
void updateItem();
void updateAvatar(const QString &peer_id);
void togglequickmessage();
void sendMessage();
void on_quickmsgText_textChanged();
void togglequickmessage();
void sendMessage();
void on_quickmsgText_textChanged();
private:
FeedHolder *mParent;

View File

@ -6,13 +6,10 @@
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<width>675</width>
<height>382</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
@ -149,7 +146,7 @@ border-radius: 10px}</string>
</spacer>
</item>
<item>
<widget class="QLabel" name="lastLabel">
<widget class="QLabel" name="timeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -230,6 +227,57 @@ border-radius: 10px}</string>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="peerDetailsButton">
<property name="text">
<string>Peer details</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/peerdetails_16x16.png</normaloff>:/images/peerdetails_16x16.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="removeFriendButton">
<property name="text">
<string>Deny friend</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/denied16.png</normaloff>:/images/denied16.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="addFriendButton">
<property name="text">
<string>Make friend</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/user/add_user16.png</normaloff>:/images/user/add_user16.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="quickmsgButton">
<property name="text">
@ -421,7 +469,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>Location</string>
<string>Location:</string>
</property>
</widget>
</item>
@ -434,7 +482,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>IP Address</string>
<string>IP Address:</string>
</property>
</widget>
</item>
@ -447,7 +495,7 @@ border-radius: 10px}</string>
</font>
</property>
<property name="text">
<string>Connection Method</string>
<string>Connection Method:</string>
</property>
</widget>
</item>

View File

@ -292,9 +292,9 @@ void NotifyQt::notifyListChange(int list, int type)
{
case NOTIFY_LIST_NEIGHBOURS:
#ifdef NOTIFY_DEBUG
std::cerr << "received neighbrs changed" << std::endl ;
std::cerr << "received neighbours changed" << std::endl ;
#endif
emit neighborsChanged();
emit neighboursChanged();
break;
case NOTIFY_LIST_FRIENDS:
#ifdef NOTIFY_DEBUG
@ -433,7 +433,7 @@ void NotifyQt::UpdateGUI()
if(!already_updated)
{
emit messagesChanged() ;
emit neighborsChanged();
emit neighboursChanged();
emit configChanged();
already_updated = true ;

View File

@ -66,7 +66,7 @@ class NotifyQt: public QObject, public NotifyBase
void filesPostModChanged(bool) const ;
void transfersChanged() const ;
void friendsChanged() const ;
void neighborsChanged() const ;
void neighboursChanged() const ;
void messagesChanged() const ;
void messagesTagsChanged() const;
void forumsChanged() const ; // use connect with Qt::QueuedConnection

View File

@ -84,6 +84,8 @@ NotifyPage::save(QString &/*errmsg*/)
newsflags |= RS_FEED_TYPE_MSG;
if (ui.notify_Chat->isChecked())
newsflags |= RS_FEED_TYPE_CHAT;
if (ui.notify_Security->isChecked())
newsflags |= RS_FEED_TYPE_SECURITY;
if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN;
@ -157,6 +159,7 @@ void NotifyPage::load()
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG);
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
ui.notify_Security->setChecked(newsflags & RS_FEED_TYPE_SECURITY);
ui.chat_NewWindow->setChecked(chatflags & RS_CHAT_OPEN);
ui.chat_Focus->setChecked(chatflags & RS_CHAT_FOCUS);

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>427</width>
<width>516</width>
<height>425</height>
</rect>
</property>
@ -558,6 +558,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Security">
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">

View File

@ -130,7 +130,7 @@ void RshareSettings::initSettings()
uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN |
RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG |
RS_FEED_TYPE_FILES);
RS_FEED_TYPE_FILES | RS_FEED_TYPE_SECURITY);
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed);
setDefault(SETTING_CHAT_FLAGS, defChat);
@ -309,7 +309,7 @@ void RshareSettings::setNotifyFlags(uint flags)
uint RshareSettings::getTrayNotifyFlags()
{
return value(SETTING_TRAYNOTIFY_FLAGS, TRAYNOTIFY_PRIVATECHAT | TRAYNOTIFY_MESSAGES | TRAYNOTIFY_CHANNELS | TRAYNOTIFY_FORUMS | TRAYNOTIFY_TRANSFERS).toUInt();
return value(SETTING_TRAYNOTIFY_FLAGS, TRAYNOTIFY_PRIVATECHAT | TRAYNOTIFY_MESSAGES | TRAYNOTIFY_CHANNELS | TRAYNOTIFY_FORUMS ).toUInt();
}
void RshareSettings::setTrayNotifyFlags(uint flags)

File diff suppressed because it is too large Load Diff

View File

@ -276,7 +276,7 @@ int main(int argc, char *argv[])
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
QObject::connect(notify,SIGNAL(groupsChanged(int)) ,w->friendsDialog ,SLOT(groupsChanged(int) ));
QObject::connect(notify,SIGNAL(privateChatChanged(int, int)) ,w ,SLOT(privateChatChanged(int, int) ));
QObject::connect(notify,SIGNAL(neighborsChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ;
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ;