diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 0ca1b384a..e38d29a5e 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -505,6 +505,9 @@ void IdDialog::insertIdList(uint32_t token) ui->idTreeWidget->addTopLevelItem(item); } } + + /* count items */ + ui->label_count->setText( "(" + QString::number(ui->idTreeWidget->topLevelItemCount()) + ")" ); filterIds(); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 4150a1fdf..778d218cb 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -20,7 +20,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -38,7 +47,16 @@ QFrame::Sunken - + + 2 + + + 2 + + + 2 + + 2 @@ -73,6 +91,13 @@ + + + + () + + + @@ -129,7 +154,16 @@ QFrame::Sunken - + + 2 + + + 2 + + + 2 + + 2 @@ -213,7 +247,7 @@ Reputation - AlignLeft|AlignVCenter + AlignLeading|AlignVCenter @@ -312,7 +346,16 @@ - + + 6 + + + 6 + + + 6 + + 6 @@ -479,7 +522,16 @@ - + + 6 + + + 6 + + + 6 + + 6 diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index be269db84..e3b975843 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -677,12 +677,20 @@ void MainWindow::updateTrayCombine() updateFriends(); } +void MainWindow::toggleStatusToolTip(bool toggle){ + if(!toggle)return; + QString tray = "RetroShare\n"; + tray += "\n" + nameAndLocation; + trayIcon->setToolTip(tray); +} + void MainWindow::updateStatus() { // This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it! if(RsAutoUpdatePage::eventsLocked()) return; - + if(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool()) + return; float downKb = 0; float upKb = 0; rsConfig->GetCurrentDataRates(downKb, upKb); diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index fae0dacbd..897740123 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -184,6 +184,7 @@ public slots: void setNewPage(int page); void setCompactStatusMode(bool compact); + void toggleStatusToolTip(bool toggle); protected: /** Default Constructor */ MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index df3cf0c14..6c64a7b89 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -590,7 +590,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int role) const { - if (role == Qt::SizeHintRole) + /*if (role == Qt::SizeHintRole) { int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ; int defh = QFontMetricsF(QWidget().font()).height(); @@ -600,7 +600,7 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int defw = 200/16.0*defh; } return QSize(defw, defh); - } + }*/ if (role != Qt::DisplayRole) return QVariant(); @@ -636,7 +636,7 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int } QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int role) const { - if (role == Qt::SizeHintRole) + /*if (role == Qt::SizeHintRole) { int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ; int defh = QFontMetricsF(QWidget().font()).height(); @@ -646,7 +646,7 @@ QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int defw = defh*200/16.0; } return QSize(defw, defh); - } + }*/ if (role != Qt::DisplayRole) return QVariant(); diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp index d8b728888..a3af87db4 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp @@ -260,7 +260,7 @@ void CreateGxsForumMsg::loadFormInformation() ui.signBox->setEnabled(true); } - ui.forumMessage->setText(""); + //ui.forumMessage->setText(""); } void CreateGxsForumMsg::createMsg() @@ -506,3 +506,8 @@ void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest } } } + +void CreateGxsForumMsg::insertPastedText(QString msg) +{ + ui.forumMessage->append(msg); +} diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h index 2447e02ba..cde7f4d77 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h @@ -40,6 +40,7 @@ public: void newMsg(); /* cleanup */ virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req); +void insertPastedText(QString msg) ; private slots: void fileHashingFinished(QList hashedFiles); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 2fe308cb3..12c207384 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -97,6 +97,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget mTokenTypeInsertThreads = nextTokenType(); mTokenTypeMessageData = nextTokenType(); mTokenTypeReplyMessage = nextTokenType(); + mTokenTypeReplyForumMessage = nextTokenType(); setUpdateWhenInvisible(true); @@ -137,7 +138,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget ui->subscribeToolButton->hide() ; connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool))); - connect(ui->newmessageButton, SIGNAL(clicked()), this, SLOT(createmessage())); + connect(ui->newmessageButton, SIGNAL(clicked()), this, SLOT(replytoforummessage())); connect(ui->newthreadButton, SIGNAL(clicked()), this, SLOT(createthread())); connect(ui->threadTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(changedThread())); @@ -404,7 +405,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/) QMenu contextMnu(this); QAction *replyAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply"), &contextMnu); - connect(replyAct, SIGNAL(triggered()), this, SLOT(createmessage())); + connect(replyAct, SIGNAL(triggered()), this, SLOT(replytoforummessage())); QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply with private message"), &contextMnu); connect(replyauthorAct, SIGNAL(triggered()), this, SLOT(replytomessage())); @@ -1787,6 +1788,18 @@ void GxsForumThreadWidget::replytomessage() requestMsgData_ReplyMessage(postId); } +void GxsForumThreadWidget::replytoforummessage() +{ + if (groupId().isNull() || mThreadId.isNull()) { + QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message")); + return; + } + + // Get Message ... then complete replyMessageData(). + RsGxsGrpMsgIdPair postId = std::make_pair(groupId(), mThreadId); + requestMsgData_ReplyForumMessage(postId); +} + void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg) { if ((msg.mMeta.mGroupId != groupId()) || (msg.mMeta.mMsgId != mThreadId)) @@ -1815,6 +1828,34 @@ void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg) } } +void GxsForumThreadWidget::replyForumMessageData(const RsGxsForumMsg &msg) +{ + if ((msg.mMeta.mGroupId != groupId()) || (msg.mMeta.mMsgId != mThreadId)) + { + std::cerr << "GxsForumThreadWidget::replyMessageData() ERROR Message Ids have changed!"; + std::cerr << std::endl; + return; + } + + if (!msg.mMeta.mAuthorId.isNull()) + { + CreateGxsForumMsg *cfm = new CreateGxsForumMsg(groupId(), mThreadId); + QTextDocument doc ; +// doc.setHtml(QString::fromUtf8(msg.mMsg.c_str()) ); +// std::string cited_text(doc.toPlainText().toStdString()) ; + RsHtml::makeQuotedText(ui->postText); + + cfm->insertPastedText(RsHtml::makeQuotedText(ui->postText)) ; + cfm->show(); + + /* window will destroy itself! */ + } + else + { + QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to an Anonymous Author")); + } +} + void GxsForumThreadWidget::changedViewBox() { if (mInProcessSettings) { @@ -2031,6 +2072,24 @@ void GxsForumThreadWidget::requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair & mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyMessage); } +void GxsForumThreadWidget::requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdPair &msgId) +{ + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; + +#ifdef DEBUG_FORUMS + std::cerr << "GxsForumThreadWidget::requestMsgData_ReplyMessage(" << msgId.first << "," << msgId.second << ")"; + std::cerr << std::endl; +#endif + + GxsMsgReq msgIds; + std::vector &vect = msgIds[msgId.first]; + vect.push_back(msgId.second); + + uint32_t token; + mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyForumMessage); +} + void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token) { #ifdef DEBUG_FORUMS @@ -2047,7 +2106,6 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token) std::cerr << std::endl; return; } - replyMessageData(msgs[0]); } else @@ -2057,6 +2115,32 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token) } } +void GxsForumThreadWidget::loadMsgData_ReplyForumMessage(const uint32_t &token) +{ +#ifdef DEBUG_FORUMS + std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage()"; + std::cerr << std::endl; +#endif + + std::vector msgs; + if (rsGxsForums->getMsgData(token, msgs)) + { + if (msgs.size() != 1) + { + std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Wrong number of answers"; + std::cerr << std::endl; + return; + } + + replyForumMessageData(msgs[0]); + } + else + { + std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Missing Message Data..."; + std::cerr << std::endl; + } +} + void GxsForumThreadWidget::loadMsgData_BanAuthor(const uint32_t &token) { #ifdef DEBUG_FORUMS @@ -2115,6 +2199,11 @@ void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenReque loadMsgData_ReplyMessage(req.mToken); return; } + + if (req.mUserType == mTokenTypeReplyForumMessage) { + loadMsgData_ReplyForumMessage(req.mToken); + return; + } if (req.mUserType == mTokenTypeBanAuthor) { loadMsgData_BanAuthor(req.mToken); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index f80956166..4e6afbb45 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -75,7 +75,13 @@ private slots: void clickedThread (QTreeWidgetItem *item, int column); void replytomessage(); + void replytoforummessage(); + void replyMessageData(const RsGxsForumMsg &msg); + void replyForumMessageData(const RsGxsForumMsg &msg); + + + //void print(); //void printpreview(); @@ -141,7 +147,10 @@ private: void loadMessageData(const uint32_t &token); void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId); void loadMsgData_ReplyMessage(const uint32_t &token); - void loadMsgData_BanAuthor(const uint32_t &token); + + void requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdPair &msgId); + void loadMsgData_ReplyForumMessage(const uint32_t &token); + void loadMsgData_BanAuthor(const uint32_t &token); private: RsGxsGroupId mLastForumID; @@ -162,6 +171,7 @@ private: uint32_t mTokenTypeInsertThreads; uint32_t mTokenTypeMessageData; uint32_t mTokenTypeReplyMessage; + uint32_t mTokenTypeReplyForumMessage; uint32_t mTokenTypeBanAuthor; /* Color definitions (for standard see qss.default) */ diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index 5f16bdc45..0d431e996 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -45,6 +45,7 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags) connect(ui.checkBoxHideSoundStatus, SIGNAL(toggled(bool)), pMainWindow->soundStatusInstance(), SLOT(setHidden(bool))); connect(ui.checkBoxHideToasterDisable, SIGNAL(toggled(bool)), pMainWindow->toasterDisableInstance(), SLOT(setHidden(bool))); connect(ui.checkBoxShowSystrayOnStatus, SIGNAL(toggled(bool)), pMainWindow->sysTrayStatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxDisableSysTrayToolTip, SIGNAL(toggled(bool)), pMainWindow, SLOT(toggleStatusToolTip(bool))); /* Populate combo boxes */ foreach (QString code, LanguageSupport::languageCodes()) { @@ -142,6 +143,8 @@ bool AppearancePage::save(QString &errmsg) Settings->setValueToGroup("StatusBar", "HideSound", QVariant(ui.checkBoxHideSoundStatus->isChecked())); Settings->setValueToGroup("StatusBar", "HideToaster", QVariant(ui.checkBoxHideToasterDisable->isChecked())); Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "DisableSysTrayToolTip", QVariant(ui.checkBoxDisableSysTrayToolTip->isChecked())); + MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked()); return true; } @@ -228,6 +231,7 @@ void AppearancePage::load() ui.checkBoxHideSoundStatus->setChecked(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool()); ui.checkBoxHideToasterDisable->setChecked(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool()); ui.checkBoxShowSystrayOnStatus->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool()); + ui.checkBoxDisableSysTrayToolTip->setChecked(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool()); } diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui index 027668dc2..95f3bf297 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.ui +++ b/retroshare-gui/src/gui/settings/AppearancePage.ui @@ -14,7 +14,16 @@ Qt::NoContextMenu - + + 6 + + + 6 + + + 6 + + 6 @@ -199,7 +208,16 @@ QFrame::Plain - + + 2 + + + 2 + + + 2 + + 2 @@ -212,7 +230,7 @@ - On List Item + On List Ite&m @@ -248,7 +266,16 @@ QFrame::Plain - + + 2 + + + 2 + + + 2 + + 2 @@ -461,6 +488,13 @@ + + + + Disable SysTray ToolTip + + + diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 46227433d..883cb6029 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "HandleRichText.h" @@ -997,3 +998,15 @@ QString RsHtml::plainText(const std::string &text) return Qt::escape(QString::fromUtf8(text.c_str())); #endif } + +QString RsHtml::makeQuotedText(RSTextBrowser *browser) +{ + QString text = browser->textCursor().selection().toPlainText(); + if(text.length() == 0) + { + text = browser->toPlainText(); + } + QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts); + text = sl.join("\n>"); + return QString(">") + text; +} diff --git a/retroshare-gui/src/util/HandleRichText.h b/retroshare-gui/src/util/HandleRichText.h index 9b8d91d84..4cea4a8d5 100644 --- a/retroshare-gui/src/util/HandleRichText.h +++ b/retroshare-gui/src/util/HandleRichText.h @@ -19,6 +19,8 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ +#include + /** * This file provides helper functions and functors for translating data from/to * rich text format and HTML. Its main goal is to facilitate decoding of chat @@ -72,6 +74,8 @@ public: static QString plainText(const QString &text); static QString plainText(const std::string &text); + static QString makeQuotedText(RSTextBrowser* browser); + protected: void embedHtml(QTextDocument *textDocument, QDomDocument &doc, QDomElement ¤tElement, EmbedInHtml& embedInfos, ulong flag); void replaceAnchorWithImg(QDomDocument& doc, QDomElement &element, QTextDocument *textDocument, const RetroShareLink &link);