mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
enabled new link type for posted (patch from Fanch)
This commit is contained in:
parent
cf746f160c
commit
d512c4a35a
@ -46,7 +46,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual QString getHelpString() const ;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "gui/gxsforums/GxsForumsDialog.h"
|
||||
#include "gui/gxschannels/GxsChannelDialog.h"
|
||||
#include "gui/Posted/PostedDialog.h"
|
||||
#include "gui/FileTransfer/SearchDialog.h"
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "util/misc.h"
|
||||
@ -61,11 +62,12 @@
|
||||
#define HOST_PERSON "person"
|
||||
#define HOST_FORUM "forum"
|
||||
#define HOST_CHANNEL "channel"
|
||||
#define HOST_POSTED "posted"
|
||||
#define HOST_MESSAGE "message"
|
||||
#define HOST_SEARCH "search"
|
||||
#define HOST_CERTIFICATE "certificate"
|
||||
#define HOST_PUBLIC_MSG "public_msg"
|
||||
#define HOST_REGEXP "file|extra|person|forum|channel|search|message|certificate|private_chat|public_msg"
|
||||
#define HOST_REGEXP "file|extra|person|forum|channel|posted|search|message|certificate|private_chat|public_msg"
|
||||
|
||||
#define FILE_NAME "name"
|
||||
#define FILE_SIZE "size"
|
||||
@ -83,6 +85,11 @@
|
||||
#define CHANNEL_ID "id"
|
||||
#define CHANNEL_MSGID "msgid"
|
||||
|
||||
#define POSTED_NAME "name"
|
||||
#define POSTED_ID "id"
|
||||
#define POSTED_MSGID "msgid"
|
||||
|
||||
|
||||
#define MESSAGE_ID "id"
|
||||
#define MESSAGE_SUBJECT "subject"
|
||||
|
||||
@ -280,6 +287,15 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.host() == HOST_POSTED) {
|
||||
_type = TYPE_POSTED;
|
||||
_name = decodedQueryItemValue(urlQuery, POSTED_NAME);
|
||||
_hash = urlQuery.queryItemValue(POSTED_ID);
|
||||
_msgId = urlQuery.queryItemValue(POSTED_MSGID);
|
||||
check();
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.host() == HOST_SEARCH) {
|
||||
_type = TYPE_SEARCH;
|
||||
_name = decodedQueryItemValue(urlQuery, SEARCH_KEYWORDS);
|
||||
@ -579,6 +595,16 @@ void RetroShareLink::check()
|
||||
if(_hash.isEmpty())
|
||||
_valid = false;
|
||||
break;
|
||||
case TYPE_POSTED:
|
||||
if(_size != 0)
|
||||
_valid = false;
|
||||
|
||||
if(_name.isEmpty())
|
||||
_valid = false;
|
||||
|
||||
if(_hash.isEmpty())
|
||||
_valid = false;
|
||||
break;
|
||||
case TYPE_SEARCH:
|
||||
if(_size != 0)
|
||||
_valid = false;
|
||||
@ -629,6 +655,7 @@ QString RetroShareLink::title() const
|
||||
return PeerDefs::rsidFromId(RsPgpId(hash().toStdString()));
|
||||
case TYPE_FORUM:
|
||||
case TYPE_CHANNEL:
|
||||
case TYPE_POSTED:
|
||||
case TYPE_SEARCH:
|
||||
break;
|
||||
case TYPE_MESSAGE:
|
||||
@ -724,6 +751,17 @@ QString RetroShareLink::toString() const
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_POSTED:
|
||||
url.setScheme(RSLINK_SCHEME);
|
||||
url.setHost(HOST_POSTED);
|
||||
urlQuery.addQueryItem(POSTED_NAME, encodeItem(_name));
|
||||
urlQuery.addQueryItem(POSTED_ID, _hash);
|
||||
if (!_msgId.isEmpty()) {
|
||||
urlQuery.addQueryItem(POSTED_MSGID, _msgId);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_SEARCH:
|
||||
url.setScheme(RSLINK_SCHEME);
|
||||
url.setHost(HOST_SEARCH);
|
||||
@ -969,6 +1007,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
case TYPE_UNKNOWN:
|
||||
case TYPE_FORUM:
|
||||
case TYPE_CHANNEL:
|
||||
case TYPE_POSTED:
|
||||
case TYPE_SEARCH:
|
||||
case TYPE_MESSAGE:
|
||||
case TYPE_CERTIFICATE:
|
||||
@ -1040,6 +1079,12 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
QStringList channelUnknown;
|
||||
QStringList channelMsgUnknown;
|
||||
|
||||
// forum
|
||||
QStringList postedFound;
|
||||
QStringList postedMsgFound;
|
||||
QStringList postedUnknown;
|
||||
QStringList postedMsgUnknown;
|
||||
|
||||
// search
|
||||
QStringList searchStarted;
|
||||
|
||||
@ -1056,8 +1101,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
QList<QStringList*> processedList;
|
||||
QList<QStringList*> errorList;
|
||||
|
||||
processedList << &fileAdded << &personAdded << &forumFound << &channelFound << &searchStarted << &messageStarted;
|
||||
errorList << &fileExist << &personExist << &personFailed << &personNotFound << &forumUnknown << &forumMsgUnknown << &channelUnknown << &channelMsgUnknown << &messageReceipientNotAccepted << &messageReceipientUnknown;
|
||||
processedList << &fileAdded << &personAdded << &forumFound << &channelFound << &postedFound << &searchStarted << &messageStarted;
|
||||
errorList << &fileExist << &personExist << &personFailed << &personNotFound << &forumUnknown << &forumMsgUnknown << &channelUnknown << &channelMsgUnknown << &postedUnknown << &postedMsgUnknown << &messageReceipientNotAccepted << &messageReceipientUnknown;
|
||||
// not needed: forumFound, channelFound, messageStarted
|
||||
|
||||
for (linkIt = links.begin(); linkIt != links.end(); ++linkIt) {
|
||||
@ -1289,6 +1334,36 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case TYPE_POSTED:
|
||||
{
|
||||
#ifdef DEBUG_RSLINK
|
||||
std::cerr << " RetroShareLink::process PostedRequest : name : " << link.name().toStdString() << ". id : " << link.hash().toStdString() << ". msgId : " << link.msgId().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
MainWindow::showWindow(MainWindow::Posted);
|
||||
PostedDialog *postedDialog = dynamic_cast<PostedDialog*>(MainWindow::getPage(MainWindow::Posted));
|
||||
|
||||
if (!postedDialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (postedDialog->navigate(RsGxsGroupId(link.id().toStdString()), RsGxsMessageId(link.msgId().toStdString()))) {
|
||||
if (link.msgId().isEmpty()) {
|
||||
postedFound.append(link.name());
|
||||
} else {
|
||||
postedMsgFound.append(link.name());
|
||||
}
|
||||
} else {
|
||||
if (link.msgId().isEmpty()) {
|
||||
postedUnknown.append(link.name());
|
||||
} else {
|
||||
postedMsgUnknown.append(link.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_SEARCH:
|
||||
{
|
||||
#ifdef DEBUG_RSLINK
|
||||
@ -1438,6 +1513,16 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
}
|
||||
}
|
||||
|
||||
// posted
|
||||
if (flag & RSLINK_PROCESS_NOTIFY_ERROR) {
|
||||
if (!postedUnknown.isEmpty()) {
|
||||
processList(postedUnknown, QObject::tr("Posted not found"), QObject::tr("Posted not found"), result);
|
||||
}
|
||||
if (!postedMsgUnknown.isEmpty()) {
|
||||
processList(postedMsgUnknown, QObject::tr("Posted message not found"), QObject::tr("Posted messages not found"), result);
|
||||
}
|
||||
}
|
||||
|
||||
// message
|
||||
if (flag & RSLINK_PROCESS_NOTIFY_ERROR) {
|
||||
if (!messageReceipientNotAccepted.isEmpty()) {
|
||||
|
@ -67,7 +67,8 @@ class RetroShareLink
|
||||
TYPE_CERTIFICATE = 0x07,
|
||||
TYPE_EXTRAFILE = 0x08,
|
||||
TYPE_PRIVATE_CHAT = 0x09,
|
||||
TYPE_PUBLIC_MSG = 0x0a
|
||||
TYPE_PUBLIC_MSG = 0x0a,
|
||||
TYPE_POSTED = 0x0b
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -71,7 +71,7 @@ void PostedGroupItem::setup()
|
||||
connect(ui->subscribeButton, SIGNAL(clicked()), this, SLOT(subscribePosted()));
|
||||
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyGroupLink()));
|
||||
|
||||
ui->copyLinkButton->hide(); // No link type at this moment
|
||||
//ui->copyLinkButton->hide(); // No link type at this moment
|
||||
|
||||
ui->expandFrame->hide();
|
||||
}
|
||||
@ -130,10 +130,10 @@ void PostedGroupItem::fill()
|
||||
#endif
|
||||
|
||||
// No link type at this moment
|
||||
// RetroShareLink link;
|
||||
// link.createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
|
||||
// ui->nameLabel->setText(link.toHtml());
|
||||
ui->nameLabel->setText(groupName());
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
// ui->nameLabel->setText(groupName());
|
||||
|
||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||
|
||||
|
@ -145,6 +145,7 @@ bool RsHtml::canReplaceAnchor(QDomDocument &/*doc*/, QDomElement &/*element*/, c
|
||||
case RetroShareLink::TYPE_PERSON:
|
||||
case RetroShareLink::TYPE_FORUM:
|
||||
case RetroShareLink::TYPE_CHANNEL:
|
||||
case RetroShareLink::TYPE_POSTED:
|
||||
case RetroShareLink::TYPE_SEARCH:
|
||||
case RetroShareLink::TYPE_MESSAGE:
|
||||
case RetroShareLink::TYPE_EXTRAFILE:
|
||||
@ -173,6 +174,7 @@ void RsHtml::anchorStylesheetForImg(QDomDocument &/*doc*/, QDomElement &/*elemen
|
||||
case RetroShareLink::TYPE_PERSON:
|
||||
case RetroShareLink::TYPE_FORUM:
|
||||
case RetroShareLink::TYPE_CHANNEL:
|
||||
case RetroShareLink::TYPE_POSTED:
|
||||
case RetroShareLink::TYPE_SEARCH:
|
||||
case RetroShareLink::TYPE_MESSAGE:
|
||||
case RetroShareLink::TYPE_EXTRAFILE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user