• 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
chattexteditpart.cpp
Go to the documentation of this file.
1 /*
2  chattexteditpart.cpp - Chat Text Edit Part
3 
4  Copyright (c) 2008 by Benson Tsai <btsai@vrwarp.com>
5  Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
6 
7  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #include "chattexteditpart.h"
20 
21 #include "kopetecontact.h"
22 #include "kopetechatsession.h"
23 #include "kopeteonlinestatus.h"
24 #include "kopeteprotocol.h"
25 #include "kopeteglobal.h"
26 #include "kopeteappearancesettings.h"
27 #include "kopetechatwindowsettings.h"
28 
29 #include <kaction.h>
30 #include <kactioncollection.h>
31 #include <kcolordialog.h>
32 #include <kconfig.h>
33 #include <kcompletion.h>
34 #include <kdebug.h>
35 #include <kfontaction.h>
36 #include <kfontdialog.h>
37 #include <kfontsizeaction.h>
38 #include <kglobalsettings.h>
39 #include <kcolorscheme.h>
40 #include <kicon.h>
41 #include <kparts/genericfactory.h>
42 #include <kstandardaction.h>
43 #include <ktoggleaction.h>
44 #include <kxmlguifactory.h>
45 
46 
47 // Qt includes
48 #include <QtCore/QTimer>
49 #include <QtCore/QRegExp>
50 #include <QtCore/QEvent>
51 #include <QKeyEvent>
52 #include <QtGui/QTextCursor>
53 #include <QtGui/QTextCharFormat>
54 
55 
56 typedef KParts::GenericFactory<ChatTextEditPart> ChatTextEditPartFactory;
57 K_EXPORT_COMPONENT_FACTORY( librichtexteditpart, ChatTextEditPartFactory )
58 
59 ChatTextEditPart::ChatTextEditPart( Kopete::ChatSession *session, QWidget *parent)
60  : KParts::ReadOnlyPart( parent ), m_session(session)
61 {
62  init(session, parent);
63 }
64 
65 ChatTextEditPart::ChatTextEditPart(QWidget *parent, QObject*, const QStringList&)
66  : KParts::ReadOnlyPart( parent ), m_session()
67 {
68  init(m_session, parent);
69 }
70 
71 void ChatTextEditPart::init( Kopete::ChatSession *session, QWidget *parent)
72 {
73  // we need an instance
74  setComponentData( ChatTextEditPartFactory::componentData() );
75 
76  editor = new KopeteRichTextWidget(parent, m_session->protocol()->capabilities(), actionCollection());
77  setWidget( editor );
78 
79  // TODO: Rename rc file
80  setXMLFile( "kopeterichtexteditpart/kopeterichtexteditpartfull.rc" );
81 
82  historyPos = -1;
83 
84  mComplete = new KCompletion();
85  mComplete->setIgnoreCase( true );
86  mComplete->setOrder( KCompletion::Weighted );
87 
88  // set params on the edit widget
89  textEdit()->setMinimumSize( QSize( 75, 20 ) );
90 
91  // some signals and slots connections
92  connect( textEdit(), SIGNAL(textChanged()), this, SLOT(slotTextChanged()) );
93 
94  // timers for typing notifications
95  m_typingRepeatTimer = new QTimer(this);
96  m_typingRepeatTimer->setObjectName("m_typingRepeatTimer");
97  m_typingStopTimer = new QTimer(this);
98  m_typingStopTimer->setObjectName("m_typingStopTimer");
99 
100  connect( m_typingRepeatTimer, SIGNAL(timeout()), this, SLOT(slotRepeatTypingTimer()) );
101  connect( m_typingStopTimer, SIGNAL(timeout()), this, SLOT(slotStoppedTypingTimer()) );
102 
103  connect( session, SIGNAL(contactAdded(const Kopete::Contact*,bool)),
104  this, SLOT(slotContactAdded(const Kopete::Contact*)) );
105  connect( session, SIGNAL(contactRemoved(const Kopete::Contact*,QString,Qt::TextFormat,bool)),
106  this, SLOT(slotContactRemoved(const Kopete::Contact*)) );
107  connect( session, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
108  this, SLOT(slotContactStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
109 
110  connect( Kopete::AppearanceSettings::self(), SIGNAL(appearanceChanged()),
111  this, SLOT(slotAppearanceChanged()) );
112 
113  connect( KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()),
114  this, SLOT(slotAppearanceChanged()) );
115 
116  connect( editor, SIGNAL(richTextSupportChanged()), this, SLOT (slotRichTextSupportChanged()) );
117 
118  slotAppearanceChanged();
119 
120  slotContactAdded( session->myself() );
121 
122  foreach( Kopete::Contact *contact, session->members() )
123  slotContactAdded( contact );
124 }
125 
126 ChatTextEditPart::~ChatTextEditPart()
127 {
128  delete mComplete;
129 }
130 
131 void ChatTextEditPart::complete()
132 {
133  QTextCursor textCursor = textEdit()->textCursor();
134  QTextBlock block = textCursor.block();
135 
136  QString txt = block.text();
137  const int blockLength = block.length() - 1; // block.length includes the '\n'
138  const int blockPosition = block.position();
139  int cursorPos = textCursor.position() - blockPosition;
140 
141  // TODO replace with textCursor.movePosition(QTextCursor::PreviousWord)?
142  const int startPos = txt.lastIndexOf( QRegExp( QLatin1String("\\s\\S+") ), cursorPos - 1 ) + 1;
143  int endPos = txt.indexOf( QRegExp( QLatin1String("[\\s\\:]") ), startPos );
144  if( endPos == -1 )
145  {
146  endPos = blockLength;
147  }
148  const QString word = txt.mid( startPos, endPos - startPos );
149 
150  if ( endPos < txt.length() && txt[endPos] == ':') {
151  // Eat ':' and ' ' too, if they are there, so that after pressing Tab
152  // we are on the right side of them again.
153  ++endPos;
154  if ( endPos < txt.length() && txt[endPos] == ' ') {
155  ++endPos;
156  }
157  }
158 
159  //kDebug(14000) << word << "from" << txt
160  // << "cursor pos=" << cursorPos
161  // << "start pos=" << startPos << "end pos=" << endPos;
162 
163  QString match;
164  if ( word != m_lastMatch )
165  {
166  match = mComplete->makeCompletion( word );
167  m_lastMatch.clear();
168  }
169  else
170  {
171  match = mComplete->nextMatch();
172  }
173 
174  if ( !match.isEmpty() )
175  {
176  m_lastMatch = match;
177 
178  if ( textCursor.blockNumber() == 0 && startPos == 0 )
179  {
180  match += QLatin1String(": ");
181  }
182 
183  //kDebug(14000) << "Selecting from position" << cursorPos << "to position" << endPos;
184  // Select the text to remove
185  textCursor.setPosition( startPos + blockPosition );
186  textCursor.setPosition( endPos + blockPosition, QTextCursor::KeepAnchor );
187  //kDebug(14000) << "replacing selection:" << textCursor.selectedText() << "with match:" << match;
188  // Type the text to replace it
189  textCursor.insertText( match );
190  textEdit()->setTextCursor( textCursor );
191  }
192  else
193  {
194  //kDebug(14000) << "No completions! Tried" << mComplete->items();
195  }
196 }
197 
198 void ChatTextEditPart::slotDisplayNameChanged( const QString &oldName, const QString &newName )
199 {
200  mComplete->removeItem( oldName );
201  mComplete->addItem( newName );
202 }
203 
204 void ChatTextEditPart::slotContactAdded( const Kopete::Contact *contact )
205 {
206  connect( contact, SIGNAL(displayNameChanged(QString,QString)),
207  this, SLOT(slotDisplayNameChanged(QString,QString)) );
208 
209  mComplete->addItem( contact->displayName() );
210 }
211 
212 void ChatTextEditPart::slotContactRemoved( const Kopete::Contact *contact )
213 {
214  disconnect( contact, SIGNAL(displayNameChanged(QString,QString)),
215  this, SLOT(slotDisplayNameChanged(QString,QString)) );
216 
217  mComplete->removeItem( contact->displayName() );
218 }
219 
220 bool ChatTextEditPart::canSend()
221 {
222  if ( !m_session ) return false;
223 
224  // can't send if there's nothing *to* send...
225  if ( text(Qt::PlainText).isEmpty() )
226  return false;
227 
228  Kopete::ContactPtrList members = m_session->members();
229 
230  // if we can't send offline, make sure we have a reachable contact...
231  if ( !( m_session->protocol()->capabilities() & Kopete::Protocol::CanSendOffline ) )
232  {
233  bool reachableContactFound = false;
234 
235  //TODO: does this perform badly in large / busy IRC channels? - no, doesn't seem to
236  for( int i = 0; i != members.size(); ++i )
237  {
238  if ( members[i]->isReachable() )
239  {
240  reachableContactFound = true;
241  break;
242  }
243  }
244 
245  // no online contact found and can't send offline? can't send.
246  if ( !reachableContactFound )
247  return false;
248  }
249 
250  return true;
251 }
252 
253 void ChatTextEditPart::slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &newStatus, const Kopete::OnlineStatus &oldStatus )
254 {
255  //FIXME: should use signal contact->isReachableChanged, but it doesn't exist ;(
256  if ( ( oldStatus.status() == Kopete::OnlineStatus::Offline )
257  != ( newStatus.status() == Kopete::OnlineStatus::Offline ) )
258  {
259  emit canSendChanged( canSend() );
260  }
261 }
262 
263 void ChatTextEditPart::sendMessage()
264 {
265  QString txt = this->text( Qt::PlainText );
266  // avoid sending emtpy messages or enter keys (see bug 100334)
267  if ( txt.isEmpty() || txt == "\n" )
268  return;
269 
270  if ( m_lastMatch.isNull() && ( txt.indexOf( QRegExp( QLatin1String("^\\w+:\\s") ) ) > -1 ) )
271  { //no last match and it finds something of the form of "word:" at the start of a line
272  QString search = txt.left( txt.indexOf(':') );
273  if( !search.isEmpty() )
274  {
275  QString match = mComplete->makeCompletion( search );
276  if( !match.isNull() )
277  textEdit()->setText( txt.replace(0,search.length(),match) );
278  }
279  }
280 
281  if ( !m_lastMatch.isNull() )
282  {
283  //FIXME: what is the next line for?
284  mComplete->addItem( m_lastMatch );
285  m_lastMatch.clear();
286  }
287 
288  slotStoppedTypingTimer();
289  Kopete::Message sentMessage = contents();
290  emit messageSent( sentMessage );
291  historyList.prepend( this->text( Qt::AutoText) );
292  historyPos = -1;
293  textEdit()->moveCursor(QTextCursor::End);
294  textEdit()->clear();
295  emit canSendChanged( false );
296 }
297 
298 bool ChatTextEditPart::isTyping()
299 {
300  QString txt = text( Qt::PlainText );
301 
302  //Make sure the message is empty. QString::isEmpty()
303  //returns false if a message contains just whitespace
304  //which is the reason why we strip the whitespace
305  return !txt.trimmed().isEmpty();
306 }
307 
308 void ChatTextEditPart::slotTextChanged()
309 {
310  if ( isTyping() )
311  {
312  // And they were previously typing
313  if( !m_typingRepeatTimer->isActive() )
314  {
315  m_typingRepeatTimer->setSingleShot( false );
316  m_typingRepeatTimer->start( 4000 );
317  slotRepeatTypingTimer();
318  }
319 
320  // Reset the stop timer again, regardless of status
321  m_typingStopTimer->setSingleShot( true );
322  m_typingStopTimer->start( 4500 );
323  }
324 
325  emit canSendChanged( canSend() );
326 }
327 
328 void ChatTextEditPart::historyUp()
329 {
330  if ( historyList.empty() || historyPos == historyList.count() - 1 )
331  return;
332 
333  QString text = this->text(Qt::PlainText);
334  bool empty = text.trimmed().isEmpty();
335 
336  // got text? save it
337  if ( !empty )
338  {
339  text = this->text(Qt::AutoText);
340  if ( historyPos == -1 )
341  {
342  historyList.prepend( text );
343  historyPos = 0;
344  }
345  else
346  {
347  historyList[historyPos] = text;
348  }
349  }
350 
351  historyPos++;
352 
353  QString newText = historyList[historyPos];
354  textEdit()->setTextOrHtml( newText );
355  textEdit()->moveCursor( QTextCursor::End );
356 }
357 
358 void ChatTextEditPart::historyDown()
359 {
360  if ( historyList.empty() || historyPos == -1 )
361  return;
362 
363  QString text = this->text(Qt::PlainText);
364  bool empty = text.trimmed().isEmpty();
365 
366  // got text? save it
367  if ( !empty )
368  {
369  text = this->text(Qt::AutoText);
370  historyList[historyPos] = text;
371  }
372 
373  historyPos--;
374 
375  QString newText = ( historyPos >= 0 ? historyList[historyPos] : QString() );
376 
377 
378  textEdit()->setTextOrHtml( newText );
379  textEdit()->moveCursor( QTextCursor::End );
380 }
381 
382 void ChatTextEditPart::addText( const QString &text )
383 {
384  if( Qt::mightBeRichText(text) )
385  {
386  if ( textEdit()->isRichTextEnabled() )
387  {
388  textEdit()->insertHtml( text );
389  }
390  else
391  {
392  QTextDocument doc;
393  doc.setHtml( text );
394  textEdit()->insertPlainText( doc.toPlainText() );
395  }
396  }
397  else
398  {
399  textEdit()->insertPlainText( text );
400  }
401 }
402 
403 void ChatTextEditPart::setContents( const Kopete::Message &message )
404 {
405  if ( isRichTextEnabled() )
406  textEdit()->setHtml ( message.escapedBody() );
407  else
408  textEdit()->setPlainText ( message.plainBody() );
409  textEdit()->moveCursor ( QTextCursor::End );
410 }
411 
412 Kopete::Message ChatTextEditPart::contents()
413 {
414  Kopete::Message currentMsg( m_session->myself(), m_session->members() );
415  currentMsg.setDirection( Kopete::Message::Outbound );
416 
417  if (isRichTextEnabled())
418  {
419  currentMsg.setHtmlBody(text());
420 
421  Kopete::Protocol::Capabilities protocolCaps = m_session->protocol()->capabilities();
422 
423  // I hate base *only* support, *waves fist at MSN*
424  if (protocolCaps & Kopete::Protocol::BaseFormatting)
425  {
426  currentMsg.setFont(textEdit()->currentRichFormat().font());
427  }
428 
429  if (protocolCaps & Kopete::Protocol::BaseFgColor)
430  {
431  currentMsg.setForegroundColor(textEdit()->currentRichFormat().foreground().color());
432  }
433 
434  if (protocolCaps & Kopete::Protocol::BaseBgColor)
435  {
436  currentMsg.setBackgroundColor(textEdit()->currentRichFormat().background().color());
437  }
438  }
439  else
440  {
441  currentMsg.setPlainBody(text());
442  }
443 
444  return currentMsg;
445 }
446 
447 void ChatTextEditPart::slotRepeatTypingTimer()
448 {
449  emit typing( true );
450 }
451 
452 void ChatTextEditPart::slotStoppedTypingTimer()
453 {
454  m_typingRepeatTimer->stop();
455  m_typingStopTimer->stop();
456  emit typing( false );
457 }
458 
459 void ChatTextEditPart::slotAppearanceChanged()
460 {
461  Kopete::AppearanceSettings *settings = Kopete::AppearanceSettings::self();
462 
463  QFont font = ( settings->chatFontSelection() == 1 ) ? settings->chatFont() : KGlobalSettings::generalFont();
464  QTextCharFormat format;
465  format.setFont(font);
466  format.setBackground(settings->chatBackgroundColor());
467  format.setForeground(settings->chatTextColor());
468 
469  editor->setDefaultPlainCharFormat(format);
470  editor->setDefaultRichCharFormat(format);
471  QString styleSheet = QLatin1String("QTextEdit { color: %1; }");
472  editor->setStyleSheet(styleSheet.arg(settings->chatTextColor().name()));
473 }
474 
475 void ChatTextEditPart::slotRichTextSupportChanged()
476 {
477  KXMLGUIFactory * f = factory();
478  if (f)
479  {
480  f->removeClient(this);
481  f->addClient(this);
482  }
483 }
484 
485 KopeteRichTextWidget *ChatTextEditPart::textEdit()
486 {
487  return editor;
488 }
489 
490 void ChatTextEditPart::setCheckSpellingEnabled( bool enabled )
491 {
492  editor->setCheckSpellingEnabled( enabled );
493 }
494 
495 bool ChatTextEditPart::checkSpellingEnabled() const
496 {
497  return editor->checkSpellingEnabled();
498 }
499 
500 void ChatTextEditPart::checkToolbarEnabled()
501 {
502  emit toolbarToggled( isRichTextEnabled() );
503 }
504 
505 KAboutData *ChatTextEditPart::createAboutData()
506 {
507  KAboutData *aboutData = new KAboutData("krichtexteditpart", 0, ki18n("Chat Text Edit Part"), "0.1",
508  ki18n("A simple rich text editor part"),
509  KAboutData::License_LGPL );
510  aboutData->addAuthor(ki18n("Richard J. Moore"), KLocalizedString(), "rich@kde.org", "http://xmelegance.org/" );
511  aboutData->addAuthor(ki18n("Jason Keirstead"), KLocalizedString(), "jason@keirstead.org", "http://www.keirstead.org/" );
512  aboutData->addAuthor(ki18n("MichaĆ«l Larouche"), KLocalizedString(), "larouche@kde.org" "http://www.tehbisnatch.org/" );
513  aboutData->addAuthor(ki18n("Benson Tsai"), KLocalizedString(), "btsai@vrwarp.com" "http://www.vrwarp.com/" );
514 
515  return aboutData;
516 }
517 
518 void ChatTextEditPart::readConfig( KConfigGroup& config )
519 {
520  kDebug() << "Loading config";
521 
522  QTextCharFormat format = editor->defaultRichFormat();
523 
524  QFont font = config.readEntry( "TextFont", format.font() );
525  QColor fg = config.readEntry( "TextFgColor", format.foreground().color() );
526  QColor bg = config.readEntry( "TextBgColor", format.background().color() );
527 
528  QTextCharFormat desiredFormat = editor->currentRichFormat();
529  desiredFormat.setFont(font);
530  desiredFormat.setForeground(fg);
531  desiredFormat.setBackground(bg);
532  editor->setCurrentRichCharFormat(desiredFormat);
533 
534  textEdit()->setAlignment(static_cast<Qt::AlignmentFlag>(config.readEntry( "EditAlignment", int(Qt::AlignLeft) )));
535 }
536 
537 void ChatTextEditPart::writeConfig( KConfigGroup& config )
538 {
539  kDebug() << "Saving config";
540 
541  config.writeEntry( "TextFont", editor->currentRichFormat().font() );
542  config.writeEntry( "TextFgColor", editor->currentRichFormat().foreground().color() );
543  config.writeEntry( "TextBgColor", editor->currentRichFormat().background().color() );
544  config.writeEntry( "EditAlignment", int(editor->alignment()) );
545 }
546 
547 void ChatTextEditPart::resetConfig( KConfigGroup& config )
548 {
549  kDebug() << "Setting default font style";
550 
551  editor->slotResetFontAndColor();
552 
553  //action_align_left->trigger();
554 
555  config.deleteEntry( "TextFont" );
556  config.deleteEntry( "TextFg" );
557  config.deleteEntry( "TextBg" );
558  config.deleteEntry( "EditAlignment" );
559 }
560 
561 QString ChatTextEditPart::text( Qt::TextFormat format ) const
562 {
563  if( (format == Qt::RichText || format == Qt::AutoText) && isRichTextEnabled() )
564  return editor->toHtml();
565  else
566  return editor->toPlainText();
567 }
568 
569 bool ChatTextEditPart::isRichTextEnabled() const
570 {
571  return editor->isRichTextEnabled();
572 }
573 
574 #include "chattexteditpart.moc"
575 
576 // vim: set noet ts=4 sts=4 sw=4:
QTextCursor::position
int position() const
ChatTextEditPart::complete
void complete()
Try to complete the word under the cursor.
Definition: chattexteditpart.cpp:131
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
KopeteRichTextWidget::setDefaultRichCharFormat
void setDefaultRichCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:520
QWidget
ChatTextEditPart::historyUp
void historyUp()
Go up an entry in the message history.
Definition: chattexteditpart.cpp:328
QTextCursor
QTextBlock::position
int position() const
ChatTextEditPart::isRichTextEnabled
bool isRichTextEnabled() const
Is rich text is currently enabled.
Definition: chattexteditpart.cpp:569
ChatTextEditPart::ChatTextEditPart
ChatTextEditPart(Kopete::ChatSession *session, QWidget *parent)
Definition: chattexteditpart.cpp:59
ChatTextEditPart::canSend
bool canSend()
Can we send messages now?
Definition: chattexteditpart.cpp:220
ChatTextEditPart::resetConfig
void resetConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:547
ChatTextEditPart::messageSent
void messageSent(Kopete::Message &message)
Emitted when a message is sent.
QFont
QTextFormat::foreground
QBrush foreground() const
QTextCharFormat::font
QFont font() const
ChatTextEditPart::checkToolbarEnabled
void checkToolbarEnabled()
Definition: chattexteditpart.cpp:500
ChatTextEditPart::readConfig
void readConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:518
QList::size
int size() const
QString::lastIndexOf
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QString::isNull
bool isNull() const
QString::clear
void clear()
QTextFormat::background
QBrush background() const
QBrush::color
const QColor & color() const
QTextFormat::setForeground
void setForeground(const QBrush &brush)
ChatTextEditPart::typing
void typing(bool typing)
Emitted every 4 seconds while the user is typing.
QRegExp
chattexteditpart.h
kopetechatwindowsettings.h
QList::count
int count(const T &value) const
ChatTextEditPart::~ChatTextEditPart
~ChatTextEditPart()
Definition: chattexteditpart.cpp:126
QList::empty
bool empty() const
QTimer
ChatTextEditPart::addText
void addText(const QString &text)
Adds text into the edit area.
Definition: chattexteditpart.cpp:382
QObject
QTextCursor::insertText
void insertText(const QString &text)
QObject::setObjectName
void setObjectName(const QString &name)
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
ChatTextEditPart::historyDown
void historyDown()
Go down an entry in the message history.
Definition: chattexteditpart.cpp:358
QTextFormat::setBackground
void setBackground(const QBrush &brush)
KopeteRichTextWidget
A KopeteRichTextWidget with overridden behaviors.
Definition: kopeterichtextwidget.h:44
ChatTextEditPart::isTyping
bool isTyping()
Is the user typing right now?
Definition: chattexteditpart.cpp:298
KopeteRichTextWidget::currentRichFormat
QTextCharFormat currentRichFormat() const
Definition: kopeterichtextwidget.cpp:564
ChatTextEditPart
An instant message composition part.
Definition: chattexteditpart.h:61
KopeteRichTextWidget::setCurrentRichCharFormat
void setCurrentRichCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:529
ChatTextEditPart::canSendChanged
void canSendChanged(bool canSend)
Our send-button-enabled flag might have changed.
ChatTextEditPart::toolbarToggled
void toolbarToggled(bool enabled)
QString
QList
QColor
ChatTextEditPart::setCheckSpellingEnabled
void setCheckSpellingEnabled(bool enabled)
Enable or Disable the automatic spell checking.
Definition: chattexteditpart.cpp:490
QStringList
QTextCharFormat
QTextCursor::block
QTextBlock block() const
ChatTextEditPart::sendMessage
void sendMessage()
Sends the text currently entered into the edit area.
Definition: chattexteditpart.cpp:263
QSize
QTextCharFormat::setFont
void setFont(const QFont &font)
QTimer::stop
void stop()
QTextBlock::text
QString text() const
QString::replace
QString & replace(int position, int n, QChar after)
ChatTextEditPart::createAboutData
static KAboutData * createAboutData()
Definition: chattexteditpart.cpp:505
QTextDocument::toPlainText
QString toPlainText() const
ChatTextEditPartFactory
KParts::GenericFactory< ChatTextEditPart > ChatTextEditPartFactory
Definition: chattexteditpart.cpp:56
KopeteRichTextWidget::setTextOrHtml
void setTextOrHtml(const QString &text)
Definition: kopeterichtextwidget.cpp:118
QString::mid
QString mid(int position, int n) const
QTextCursor::blockNumber
int blockNumber() const
ChatTextEditPart::contents
Kopete::Message contents()
Returns the message currently in the edit area.
Definition: chattexteditpart.cpp:412
QLatin1String
QTextBlock
QTextDocument
ChatTextEditPart::writeConfig
void writeConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:537
KopeteRichTextWidget::isRichTextEnabled
bool isRichTextEnabled() const
Definition: kopeterichtextwidget.cpp:569
QString::length
int length() const
Qt::mightBeRichText
bool mightBeRichText(const QString &text)
QTextDocument::setHtml
void setHtml(const QString &html)
QString::left
QString left(int n) const
QTimer::start
void start(int msec)
QList::prepend
void prepend(const T &value)
KopeteRichTextWidget::slotResetFontAndColor
void slotResetFontAndColor()
Definition: kopeterichtextwidget.cpp:249
ChatTextEditPart::checkSpellingEnabled
bool checkSpellingEnabled() const
Get the state of auto spell checking.
Definition: chattexteditpart.cpp:495
ChatTextEditPart::setContents
void setContents(const Kopete::Message &message)
Sets the message in the edit field.
Definition: chattexteditpart.cpp:403
QTimer::isActive
bool isActive() const
KopeteRichTextWidget::setDefaultPlainCharFormat
void setDefaultPlainCharFormat(const QTextCharFormat &format)
Definition: kopeterichtextwidget.cpp:499
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
ChatTextEditPart::text
QString text(Qt::TextFormat format=Qt::AutoText) const
Get the text in the editor in the given format.
Definition: chattexteditpart.cpp:561
KopeteRichTextWidget::defaultRichFormat
QTextCharFormat defaultRichFormat() const
Definition: kopeterichtextwidget.cpp:559
ChatTextEditPart::textEdit
KopeteRichTextWidget * textEdit()
Get the inside KTextEdit.
Definition: chattexteditpart.cpp:485
QTimer::setSingleShot
void setSingleShot(bool singleShot)
QTextBlock::length
int length() const
QTextCursor::setPosition
void setPosition(int pos, MoveMode m)
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