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
This commit is contained in:
defnax 2010-02-23 14:01:51 +00:00
parent 4ed969a4cd
commit 451ede6fde
3 changed files with 44 additions and 1 deletions

View File

@ -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("<a href='" + link + "'> " + link + "</a>");
}
else
{
QMessageBox::warning(this, tr("RetroShare"),tr("Clipboard does not contains RetroShare link('s)"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
}

View File

@ -48,6 +48,8 @@ private slots:
/* actions to take.... */
void createMsg();
void cancelMsg();
void pasteLink();
void smileyWidgetForums();
void addSmileys();

View File

@ -175,6 +175,20 @@ border: 1px solid #CCCCCC;}</string>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pastersButton">
<property name="toolTip">
<string>Paste retroshare link</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>