fixd merged with master

This commit is contained in:
csoler 2018-02-07 22:07:49 +01:00
commit 2ee78d7b96
11 changed files with 996 additions and 797 deletions

View File

@ -10,7 +10,7 @@ Add to the PATH environment variable by editing your *~/.profile* file.
export PATH="/users/$USER/Qt/5.5/clang_64/bin:$PATH"
Depends on wich version of Qt you use.
Depends on which version of Qt you use.
## ***Choose if you use MacPort or HomeBrew***

View File

@ -7,6 +7,7 @@
#include "chat/ChatTabWidget.h"
#include "chat/CreateLobbyDialog.h"
#include "common/RSTreeWidgetItem.h"
#include "gui/RetroShareLink.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/Identity/IdEditDialog.h"
#include "gui/settings/rsharesettings.h"
@ -58,6 +59,7 @@
#define IMAGE_TYPING ":images/typing.png"
#define IMAGE_MESSAGE ":images/chat.png"
#define IMAGE_AUTOSUBSCRIBE ":images/accepted16.png"
#define IMAGE_COPYRSLINK ":/images/copyrslink.png"
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
: RsAutoUpdatePage(5000, parent, flags)
@ -321,6 +323,8 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(QIcon(IMAGE_AUTOSUBSCRIBE), tr("Remove Auto Subscribe"), this, SLOT(autoSubscribeItem()));
else if(!own_identities.empty())
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem()));
contextMnu.addAction(QIcon(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink()));
}
contextMnu.addSeparator();//-------------------------------------------------------------------
@ -743,7 +747,7 @@ void ChatLobbyWidget::subscribeChatLobbyAs()
ChatDialog::chatFriend(ChatId(id),true) ;
}
void ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
bool ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
{
QTreeWidgetItem *item = getTreeWidgetItem(id) ;
@ -758,13 +762,14 @@ void ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
cldCW->getChatWidget()->scrollToAnchor(anchor);
ui.lobbyTreeWidget->setCurrentItem(item);
}
ui.lobbyTreeWidget->setCurrentItem(item);
return true;
}
}
return false;
}
void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
@ -890,6 +895,24 @@ void ChatLobbyWidget::autoSubscribeItem()
autoSubscribeLobby(ui.lobbyTreeWidget->currentItem());
}
void ChatLobbyWidget::copyItemLink()
{
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
if (item == NULL || item->type() != TYPE_LOBBY) {
return;
}
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
QString name = item->text(COLUMN_NAME);
RetroShareLink link = RetroShareLink::createChatRoom(ChatId(id),name);
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}
QTreeWidgetItem *ChatLobbyWidget::getTreeWidgetItem(ChatLobbyId id)
{
for(int p=0;p<4;++p)

View File

@ -50,7 +50,7 @@ public:
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
void addChatPage(ChatLobbyDialog *) ;
void showLobbyAnchor(ChatLobbyId id, QString anchor) ;
bool showLobbyAnchor(ChatLobbyId id, QString anchor) ;
uint unreadCount();
@ -78,6 +78,7 @@ protected slots:
void updatePeerEntering(ChatLobbyId);
void updatePeerLeaving(ChatLobbyId);
void autoSubscribeItem();
void copyItemLink();
private slots:
void filterColumnChanged(int);

View File

@ -603,7 +603,7 @@ void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<
QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
RetroShareLink link = RetroShareLink::createCollection(dir_name,ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ;
RetroShareLink link = RetroShareLink::createFileTree(dir_name,ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ;
if(link.valid())
urls.push_back(link) ;

View File

@ -1964,10 +1964,10 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
switch(u.mServiceId)
{
case RS_SERVICE_GXS_TYPE_CHANNELS: service_name = tr("Channels") ;service_type = RetroShareLink::TYPE_CHANNEL ; break ;
case RS_SERVICE_GXS_TYPE_FORUMS: service_name = tr("Forums") ; service_type = RetroShareLink::TYPE_FORUM ; break ;
case RS_SERVICE_GXS_TYPE_POSTED: service_name = tr("Posted") ; service_type = RetroShareLink::TYPE_POSTED ; break ;
case RS_SERVICE_TYPE_CHAT: service_name = tr("Chat") ; break ;
case RS_SERVICE_GXS_TYPE_CHANNELS: service_name = tr("Channels") ;service_type = RetroShareLink::TYPE_CHANNEL ; break ;
case RS_SERVICE_GXS_TYPE_FORUMS: service_name = tr("Forums") ; service_type = RetroShareLink::TYPE_FORUM ; break ;
case RS_SERVICE_GXS_TYPE_POSTED: service_name = tr("Posted") ; service_type = RetroShareLink::TYPE_POSTED ; break ;
case RS_SERVICE_TYPE_CHAT: service_name = tr("Chat") ; service_type = RetroShareLink::TYPE_CHAT_ROOM ; break ;
default:
service_name = tr("Unknown"); service_type = RetroShareLink::TYPE_UNKNOWN ;
}
@ -1994,8 +1994,8 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
}
case RsIdentityUsage::CHAT_LOBBY_MSG_VALIDATION: // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
{
// there is no link for chat lobby yet.
return tr("Message in chat lobby %1").arg(u.mAdditionalId) ;
RetroShareLink l = RetroShareLink::createChatRoom(ChatId(ChatLobbyId(u.mAdditionalId)),QString::number(u.mAdditionalId));
return tr("Message in chat room %1").arg(l.toHtml()) ;
}
case RsIdentityUsage::GLOBAL_ROUTER_SIGNATURE_CHECK: // Global router message validation
{

File diff suppressed because it is too large Load Diff

View File

@ -32,23 +32,25 @@
// shared | Y | Y | Y (send RS link) | Paste menu? | Paste menu?
// -------------+----------------+--------------------------+------------------+-------------+-------------
//
#include <stdint.h>
#include <retroshare/rstypes.h>
#include <retroshare/rsgxsifacetypes.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rstypes.h>
#include <QString>
#include <QVector>
#include <QUrl>
#include <QVector>
#define RSLINK_PROCESS_NOTIFY_SUCCESS 1 // notify on success
#define RSLINK_PROCESS_NOTIFY_ERROR 2 // notify on error
#define RSLINK_PROCESS_NOTIFY_ASK 4 // ask for add the links
#define RSLINK_PROCESS_NOTIFY_BAD_CHARS 8 // / or \\ characters in a filename
#include <stdint.h>
#define RSLINK_PROCESS_NOTIFY_ALL 15
#define RSLINK_PROCESS_NOTIFY_SUCCESS 1 // notify on success
#define RSLINK_PROCESS_NOTIFY_ERROR 2 // notify on error
#define RSLINK_PROCESS_NOTIFY_ASK 4 // ask for add the links
#define RSLINK_PROCESS_NOTIFY_BAD_CHARS 8 // / or \\ characters in a filename
#define RSLINK_SCHEME "retroshare"
#define RSLINK_PROCESS_NOTIFY_ALL 15
#define RSLINK_SCHEME "retroshare"
#define RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST 1
#define RSLINK_SUBTYPE_FILE_EXTRA 2
@ -57,20 +59,21 @@ class RetroShareLink
{
public:
enum enumType {
TYPE_UNKNOWN = 0x00,
TYPE_FILE = 0x01,
TYPE_PERSON = 0x02,
TYPE_FORUM = 0x03,
TYPE_CHANNEL = 0x04,
TYPE_SEARCH = 0x05,
TYPE_MESSAGE = 0x06,
TYPE_CERTIFICATE = 0x07,
TYPE_EXTRAFILE = 0x08,
TYPE_PRIVATE_CHAT = 0x09,
TYPE_PUBLIC_MSG = 0x0a,
TYPE_POSTED = 0x0b,
TYPE_IDENTITY = 0x0c,
TYPE_FILE_TREE = 0x0d
TYPE_UNKNOWN = 0x00,
TYPE_FILE = 0x01,
TYPE_PERSON = 0x02,
TYPE_FORUM = 0x03,
TYPE_CHANNEL = 0x04,
TYPE_SEARCH = 0x05,
TYPE_MESSAGE = 0x06,
TYPE_CERTIFICATE = 0x07,
TYPE_EXTRAFILE = 0x08,
TYPE_PRIVATE_CHAT = 0x09,//Deprecated
TYPE_PUBLIC_MSG = 0x0a,
TYPE_POSTED = 0x0b,
TYPE_IDENTITY = 0x0c,
TYPE_FILE_TREE = 0x0d,
TYPE_CHAT_ROOM = 0x0e
};
public:
@ -78,43 +81,47 @@ class RetroShareLink
RetroShareLink(const QUrl& url);
RetroShareLink(const QString& url);
static RetroShareLink createIdentity(const RsGxsId& gxs_id,const QString& name,const QString& radix_data) ;
static RetroShareLink createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
static RetroShareLink createFile(const QString& name, uint64_t size, const QString& hash);
static RetroShareLink createCollection(const QString& name, uint64_t size,uint32_t count,const QString& radix_data);
static RetroShareLink createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
static RetroShareLink createPerson(const RsPgpId &id);
static RetroShareLink createCertificate(const RsPeerId &ssl_id) ;
static RetroShareLink createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
static RetroShareLink createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName);
static RetroShareLink createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName);
static RetroShareLink createSearch(const QString& keywords);
static RetroShareLink createMessage(const RsPeerId &peerId, const QString& subject);
static RetroShareLink createMessage(const RsGxsId &peerId, const QString& subject);
static RetroShareLink createCertificate(const RsPeerId &ssl_id) ;
static RetroShareLink createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
static RetroShareLink createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
static RetroShareLink createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
static RetroShareLink createIdentity(const RsGxsId& gxs_id,const QString& name,const QString& radix_data) ;
static RetroShareLink createFileTree(const QString& name, uint64_t size,uint32_t count,const QString& radix_data);
static RetroShareLink createChatRoom(const ChatId &chatId, const QString& name);
bool valid() const { return _valid; }
enumType type() const {return _type; }
uint64_t size() const { return _size ; }
const QString& name() const { return _name ; }
uint64_t size() const { return _size ; }
const QString& hash() const { return _hash ; }
const QString& id() const { return _hash ; }
const QString& msgId() const { return _msgId ; }
const QString& subject() const { return _subject ; }
const QString& GPGRadix64Key() const { return _GPGBase64String ; }
const QString& GPGBase64CheckSum() const { return _GPGBase64CheckSum ; }
const QString& SSLId() const { return _SSLid ; }
const QString& GPGId() const { return _GPGid ; }
const QString& localIPAndPort() const { return _loc_ip_port ; }
const QString& externalIPAndPort() const { return _ext_ip_port ; }
const QString& dyndns() const { return _dyndns_name ; }
//const QString& GPGRadix64Key() const { return _GPGBase64String ; }
//const QString& GPGBase64CheckSum() const { return _GPGBase64CheckSum ; }
const QString& location() const { return _location ; }
//const QString& externalIPAndPort() const { return _ext_ip_port ; }
//const QString& localIPAndPort() const { return _loc_ip_port ; }
//const QString& dyndns() const { return _dyndns_name ; }
const QString& radix() const { return _radix ; }
time_t timeStamp() const { return _time_stamp ; }
QString title() const;
QString radixGroupData() const { return _radix_group_data ;}
QString radixGroupData() const { return _radix_group_data ;}
uint32_t count() const { return _count ; }
unsigned int subType() const { return _subType; }
void setSubType(unsigned int subType) { _subType = subType; }
// get title depends link's type
QString title() const;
// get nice name for anchor
QString niceName() const;
@ -132,8 +139,6 @@ class RetroShareLink
QUrl toUrl() const ;
bool valid() const { return _valid; }
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
static int process(const QStringList &urls, RetroShareLink::enumType type = RetroShareLink::TYPE_UNKNOWN, uint flag = RSLINK_PROCESS_NOTIFY_ALL);
@ -154,21 +159,21 @@ class RetroShareLink
enumType _type;
QString _name;
uint64_t _size;
QString _hash; // or id (forum, channel, message)
QString _hash; // or id (forum, channel, message, chat room)
QString _msgId; // id of the message (forum, channel)
QString _subject;
QString _SSLid ; // ssl id for rs links
QString _GPGid ; // ssl id for rs links
QString _GPGBase64String ; // GPG Cert
QString _GPGBase64CheckSum ; // GPG Cert
//QString _GPGBase64String ; // GPG Cert
//QString _GPGBase64CheckSum ; // GPG Cert
QString _location ; // location
QString _ext_ip_port ;
QString _loc_ip_port ;
QString _dyndns_name ;
QString _radix ;
QString _encrypted_chat_info ; // encrypted data string for the recipient of a chat invite
//QString _ext_ip_port ;
//QString _loc_ip_port ;
//QString _dyndns_name ;
QString _radix ;
//QString _encrypted_chat_info ; // encrypted data string for the recipient of a chat invite
time_t _time_stamp ; // time stamp at which the link will expire.
QString _radix_group_data;
QString _radix_group_data;
uint32_t _count ;
unsigned int _subType; // for general use as sub type for _type (RSLINK_SUBTYPE_...)

View File

@ -38,7 +38,7 @@
#include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h>
static std::map<ChatId, ChatDialog*> chatDialogs2;
static std::map<ChatId, ChatDialog*> chatDialogsList;
ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
QWidget(parent, flags)
@ -49,8 +49,8 @@ ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
ChatDialog::~ChatDialog()
{
std::map<ChatId, ChatDialog *>::iterator it;
if (chatDialogs2.end() != (it = chatDialogs2.find(mChatId))) {
chatDialogs2.erase(it);
if (chatDialogsList.end() != (it = chatDialogsList.find(mChatId))) {
chatDialogsList.erase(it);
}
}
@ -78,7 +78,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
/*static*/ ChatDialog* ChatDialog::getExistingChat(ChatId id)
{
std::map<ChatId, ChatDialog*>::iterator it;
if (chatDialogs2.end() != (it = chatDialogs2.find(id))) {
if (chatDialogsList.end() != (it = chatDialogsList.find(id))) {
/* exists already */
return it->second;
}
@ -122,7 +122,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
}
}
if(cd)
chatDialogs2[id] = cd;
chatDialogsList[id] = cd;
}
}
@ -142,14 +142,14 @@ void ChatDialog::init(const ChatId &id, const QString &title)
/* ChatDialog destuctor removes the entry from the map */
std::list<ChatDialog*> list;
std::map<ChatId, ChatDialog*>::iterator it;
for (it = chatDialogs2.begin(); it != chatDialogs2.end(); ++it) {
std::map<ChatId, ChatDialog*>::iterator it;
for (it = chatDialogsList.begin(); it != chatDialogsList.end(); ++it) {
if (it->second) {
list.push_back(it->second);
}
}
chatDialogs2.clear();
chatDialogsList.clear();
std::list<ChatDialog*>::iterator it1;
for (it1 = list.begin(); it1 != list.end(); ++it1) {

View File

@ -172,7 +172,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));
connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
//connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
connect(ui->chatTextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateLenOfChatTextEdit()));

View File

@ -229,7 +229,6 @@ bool RsHtml::canReplaceAnchor(QDomDocument &/*doc*/, QDomElement &/*element*/, c
switch (link.type()) {
case RetroShareLink::TYPE_UNKNOWN:
case RetroShareLink::TYPE_FILE:
case RetroShareLink::TYPE_FILE_TREE:
case RetroShareLink::TYPE_PERSON:
case RetroShareLink::TYPE_FORUM:
case RetroShareLink::TYPE_CHANNEL:
@ -240,6 +239,8 @@ bool RsHtml::canReplaceAnchor(QDomDocument &/*doc*/, QDomElement &/*element*/, c
case RetroShareLink::TYPE_PUBLIC_MSG:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_IDENTITY:
case RetroShareLink::TYPE_FILE_TREE:
case RetroShareLink::TYPE_CHAT_ROOM:
// not yet implemented
break;
@ -260,7 +261,6 @@ void RsHtml::anchorStylesheetForImg(QDomDocument &/*doc*/, QDomElement &/*elemen
switch (link.type()) {
case RetroShareLink::TYPE_UNKNOWN:
case RetroShareLink::TYPE_FILE:
case RetroShareLink::TYPE_FILE_TREE:
case RetroShareLink::TYPE_PERSON:
case RetroShareLink::TYPE_FORUM:
case RetroShareLink::TYPE_CHANNEL:
@ -271,6 +271,8 @@ void RsHtml::anchorStylesheetForImg(QDomDocument &/*doc*/, QDomElement &/*elemen
case RetroShareLink::TYPE_PUBLIC_MSG:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_IDENTITY:
case RetroShareLink::TYPE_FILE_TREE:
case RetroShareLink::TYPE_CHAT_ROOM:
// not yet implemented
break;

View File

@ -74,7 +74,6 @@ Drawer
{
id: gxsText
text: (ChatCache.contactsCache.own)?ChatCache.contactsCache.own.gxs_id : ""
// height: contentHeight
wrapMode: Text.WrapAnywhere
width: header.width
anchors.top: nickText.bottom
@ -89,29 +88,17 @@ Drawer
}
delegate: Item
{
property var styles: StyleSideBar.item
id: menuItem
width: parent.width
height: styles.height
Connections
{
target: mainWindow
onCoreReadyChanged:
{
console.log("Drawer onCoreReadyChanged",
model.title,
model.showOnCoreReady,
mainWindow.coreReady)
if (model.showOnCoreReady)
menuItem.setVisible(mainWindow.coreReady)
}
}
visible: model.showOnCoreReady ? mainWindow.coreReady : true
height: visible ? styles.height : 0
Component.onCompleted:
if (Q_OS_ANDROID && !model.showOnOsAndroid) visible = false
ButtonText
{
@ -142,28 +129,10 @@ Drawer
listView.currentIndex = index
menuList.actions[model.title]();
lastItem = stackView.currentItem
// titleLabel.text = model.title
// stackView.replace(model.source)
}
drawer.close()
}
}
visible: (model.showOnCoreReady)? setVisible(mainWindow.coreReady) : true
Component.onCompleted:
{
if (!model.showOnOsAndroid && Q_OS_ANDROID)
setVisible(false)
}
function setVisible(b)
{
menuItem.visible = b
if (!b) menuItem.height = 0
else menuItem.height = styles.height
return b;
}
}
model: ListModel
@ -220,24 +189,28 @@ Drawer
{
title: "Contacts"
showOnCoreReady: true
showOnOsAndroid: true
icon: "/icons/search.svg"
}
ListElement
{
title: "Trusted Nodes"
showOnCoreReady: true
showOnOsAndroid: true
icon: "/icons/netgraph.svg"
}
ListElement
{
title: "Paste Link"
showOnCoreReady: true
showOnOsAndroid: true
icon: "/icons/add.svg"
}
ListElement
{
title: "Share identity"
showOnCoreReady: true
showOnOsAndroid: true
icon: "/icons/share.svg"
}
ListElement
@ -250,6 +223,7 @@ Drawer
ListElement
{
title: "Terminate Core"
showOnCoreReady: false
showOnOsAndroid: false
icon: "/icons/exit.svg"
}