Added Split Text for Compose Message

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2125 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-01-25 15:36:24 +00:00
parent bb3a1ba8b1
commit 777b52753a
5 changed files with 83 additions and 24 deletions

View file

@ -92,6 +92,8 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
connect(ui.sizedecreaseButton, SIGNAL (clicked()), this, SLOT (fontSizeDecrease()));
connect(ui.blockquoteButton, SIGNAL (clicked()), this, SLOT (blockQuote()));
connect(ui.codeButton, SIGNAL (clicked()), this, SLOT (toggleCode()));
connect(ui.splitPostButton, SIGNAL (clicked()), this, SLOT (addPostSplitter()));
connect(ui.msgText, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
this, SLOT(currentCharFormatChanged(const QTextCharFormat &)));
@ -1141,6 +1143,22 @@ void ChanMsgDialog::toggleCode()
ui.msgText->setFocus( Qt::OtherFocusReason );
}
void ChanMsgDialog::addPostSplitter()
{
QTextBlockFormat f = ui.msgText->textCursor().blockFormat();
QTextBlockFormat f1 = f;
f.setProperty( TextFormat::IsHtmlTagSign, true );
f.setProperty( QTextFormat::BlockTrailingHorizontalRulerWidth,
QTextLength( QTextLength::PercentageLength, 80 ) );
if ( ui.msgText->textCursor().block().text().isEmpty() ) {
ui.msgText->textCursor().mergeBlockFormat( f );
} else {
ui.msgText->textCursor().insertBlock( f );
}
ui.msgText->textCursor().insertBlock( f1 );
}
void ChanMsgDialog::attachFile()
{
// select a file