diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index c12f73e02..73852dd38 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -246,7 +246,7 @@ void ChannelFeed::openChat(std::string /*peerId*/) { } -void ChannelFeed::openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/) +void ChannelFeed::openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /* title */) { } diff --git a/retroshare-gui/src/gui/ChannelFeed.h b/retroshare-gui/src/gui/ChannelFeed.h index 4609c2602..6ea6ecc5b 100644 --- a/retroshare-gui/src/gui/ChannelFeed.h +++ b/retroshare-gui/src/gui/ChannelFeed.h @@ -54,7 +54,7 @@ public: virtual QScrollArea *getScrollArea(); virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void openChat(std::string peerId); - virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/); + virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /*title */); bool navigate(const std::string& channelId, const std::string& msgId); diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index 183504763..5989411f6 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -811,7 +811,7 @@ void NewsFeed::openChat(std::string peerId) } -void NewsFeed::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) +void NewsFeed::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) { std::cerr << "NewsFeed::openComments() Not Handled Yet"; std::cerr << std::endl; diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 352eddbef..958d9bc84 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -47,7 +47,7 @@ public: virtual QScrollArea *getScrollArea(); virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void openChat(std::string peerId); - virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId); + virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); static void testFeeds(uint notifyFlags); static void testFeed(FeedNotify *feedNotify); diff --git a/retroshare-gui/src/gui/Posted/PostedComments.cpp b/retroshare-gui/src/gui/Posted/PostedComments.cpp deleted file mode 100644 index 8340cdc49..000000000 --- a/retroshare-gui/src/gui/Posted/PostedComments.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Retroshare Posted Comments - * - * Copyright 2012-2012 by Robert Fernie. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License Version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - * Please report all bugs and problems to "retroshare@lunamutt.com". - * - */ - -#include "PostedComments.h" -#include "PostedCreateCommentDialog.h" - -#include - - -#include -#include - -#include -#include -#include - - - -/**************************************************************** - * New Photo Display Widget. - * - * This has two 'lists'. - * Top list shows Albums. - * Lower list is photos from the selected Album. - * - * Notes: - * Each Item will be an AlbumItem, which contains a thumbnail & random details. - * We will limit Items to < 100. With a 'Filter to see more message. - * - * Thumbnails will come from Service. - * Option to Share albums / pictures onward (if permissions allow). - * Option to Download the albums to a specified directory. (is this required if sharing an album?) - * - * Will introduce a FullScreen SlideShow later... first get basics happening. - */ - - - - -/** Constructor */ -PostedComments::PostedComments(QWidget *parent) -:QWidget(parent) -{ - ui.setupUi(this); - ui.postFrame->setVisible(false); - ui.treeWidget->setup(rsPosted->getTokenService()); -} - -void PostedComments::loadRequest(const TokenQueue *queue, const TokenRequest &req) -{ - -} - -void PostedComments::loadComments(const RsPostedPost& post) -{ - std::cerr << "PostedComments::loadComments(" << post.mMeta.mOrigMsgId << ")"; - std::cerr << std::endl; - - mCurrentPost = post; - setUpPostFrame(); - - RsGxsGrpMsgIdPair threadId; - - threadId.first = post.mMeta.mGroupId; - threadId.second = post.mMeta.mOrigMsgId; - - ui.treeWidget->requestComments(threadId); -} - - -void PostedComments::setUpPostFrame() -{ - ui.postFrame->setVisible(true); - - QDateTime qtime; - qtime.setTime_t(mCurrentPost.mMeta.mPublishTs); - QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); - ui.dateLabel->setText(timestamp); - ui.fromLabel->setText(QString::fromUtf8(mCurrentPost.mMeta.mAuthorId.c_str())); - ui.titleLabel->setText("" + - QString::fromStdString(mCurrentPost.mMeta.mMsgName) + ""); - ui.siteLabel->setText("" + - QString::fromStdString(mCurrentPost.mLink) + ""); - - ui.scoreLabel->setText(QString("0")); - - ui.notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes)); - -} - diff --git a/retroshare-gui/src/gui/Posted/PostedComments.h b/retroshare-gui/src/gui/Posted/PostedComments.h deleted file mode 100644 index 3053f18e1..000000000 --- a/retroshare-gui/src/gui/Posted/PostedComments.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Retroshare Posted Comments - * - * Copyright 2012-2012 by Robert Fernie. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License Version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - * Please report all bugs and problems to "retroshare@lunamutt.com". - * - */ - -#ifndef MRK_POSTED_COMMENTS_H -#define MRK_POSTED_COMMENTS_H - -//#include "gui/mainpage.h" -#include "ui_PostedComments.h" - -#include - -#include - -#include "util/TokenQueue.h" - -class PostedComments: public QWidget, public TokenResponse -{ - Q_OBJECT - -public: - PostedComments(QWidget *parent = 0); - -public slots: - - void loadComments(const RsPostedPost& ); - -private: - void loadRequest(const TokenQueue *queue, const TokenRequest &req); - void setUpPostFrame(); - - RsPostedPost mCurrentPost; - - /* UI - from Designer */ - Ui::PostedComments ui; - -}; - -#endif - diff --git a/retroshare-gui/src/gui/Posted/PostedComments.ui b/retroshare-gui/src/gui/Posted/PostedComments.ui deleted file mode 100644 index 817cc6ff7..000000000 --- a/retroshare-gui/src/gui/Posted/PostedComments.ui +++ /dev/null @@ -1,367 +0,0 @@ - - - PostedComments - - - - 0 - 0 - 632 - 398 - - - - Form - - - - - - - 0 - 0 - - - - background-color: rgb(203, 203, 203); - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 20 - - - - 1 - - - - - - - - - /\ - - - - - - - score - - - - - - - \/ - - - - - - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Title this is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title dont you think? yes it is and should wrap around I hope - - - true - - - true - - - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - Date - - - - - - - - 0 - 0 - - - - - 9 - - - - You eyes only - - - true - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - From - - - - - - - - 0 - 0 - - - - - 9 - - - - Signed by - - - true - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - Site - - - - - - - - 0 - 0 - - - - - 9 - - - - Signed by - - - true - - - - - - - - - - - - - - background-color: rgb(203, 203, 203); - - - - - - - - - false - - - - 6 - - - 0 - - - - - Hot - - - true - - - true - - - - - - - New - - - true - - - true - - - - - - - Top - - - true - - - false - - - true - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Refresh - - - - - - - - - - Comment - - - - - Author - - - - - Date - - - - - Points - - - - - - - - - GxsCommentTreeWidget - QTreeWidget -
gui/gxs/GxsCommentTreeWidget.h
-
-
- - -
diff --git a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.cpp deleted file mode 100644 index e5eaa27c6..000000000 --- a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "PostedCreateCommentDialog.h" -#include "ui_PostedCreateCommentDialog.h" - -PostedCreateCommentDialog::PostedCreateCommentDialog(TokenQueue *tokQ, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) : - QDialog(parent), - ui(new Ui::PostedCreateCommentDialog), mTokenQueue(tokQ), mParentId(parentId), mThreadId(threadId) -{ - ui->setupUi(this); - connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment())); -} - -void PostedCreateCommentDialog::createComment() -{ - RsPostedComment comment; - - comment.mComment = ui->commentTextEdit->document()->toPlainText().toStdString(); - comment.mMeta.mParentId = mParentId.second; - comment.mMeta.mGroupId = mParentId.first; - comment.mMeta.mThreadId = mThreadId; - - uint32_t token; - rsPosted->submitComment(token, comment); - mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0); - close(); -} - -PostedCreateCommentDialog::~PostedCreateCommentDialog() -{ - delete ui; -} diff --git a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.h b/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.h deleted file mode 100644 index 8edae3e1a..000000000 --- a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef POSTEDCREATECOMMENTDIALOG_H -#define POSTEDCREATECOMMENTDIALOG_H - -#include -#include "retroshare/rsposted.h" -#include "util/TokenQueue.h" - -namespace Ui { - class PostedCreateCommentDialog; -} - -class PostedCreateCommentDialog : public QDialog -{ - Q_OBJECT - -public: - explicit PostedCreateCommentDialog(TokenQueue* tokQ, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0); - ~PostedCreateCommentDialog(); - -private slots: - - void createComment(); - -private: - Ui::PostedCreateCommentDialog *ui; - TokenQueue* mTokenQueue; - RsGxsGrpMsgIdPair mParentId; - RsGxsMessageId mThreadId; -}; - -#endif // POSTEDCREATECOMMENTDIALOG_H diff --git a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.ui b/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.ui deleted file mode 100644 index ddecc9214..000000000 --- a/retroshare-gui/src/gui/Posted/PostedCreateCommentDialog.ui +++ /dev/null @@ -1,82 +0,0 @@ - - - PostedCreateCommentDialog - - - - 0 - 0 - 372 - 145 - - - - Make Comment - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Comment</span></p></body></html> - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - PostedCreateCommentDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PostedCreateCommentDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp index aa611f178..bb81e41de 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp @@ -1,21 +1,65 @@ +/* + * Retroshare Posted + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include #include "PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h" +#include + PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), ui(new Ui::PostedCreatePostDialog) { ui->setupUi(this); connect(this, SIGNAL(accepted()), this, SLOT(createPost())); + + /* fill in the available OwnIds for signing */ + ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); + } void PostedCreatePostDialog::createPost() { + RsGxsId authorId; + if (!ui->idChooser->getChosenId(authorId)) + { + std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed"; + std::cerr << std::endl; + + QMessageBox::warning(this, tr("RetroShare"),tr("Please reate or choose a Signing Id first"), + QMessageBox::Ok, QMessageBox::Ok); + + return; + } + + RsPostedPost post; post.mMeta.mGroupId = mGrpId; - post.mLink = ui->linkEdit->text().toStdString(); - post.mNotes = ui->notesTextEdit->toPlainText().toStdString(); - post.mMeta.mMsgName = ui->titleEdit->text().toStdString(); + post.mLink = std::string(ui->linkEdit->text().toUtf8()); + post.mNotes = std::string(ui->notesTextEdit->toPlainText().toUtf8()); + post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8()); + post.mMeta.mAuthorId = authorId; uint32_t token; mPosted->createPost(token, post); diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h index 9a06042b8..85531bda9 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h @@ -1,3 +1,26 @@ +/* + * Retroshare Posted + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + #ifndef POSTEDCREATEPOSTDIALOG_H #define POSTEDCREATEPOSTDIALOG_H diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui index e565194d0..9f6c48ec1 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui @@ -6,8 +6,8 @@ 0 0 - 406 - 195 + 593 + 371 @@ -40,8 +40,8 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Link</span></p></body></html> +</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Link</span></p></body></html> @@ -50,6 +50,36 @@ p, li { white-space: pre-wrap; } + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 78 + 17 + + + + + + + + Signed by: + + + + + + + + @@ -76,7 +106,16 @@ p, li { white-space: pre-wrap; } - + + + GxsIdChooser + QComboBox +
gui/gxs/GxsIdChooser.h
+
+
+ + + buttonBox diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp deleted file mode 100644 index ae7bc0b4c..000000000 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Retroshare Posted List - * - * Copyright 2012-2012 by Robert Fernie. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License Version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - * Please report all bugs and problems to "retroshare@lunamutt.com". - * - */ - -#include "PostedDialog.h" - -#include "PostedListDialog.h" -#include "PostedComments.h" - -#include - -#include -#include - -#include -#include - -/****** - * #define PHOTO_DEBUG 1 - *****/ - - -/**************************************************************** - * Posted Dialog - * - */ - -PostedDialog::PostedDialog(QWidget *parent) -: MainPage(parent) -{ - ui.setupUi(this); - - mPostedList = new PostedListDialog(this, NULL); - mPostedComments = new PostedComments(NULL); - - QString list(tr("List")); - ui.tabWidget->addTab(mPostedList, list); - QString comments(tr("Comments")); - ui.tabWidget->addTab(mPostedComments, comments); - - connect(mPostedList, SIGNAL(loadComments( std::string ) ), mPostedComments, SLOT(loadComments( std::string ) ) ); -} - -void PostedDialog::commentLoad(const RsPostedPost &post) -{ - mPostedComments->loadComments(post); - ui.tabWidget->setCurrentWidget(mPostedComments); -} - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.h b/retroshare-gui/src/gui/Posted/PostedDialog.h index cb5c6710f..7fd2be4b2 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedDialog.h @@ -57,10 +57,11 @@ public: return rsPosted; } - virtual GxsCommentHeader *createHeaderWidget() - { - return NULL; - } + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) + { + return new PostedItem(NULL, 0, grpId, msgId, true); + } + }; #endif diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.ui b/retroshare-gui/src/gui/Posted/PostedDialog.ui deleted file mode 100644 index 757f2f61b..000000000 --- a/retroshare-gui/src/gui/Posted/PostedDialog.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - PostedDialog - - - - 0 - 0 - 726 - 557 - - - - - 1 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - - - - 24 - 24 - - - - - - - :/images/posted_24.png - - - - - - - - 10 - 75 - true - - - - Posted Links - - - - - - - Qt::Horizontal - - - - 573 - 20 - - - - - - - - - - - -1 - - - - - - - - - - diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp index f4168284c..eecd28cf2 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Posted * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "PostedGroupDialog.h" diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h index 3096a5732..e85b27777 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Posted * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _POSTED_GROUP_DIALOG_H diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index 996e157dc..7dea1c7e5 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -37,80 +37,127 @@ /** Constructor */ -PostedItem::PostedItem(PostedHolder *postHolder, const RsPostedPost &post) -:QWidget(NULL), mPostHolder(postHolder), mPost(post) + +PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) + :GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsPosted, true) { - setupUi(this); - setAttribute ( Qt::WA_DeleteOnClose, true ); - - setContent(mPost); - - connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) ); - connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); - connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); - - return; + setup(); } +PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome) + :GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, false), + mPost(post) +{ + setup(); + + setContent(mPost); +} + + +void PostedItem::setup() +{ + setupUi(this); + setAttribute ( Qt::WA_DeleteOnClose, true ); + + connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) ); + connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); + connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); + + return; +} + + +void PostedItem::loadMessage(const uint32_t &token) +{ + std::vector posts; + if (!rsPosted->getPostData(token, posts)) + { + std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data"; + std::cerr << std::endl; + return; + } + + if (posts.size() != 1) + { + std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items"; + std::cerr << std::endl; + return; + } + + mPost = posts[0]; + setContent(mPost); + + return; +} + + + void PostedItem::setContent(const RsPostedPost &post) { - mPost = post; - QDateTime qtime; - qtime.setTime_t(mPost.mMeta.mPublishTs); - QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); - dateLabel->setText(timestamp); - fromLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str())); - titleLabel->setText("" + - QString::fromStdString(post.mMeta.mMsgName) + ""); - siteLabel->setText("" + - QString::fromStdString(post.mLink) + ""); + mPost = post; + QDateTime qtime; + qtime.setTime_t(mPost.mMeta.mPublishTs); + QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); + dateLabel->setText(timestamp); + fromLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str())); + titleLabel->setText("" + + QString::fromStdString(post.mMeta.mMsgName) + ""); + siteLabel->setText("" + + QString::fromStdString(post.mLink) + ""); - uint32_t up, down, nComments; + uint32_t up, down, nComments; #if 0 - bool ok = rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments); + bool ok = rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments); - if(ok) - { - int32_t vote = up - down; - scoreLabel->setText(QString::number(vote)); + if(ok) + { + int32_t vote = up - down; + scoreLabel->setText(QString::number(vote)); - numCommentsLabel->setText("

# Comments: " - + QString::number(nComments) + "

"); - } + numCommentsLabel->setText("

# Comments: " + + QString::number(nComments) + "

"); + } #endif } RsPostedPost PostedItem::getPost() const { - return mPost; + return mPost; } void PostedItem::makeDownVote() { - RsGxsGrpMsgIdPair msgId; - msgId.first = mPost.mMeta.mGroupId; - msgId.second = mPost.mMeta.mMsgId; - emit vote(msgId, false); + RsGxsGrpMsgIdPair msgId; + msgId.first = mPost.mMeta.mGroupId; + msgId.second = mPost.mMeta.mMsgId; + emit vote(msgId, false); } void PostedItem::makeUpVote() { - RsGxsGrpMsgIdPair msgId; - msgId.first = mPost.mMeta.mGroupId; - msgId.second = mPost.mMeta.mMsgId; - emit vote(msgId, true); + RsGxsGrpMsgIdPair msgId; + msgId.first = mPost.mMeta.mGroupId; + msgId.second = mPost.mMeta.mMsgId; + emit vote(msgId, true); } void PostedItem::loadComments() { - std::cerr << "PostedItem::loadComments() Requesting for " << mThreadId; - std::cerr << std::endl; - mPostHolder->showComments(mPost); + std::cerr << "PostedItem::loadComments()"; + std::cerr << std::endl; + if (mParent) + { + QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str()); + mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title); + } } + + + diff --git a/retroshare-gui/src/gui/Posted/PostedItem.h b/retroshare-gui/src/gui/Posted/PostedItem.h index de968d019..622f710f1 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.h +++ b/retroshare-gui/src/gui/Posted/PostedItem.h @@ -27,23 +27,17 @@ #include "ui_PostedItem.h" #include +#include "gui/feeds/FeedHolder.h" +#include "gui/gxs/GxsFeedItem.h" -class RsPostedPost; -class PostedItem; -class PostedHolder -{ - public: - - virtual void showComments(const RsPostedPost& post) = 0; -}; - -class PostedItem : public QWidget, private Ui::PostedItem +class PostedItem : public GxsFeedItem, private Ui::PostedItem { Q_OBJECT public: - PostedItem(PostedHolder *parent, const RsPostedPost &post); + PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); + PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome); RsPostedPost getPost() const; void setContent(const RsPostedPost& post); @@ -56,12 +50,16 @@ private slots: signals: void vote(const RsGxsGrpMsgIdPair& msgId, bool up); +protected: + virtual void loadMessage(const uint32_t &token); + private: + + void setup(); + uint32_t mType; bool mSelected; - std::string mThreadId; - PostedHolder *mPostHolder; RsPostedPost mPost; }; diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp index 729c79b01..4d7b7f377 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp @@ -214,12 +214,34 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up) #endif } -void PostedListDialog::showComments(const RsPostedPost& post) + +/*****************************************************************************************/ + // Overloaded from FeedHolder. +QScrollArea *PostedListDialog::getScrollArea() { - commentLoad(post.mMeta.mGroupId, post.mMeta.mMsgId); - //mCommentHolder->commentLoad(post); + return ui.scrollArea; } +void PostedListDialog::deleteFeedItem(QWidget *item, uint32_t type) +{ + std::cerr << "PostedListDialog::deleteFeedItem() Nah"; + std::cerr << std::endl; + return; +} + +void PostedListDialog::openChat(std::string peerId) +{ + std::cerr << "PostedListDialog::openChat() Nah"; + std::cerr << std::endl; + return; +} + +void PostedListDialog::openComments(uint32_t feed_type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) +{ + commentLoad(groupId, msgId, title); +} + +/*****************************************************************************************/ void PostedListDialog::updateDisplay() @@ -500,7 +522,7 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) void PostedListDialog::loadPost(const RsPostedPost &post) { - PostedItem *item = new PostedItem(this, post); + PostedItem *item = new PostedItem(this, 0, post, true); connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool))); QLayout *alayout = ui.scrollAreaWidgetContents->layout(); mPosts.insert(post.mMeta.mMsgId, item); diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.h b/retroshare-gui/src/gui/Posted/PostedListDialog.h index fb047bf8c..60489ff5c 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.h @@ -53,14 +53,18 @@ #define POSTEDDIALOG_INSERT_POST 5 #define POSTEDDIALOG_REPLY_MESSAGE 6 -class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse, public GxsServiceDialog +class PostedListDialog : public RsAutoUpdatePage, public FeedHolder, public TokenResponse, public GxsServiceDialog { Q_OBJECT public: PostedListDialog(QWidget *parent = 0); - void showComments(const RsPostedPost& post); + // Overloaded from FeedHolder. + virtual QScrollArea *getScrollArea(); + virtual void deleteFeedItem(QWidget *item, uint32_t type); + virtual void openChat(std::string peerId); + virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); private slots: diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.ui b/retroshare-gui/src/gui/Posted/PostedListDialog.ui index 2bddcaefc..f8e3ed70a 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.ui @@ -220,8 +220,8 @@ 0 0 - 426 - 327 + 443 + 316 @@ -230,24 +230,7 @@ 0 - - - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 20 - 309 - - - - - +
diff --git a/retroshare-gui/src/gui/feeds/FeedHolder.h b/retroshare-gui/src/gui/feeds/FeedHolder.h index 3823e3430..5e9e55b79 100644 --- a/retroshare-gui/src/gui/feeds/FeedHolder.h +++ b/retroshare-gui/src/gui/feeds/FeedHolder.h @@ -37,7 +37,7 @@ public: virtual QScrollArea *getScrollArea() = 0; virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0; virtual void openChat(std::string peerId) = 0; - virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0; + virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) = 0; // Workaround for QTBUG-3372 void lockLayout(QWidget *feedItem, bool lock); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index b2fadb779..ea43fb550 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Feed Item * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include #include @@ -40,39 +42,41 @@ * #define DEBUG_ITEM 1 ****/ +#define DEBUG_ITEM 1 + #define COLOR_NORMAL QColor(248, 248, 248) #define COLOR_NEW QColor(220, 236, 253) #define SELF_LOAD 1 #define DATA_PROVIDED 2 -/** Constructor */ -GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mChanId(chanId), mMsgId(msgId), mIsHome(isHome) + +GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) + :GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsGxsChannels, true) { mMode = SELF_LOAD; - mSubscribeFlags = 0; setup(); - - // THIS IS JUST SO WE REMEMBER TO DO IT. - updateItemStatic(); - updateItem(); } + + + /** Constructor */ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mChanId(post.mMeta.mGroupId), mMsgId(post.mMeta.mMsgId), mIsHome(isHome) + :GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, false) { + std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load"; + std::cerr << std::endl; + mMode = DATA_PROVIDED; - mSubscribeFlags = subFlags; + mGroupMeta.mSubscribeFlags = subFlags; + m_inUpdateItemStatic = false; setup(); + // is it because we are in the constructor? loadPost(post); - updateItem(); } @@ -95,7 +99,7 @@ void GxsChannelPostItem::setup() connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) ); // HACK FOR NOW. - connect( commentButton, SIGNAL( clicked( void ) ), this, SLOT( comments ( void ) ) ); + connect( commentButton, SIGNAL( clicked( void ) ), this, SLOT( loadComments ( void ) ) ); connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) ); connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) ); @@ -121,153 +125,37 @@ void GxsChannelPostItem::setup() } - -void GxsChannelPostItem::updateItemStatic() +void GxsChannelPostItem::loadComments() { -#if 0 - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "GxsChannelPostItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - ChannelMsgInfo cmi; - - if (!rsChannels) - return; - - if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) - return; - - m_inUpdateItemStatic = true; - - QString title; - - ChannelInfo ci; - rsChannels->getChannelInfo(mChanId, ci); - - if (!mIsHome) - { - title = tr("Channel Feed") + ": "; - RetroShareLink link; - link.createChannel(ci.channelId, ""); - title += link.toHtml(); - titleLabel->setText(title); - RetroShareLink msgLink; - msgLink.createChannel(cmi.channelId, cmi.msgId); - subjectLabel->setText(msgLink.toHtml()); - - if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) { - unsubscribeButton->setEnabled(true); - } else { - unsubscribeButton->setEnabled(false); - } - readButton->hide(); - newLabel->hide(); - copyLinkButton->hide(); - } - else - { - /* subject */ - titleLabel->setText(QString::fromStdWString(cmi.subject)); - subjectLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - /* disable buttons: deletion facility not enabled with cache services yet */ - clearButton->setEnabled(false); - unsubscribeButton->setEnabled(false); - clearButton->hide(); - readAndClearButton->hide(); - unsubscribeButton->hide(); - copyLinkButton->show(); - - if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) { - readButton->setVisible(true); - - uint32_t status = 0; - rsChannels->getMessageStatus(mChanId, mMsgId, status); - - if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) { - readButton->setChecked(true); - readButton->setIcon(QIcon(":/images/message-state-unread.png")); - } else { - readButton->setChecked(false); - readButton->setIcon(QIcon(":/images/message-state-read.png")); - } - - bool newState; - QColor color; - if (status & CHANNEL_MSG_STATUS_READ) { - newLabel->setVisible(false); - newState = false; - color = COLOR_NORMAL; - } else { - newLabel->setVisible(true); - newState = true; - color = COLOR_NEW; - } - - /* unpolish widget to clear the stylesheet's palette cache */ - frame->style()->unpolish(frame); - - QPalette palette = frame->palette(); - palette.setColor(frame->backgroundRole(), color); - frame->setPalette(palette); - - frame->setProperty("new", newState); - Rshare::refreshStyleSheet(frame, false); - } else { - readButton->setVisible(false); - newLabel->setVisible(false); - } - } - - msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - msgFrame->setVisible(!cmi.msg.empty()); - - datetimelabel->setText(DateTime::formatLongDateTime(cmi.ts)); - - filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size))); - - if (mFileItems.empty() == false) { - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - delete(*it); - } - mFileItems.clear(); - } - - std::list::iterator it; - for(it = cmi.files.begin(); it != cmi.files.end(); it++) - { - /* add file */ - SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size, - SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, ""); - mFileItems.push_back(fi); - - /* check if the file is a media file */ - if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix())) - fi->mediatype(); - - - QLayout *layout = expandFrame->layout(); - layout->addWidget(fi); - } - - if(cmi.thumbnail.image_thumbnail != NULL) - { - QPixmap thumbnail; - thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG"); - - logoLabel->setPixmap(thumbnail); - } - - m_inUpdateItemStatic = false; -#endif - + QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str()); + comments(title); } +void GxsChannelPostItem::loadMessage(const uint32_t &token) +{ + std::cerr << "GxsChannelPostItem::loadMessage()"; + std::cerr << std::endl; + + std::vector posts; + if (!rsGxsChannels->getPostData(token, posts)) + { + std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data"; + std::cerr << std::endl; + return; + } + + if (posts.size() != 1) + { + std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items"; + std::cerr << std::endl; + return; + } + + loadPost(posts[0]); + + updateItem(); +} @@ -279,6 +167,10 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) std::cerr << std::endl; #endif + m_inUpdateItemStatic = true; + + mPost = post; + QString title; if (!mIsHome) @@ -318,10 +210,11 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) unsubscribeButton->hide(); copyLinkButton->show(); - if (IS_GROUP_SUBSCRIBED(mSubscribeFlags) || IS_GROUP_ADMIN(mSubscribeFlags)) + if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags)) { readButton->setVisible(true); +#if 0 uint32_t status = 0; rsChannels->getMessageStatus(mChanId, mMsgId, status); @@ -336,6 +229,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) readButton->setChecked(false); readButton->setIcon(QIcon(":/images/message-state-read.png")); } +#endif bool newState; QColor color; @@ -407,8 +301,11 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) { QPixmap thumbnail; thumbnail.loadFromData(post.mThumbnail.mData, post.mThumbnail.mSize, "PNG"); + // Wiping data - as its been passed to thumbnail. logoLabel->setPixmap(thumbnail); } + + m_inUpdateItemStatic = false; } void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left) @@ -500,13 +397,16 @@ void GxsChannelPostItem::updateItem() } // HACK TO DISPLAY COMMENT BUTTON FOR NOW. - downloadButton->show(); - downloadButton->setEnabled(true); + //downloadButton->show(); + //downloadButton->setEnabled(true); } void GxsChannelPostItem::toggle() { - mParent->lockLayout(this, true); + if (mParent) + { + mParent->lockLayout(this, true); + } if (expandFrame->isHidden()) { @@ -523,37 +423,9 @@ void GxsChannelPostItem::toggle() expandButton->setToolTip(tr("Expand")); } - mParent->lockLayout(this, false); -} - -void GxsChannelPostItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "GxsChannelPostItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - if (mParent) { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -void GxsChannelPostItem::comments() -{ -#ifdef DEBUG_ITEM - std::cerr << "GxsChannelPostItem::comments()"; - std::cerr << std::endl; -#endif - - if (mParent) - { - mParent->openComments(mFeedId, mChanId, mMsgId); + mParent->lockLayout(this, false); } } @@ -577,10 +449,7 @@ void GxsChannelPostItem::unsubscribeChannel() std::cerr << std::endl; #endif - if (rsChannels) - { - rsChannels->channelSubscribe(mChanId, false, false); - } + unsubscribe(); updateItemStatic(); } @@ -609,6 +478,8 @@ void GxsChannelPostItem::play() void GxsChannelPostItem::readToggled(bool checked) { + +#if 0 if (m_inUpdateItemStatic) { return; } @@ -630,10 +501,15 @@ void GxsChannelPostItem::readToggled(bool checked) if (!mIsHome) { connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); } + +#endif + } void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status) { + +#if 0 if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) { if (!mIsHome) { if (status & CHANNEL_MSG_STATUS_READ) { @@ -643,10 +519,14 @@ void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, co } updateItemStatic(); } +#endif + } void GxsChannelPostItem::copyLink() { + +#if 0 if (mChanId.empty() || mMsgId.empty()) { return; } @@ -660,4 +540,6 @@ void GxsChannelPostItem::copyLink() RSLinkClipboard::copyLinks(urls); } } +#endif + } diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 6ede57f06..4ce835eb3 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -1,80 +1,77 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Feed Item * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_CHANNEL_POST_ITEM_H #define _GXS_CHANNEL_POST_ITEM_H #include +#include "gui/gxs/GxsFeedItem.h" #include "ui_GxsChannelPostItem.h" #include class FeedHolder; class SubFileItem; -class GxsChannelPostItem : public QWidget, private Ui::GxsChannelPostItem +class GxsChannelPostItem : public GxsFeedItem, private Ui::GxsChannelPostItem { Q_OBJECT public: /** Default Constructor */ - GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome); + GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome); - void updateItemStatic(); + void setFileCleanUpWarning(uint32_t time_left); - const std::string &msgId() { return mMsgId; } + //const std::string &msgId() { return mMsgId; } + +protected: +virtual void loadMessage(const uint32_t &token); private slots: /* default stuff */ - void removeItem(); void toggle(); - void readAndClearItem(); - void unsubscribeChannel(); void download(); void play(); void copyLink(); - void comments(); + void loadComments(); void readToggled(bool checked); void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status); + void unsubscribeChannel(); void updateItem(); private: void setup(); void loadPost(const RsGxsChannelPost &post); - - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mChanId; - std::string mMsgId; - - bool mIsHome; bool m_inUpdateItemStatic; uint32_t mMode; uint32_t mSubscribeFlags; + RsGxsChannelPost mPost; std::list mFileItems; }; diff --git a/retroshare-gui/src/gui/gxs/GxsCircleChooser.cpp b/retroshare-gui/src/gui/gxs/GxsCircleChooser.cpp index 926400320..651cbbd50 100644 --- a/retroshare-gui/src/gui/gxs/GxsCircleChooser.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCircleChooser.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "GxsCircleChooser.h" diff --git a/retroshare-gui/src/gui/gxs/GxsCircleChooser.h b/retroshare-gui/src/gui/gxs/GxsCircleChooser.h index 74986e02f..7e6d6e2ce 100644 --- a/retroshare-gui/src/gui/gxs/GxsCircleChooser.h +++ b/retroshare-gui/src/gui/gxs/GxsCircleChooser.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_CIRCLES_CHOOSER_H diff --git a/retroshare-gui/src/gui/gxs/GxsCircleLabel.cpp b/retroshare-gui/src/gui/gxs/GxsCircleLabel.cpp index 02f9f0800..f1d3a71e6 100644 --- a/retroshare-gui/src/gui/gxs/GxsCircleLabel.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCircleLabel.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "GxsCircleLabel.h" diff --git a/retroshare-gui/src/gui/gxs/GxsCircleLabel.h b/retroshare-gui/src/gui/gxs/GxsCircleLabel.h index 03f43d62a..2ba4abe2f 100644 --- a/retroshare-gui/src/gui/gxs/GxsCircleLabel.h +++ b/retroshare-gui/src/gui/gxs/GxsCircleLabel.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_CIRCLE_LABEL_H diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp index 36316bfe6..dc34da70d 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp @@ -1,5 +1,5 @@ /* - * Retroshare Posted List + * Retroshare Comment Container * * Copyright 2012-2012 by Robert Fernie. * @@ -61,16 +61,23 @@ void GxsCommentContainer::setup() } -void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) +#define MAX_COMMENT_TITLE 32 + +void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) { - QString comments(tr("Comments")); + QString comments = title; + if (title.length() > MAX_COMMENT_TITLE) + { + comments.truncate(MAX_COMMENT_TITLE - 3); + comments += "..."; + } + GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService()); - GxsCommentHeader *commentHeader = createHeaderWidget(); + QWidget *commentHeader = createHeaderWidget(grpId, msgId); commentDialog->setCommentHeader(commentHeader); commentDialog->commentLoad(grpId, msgId); - //commentHeader->commentLoad(grpId, msgId); ui.tabWidget->addTab(commentDialog, comments); } @@ -80,13 +87,18 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess void GxsCommentContainer::tabCloseRequested(int index) { std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")"; + std::cerr << std::endl; if (index != 0) { QWidget *comments = ui.tabWidget->widget(index); ui.tabWidget->removeTab(index); delete comments; } - std::cerr << "GxsCommentContainer::tabCloseRequested() Not closing First Tab"; + else + { + std::cerr << "GxsCommentContainer::tabCloseRequested() Not closing First Tab"; + std::cerr << std::endl; + } } diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.h b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h index 8b101dd04..3520c3334 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.h +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h @@ -32,20 +32,8 @@ #include -class GxsCommentHeader -{ -public: - - /*! - * This should be used for loading comments of a message on a main comment viewing page - * @param msgId the message id for which comments will be requested - */ - virtual void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; -}; - class GxsServiceDialog; - class GxsCommentContainer : public MainPage { Q_OBJECT @@ -54,13 +42,13 @@ public: GxsCommentContainer(QWidget *parent = 0); void setup(); - void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId); + void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title); virtual GxsServiceDialog *createServiceDialog() = 0; virtual QString getServiceName() = 0; virtual RsTokenService *getTokenService() = 0; virtual RsGxsCommentService *getCommentService() = 0; - virtual GxsCommentHeader *createHeaderWidget() = 0; + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; private slots: void tabCloseRequested(int index); @@ -85,9 +73,9 @@ public: virtual ~GxsServiceDialog() { return; } - void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) + void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) { - mContainer->commentLoad(grpId, msgId); + mContainer->commentLoad(grpId, msgId, title); } private: GxsCommentContainer *mContainer; diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index e76bbbbca..f0bde4470 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -102,8 +102,23 @@ void GxsCommentDialog::voterSelectionChanged( int index ) -void GxsCommentDialog::setCommentHeader(GxsCommentHeader *header) +void GxsCommentDialog::setCommentHeader(QWidget *header) { + if (!header) + { + std::cerr << "GxsCommentDialog::setCommentHeader() NULL header!"; + std::cerr << std::endl; + return; + } + + std::cerr << "GxsCommentDialog::setCommentHeader() Adding header to ui,postFrame"; + std::cerr << std::endl; + + //header->setParent(ui.postFrame); + //ui.postFrame->setVisible(true); + + QLayout *alayout = ui.postFrame->layout(); + alayout->addWidget(header); #if 0 ui.postFrame->setVisible(true); diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.h b/retroshare-gui/src/gui/gxs/GxsCommentDialog.h index 81b88c0ba..73f8e3f01 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.h @@ -35,7 +35,7 @@ class GxsCommentDialog: public QWidget public: GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service); - void setCommentHeader(GxsCommentHeader *header); + void setCommentHeader(QWidget *header); void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId); private slots: diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui index 1d8975430..84bb952e2 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui @@ -22,222 +22,16 @@ 0 - - background-color: rgb(203, 203, 203); - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 20 - - - - 1 - - - - - - - - - /\ - - - - - - - score - - - - - - - \/ - - - - - - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Title this is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title dont you think? yes it is and should wrap around I hope - - - true - - - true - - - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - Date - - - - - - - - 0 - 0 - - - - - 9 - - - - You eyes only - - - true - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - From - - - - - - - - 0 - 0 - - - - - 9 - - - - Signed by - - - true - - - - - - - - - - - - 0 - 0 - - - - - 9 - 75 - true - - - - Site - - - - - - - - 0 - 0 - - - - - 9 - - - - Signed by - - - true - - - - - - - + + + 9 + + + 1 + + + 1 + @@ -364,6 +158,11 @@ DownVotes + + + OwnVote + + diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index f1ff683e3..2aa51bd46 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -1,23 +1,25 @@ -/**************************************************************** -* RetroShare is distributed under the following license: -* -* Copyright (C) 2008 Robert Fernie -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301, USA. -****************************************************************/ +/* + * Retroshare Gxs Support + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include #include @@ -35,11 +37,14 @@ #define PCITEM_COLUMN_SCORE 3 #define PCITEM_COLUMN_UPVOTES 4 #define PCITEM_COLUMN_DOWNVOTES 5 -#define PCITEM_COLUMN_MSGID 6 -#define PCITEM_COLUMN_PARENTID 7 +#define PCITEM_COLUMN_OWNVOTE 6 +#define PCITEM_COLUMN_MSGID 7 +#define PCITEM_COLUMN_PARENTID 8 #define GXSCOMMENTS_LOADTHREAD 1 +#define COMMENT_VOTE_ACK 0x001234 + /* Images for context menu icons */ #define IMAGE_MESSAGE ":/images/folder-draft.png" @@ -164,7 +169,7 @@ void GxsCommentTreeWidget::vote(const RsGxsGroupId &groupId, const RsGxsMessageI uint32_t token; mCommentService->createVote(token, vote); - mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0); + mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, COMMENT_VOTE_ACK); } @@ -373,6 +378,17 @@ void GxsCommentTreeWidget::acknowledgeComment(const uint32_t &token) } +void GxsCommentTreeWidget::acknowledgeVote(const uint32_t &token) +{ + RsGxsGrpMsgIdPair msgId; + if (mCommentService->acknowledgeVote(token, msgId)) + { + // reload data if vote was added. + service_requestComments(mThreadId); + } +} + + void GxsCommentTreeWidget::service_loadThread(const uint32_t &token) { std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!"; @@ -416,6 +432,9 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token) text = QString::number(comment.mDownVotes); item->setText(PCITEM_COLUMN_DOWNVOTES, text); + text = QString::number(comment.mOwnVote); + item->setText(PCITEM_COLUMN_OWNVOTE, text); + text = QString::fromUtf8(comment.mMeta.mMsgId.c_str()); item->setText(PCITEM_COLUMN_MSGID, text); @@ -475,7 +494,14 @@ void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenReque switch(req.mAnsType) { case RS_TOKREQ_ANSTYPE_ACK: - acknowledgeComment(req.mToken); + if (req.mUserType == COMMENT_VOTE_ACK) + { + acknowledgeVote(req.mToken); + } + else + { + acknowledgeComment(req.mToken); + } break; case RS_TOKREQ_ANSTYPE_DATA: loadThread(req.mToken); diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.h b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.h index 39d3b4b45..275d34507 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.h +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.h @@ -1,23 +1,25 @@ -/**************************************************************** -* RetroShare is distributed under the following license: -* -* Copyright (C) 2008 Robert Fernie -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301, USA. -****************************************************************/ +/* + * Retroshare Gxs Support + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_COMMENT_TREE_WIDGET_H #define _GXS_COMMENT_TREE_WIDGET_H @@ -54,6 +56,8 @@ protected: void completeItems(); void acknowledgeComment(const uint32_t& token); + void acknowledgeVote(const uint32_t &token); + void loadThread(const uint32_t &token); void addItem(std::string itemId, std::string parentId, QTreeWidgetItem *item); diff --git a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp index 7541af2aa..2713f28dc 100644 --- a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp @@ -1,3 +1,26 @@ +/* + * Retroshare Gxs Support + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + #include "GxsCreateCommentDialog.h" #include "ui_GxsCreateCommentDialog.h" diff --git a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h index 72a53e975..4b1ef9d16 100644 --- a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h @@ -1,3 +1,26 @@ +/* + * Retroshare Gxs Support + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + #ifndef _MRK_GXS_CREATE_COMMENT_DIALOG_H #define _MRK_GXS_CREATE_COMMENT_DIALOG_H diff --git a/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp b/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp new file mode 100644 index 000000000..56a9264ba --- /dev/null +++ b/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp @@ -0,0 +1,255 @@ +/* + * Retroshare Gxs Feed Item + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include "gui/gxs/GxsFeedItem.h" +#include "gui/feeds/FeedHolder.h" + +#include + +/** + * #define DEBUG_ITEM 1 + **/ + +#define DEBUG_ITEM 1 + +#define GXSFEEDITEM_GROUPMETA 5 +#define GXSFEEDITEM_MESSAGE 6 + + +void GxsFeedItem::removeItem() +{ +#ifdef DEBUG_ITEM + std::cerr << "GxsFeedItem::removeItem()"; + std::cerr << std::endl; +#endif + + if (mParent) + { + mParent->lockLayout(this, true); + } + + hide(); + + if (mParent) + { + mParent->lockLayout(this, false); + mParent->deleteFeedItem(this, mFeedId); + } +} + +void GxsFeedItem::comments(const QString &title) +{ +#ifdef DEBUG_ITEM + std::cerr << "GxsFeedItem::comments()"; + std::cerr << std::endl; +#endif + + if (mParent) + { + mParent->openComments(mFeedId, mGroupId, mMessageId, title); + } +} + +void GxsFeedItem::unsubscribe() +{ +#ifdef DEBUG_ITEM + std::cerr << "GxsFeedItem::unsubscribe()"; + std::cerr << std::endl; +#endif + + if (mGxsIface) + { + uint32_t token; + mGxsIface->subscribeToGroup(token, mGroupId, false); + } +} + + +void GxsFeedItem::subscribe() +{ +#ifdef DEBUG_ITEM + std::cerr << "GxsFeedItem::subscribe()"; + std::cerr << std::endl; +#endif + + if (mGxsIface) + { + uint32_t token; + mGxsIface->subscribeToGroup(token, mGroupId, true); + } +} + + +void GxsFeedItem::updateItemStatic() +{ + std::cerr << "GxsFeedItem::updateItemStatic()"; + std::cerr << std::endl; + requestMessage(); +} + + +void GxsFeedItem::updateItem() +{ + std::cerr << "GxsFeedItem::updateItem() EMPTY"; + std::cerr << std::endl; +} + + +/***********************************************************/ + +GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData) + :QWidget(NULL) +{ + std::cerr << "GxsFeedItem::GxsFeedItem()"; + std::cerr << std::endl; + + /* this are just generally useful for all children */ + mParent = parent; + mFeedId = feedId; + mIsHome = isHome; + + /* load data if we can */ + mGroupId = groupId; + mMessageId = messageId; + mGxsIface = iface; + + if (loadData && iface) + { + mLoadQueue = new TokenQueue(iface->getTokenService(), this); + requestGroupMeta(); + } + else + { + mLoadQueue = NULL; + } +} + + +GxsFeedItem::~GxsFeedItem() +{ + std::cerr << "GxsFeedItem::~GxsFeedItem()"; + std::cerr << std::endl; + + if (mLoadQueue) + { + delete mLoadQueue; + } +} + + +void GxsFeedItem::requestGroupMeta() +{ + std::cerr << "GxsFeedItem::requestGroup()"; + std::cerr << std::endl; + + if (!mLoadQueue) + { + return; + } + + std::list ids; + ids.push_back(mGroupId); + + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; + uint32_t token; + mLoadQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, GXSFEEDITEM_GROUPMETA); + + updateItemStatic(); +} + + +void GxsFeedItem::requestMessage() +{ + std::cerr << "GxsFeedItem::requestMessage()"; + std::cerr << std::endl; + + if (!mLoadQueue) + { + return; + } + + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; + + GxsMsgReq msgIds; + std::vector &vect_msgIds = msgIds[mGroupId]; + vect_msgIds.push_back(mMessageId); + + uint32_t token; + mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSFEEDITEM_MESSAGE); +} + + +void GxsFeedItem::loadGroupMeta(const uint32_t &token) +{ + std::cerr << "GxsFeedItem::loadGroupMeta()"; + std::cerr << std::endl; + + std::list groupMeta; + + if (!mGxsIface->getGroupSummary(token, groupMeta)) + { + std::cerr << "GxsFeedItem::loadGroupMeta() Error getting GroupMeta"; + std::cerr << std::endl; + return; + } + + if (groupMeta.size() == 1) + { + mGroupMeta = *groupMeta.begin(); + } + else + { + std::cerr << "GxsFeedItem::loadGroupMeta() ERROR Should be ONE GroupMeta"; + std::cerr << std::endl; + } +} + + +void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req) +{ + std::cerr << "GxsFeedItem::loadRequest()"; + std::cerr << std::endl; + + if (queue == mLoadQueue) + { + switch(req.mUserType) + { + case GXSFEEDITEM_GROUPMETA: + loadGroupMeta(req.mToken); + break; + + case GXSFEEDITEM_MESSAGE: + loadMessage(req.mToken); + break; + + default: + std::cerr << "GxsFeedItem::loadRequest() ERROR: INVALID TYPE"; + std::cerr << std::endl; + break; + } + } +} + + diff --git a/retroshare-gui/src/gui/gxs/GxsFeedItem.h b/retroshare-gui/src/gui/gxs/GxsFeedItem.h new file mode 100644 index 000000000..8a6980deb --- /dev/null +++ b/retroshare-gui/src/gui/gxs/GxsFeedItem.h @@ -0,0 +1,83 @@ +/* + * Retroshare Gxs Feed Item + * + * Copyright 2012-2013 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef _GXS_GENERIC_FEED_ITEM_H +#define _GXS_GENERIC_FEED_ITEM_H + +#include +#include "util/TokenQueue.h" +#include + +class FeedHolder; + +class GxsFeedItem : public QWidget, public TokenResponse +{ + Q_OBJECT + +public: + /** Note parent can = NULL */ + GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData); +virtual ~GxsFeedItem(); + +protected: + + // generic Fns - to be overloaded. +virtual void updateItemStatic(); +virtual void updateItem(); +virtual void loadMessage(const uint32_t &token) = 0; + + + void requestMessage(); + +virtual void loadGroupMeta(const uint32_t &token); +virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req); + + // general fns that can be implemented here. +protected slots: + + void comments(const QString &title); + void subscribe(); + void unsubscribe(); + void removeItem(); + +protected: + + FeedHolder *mParent; + uint32_t mFeedId; + bool mIsHome; + + RsGxsGroupId mGroupId; + RsGxsMessageId mMessageId; + + RsGroupMetaData mGroupMeta; + +private: + + void requestGroupMeta(); + + RsGxsIfaceHelper *mGxsIface; + TokenQueue *mLoadQueue; +}; + +#endif + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index cab804e6d..d87e767c3 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index e85a992c9..ec174e276 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_GROUP_DIALOG_H #define _GXS_GROUP_DIALOG_H diff --git a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp index 05edd8f4e..c832b7ba6 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "GxsIdChooser.h" diff --git a/retroshare-gui/src/gui/gxs/GxsIdChooser.h b/retroshare-gui/src/gui/gxs/GxsIdChooser.h index 39606442a..0615c58b3 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdChooser.h +++ b/retroshare-gui/src/gui/gxs/GxsIdChooser.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_ID_CHOOSER_H diff --git a/retroshare-gui/src/gui/gxs/GxsIdLabel.cpp b/retroshare-gui/src/gui/gxs/GxsIdLabel.cpp index 26189b803..bae9f798a 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdLabel.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdLabel.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "GxsIdLabel.h" diff --git a/retroshare-gui/src/gui/gxs/GxsIdLabel.h b/retroshare-gui/src/gui/gxs/GxsIdLabel.h index e0e7c4992..95b9ea9af 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdLabel.h +++ b/retroshare-gui/src/gui/gxs/GxsIdLabel.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_ID_LABEL_H diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp index cbfa4f025..39a3782fb 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp @@ -1,23 +1,26 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + #include "GxsIdTreeWidgetItem.h" diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h index 9b5b74710..5b646d85e 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h @@ -1,24 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2012 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _GXS_ID_TREEWIDGETITEM_H #define _GXS_ID_TREEWIDGETITEM_H diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp index 596dfe318..214724585 100644 --- a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #include "WikiGroupDialog.h" diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.h b/retroshare-gui/src/gui/gxs/WikiGroupDialog.h index f8549587e..4699b2c17 100644 --- a/retroshare-gui/src/gui/gxs/WikiGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/WikiGroupDialog.h @@ -1,23 +1,25 @@ -/**************************************************************** - * RetroShare is distributed under the following license: +/* + * Retroshare Gxs Support * - * Copyright (C) 2008 Robert Fernie + * Copyright 2012-2013 by Robert Fernie. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ #ifndef _WIKI_GROUP_DIALOG_H diff --git a/retroshare-gui/src/gui/gxschannels/ChannelDialog.h b/retroshare-gui/src/gui/gxschannels/ChannelDialog.h index a7a844e84..890b68238 100644 --- a/retroshare-gui/src/gui/gxschannels/ChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/ChannelDialog.h @@ -29,6 +29,7 @@ #include "gui/gxs/GxsCommentContainer.h" #include "gui/gxschannels/GxsChannelDialog.h" +#include "gui/feeds/GxsChannelPostItem.h" class ChannelDialog : public GxsCommentContainer @@ -59,9 +60,9 @@ public: return rsGxsChannels; } - virtual GxsCommentHeader *createHeaderWidget() + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) { - return NULL; + return new GxsChannelPostItem(NULL, 0, grpId, msgId, true); } }; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 650875594..7f3ae0903 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -132,9 +132,9 @@ GxsChannelDialog::~GxsChannelDialog() // Callback from Widget->FeedHolder->ServiceDialog->CommentContainer->CommentDialog, -void GxsChannelDialog::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) +void GxsChannelDialog::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) { - commentLoad(groupId, msgId); + commentLoad(groupId, msgId, title); } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index 6edb47b28..fad420f0b 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -61,7 +61,7 @@ public: virtual QScrollArea *getScrollArea(); virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void openChat(std::string peerId); - virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId); + virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); bool navigate(const std::string& channelId, const std::string& msgId); diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp index 110457c81..18e864e08 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp @@ -298,12 +298,19 @@ void CreateGxsForumMsg::createMsg() { std::cerr << "CreateGxsForumMsg::createMsg() ERROR GETTING AuthorId!"; std::cerr << std::endl; + QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id"), + QMessageBox::Ok, QMessageBox::Ok); + + return; } } else { std::cerr << "CreateGxsForumMsg::createMsg() No Signature (for now :)"; std::cerr << std::endl; + QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id, it is required"), + QMessageBox::Ok, QMessageBox::Ok); + return; } uint32_t token;