From 451ede6fde63e291178db74b7bce6d310333ede7 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 23 Feb 2010 14:01:51 +0000 Subject: [PATCH] added Past rs links from Button, and fixed not allow send blank Forum Messages git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2397 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/forums/CreateForumMsg.cpp | 29 ++++++++++++++++++- .../src/gui/forums/CreateForumMsg.h | 2 ++ .../src/gui/forums/CreateForumMsg.ui | 14 +++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index 714a9f367..30e8b3ff5 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -61,7 +61,7 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId) connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) ); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); - + connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); newMsg(); @@ -131,6 +131,14 @@ void CreateForumMsg::createMsg() { QString name = ui.forumSubject->text(); QString desc = ui.forumMessage->toHtml(); + + if(name.isEmpty()) + { /* error message */ + QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), + QMessageBox::Ok, QMessageBox::Ok); + + return; //Don't add a empty Subject!! + } ForumMsgInfo msgInfo; @@ -376,4 +384,23 @@ void CreateForumMsg::fileHashingFinished(AttachFileItem* file) { } +void CreateForumMsg::pasteLink() +{ + + QString link = QApplication::clipboard()->text(); + + if (link.startsWith("retroshare://", Qt::CaseInsensitive)) + { + ui.forumMessage->setHtml(" " + link + ""); + } + else + { + QMessageBox::warning(this, tr("RetroShare"),tr("Clipboard does not contains RetroShare link('s)"), + QMessageBox::Ok, QMessageBox::Ok); + + return; + } + + +} diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h index 118217d13..7606627af 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.h +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.h @@ -48,6 +48,8 @@ private slots: /* actions to take.... */ void createMsg(); void cancelMsg(); + void pasteLink(); + void smileyWidgetForums(); void addSmileys(); diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui index 4de35a3a1..cc847526d 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.ui +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.ui @@ -175,6 +175,20 @@ border: 1px solid #CCCCCC;} + + + + Paste retroshare link + + + + + + + :/images/copyrslink.png:/images/copyrslink.png + + +