diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp
index da7e85187..79e4a34de 100644
--- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp
+++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp
@@ -69,7 +69,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
connect(ui.sizedecreaseButton, SIGNAL (clicked()), this, SLOT (fontSizeDecrease()));
connect(ui.actionQuote, SIGNAL(triggered()), this, SLOT(blockQuote()));
connect(ui.codeButton, SIGNAL (clicked()), this, SLOT (toggleCode()));
- connect(ui.splitPostButton, SIGNAL (clicked()), this, SLOT (addPostSplitter()));
connect(ui.msgText, SIGNAL( checkSpellingChanged( bool ) ), this, SLOT( spellChecking( bool ) ) );
@@ -135,14 +134,15 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
- ui.comboStyle->addItem("Standard");
+ /*ui.comboStyle->addItem("Standard");
ui.comboStyle->addItem("Bullet List (Disc)");
ui.comboStyle->addItem("Bullet List (Circle)");
ui.comboStyle->addItem("Bullet List (Square)");
ui.comboStyle->addItem("Ordered List (Decimal)");
ui.comboStyle->addItem("Ordered List (Alpha lower)");
- ui.comboStyle->addItem("Ordered List (Alpha upper)");
- connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(textStyle(int)));
+ ui.comboStyle->addItem("Ordered List (Alpha upper)");*/
+ //connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(textStyle(int)));
+ connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(changeFormatType(int)));
connect(ui.comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &)));
@@ -680,6 +680,10 @@ void MessageComposer::setupInsertActions()
a = new QAction(QIcon(""), tr("&Image"), this);
connect(a, SIGNAL(triggered()), this, SLOT(addImage()));
menu->addAction(a);
+
+ a = new QAction(QIcon(""), tr("&Horizontal Line"), this);
+ connect(a, SIGNAL(triggered()), this, SLOT(addPostSplitter()));
+ menu->addAction(a);
}
@@ -721,6 +725,62 @@ void MessageComposer::textSize(const QString &p)
}
}
+void MessageComposer::changeFormatType(int styleIndex )
+{
+ ui.msgText->setFocus( Qt::OtherFocusReason );
+
+ QTextCursor cursor = ui.msgText->textCursor();
+ //QTextBlockFormat bformat = cursor.blockFormat();
+ QTextBlockFormat bformat;
+ QTextCharFormat cformat;
+
+ switch (styleIndex) {
+ default:
+ case 0:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 0 ) );
+ cformat.setFontWeight( QFont::Normal );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
+ break;
+ case 1:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 1 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 3 ) );
+ break;
+ case 2:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 2 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 2 ) );
+ break;
+ case 3:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 3 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 1 ) );
+ break;
+ case 4:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 4 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
+ break;
+ case 5:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 5 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -1 ) );
+ break;
+ case 6:
+ bformat.setProperty( TextFormat::HtmlHeading, QVariant( 6 ) );
+ cformat.setFontWeight( QFont::Bold );
+ cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -2 ) );
+ break;
+ }
+ //cformat.clearProperty( TextFormat::HasCodeStyle );
+
+ cursor.beginEditBlock();
+ cursor.mergeBlockFormat( bformat );
+ cursor.select( QTextCursor::BlockUnderCursor );
+ cursor.mergeCharFormat( cformat );
+ cursor.endEditBlock();
+}
+
void MessageComposer::textStyle(int styleIndex)
{
QTextCursor cursor = ui.msgText->textCursor();
diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h
index 4c42fbe19..1d9c56328 100644
--- a/retroshare-gui/src/gui/msgs/MessageComposer.h
+++ b/retroshare-gui/src/gui/msgs/MessageComposer.h
@@ -67,6 +67,9 @@ public slots:
void sendMessage();
void cancelMessage();
void addImage();
+
+ void changeFormatType(int styleIndex );
+
protected:
void closeEvent (QCloseEvent * event);
diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.ui b/retroshare-gui/src/gui/msgs/MessageComposer.ui
index 14313da7d..306b15142 100644
--- a/retroshare-gui/src/gui/msgs/MessageComposer.ui
+++ b/retroshare-gui/src/gui/msgs/MessageComposer.ui
@@ -182,10 +182,50 @@ border: 1px solid #CCCCCC;}
- 75
+ 16777215
16777215
+ -
+
+ Paragraph
+
+
+ -
+
+ Heading 1
+
+
+ -
+
+ Heading 2
+
+
+ -
+
+ Heading 2
+
+
+ -
+
+ Heading 3
+
+
+ -
+
+ Heading 4
+
+
+ -
+
+ Heading 5
+
+
+ -
+
+ Heading 6
+
+
-
@@ -383,7 +423,7 @@ border: 1px solid #CCCCCC;}
- -
+
-
@@ -408,7 +448,7 @@ border: 1px solid #CCCCCC;}
- -
+
-
@@ -442,7 +482,7 @@ border: 1px solid #CCCCCC;}
- -
+
-
@@ -500,7 +540,7 @@ border: 1px solid #CCCCCC;}
- -
+
-
Qt::Horizontal
@@ -513,29 +553,6 @@ border: 1px solid #CCCCCC;}
- -
-
-
- Split text
-
-
-
-
-
-
- :/images/textedit/hi22-action-insert-more-mark.png:/images/textedit/hi22-action-insert-more-mark.png
-
-
-
- 22
- 22
-
-
-
- true
-
-
-