• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/kopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • kopete
  • chatwindow
kopeterichtextwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Roman Jarosz <kedgedev@gmail.com>
3  Copyright (C) 2009 Benson Tsai <btsai@vrwarp.com>
4  Copyright (C) 2006 MichaĆ«l Larouche <larouche@kde.org>
5  Copyright (C) 2003 Richard Moore <rich@kde.org>
6  Copyright (c) 2003-2005 Jason Keirstead <jason@keirstead.org>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License version 2 as published by the Free Software Foundation.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include "kopeterichtextwidget.h"
24 
25 // KDE includes
26 #include <kdebug.h>
27 #include <kaction.h>
28 #include <kactioncollection.h>
29 #include <kactionmenu.h>
30 #include <klocalizedstring.h>
31 #include <ktoggleaction.h>
32 #include <kcolorscheme.h>
33 #include <KConfigGroup>
34 
35 // Qt includes
36 #include <QUrl>
37 #include <QtCore/QEvent>
38 #include <QKeyEvent>
39 #include <QtGui/QTextCursor>
40 #include <QtGui/QTextCharFormat>
41 #include <QTextDocumentFragment>
42 
43 // TODO: Add i18n context
44 
49 //@cond PRIVATE
50 class KopeteRichTextWidget::Private
51 {
52 public:
53  Private(KopeteRichTextWidget *parent, KActionCollection *ac, Kopete::Protocol::Capabilities caps)
54  : q(parent), actionCollection(ac), protocolCaps(caps), resettingCharFormat(false), empty(true), updating(false), changingTextMode(false),
55  checkSpelling(0), toggleRichText(0), reset(0)
56  {
57  }
58 
59  KopeteRichTextWidget *q;
60  KActionCollection *actionCollection;
61 
62  QList<QKeySequence> sendKeySequenceList;
63 
64  const Kopete::Protocol::Capabilities protocolCaps;
65 
66  QTextCharFormat defaultPlainFormat;
67  QTextCharFormat defaultRichFormat;
68  QTextCharFormat currentRichFormat;
69 
70  QTextCharFormat lastCharFormat;
71  bool resettingCharFormat;
72 
73  bool empty;
74  bool updating;
75 
76  bool changingTextMode;
77 
78  KToggleAction* autoResize;
79  KToggleAction* checkSpelling;
80  KToggleAction* toggleRichText;
81  KAction* reset;
82 
83  void mergeAll(const QTextCharFormat& format);
84 };
85 //@endcond
86 
87 KopeteRichTextWidget::KopeteRichTextWidget(QWidget* parent, Kopete::Protocol::Capabilities protocolCaps, KActionCollection *actionCollection)
88  : KRichTextWidget(parent),
89  d(new Private(this, actionCollection, protocolCaps))
90 {
91  connect(this, SIGNAL(textModeChanged(KRichTextEdit::Mode)),
92  this, SLOT(slotTextModeChanged(KRichTextEdit::Mode)));
93 
94  // Default plaintext setup
95  setRichTextSupport(KopeteRichTextWidget::DisableRichText);
96  d->changingTextMode = true;
97  switchToPlainText();
98  d->changingTextMode = false;
99  createActions(d->actionCollection);
100  setCurrentPlainCharFormat(d->defaultPlainFormat);
101 
102  connect(this, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
103  this, SLOT(updateCharFormat(QTextCharFormat)));
104 
105  connect(this, SIGNAL(textChanged()),
106  this, SLOT(updateTextFormat()));
107 }
108 
109 KopeteRichTextWidget::~KopeteRichTextWidget()
110 {
111  KConfigGroup configGroupMode( KGlobal::config(), QLatin1String( "KopeteChatWindowGroupMode" ));
112  KConfigGroup configIndividual( KGlobal::config(), QLatin1String( "KopeteChatWindowIndividualMode" ));
113  configGroupMode.writeEntry( "AutoResize", d->autoResize->isChecked());
114  configIndividual.writeEntry( "AutoResize", d->autoResize->isChecked());
115  delete d;
116 }
117 
118 void KopeteRichTextWidget::setTextOrHtml(const QString &text)
119 {
120  if (Qt::mightBeRichText(text))
121  {
122  if (isRichTextEnabled())
123  setHtml(text);
124  else
125  {
126  QTextDocument doc;
127  doc.setHtml(text);
128  setPlainText(doc.toPlainText());
129  }
130  }
131  else
132  {
133  setPlainText(text);
134  }
135 }
136 
137 void KopeteRichTextWidget::slotCheckSpellingChanged(bool b)
138 {
139  setCheckSpellingEnabled(b);
140 }
141 
142 void KopeteRichTextWidget::slotDocumentSizeUpdated()
143 {
144  int currentFontHeight = QFontMetrics(font()).height();
145  int difference = document()->size().toSize().height() - size().height() + currentFontHeight;
146  emit documentSizeUpdated(difference);
147 }
148 
149 void KopeteRichTextWidget::slotEnableAutoResize(bool enable)
150 {
151  if (enable)
152  {
153  connect(this, SIGNAL(textChanged()),
154  this, SLOT(slotDocumentSizeUpdated()));
155  }
156  else
157  {
158  disconnect(this, SLOT(slotDocumentSizeUpdated()));
159  }
160 }
161 
162 void KopeteRichTextWidget::createActions(KActionCollection *actionCollection)
163 {
164  KConfigGroup config(KGlobal::config(), QLatin1String("KopeteChatWindowIndividualMode"));
165 
166  bool autoResizeEnabled = config.readEntry("AutoResize", true);
167  d->autoResize = new KToggleAction( i18n("Input auto-resize"), actionCollection );
168  connect( d->autoResize, SIGNAL(toggled(bool)), this, SLOT(slotEnableAutoResize(bool)) );
169  d->autoResize->setChecked(autoResizeEnabled);
170  slotEnableAutoResize(autoResizeEnabled);
171  actionCollection->addAction( "enable_autoresize", d->autoResize );
172 
173  if (!d->checkSpelling)
174  {
175  d->checkSpelling = new KToggleAction(KIcon("tools-check-spelling"), i18n("Automatic Spell Checking"), actionCollection);
176  actionCollection->addAction("enable_auto_spell_check", d->checkSpelling);
177  d->checkSpelling->setChecked(true);
178  connect(d->checkSpelling, SIGNAL(toggled(bool)), this, SLOT(slotCheckSpellingChanged(bool)));
179  }
180 
181  bool richTextSupport = (getProtocolRichTextSupport() != KopeteRichTextWidget::DisableRichText);
182  if (!d->toggleRichText && richTextSupport)
183  {
184  d->toggleRichText = new KToggleAction(KIcon("draw-freehand"), i18n("Enable &Rich Text"), actionCollection);
185  actionCollection->addAction("enable_richtext", d->toggleRichText);
186  d->toggleRichText->setChecked(isRichTextEnabled());
187  connect(d->toggleRichText, SIGNAL(toggled(bool)), this, SLOT(setRichTextEnabled(bool)));
188  }
189  else if (d->toggleRichText && !richTextSupport)
190  {
191  actionCollection->removeAction(d->toggleRichText);
192  d->toggleRichText = 0;
193  }
194 
195  if (!d->reset && isRichTextEnabled())
196  {
197  d->reset = new KAction(KIcon("format-stroke-color"), i18n("Reset Font And Color"), actionCollection);
198  actionCollection->addAction("format_font_and_color_reset", d->reset);
199  connect(d->reset, SIGNAL(triggered(bool)), this, SLOT(slotResetFontAndColor()));
200  }
201  else if (d->reset && !isRichTextEnabled())
202  {
203  actionCollection->removeAction(d->reset);
204  d->reset = 0;
205  }
206 
207  KRichTextWidget::createActions(actionCollection);
208 
209  // FIXME: Really ugly hack, but we reset format in updateCharFormat and if we don't disconnect this
210  // then actions will have old values and not the reset.
211  disconnect(this, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
212  this, SLOT(_k_updateCharFormatActions(QTextCharFormat)));
213 }
214 
215 void KopeteRichTextWidget::setRichTextEnabled(bool enable)
216 {
217  if (isRichTextEnabled() == enable)
218  return;
219 
220  KopeteRichTextWidget::RichTextSupport richText = getProtocolRichTextSupport();
221  if (enable && richText != KopeteRichTextWidget::DisableRichText)
222  {
223  setRichTextSupport(richText);
224  d->changingTextMode = true;
225  enableRichTextMode();
226  d->changingTextMode = false;
227  createActions(d->actionCollection);
228  setCurrentRichCharFormat(d->currentRichFormat);
229  }
230  else
231  {
232  setRichTextSupport(KopeteRichTextWidget::DisableRichText);
233  d->changingTextMode = true;
234  switchToPlainText();
235  d->changingTextMode = false;
236  createActions(d->actionCollection);
237  setCurrentPlainCharFormat(d->defaultPlainFormat);
238  }
239 
240  if (d->toggleRichText)
241  d->toggleRichText->setChecked(isRichTextEnabled());
242 
243  if (d->reset)
244  d->reset->setEnabled(isRichTextEnabled());
245 
246  emit richTextSupportChanged();
247 }
248 
249 void KopeteRichTextWidget::slotResetFontAndColor()
250 {
251  setCurrentRichCharFormat(d->defaultRichFormat);
252 }
253 
254 void KopeteRichTextWidget::setFontFamily(QString family)
255 {
256  d->currentRichFormat.setFontFamily(family);
257  if (!isRichTextEnabled())
258  return;
259 
260  if (d->protocolCaps & Kopete::Protocol::BaseFont)
261  {
262  QTextCharFormat format;
263  format.setFontFamily(family);
264  d->mergeAll(format);
265  }
266  else
267  {
268  KRichTextWidget::setFontFamily(family);
269  }
270 }
271 
272 void KopeteRichTextWidget::setFontSize(int size)
273 {
274  d->currentRichFormat.setFontPointSize(size);
275  if (!isRichTextEnabled())
276  return;
277 
278  if (d->protocolCaps & Kopete::Protocol::BaseFont)
279  {
280  QTextCharFormat format;
281  format.setFontPointSize(size);
282  d->mergeAll(format);
283  }
284  else
285  {
286  KRichTextWidget::setFontSize(size);
287  }
288 }
289 
290 void KopeteRichTextWidget::setTextBold(bool bold)
291 {
292  QFont font = d->currentRichFormat.font();
293  font.setBold(bold);
294  d->currentRichFormat.setFont(font);
295 
296  if (!isRichTextEnabled())
297  return;
298 
299  if (d->protocolCaps & Kopete::Protocol::BaseBFormatting)
300  {
301  QTextCharFormat format;
302  format.setFontWeight(d->currentRichFormat.fontWeight());
303  d->mergeAll(format);
304  }
305  else
306  {
307  KRichTextWidget::setTextBold(bold);
308  }
309 }
310 
311 void KopeteRichTextWidget::setTextItalic(bool italic)
312 {
313  d->currentRichFormat.setFontItalic(italic);
314  if (!isRichTextEnabled())
315  return;
316 
317  if (d->protocolCaps & Kopete::Protocol::BaseIFormatting)
318  {
319  QTextCharFormat format;
320  format.setFontItalic(italic);
321  d->mergeAll(format);
322  }
323  else
324  {
325  KRichTextWidget::setTextItalic(italic);
326  }
327 }
328 
329 void KopeteRichTextWidget::setTextUnderline(bool underline)
330 {
331  d->currentRichFormat.setFontUnderline(underline);
332  if (!isRichTextEnabled())
333  return;
334 
335  if (d->protocolCaps & Kopete::Protocol::BaseUFormatting)
336  {
337  QTextCharFormat format;
338  format.setFontItalic(underline);
339  d->mergeAll(format);
340  }
341  else
342  {
343  KRichTextWidget::setTextUnderline(underline);
344  }
345 }
346 
347 void KopeteRichTextWidget::setTextStrikeOut(bool)
348 {
349  kDebug() << "Strikeout not supported!";
350 }
351 
352 void KopeteRichTextWidget::setCurrentCharFormat(const QTextCharFormat & format)
353 {
354  d->lastCharFormat = format;
355  KRichTextWidget::setCurrentCharFormat(format);
356 }
357 
358 void KopeteRichTextWidget::updateCharFormat(const QTextCharFormat & f)
359 {
360  // TODO: This should go to KRichTextWidget or KRichTextEdit
361  if (d->resettingCharFormat)
362  return;
363 
364  if (f != QTextCharFormat() || !document()->isEmpty())
365  {
366  d->lastCharFormat = f;
367  bool bOpaque = d->lastCharFormat.foreground().isOpaque();
368  bool fOpaque = d->lastCharFormat.background().isOpaque();
369 
370  if (!fOpaque)
371  d->lastCharFormat.setForeground(palette().color(QPalette::Active, QPalette::Text));
372  if (!bOpaque)
373  d->lastCharFormat.setBackground(palette().color(QPalette::Active, QPalette::Base));
374 
375  if (!fOpaque || !bOpaque)
376  {
377  d->resettingCharFormat = true;
378  KRichTextWidget::setCurrentCharFormat(d->lastCharFormat);
379  d->resettingCharFormat = false;
380  }
381 
382  if (isRichTextEnabled() && d->currentRichFormat != d->lastCharFormat)
383  {
384  d->currentRichFormat = d->lastCharFormat;
385 
386  if (d->protocolCaps & Kopete::Protocol::BaseBgColor)
387  {
388  QPalette palette = this->palette();
389  palette.setColor(QPalette::Active, QPalette::Base, d->lastCharFormat.background().color());
390  palette.setColor(QPalette::Inactive, QPalette::Base, d->lastCharFormat.background().color());
391  this->setPalette(palette);
392  }
393  }
394  }
395  else
396  {
397  d->resettingCharFormat = true;
398  KRichTextWidget::setCurrentCharFormat(d->lastCharFormat);
399  d->resettingCharFormat = false;
400  }
401  updateActionStates();
402 }
403 
404 void KopeteRichTextWidget::updateTextFormat()
405 {
406  if (d->updating || !isRichTextEnabled())
407  return;
408 
409  bool empty = document()->isEmpty();
410  if (!empty && d->empty)
411  {
412  d->updating = true;
413  QTextCursor cursor = textCursor();
414  cursor.beginEditBlock();
415  cursor.select(QTextCursor::Document);
416  cursor.mergeCharFormat(d->currentRichFormat);
417  mergeCurrentCharFormat(d->currentRichFormat);
418  cursor.endEditBlock();
419  d->updating = false;
420  }
421 
422  d->empty = empty;
423 }
424 
425 void KopeteRichTextWidget::insertFromMimeData(const QMimeData * source)
426 {
427  if (source->hasUrls())
428  {
429  QList<QUrl> urls = source->urls();
430  if (urls.size() > 0)
431  {
432  textCursor().insertText(urls[0].toString());
433  return;
434  }
435  }
436 
437  // If HTML then you need to unset d->empty to make sure rich text gets through correctly
438  if (source->hasHtml())
439  {
440  d->empty = d->empty && source->html().isEmpty();
441  // double check to make sure we aren't pasting empty space
442  if (d->empty)
443  {
444  QTextDocumentFragment frag = QTextDocumentFragment::fromHtml(source->html());
445  d->empty = frag.toPlainText().trimmed().isEmpty();
446  }
447  }
448 
449  KRichTextWidget::insertFromMimeData(source);
450 }
451 
452 bool KopeteRichTextWidget::event(QEvent *event)
453 {
454  if (event->type() == QEvent::ShortcutOverride)
455  {
456  QKeyEvent *keyEvent = dynamic_cast<QKeyEvent*>(event);
457  if (keyEvent)
458  {
459  if (keyEvent->matches(QKeySequence::Copy) && !textCursor().hasSelection())
460  {
461  // The copy shortcut has to be handled outside of
462  // the textedit because otherwise you cannot use it
463  // to copy a selection in the chatmessagepart
464  // see bug: #163535
465  return QWidget::event(event);
466  }
467  if ((keyEvent->matches(QKeySequence::MoveToPreviousPage) || keyEvent->matches(QKeySequence::MoveToNextPage))
468  && document()->isEmpty())
469  {
470  // Allow to scroll the chat if the user has not entered
471  // some text in the KRichTextEditPart.
472  return QWidget::event(event);
473  }
474  }
475  }
476  if (event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyRelease || event->type() == QEvent::KeyPress){
477  QKeyEvent *keyEvent = dynamic_cast<QKeyEvent*>(event);
478  if (keyEvent)
479  {
480  QKeySequence keyEventSequance(keyEvent->modifiers() + keyEvent->key());
481  foreach(const QKeySequence& sendKeySequence, d->sendKeySequenceList)
482  {
483  if (keyEventSequance.matches(sendKeySequence))
484  {
485  // Don't handle the shortcut for sending text in the textedit
486  return false;// QWidget::event(event);
487  }
488  }
489  }
490  }
491  return KRichTextWidget::event(event);
492 }
493 
494 void KopeteRichTextWidget::setSendKeySequenceList(const QList<QKeySequence>& keySequenceList)
495 {
496  d->sendKeySequenceList = keySequenceList;
497 }
498 
499 void KopeteRichTextWidget::setDefaultPlainCharFormat(const QTextCharFormat& format)
500 {
501  d->defaultPlainFormat = format;
502  setCurrentPlainCharFormat(d->defaultPlainFormat);
503 }
504 
505 void KopeteRichTextWidget::setCurrentPlainCharFormat(const QTextCharFormat & format)
506 {
507  if (isRichTextEnabled())
508  return;
509 
510  setCurrentCharFormat(format);
511  d->mergeAll(format);
512 
513  // set background color to match
514  QPalette palette = this->palette();
515  palette.setColor(QPalette::Active, QPalette::Base, format.background().color());
516  palette.setColor(QPalette::Inactive, QPalette::Base, format.background().color());
517  this->setPalette(palette);
518 }
519 
520 void KopeteRichTextWidget::setDefaultRichCharFormat(const QTextCharFormat& format)
521 {
522  bool usingDefaultFormat = (d->defaultRichFormat == d->currentRichFormat);
523 
524  d->defaultRichFormat = format;
525  if (usingDefaultFormat)
526  setCurrentRichCharFormat(d->defaultRichFormat);
527 }
528 
529 void KopeteRichTextWidget::setCurrentRichCharFormat(const QTextCharFormat & format)
530 {
531  d->currentRichFormat = format;
532 
533  if (isRichTextEnabled())
534  {
535  setCurrentCharFormat(format);
536  if (d->protocolCaps & (Kopete::Protocol::BaseFormatting | Kopete::Protocol::BaseColor))
537  {
538  d->mergeAll(format);
539  }
540 
541  QColor color;
542  if (d->protocolCaps & Kopete::Protocol::BaseBgColor)
543  color = format.background().color();
544  else
545  color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
546 
547  QPalette palette = this->palette();
548  palette.setColor(QPalette::Active, QPalette::Base, color);
549  palette.setColor(QPalette::Inactive, QPalette::Base, color);
550  this->setPalette(palette);
551  }
552 }
553 
554 QTextCharFormat KopeteRichTextWidget::defaultPlainFormat() const
555 {
556  return d->defaultPlainFormat;
557 }
558 
559 QTextCharFormat KopeteRichTextWidget::defaultRichFormat() const
560 {
561  return d->defaultRichFormat;
562 }
563 
564 QTextCharFormat KopeteRichTextWidget::currentRichFormat() const
565 {
566  return d->currentRichFormat;
567 }
568 
569 bool KopeteRichTextWidget::isRichTextEnabled() const
570 {
571  return (textMode() == KopeteRichTextWidget::Rich);
572 }
573 
574 void KopeteRichTextWidget::slotTextModeChanged(KRichTextEdit::Mode)
575 {
576  if (d->changingTextMode == false)
577  {
578  kWarning() << "Unexpected text mode change!!!";
579  kWarning() << kBacktrace();
580  }
581 }
582 
583 KopeteRichTextWidget::RichTextSupport KopeteRichTextWidget::getProtocolRichTextSupport() const
584 {
585  KopeteRichTextWidget::RichTextSupport richText = KopeteRichTextWidget::DisableRichText;
586 
587  // Check for bold
588  if ((d->protocolCaps & Kopete::Protocol::BaseBFormatting) || (d->protocolCaps & Kopete::Protocol::RichBFormatting))
589  {
590  richText |= KopeteRichTextWidget::SupportBold;
591  }
592  // Check for italic
593  if ((d->protocolCaps & Kopete::Protocol::BaseIFormatting) || (d->protocolCaps & Kopete::Protocol::RichIFormatting))
594  {
595  richText |= KopeteRichTextWidget::SupportItalic;
596  }
597  // Check for underline
598  if ((d->protocolCaps & Kopete::Protocol::BaseUFormatting) || (d->protocolCaps & Kopete::Protocol::RichUFormatting))
599  {
600  richText |= KopeteRichTextWidget::SupportUnderline;
601  }
602  // Check for font support
603  if ((d->protocolCaps & Kopete::Protocol::BaseFont) || (d->protocolCaps & Kopete::Protocol::RichFont))
604  {
605  richText |= KopeteRichTextWidget::SupportFontFamily | KopeteRichTextWidget::SupportFontSize;
606  }
607  // Check for text color support
608  if ((d->protocolCaps & Kopete::Protocol::BaseFgColor) || (d->protocolCaps & Kopete::Protocol::RichFgColor))
609  {
610  richText |= KopeteRichTextWidget::SupportTextForegroundColor;
611  }
612  // Check for background color support
613  if ((d->protocolCaps & Kopete::Protocol::BaseBgColor) || (d->protocolCaps & Kopete::Protocol::RichBgColor))
614  {
615  richText |= KopeteRichTextWidget::SupportTextBackgroundColor;
616  }
617  // Check for alignment
618  if (d->protocolCaps & Kopete::Protocol::Alignment)
619  {
620  richText |= KopeteRichTextWidget::SupportAlignment;
621  }
622 
623  return richText;
624 }
625 
626 void KopeteRichTextWidget::Private::mergeAll(const QTextCharFormat& format)
627 {
628  QTextCursor cursor = q->textCursor();
629  cursor.beginEditBlock();
630  cursor.select(QTextCursor::Document);
631  cursor.mergeCharFormat(format);
632  q->mergeCurrentCharFormat(format);
633  cursor.endEditBlock();
634 }
635 
636 // kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on;
637 #include "kopeterichtextwidget.moc"
KopeteRichTextWidget::documentSizeUpdated
void documentSizeUpdated(int difference)
QTextCharFormat::setFontItalic
void setFontItalic(bool italic)
KopeteRichTextWidget::defaultPlainFormat
QTextCharFormat defaultPlainFormat() const
Definition: kopeterichtextwidget.cpp:554
QEvent
KopeteRichTextWidget::setDefaultRichCharFormat
void setDefaultRichCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:520
QWidget
QKeyEvent::modifiers
Qt::KeyboardModifiers modifiers() const
QEvent::type
Type type() const
QTextCursor
KopeteRichTextWidget::slotCheckSpellingChanged
void slotCheckSpellingChanged(bool b)
Definition: kopeterichtextwidget.cpp:137
KopeteRichTextWidget::setRichTextEnabled
void setRichTextEnabled(bool enable)
enable/disable rich text support
Definition: kopeterichtextwidget.cpp:215
QPalette::setColor
void setColor(ColorGroup group, ColorRole role, const QColor &color)
QTextCharFormat::setFontPointSize
void setFontPointSize(qreal size)
KopeteRichTextWidget::setTextBold
void setTextBold(bool bold)
Definition: kopeterichtextwidget.cpp:290
QFont
QTextFormat::foreground
QBrush foreground() const
KopeteRichTextWidget::richTextSupportChanged
void richTextSupportChanged()
KopeteRichTextWidget::setTextItalic
void setTextItalic(bool italic)
Definition: kopeterichtextwidget.cpp:311
kopeterichtextwidget.h
QFontMetrics
KopeteRichTextWidget::event
virtual bool event(QEvent *event)
Definition: kopeterichtextwidget.cpp:452
QMimeData
QList::size
int size() const
QTextCursor::select
void select(SelectionType selection)
QBrush::isOpaque
bool isOpaque() const
QTextFormat::background
QBrush background() const
QBrush::color
const QColor & color() const
QFont::setBold
void setBold(bool enable)
KopeteRichTextWidget::createActions
virtual void createActions(KActionCollection *actionCollection)
Definition: kopeterichtextwidget.cpp:162
KopeteRichTextWidget::setTextUnderline
void setTextUnderline(bool underline)
Definition: kopeterichtextwidget.cpp:329
KopeteRichTextWidget::setSendKeySequenceList
void setSendKeySequenceList(const QList< QKeySequence > &keySequenceList)
Definition: kopeterichtextwidget.cpp:494
QMimeData::hasHtml
bool hasHtml() const
QTextDocumentFragment
KopeteRichTextWidget::updateTextFormat
void updateTextFormat()
Definition: kopeterichtextwidget.cpp:404
KRichTextWidget
QTextCursor::endEditBlock
void endEditBlock()
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
KopeteRichTextWidget
A KopeteRichTextWidget with overridden behaviors.
Definition: kopeterichtextwidget.h:44
KopeteRichTextWidget::currentRichFormat
QTextCharFormat currentRichFormat() const
Definition: kopeterichtextwidget.cpp:564
KopeteRichTextWidget::setCurrentRichCharFormat
void setCurrentRichCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:529
KopeteRichTextWidget::updateCharFormat
void updateCharFormat(const QTextCharFormat &)
Definition: kopeterichtextwidget.cpp:358
QString
QList
QColor
QKeyEvent::matches
bool matches(QKeySequence::StandardKey key) const
QTextCharFormat
QKeyEvent::key
int key() const
KopeteRichTextWidget::slotEnableAutoResize
void slotEnableAutoResize(bool enable)
Definition: kopeterichtextwidget.cpp:149
QTextCursor::beginEditBlock
void beginEditBlock()
QTextCursor::mergeCharFormat
void mergeCharFormat(const QTextCharFormat &modifier)
QTextCharFormat::setFontWeight
void setFontWeight(int weight)
QKeyEvent
QTextDocument::toPlainText
QString toPlainText() const
KopeteRichTextWidget::setTextOrHtml
void setTextOrHtml(const QString &text)
Definition: kopeterichtextwidget.cpp:118
QMimeData::hasUrls
bool hasUrls() const
QLatin1String
QKeySequence
QMimeData::urls
QList< QUrl > urls() const
QTextDocument
KopeteRichTextWidget::isRichTextEnabled
bool isRichTextEnabled() const
Definition: kopeterichtextwidget.cpp:569
QTextCharFormat::setFontFamily
void setFontFamily(const QString &family)
KAction
KopeteRichTextWidget::KopeteRichTextWidget
KopeteRichTextWidget(QWidget *parent, Kopete::Protocol::Capabilities protocolCaps, KActionCollection *actionCollection)
Private class that helps to provide binary compatibility between releases.
Definition: kopeterichtextwidget.cpp:87
QTextDocumentFragment::fromHtml
QTextDocumentFragment fromHtml(const QString &text)
QTextDocumentFragment::toPlainText
QString toPlainText() const
QFontMetrics::height
int height() const
Qt::mightBeRichText
bool mightBeRichText(const QString &text)
QTextDocument::setHtml
void setHtml(const QString &html)
KopeteRichTextWidget::setFontSize
void setFontSize(int size)
Definition: kopeterichtextwidget.cpp:272
KopeteRichTextWidget::insertFromMimeData
virtual void insertFromMimeData(const QMimeData *source)
Definition: kopeterichtextwidget.cpp:425
KopeteRichTextWidget::slotResetFontAndColor
void slotResetFontAndColor()
Definition: kopeterichtextwidget.cpp:249
KopeteRichTextWidget::setDefaultPlainCharFormat
void setDefaultPlainCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:499
KopeteRichTextWidget::~KopeteRichTextWidget
~KopeteRichTextWidget()
Definition: kopeterichtextwidget.cpp:109
QWidget::event
virtual bool event(QEvent *event)
QMimeData::html
QString html() const
KopeteRichTextWidget::setTextStrikeOut
void setTextStrikeOut(bool strikeout)
Definition: kopeterichtextwidget.cpp:347
KopeteRichTextWidget::slotTextModeChanged
void slotTextModeChanged(KRichTextEdit::Mode mode)
Definition: kopeterichtextwidget.cpp:574
QPalette
KopeteRichTextWidget::defaultRichFormat
QTextCharFormat defaultRichFormat() const
Definition: kopeterichtextwidget.cpp:559
KopeteRichTextWidget::slotDocumentSizeUpdated
void slotDocumentSizeUpdated()
Definition: kopeterichtextwidget.cpp:142
KopeteRichTextWidget::setFontFamily
void setFontFamily(QString family)
Definition: kopeterichtextwidget.cpp:254
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal