23 #include "kncomposereditor.moc"
26 #include <KPIMTextEdit/EMailQuoteHighlighter>
27 #include <KConfigGroup>
28 #include <QApplication>
29 #include <messagecomposer/utils/util.h>
43 KConfigGroup config(
knGlobals.config(),
"VISUAL_APPEARANCE" );
44 QColor defaultColor1( 0x00, 0x80, 0x00 );
45 QColor defaultColor2( 0x00, 0x70, 0x00 );
46 QColor defaultColor3( 0x00, 0x60, 0x00 );
47 QColor defaultForeground( qApp->palette().color( QPalette::Text ) );
48 QColor col1 = config.readEntry(
"ForegroundColor", defaultForeground );
49 QColor col2 = config.readEntry(
"quote3Color", defaultColor3 );
50 QColor col3 = config.readEntry(
"quote2Color", defaultColor2 );
51 QColor col4 = config.readEntry(
"quote1Color", defaultColor1 );
53 highlighter->setQuoteColor(col1, col2, col3, col4);
58 QTextCursor cursor = textCursor();
59 if ( cursor.hasSelection() )
60 insertPlainText( MessageComposer::Util::rot13( cursor.selectedText() ) );
69 if (hasMarkedText()) {
70 QString s = QString::fromLatin1(
"\n") + markedText() + QString::fromLatin1(
"\n");
71 s.replace(QRegExp(
"\n,----[^\n]*\n"),
"\n");
72 s.replace(QRegExp(
"\n| "),
"\n");
73 s.replace(QRegExp(
"\n`----[^\n]*\n"),
"\n");
75 s.truncate(s.length()-1);
78 int l = currentLine();
79 int c = currentColumn();
81 QString s = textLine(l);
82 if (!((s.left(2) ==
"| ")||(s.left(5)==
",----")||(s.left(5)==
"`----")))
89 while ((x>=0)&&(textLine(x).left(5)!=
",----"))
91 if ((x>=0)&&(textLine(x).left(5)==
",----")) {
94 for (
int i=x;i<=l;++i) {
96 if (s.left(2) ==
"| ") {
106 while ((x<numLines())&&(textLine(x).left(5)!=
"`----"))
108 if ((x<numLines())&&(textLine(x).left(5)==
"`----")) {
110 for (
int i=l+1;i<x;++i) {
112 if (s.left(2) ==
"| ") {
120 setCursorPosition(l,c-2);
130 MessageComposer::Util::addTextBox(
this);
static KNGlobals * self()
Return the KNGlobals instance.
KNComposerEditor(QWidget *parent=0)
Constructs a KNComposerEditor object.
void slotRot13()
Warning: This function switches back to plain text mode.
virtual ~KNComposerEditor()
#define knGlobals
Keep compatibility with the old way.
virtual void changeHighlighterColors(KPIMTextEdit::EMailQuoteHighlighter *highlighter)