• 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
chatview.cpp
Go to the documentation of this file.
1 /*
2  chatview.cpp - Chat View
3 
4  Copyright (c) 2008 by Benson Tsai <btsai@vrwarp.com>
5  Copyright (c) 2002-2004 by Olivier Goffart <ogoffart@kde.org>
6  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
7  Copyright (c) 2008 by Benson Tsai <btsai@vrwarp.com>
8 
9  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
10 
11  *************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  *************************************************************************
19 */
20 
21 #include "chatview.h"
22 
23 #include "chatmessagepart.h"
24 #include "chattexteditpart.h"
25 #include "kopetechatwindow.h"
26 #include "kopetechatsession.h"
27 #include "kopetemetacontact.h"
28 #include "kopetepluginmanager.h"
29 #include "kopeteprotocol.h"
30 #include "kopeteaccount.h"
31 #include "kopeteglobal.h"
32 #include "kopetecontactlist.h"
33 #include "kopeteviewmanager.h"
34 #include "kopetebehaviorsettings.h"
35 #include "kopetechatwindowstylemanager.h"
36 
37 #include <kconfig.h>
38 #include <ktabwidget.h>
39 #include <kdebug.h>
40 #include <klocale.h>
41 #include <kmessagebox.h>
42 #include <kmenu.h>
43 #include <kstringhandler.h>
44 #include <kwindowsystem.h>
45 #include <kglobalsettings.h>
46 #include <kgenericfactory.h>
47 #include <khtmlview.h>
48 #include <kxmlguifactory.h>
49 
50 #include <QTimer>
51 #include <QSplitter>
52 #include <Q3UriDrag>
53 #include <QScrollBar>
54 
55 K_PLUGIN_FACTORY( ChatWindowPluginFactory, registerPlugin<ChatWindowPlugin>(); )
56 K_EXPORT_PLUGIN( ChatWindowPluginFactory( "kopete_chatwindow" ) )
57 
58 ChatWindowPlugin::ChatWindowPlugin(QObject *parent, const QVariantList &) :
59  Kopete::ViewPlugin( ChatWindowPluginFactory::componentData(), parent )
60 {
61  // Load styles to make style fallback work
62  ChatWindowStyleManager::self();
63 }
64 
65 KopeteView* ChatWindowPlugin::createView( Kopete::ChatSession *manager )
66 {
67  return new ChatView(manager,this);
68 }
69 
70 class KopeteChatViewPrivate
71 {
72 public:
73  QString captionText;
74  QString statusText;
75  bool isActive;
76  bool sendInProgress;
77  bool visibleMembers;
78  bool warnGroupChat;
79  QSplitter * splitter;
80 };
81 
82 ChatView::ChatView( Kopete::ChatSession *mgr, ChatWindowPlugin *parent )
83  : KVBox( 0l ), KopeteView( mgr, parent )
84  , d(new KopeteChatViewPrivate)
85 {
86  d->isActive = false;
87  d->visibleMembers = false;
88  d->sendInProgress = false;
89 
90  KVBox *vbox=this;
91 
92  m_mainWindow = 0L;
93  m_tabState = Normal;
94 
95  d->warnGroupChat = mgr->warnGroupChat();
96 
97  //FIXME: don't widgets start off hidden anyway?
98  hide();
99 
100  d->splitter = new QSplitter( Qt::Vertical, vbox );
101 
102  //Create the view dock widget (KHTML Part), and set it to no docking (lock it in place)
103  m_messagePart = new ChatMessagePart( mgr , this );
104 
105  //Create the bottom dock widget, with the edit area, statusbar and send button
106  m_editPart = new ChatTextEditPart( mgr, vbox );
107 
108  d->splitter->addWidget(m_messagePart->view());
109  d->splitter->addWidget(m_editPart->widget());
110  d->splitter->setChildrenCollapsible( false );
111  QList<int> sizes;
112  sizes << 240 << 40;
113  d->splitter->setSizes( sizes );
114 
115  // FIXME: is this used these days? it seems totally unnecessary
116  connect( editPart(), SIGNAL(toolbarToggled(bool)), this, SLOT(slotToggleRtfToolbar(bool)) );
117 
118  connect( editPart(), SIGNAL(messageSent(Kopete::Message&)),
119  this, SIGNAL(messageSent(Kopete::Message&)) );
120  connect( editPart(), SIGNAL(canSendChanged(bool)),
121  this, SIGNAL(canSendChanged(bool)) );
122  connect( editPart(), SIGNAL(typing(bool)),
123  mgr, SLOT(typing(bool)) );
124  connect( editPart()->textEdit(), SIGNAL(documentSizeUpdated(int)),
125  this, SLOT(slotRecalculateSize(int)) );
126 
127  //Set the view as the main widget
128 // setView(viewDock);
129 
130  //It is possible to drag and drop on this widget.
131  // I had to disable the acceptDrop in the khtml widget to be able to intercept theses events.
132  setAcceptDrops(true);
133 // viewDock->setAcceptDrops(false);
134 
135  //Manager signals
136  connect( mgr, SIGNAL(displayNameChanged()),
137  this, SLOT(slotChatDisplayNameChanged()) );
138  connect( mgr, SIGNAL(statusMessageChanged(Kopete::Contact*)),
139  this, SLOT(slotStatusMessageChanged( Kopete::Contact*)));
140  connect( mgr, SIGNAL(contactAdded(const Kopete::Contact*,bool)),
141  this, SLOT(slotContactAdded(const Kopete::Contact*,bool)) );
142  connect( mgr, SIGNAL(contactRemoved(const Kopete::Contact*,QString,Qt::TextFormat,bool)),
143  this, SLOT(slotContactRemoved(const Kopete::Contact*,QString,Qt::TextFormat,bool)) );
144  connect( mgr, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
145  this, SLOT(slotContactStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
146  connect( mgr, SIGNAL(remoteTyping(const Kopete::Contact*,bool)),
147  this, SLOT(remoteTyping(const Kopete::Contact*,bool)) );
148  connect( mgr, SIGNAL(eventNotification(QString)),
149  this, SLOT(setStatusText(QString)) );
150 
151  //Connections to the manager and the ViewManager that every view should have
152  connect( this, SIGNAL(closing(KopeteView*)),
153  KopeteViewManager::viewManager(), SLOT(slotViewDestroyed(KopeteView*)) );
154  connect( this, SIGNAL(activated(KopeteView*)),
155  KopeteViewManager::viewManager(), SLOT(slotViewActivated(KopeteView*)) );
156  connect( this, SIGNAL(messageSent(Kopete::Message&)),
157  mgr, SLOT(sendMessage(Kopete::Message&)) );
158  connect( mgr, SIGNAL(messageSuccess()),
159  this, SLOT(messageSentSuccessfully()));
160 
161  // add contacts
162  slotContactAdded( mgr->myself(), true );
163  for ( int i = 0; i != mgr->members().size(); ++i )
164  {
165  slotContactAdded( mgr->members()[i], true );
166  }
167 
168  setFocusProxy( editPart()->widget() );
169  m_messagePart->view()->setFocusProxy( editPart()->widget() );
170  editPart()->widget()->setFocus();
171 
172  slotChatDisplayNameChanged();
173 
174  // restore docking positions
175  readOptions();
176 }
177 
178 ChatView::~ChatView()
179 {
180  emit( closing( static_cast<KopeteView*>(this) ) );
181 
182  saveOptions();
183 
184  delete d;
185 }
186 
187 KTextEdit *ChatView::editWidget()
188 {
189  return editPart()->textEdit();
190 }
191 
192 QWidget *ChatView::mainWidget()
193 {
194  return this;
195 }
196 
197 bool ChatView::canSend() const
198 {
199  return editPart()->canSend();
200 }
201 
202 bool ChatView::canSendFile() const
203 {
204  Kopete::ContactPtrList contacts = msgManager()->members();
205  if ( contacts.count() != 1 )
206  return false;
207 
208  return contacts.first()->canAcceptFiles();
209 }
210 
211 Kopete::Message ChatView::currentMessage()
212 {
213  return editPart()->contents();
214 }
215 
216 void ChatView::setCurrentMessage( const Kopete::Message &message )
217 {
218  editPart()->setContents( message );
219 }
220 
221 void ChatView::cut()
222 {
223  editPart()->textEdit()->cut();
224 }
225 
226 void ChatView::copy()
227 {
228  if ( messagePart()->hasSelection() )
229  messagePart()->copy();
230  else
231  editPart()->textEdit()->copy();
232 }
233 
234 void ChatView::paste()
235 {
236  editPart()->textEdit()->paste();
237 }
238 
239 void ChatView::nickComplete()
240 {
241  return editPart()->complete();
242 }
243 
244 void ChatView::addText( const QString &text )
245 {
246  editPart()->addText( text );
247 }
248 
249 void ChatView::clear()
250 {
251  int response = KMessageBox::Continue;
252 
253  if ( !unreadMessageFrom.isNull() )
254  {
255  response = KMessageBox::warningContinueCancel( this, i18n("<qt>You have received a message from <b>%1</b> in the last "
256  "second. Are you sure you want to clear this chat?</qt>", unreadMessageFrom ), i18n( "Unread Message" ),
257  KGuiItem( i18nc( "@action:button", "Clear Chat" ) ), KStandardGuiItem::cancel(), QLatin1String("AskClearChatRecentMessage" ) );
258  }
259 
260  if ( response == KMessageBox::Continue )
261  messagePart()->clear();
262 }
263 
264 void ChatView::resetFontAndColor()
265 {
266  Kopete::ContactPtrList contacts = msgManager()->members();
267  if ( contacts.count() != 1 )
268  return;
269 
270  Kopete::MetaContact* mc = contacts.first()->metaContact();
271  if ( !mc )
272  return;
273 
274  QString contactListGroup = QString(QLatin1String("chatwindow_") + QString(mc->metaContactId()));
275  KConfigGroup config = KGlobal::config()->group(contactListGroup);
276  editPart()->resetConfig( config );
277  config.sync();
278 }
279 
280 void ChatView::raise( bool activate )
281 {
282  // this shouldn't change the focus. When the window is raised when a new message arrives
283  // if i am coding, or talking to someone else, i want to end my sentence before switching to
284  // the other chat. i just want to KNOW and SEE the other chat to switch to it later
285  // (except if activate==true)
286 
287  if ( !m_mainWindow || !m_mainWindow->isActiveWindow() || activate )
288  makeVisible();
289 #ifdef Q_WS_X11
290  if (!KWindowSystem::windowInfo(m_mainWindow->winId(), NET::WMDesktop).onAllDesktops())
291  {
292  if (Kopete::BehaviorSettings::self()->trayflashNotifySetCurrentDesktopToChatView() && activate)
293  KWindowSystem::setCurrentDesktop(KWindowSystem::windowInfo(m_mainWindow->winId(), NET::WMDesktop).desktop());
294  else
295  KWindowSystem::setOnDesktop(m_mainWindow->winId(), KWindowSystem::currentDesktop());
296  }
297 #endif
298  if(m_mainWindow->isMinimized())
299  {
300  KWindowSystem::unminimizeWindow( m_mainWindow->winId());
301  }
302 
303 
304  m_mainWindow->raise();
305 
306  //Will not activate window if user was typing
307  if ( activate )
308  KWindowSystem::forceActiveWindow( m_mainWindow->winId() );
309 
310 }
311 
312 void ChatView::makeVisible()
313 {
314  if ( !m_mainWindow )
315  {
316  m_mainWindow = KopeteChatWindow::window( m_manager );
317  m_mainWindow->setObjectName( QLatin1String("KopeteChatWindow") );
318 // if ( root )
319 // root->repaint( true );
320  emit windowCreated();
321  }
322 
323  if ( !m_mainWindow->isVisible() )
324  {
325  m_mainWindow->show();
326  // scroll down post show and layout, otherwise the geometry is wrong to scroll to the bottom.
327  m_messagePart->keepScrolledDown();
328  }
329 
330 
331 
332  m_mainWindow->setActiveView( this );
333 }
334 
335 bool ChatView::isVisible()
336 {
337  return ( m_mainWindow && m_mainWindow->isVisible() );
338 }
339 
340 bool ChatView::sendInProgress() const
341 {
342  return d->sendInProgress;
343 }
344 
345 bool ChatView::closeView( bool force )
346 {
347  int response = KMessageBox::Continue;
348 
349  if ( !force )
350  {
351  if ( m_manager->members().count() > 1 && ! d->warnGroupChat )
352  {
353  QString shortCaption = d->captionText;
354  shortCaption = KStringHandler::rsqueeze( shortCaption );
355 
356  response = KMessageBox::warningContinueCancel( this, i18n("<qt>You are about to leave the groupchat session <b>%1</b>.<br />"
357  "You will not receive future messages from this conversation.</qt>", shortCaption ), i18n( "Closing Group Chat" ),
358  KGuiItem( i18nc( "@action:button", "Close Chat" ) ), KStandardGuiItem::cancel(), QLatin1String( "AskCloseGroupChat" ) );
359  }
360 
361  if ( !unreadMessageFrom.isNull() && ( response == KMessageBox::Continue ) )
362  {
363  response = KMessageBox::warningContinueCancel( this, i18n("<qt>You have received a message from <b>%1</b> in the last "
364  "second. Are you sure you want to close this chat?</qt>", unreadMessageFrom ), i18n( "Unread Message" ),
365  KGuiItem( i18nc( "@action:button", "Close Chat" ) ), KStandardGuiItem::cancel(), QLatin1String("AskCloseChatRecentMessage" ) );
366  }
367 
368  if ( d->sendInProgress && ( response == KMessageBox::Continue ) )
369  {
370  response = KMessageBox::warningContinueCancel( this, i18n( "You have a message send in progress, which will be "
371  "aborted if this chat is closed. Are you sure you want to close this chat?" ), i18n( "Message in Transit" ),
372  KGuiItem( i18nc( "@action:button", "Close Chat" ) ), KStandardGuiItem::cancel(), QLatin1String( "AskCloseChatMessageInProgress" ) );
373  }
374  }
375 
376  if( response == KMessageBox::Continue )
377  {
378  // Remove the widget from the window it's attached to
379  // and schedule it for deletion
380  if( m_mainWindow )
381  m_mainWindow->detachChatView( this );
382  deleteLater();
383 
384  return true;
385  }
386 
387  return false;
388 }
389 
390 ChatView::KopeteTabState ChatView::tabState() const
391 {
392  return m_tabState;
393 }
394 
395 void ChatView::updateChatState( KopeteTabState newState )
396 {
397  if ( newState == Undefined )
398  newState = m_tabState;
399  else if ( newState != Typing && ( newState != Changed || ( m_tabState != Message && m_tabState != Highlighted ) )
400  && ( newState != Message || m_tabState != Highlighted ) )
401  { //if the new state is not a typing state and we don't already have a message or a highlighted message
402  //change the tab state
403  m_tabState = newState;
404  }
405 
406  newState = m_remoteTypingMap.isEmpty() ? m_tabState : Typing ;
407 
408  emit updateChatState( this, newState );
409 
410  if( newState != Typing )
411  {
412  setStatusText( i18np( "One other person in the chat",
413  "%1 other people in the chat", m_manager->members().count() ) );
414  }
415 }
416 
417 void ChatView::setMainWindow( KopeteChatWindow* parent )
418 {
419  if (m_mainWindow)
420  {
421  m_mainWindow->guiFactory()->removeClient(editPart());
422  }
423 
424  m_mainWindow = parent;
425 
426  if (m_mainWindow)
427  {
428  m_mainWindow->guiFactory()->addClient(editPart());
429  }
430 }
431 
432 void ChatView::remoteTyping( const Kopete::Contact *contact, bool isTyping )
433 {
434  TypingMap::iterator it = m_remoteTypingMap.find(contact);
435  if (it != m_remoteTypingMap.end())
436  {
437  if (it.value()->isActive())
438  it.value()->stop();
439  delete it.value();
440  m_remoteTypingMap.erase(it);
441  }
442  if( isTyping )
443  {
444  m_remoteTypingMap.insert( contact, new QTimer(this) );
445  connect( m_remoteTypingMap[ contact ], SIGNAL(timeout()), SLOT(slotRemoteTypingTimeout()) );
446 
447  m_remoteTypingMap[ contact ]->setSingleShot( true );
448  m_remoteTypingMap[ contact ]->start( 6000 );
449  }
450 
451  // Loop through the map, constructing a string of people typing
452  QStringList typingList;
453 
454  for( it = m_remoteTypingMap.begin(); it != m_remoteTypingMap.end(); ++it )
455  {
456  const Kopete::Contact *c = it.key();
457  typingList.append( m_messagePart->formatName(c, Qt::PlainText) );
458  }
459 
460  // Update the status area
461  if( !typingList.isEmpty() )
462  {
463  if ( typingList.count() == 1 )
464  setStatusText( i18n( "%1 is typing a message", typingList.first() ) );
465  else
466  {
467  QString statusTyping = typingList.join( QLatin1String( ", " ) );
468  setStatusText( i18nc( "%1 is a list of names", "%1 are typing a message", statusTyping ) );
469  }
470  updateChatState( Typing );
471  }
472  else
473  {
474  updateChatState();
475  }
476 }
477 
478 void ChatView::setStatusText( const QString &status )
479 {
480  d->statusText = status;
481  if ( d->isActive )
482  m_mainWindow->setStatus( status );
483 }
484 
485 void ChatView::slotRecalculateSize(int difference)
486 {
487  // Firstly, save the scrollbar state
488  QScrollBar *messageAreaScrollBar = messagePart()->view()->verticalScrollBar();
489  bool isScrolledDown = messageAreaScrollBar->value() == messageAreaScrollBar->maximum();
490 
491  // Apply sizes changing to splitter
492  QList<int> sizes = d->splitter->sizes();
493  sizes.first() -= difference;
494  sizes.last() += difference;
495  d->splitter->setSizes(sizes);
496 
497  // Restore scrollbar state
498  if (isScrolledDown) {
499  messagePart()->keepScrolledDown();
500  }
501 }
502 
503 const QString& ChatView::statusText()
504 {
505  return d->statusText;
506 }
507 
508 void ChatView::slotChatDisplayNameChanged()
509 {
510  // This fires whenever a contact or MC changes displayName, so only
511  // update the caption if it changed to avoid unneeded updates that
512  // could cause flickering
513  QString chatName = m_manager->displayName();
514 
515  foreach (const Kopete::Contact *c, msgManager()->members())
516  {
517  QString contactName = m_messagePart->formatName(c, Qt::PlainText);
518  if ( c->metaContact() )
519  {
520  chatName.replace( c->metaContact()->displayName(), contactName );
521  }
522  else
523  {
524  chatName.replace( c->displayName(), contactName );
525  }
526  }
527 
528 
529  if ( chatName != d->captionText )
530  setCaption( chatName, true );
531 }
532 
533 void ChatView::slotDisplayNameChanged( const QString &oldValue, const QString &newValue )
534 {
535  if( Kopete::BehaviorSettings::self()->showEvents() )
536  {
537  if( oldValue != newValue )
538  sendInternalMessage( i18n( "%1 is now known as %2", oldValue, newValue ) );
539  }
540 }
541 
542 void ChatView::slotStatusMessageChanged( Kopete::Contact* contact )
543 {
544  if ( contact == m_manager->myself() )
545  return;
546  const QString contactName = m_messagePart->formatName(contact, Qt::PlainText);
547  const QString statusTitle = contact->statusMessage().title();
548  const QString statusMessage = contact->statusMessage().message();
549  QString msg;
550  if ( statusTitle.isEmpty() && statusMessage.isEmpty() )
551  msg = i18nc( "%1 is a contact's name", "%1 deleted status message", contactName );
552  else
553  {
554  if ( statusTitle.isEmpty() )
555  msg = statusMessage;
556  else if ( statusMessage.isEmpty() )
557  msg = statusTitle;
558  else
559  msg = statusTitle + " - " + statusMessage;
560  msg = i18nc( "%1 is a contact's name", "%1 changed status message: %2", contactName, msg );
561  }
562 
563  sendInternalMessage( msg );
564 }
565 
566 void ChatView::slotContactAdded(const Kopete::Contact *contact, bool suppress)
567 {
568  if( contact->metaContact() && contact->metaContact() != Kopete::ContactList::self()->myself() )
569  {
570  connect( contact->metaContact(), SIGNAL(displayNameChanged(QString,QString)),
571  this, SLOT(slotDisplayNameChanged(QString,QString)) );
572  }
573  else
574  {
575  connect( contact, SIGNAL(displayNameChanged(QString,QString)),
576  this, SLOT(slotDisplayNameChanged(QString,QString)) );
577  }
578 
579  const QString contactName = m_messagePart->formatName(contact, Qt::PlainText);
580  if( !suppress && Kopete::BehaviorSettings::self()->showEvents() && m_manager->members().count() > 1 )
581  sendInternalMessage( i18n("%1 has joined the chat.", contactName) );
582 
583  if ( m_manager->members().count() == 1 )
584  {
585  connect( m_manager->members().first(), SIGNAL(canAcceptFilesChanged()), this, SIGNAL(canAcceptFilesChanged()) );
586  updateChatState();
587  emit updateStatusIcon( this );
588  emit canAcceptFilesChanged();
589  }
590  else
591  disconnect( m_manager->members().first(), SIGNAL(canAcceptFilesChanged()), this, SIGNAL(canAcceptFilesChanged()) );
592 
593  const QString statusTitle = contact->statusMessage().title();
594  const QString statusMessage = contact->statusMessage().message();
595  if ( contact != m_manager->myself() && ( !statusTitle.isEmpty() || !statusMessage.isEmpty() ) )
596  {
597  QString msg;
598  if ( statusTitle.isEmpty() )
599  msg = statusMessage;
600  else if ( statusMessage.isEmpty() )
601  msg = statusTitle;
602  else
603  msg = statusTitle + " - " + statusMessage;
604  sendInternalMessage( i18n( "%1 status message is %2", contactName, msg ) );
605  }
606 }
607 
608 void ChatView::slotContactRemoved( const Kopete::Contact *contact, const QString &reason, Qt::TextFormat format, bool suppressNotification )
609 {
610 // kDebug(14000) ;
611  if ( contact != m_manager->myself() )
612  {
613  TypingMap::iterator it = m_remoteTypingMap.find( contact );
614  if ( it != m_remoteTypingMap.end() )
615  {
616  if ((*it)->isActive())
617  (*it)->stop();
618  delete (*it);
619  m_remoteTypingMap.remove( contact );
620  }
621 
622  // When the last person leaves, don't disconnect the signals, since we're in a one-to-one chat
623  if ( m_manager->members().count() > 0 )
624  {
625  if( contact->metaContact() )
626  {
627  disconnect( contact->metaContact(), SIGNAL(displayNameChanged(QString,QString)),
628  this, SLOT(slotDisplayNameChanged(QString,QString)) );
629  }
630  else
631  {
632  disconnect( contact, SIGNAL(displayNameChanged(QString,QString)),
633  this, SLOT(slotDisplayNameChanged(QString,QString)) );
634  }
635  }
636 
637  if ( !suppressNotification && Kopete::BehaviorSettings::self()->showEvents() )
638  {
639  QString contactName = m_messagePart->formatName(contact, Qt::PlainText);
640  if ( reason.isEmpty() )
641  sendInternalMessage( i18n( "%1 has left the chat.", contactName ), format ) ;
642  else
643  sendInternalMessage( i18n( "%1 has left the chat (%2).", contactName, reason ), format);
644  }
645 
646  disconnect( contact, SIGNAL(canAcceptFilesChanged()), this, SIGNAL(canAcceptFilesChanged()) );
647  }
648 
649  updateChatState();
650  emit updateStatusIcon( this );
651  emit canAcceptFilesChanged();
652 }
653 
654 QString& ChatView::caption() const
655 {
656  return d->captionText;
657 }
658 
659 void ChatView::setCaption( const QString &text, bool modified )
660 {
661 // kDebug(14000) ;
662  QString newCaption = text;
663 
664  //Save this caption
665  d->captionText = text;
666 
667  //Turncate if needed
668  newCaption = KStringHandler::rsqueeze( d->captionText, 20 );
669 
670  //Call the original set caption
671  QWidget::setWindowTitle( newCaption );
672 
673  emit updateChatTooltip( this, QString::fromLatin1("<qt>%1</qt>").arg( d->captionText ) );
674  emit updateChatLabel( this, newCaption );
675  //Blink icon if modified and not active
676  if( !d->isActive && modified )
677  updateChatState( Changed );
678  else
679  updateChatState();
680 
681  //Tell the parent we changed our caption
682  emit( captionChanged( d->isActive ) );
683 }
684 
685 void ChatView::appendMessage(Kopete::Message &message)
686 {
687  remoteTyping( message.from(), false );
688 
689  messagePart()->appendMessage(message);
690 
691  if( !d->isActive )
692  {
693  switch ( message.importance() )
694  {
695  case Kopete::Message::Highlight:
696  updateChatState( Highlighted );
697  break;
698  case Kopete::Message::Normal:
699  if ( message.direction() == Kopete::Message::Inbound )
700  {
701  updateChatState( Message );
702  break;
703  } // if it's an enternal message or a outgoing, fall thought
704  default:
705  updateChatState( Changed );
706  }
707  }
708 
709  if( message.direction() == Kopete::Message::Inbound )
710  {
711  unreadMessageFrom = m_messagePart->formatName ( message.from(), Qt::PlainText );
712  QTimer::singleShot( 1000, this, SLOT(slotMarkMessageRead()) );
713  }
714  else
715  unreadMessageFrom.clear();
716 }
717 
718 void ChatView::sendFile()
719 {
720  Kopete::ContactPtrList contacts = msgManager()->members();
721  if ( contacts.count() != 1 )
722  return;
723 
724  Kopete::Contact* contact = contacts.first();
725  if ( contact->canAcceptFiles() )
726  contact->sendFile();
727 }
728 
729 void ChatView::slotMarkMessageRead()
730 {
731  unreadMessageFrom.clear();
732 }
733 
734 void ChatView::slotToggleRtfToolbar( bool enabled )
735 {
736  emit rtfEnabled( this, enabled );
737 }
738 
739 void ChatView::slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &newStatus, const Kopete::OnlineStatus &oldStatus )
740 {
741  kDebug(14000) << contact;
742  bool inhibitNotification = ( newStatus.status() == Kopete::OnlineStatus::Unknown ||
743  oldStatus.status() == Kopete::OnlineStatus::Unknown );
744  if ( contact && Kopete::BehaviorSettings::self()->showEvents() && !inhibitNotification )
745  {
746  if ( contact->account() && contact == contact->account()->myself() )
747  {
748  // Separate notification for the 'self' contact
749  if ( newStatus.status() != Kopete::OnlineStatus::Connecting )
750  sendInternalMessage( i18n( "You are now marked as %1.", newStatus.description() ) );
751  }
752  else if ( !contact->account() || !contact->account()->suppressStatusNotification() )
753  {
754  // We shouldn't show an internal message if status have changed
755  // but status visible by user hadn't. It can be happened
756  // if contact changed Xtraz status (oscar/icq protocol)
757  // In this case only status' metadata changes, and no need
758  // to show this message (see bug #193402)
759  if ( newStatus.status() != oldStatus.status() )
760  {
761  QString contactName = m_messagePart->formatName(contact, Qt::PlainText);
762  sendInternalMessage( i18n( "%2 is now %1.",
763  newStatus.description(), contactName ) );
764  }
765  }
766  }
767 
768  // update the windows caption
769  slotChatDisplayNameChanged();
770  emit updateStatusIcon( this );
771 }
772 
773 void ChatView::sendInternalMessage(const QString &msg, Qt::TextFormat format )
774 {
775  // When closing kopete, some internal message may be sent because some contact are deleted
776  // these contacts can already be deleted
777  Kopete::Message message = Kopete::Message();
778  message.setDirection( Kopete::Message::Internal );
779  switch(format)
780  {
781  default:
782  case Qt::PlainText:
783  message.setPlainBody( msg );
784  break;
785  case Qt::RichText:
786  message.setHtmlBody( msg );
787  break;
788  }
789 
790  // (in many case, this is useless to set myself as contact)
791  // TODO: set the contact which initiate the internal message,
792  // so we can later show a icon of it (for example, when he join a chat)
793  messagePart()->appendMessage( message );
794 }
795 
796 void ChatView::sendMessage()
797 {
798  d->sendInProgress = true;
799  editPart()->sendMessage();
800 }
801 
802 void ChatView::messageSentSuccessfully()
803 {
804  d->sendInProgress = false;
805  emit messageSuccess( this );
806 }
807 
808 void ChatView::saveOptions()
809 {
810  KSharedConfig::Ptr config = KGlobal::config();
811  KConfigGroup kopeteChatWindowMainWinSettings( config, ( msgManager()->form() == Kopete::ChatSession::Chatroom ? QLatin1String( "KopeteChatWindowGroupMode" ) : QLatin1String( "KopeteChatWindowIndividualMode" ) ) );
812  kopeteChatWindowMainWinSettings.writeEntry( QLatin1String("ChatViewSplitter"), d->splitter->saveState().toBase64() );
813  saveChatSettings();
814  config->sync();
815 }
816 
817 void ChatView::saveChatSettings()
818 {
819  Kopete::ContactPtrList contacts = msgManager()->members();
820  if ( contacts.count() != 1 )
821  return; //can't save with more than one other person in the chat
822 
823  Kopete::MetaContact* mc = contacts.first()->metaContact();
824  if ( !mc )
825  return;
826 
827  QString contactListGroup = QString(QLatin1String("chatwindow_") +
828  QString(mc->metaContactId()));
829  KConfigGroup config = KGlobal::config()->group(contactListGroup);
830 
831  // If settings are the same as default delete entry from config. This will propagate global setting change.
832  if ( editPart()->isRichTextEnabled() != Kopete::BehaviorSettings::self()->richTextByDefault() )
833  config.writeEntry( "EnableRichText", editPart()->isRichTextEnabled() );
834  else
835  config.deleteEntry( "EnableRichText" );
836 
837  if ( editPart()->checkSpellingEnabled() != Kopete::BehaviorSettings::self()->spellCheck() )
838  config.writeEntry( "EnableAutoSpellCheck", editPart()->checkSpellingEnabled() );
839  else
840  config.deleteEntry( "EnableAutoSpellCheck" );
841 
842  editPart()->writeConfig( config );
843  config.sync();
844 }
845 
846 void ChatView::loadChatSettings()
847 {
848  Kopete::ContactPtrList contacts = msgManager()->members();
849  if ( contacts.count() != 1 )
850  return; //can't load with more than one other person in the chat
851 
852  //read settings for metacontact
853  QString contactListGroup = QString(QLatin1String("chatwindow_") +
854  QString(contacts.first()->metaContact()->metaContactId()));
855  KConfigGroup config(KGlobal::config(), contactListGroup );
856  bool enableRichText = config.readEntry( "EnableRichText", Kopete::BehaviorSettings::self()->richTextByDefault() );
857  editPart()->textEdit()->setRichTextEnabled( enableRichText );
858  emit rtfEnabled( this, editPart()->isRichTextEnabled() );
859  bool enableAutoSpell = config.readEntry( "EnableAutoSpellCheck", Kopete::BehaviorSettings::self()->spellCheck() );
860  emit autoSpellCheckEnabled( this, enableAutoSpell );
861  editPart()->readConfig( config );
862 }
863 
864 void ChatView::readOptions()
865 {
866  KConfigGroup kopeteChatWindowMainWinSettings( KGlobal::config(), ( msgManager()->form() == Kopete::ChatSession::Chatroom ? QLatin1String( "KopeteChatWindowGroupMode" ) : QLatin1String( "KopeteChatWindowIndividualMode" ) ) );
867  //kDebug(14000) << "reading splitterpos from key: " << dockKey;
868  QByteArray state;
869  state = kopeteChatWindowMainWinSettings.readEntry( QLatin1String("ChatViewSplitter"), state );
870  d->splitter->restoreState( QByteArray::fromBase64( state ) );
871 }
872 
873 void ChatView::setActive( bool value )
874 {
875  d->isActive = value;
876  if (d->isActive)
877  {
878  updateChatState(Normal);
879 
880  // attach editpart back on...
881  KXMLGUIFactory * f = msgManager()->factory();
882  if (f)
883  {
884  f->addClient(m_editPart);
885  }
886 
887  emit(activated(static_cast<KopeteView*>(this)));
888  }
889  else
890  {
891  KXMLGUIFactory * f = m_editPart->factory();
892  if (f)
893  {
894  f->removeClient(m_editPart);
895  }
896  }
897 }
898 
899 void ChatView::slotRemoteTypingTimeout()
900 {
901  // Remove the topmost timer from the list. Why does QPtrDict use void* keys and not typed keys? *sigh*
902  // FIXME: should remove the right item, not the topmost
903  if ( !m_remoteTypingMap.isEmpty() )
904  remoteTyping( m_remoteTypingMap.begin().key(), false );
905 }
906 
907 void ChatView::dragEnterEvent ( QDragEnterEvent * event )
908 {
909  const bool accept = isDragEventAccepted( event );
910  if ( accept )
911  {
912  event->setAccepted( true );
913  return;
914  }
915  QWidget::dragEnterEvent( event );
916 }
917 
918 void ChatView::dragMoveEvent( QDragMoveEvent * event )
919 {
920  const bool accept = isDragEventAccepted( event );
921  if ( accept )
922  {
923  event->setAccepted( true );
924  return;
925  }
926  QWidget::dragMoveEvent( event );
927 }
928 
929 bool ChatView::isDragEventAccepted( const QDragMoveEvent * event ) const
930 {
931  if( event->provides( "application/kopete.metacontacts.list" ) )
932  {
933  QByteArray encodedData = event->encodedData ( "application/kopete.metacontacts.list" );
934  QDataStream stream( &encodedData, QIODevice::ReadOnly );
935  QString metacontactID;
936  stream >> metacontactID;
937 
938  metacontactID.remove( 0, metacontactID.indexOf('/')+1 ); // strip groupid
939  kDebug() << metacontactID;
940  Kopete::MetaContact *parent = Kopete::ContactList::self()->metaContact(metacontactID);
941  if ( parent && m_manager->mayInvite() )
942  {
943  foreach ( Kopete::Contact * candidate, parent->contacts() )
944  {
945  if( candidate && candidate->account() == m_manager->account() && candidate->isOnline())
946  {
947  if( candidate != m_manager->myself() && !m_manager->members().contains( candidate ) )
948  return true;
949  }
950  }
951  }
952  }
953  // make sure it doesn't come from the current chat view - then it's an emoticon
954  else if ( KUrl::List::canDecode( event->mimeData() ) && m_manager->members().count() == 1 &&
955  ( event->source() != (QWidget*)m_messagePart->view()->viewport() ) )
956  {
957  Kopete::ContactPtrList members = m_manager->members();
958  Kopete::Contact *contact = members.first();
959  if ( contact && contact->canAcceptFiles() )
960  return true;
961  }
962  return false;
963 }
964 
965 void ChatView::dropEvent ( QDropEvent * event )
966 {
967  Kopete::ContactPtrList contacts;
968 
969  if( event->provides( "application/kopete.metacontacts.list" ) )
970  {
971  QByteArray encodedData = event->encodedData ( "application/kopete.metacontacts.list" );
972  QDataStream stream( &encodedData, QIODevice::ReadOnly );
973  QString metacontactID;
974  stream >> metacontactID;
975 
976  metacontactID.remove( 0, metacontactID.indexOf('/')+1 ); // strip groupid
977  Kopete::MetaContact *parent = Kopete::ContactList::self()->metaContact(metacontactID);
978  if ( parent && m_manager->mayInvite() )
979  {
980  foreach ( Kopete::Contact * candidate, parent->contacts() )
981  {
982  if( candidate && candidate->account() == m_manager->account() && candidate->isOnline())
983  {
984  if( candidate != m_manager->myself() && !m_manager->members().contains( candidate ) )
985  m_manager->inviteContact(candidate->contactId());
986  }
987  }
988  }
989  }
990  else if ( event->provides( "text/uri-list" ) && m_manager->members().count() == 1 )
991  {
992  Kopete::ContactPtrList members = m_manager->members();
993  Kopete::Contact *contact = members.first();
994 
995  if ( !contact || !contact->canAcceptFiles() || !Q3UriDrag::canDecode( event ) )
996  {
997  event->ignore();
998  return;
999  }
1000 
1001  KUrl::List urlList = KUrl::List::fromMimeData( event->mimeData() );
1002 
1003  for ( KUrl::List::Iterator it = urlList.begin(); it != urlList.end(); ++it )
1004  {
1005  if ( (*it).isLocalFile() )
1006  { //send a file
1007  contact->sendFile( *it );
1008  }
1009  else
1010  { //this is a URL, send the URL in a message
1011  addText( (*it).url() );
1012  }
1013  }
1014  event->accept();
1015  return;
1016  }
1017  else
1018  QWidget::dropEvent(event);
1019 
1020 }
1021 
1022 void ChatView::registerContextMenuHandler( QObject *target, const char* slot )
1023 {
1024  connect( m_messagePart,
1025  SIGNAL(contextMenuEvent(Kopete::Message&,QString,KMenu*)),
1026  target,
1027  slot
1028  );
1029 }
1030 
1031 void ChatView::registerTooltipHandler( QObject *target, const char* slot )
1032 {
1033  connect( m_messagePart,
1034  SIGNAL(tooltipEvent(Kopete::Message&,QString,QString&)),
1035  target,
1036  slot
1037  );
1038 }
1039 
1040 #include "chatview.moc"
1041 
1042 // vim: set noet ts=4 sts=4 sw=4:
1043 
ChatView::loadChatSettings
void loadChatSettings()
read the chat settings (rich text, auto spelling)
Definition: chatview.cpp:846
ChatTextEditPart::complete
void complete()
Try to complete the word under the cursor.
Definition: chattexteditpart.cpp:131
ChatView
Definition: chatview.h:62
ChatView::editPart
ChatTextEditPart * editPart() const
Definition: chatview.h:73
ChatView::Undefined
Definition: chatview.h:70
ChatView::setCaption
void setCaption(const QString &text, bool modified)
Sets the text to be displayed on tab label and window caption.
Definition: chatview.cpp:659
QWidget
QWidget::dropEvent
virtual void dropEvent(QDropEvent *event)
ChatView::caption
QString & caption() const
Definition: chatview.cpp:654
KVBox
ChatMessagePart::clear
void clear()
Clear the message window.
Definition: chatmessagepart.cpp:707
ChatView::cut
void cut()
Initiates a cut action on the edit area of the chat view.
Definition: chatview.cpp:221
QMap::erase
iterator erase(iterator pos)
ChatView::closeView
virtual bool closeView(bool force=false)
Definition: chatview.cpp:345
ChatMessagePart::appendMessage
void appendMessage(Kopete::Message &message, bool restoring=false)
Appends a message to the messave view.
Definition: chatmessagepart.cpp:474
ChatWindowStyleManager::self
static ChatWindowStyleManager * self()
Singleton access to this class.
Definition: kopetechatwindowstylemanager.cpp:66
QDropEvent::mimeData
const QMimeData * mimeData() const
ChatView::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *)
Definition: chatview.cpp:918
kopetechatwindowstylemanager.h
ChatView::windowCreated
void windowCreated()
Emitted when we re-parent ourselves with a new window.
KopeteRichTextWidget::setRichTextEnabled
void setRichTextEnabled(bool enable)
enable/disable rich text support
Definition: kopeterichtextwidget.cpp:215
ChatTextEditPart::canSend
bool canSend()
Can we send messages now?
Definition: chattexteditpart.cpp:220
QByteArray
ChatWindowPlugin
This is the class that makes the chatwindow a plugin.
Definition: chatview.h:380
ChatView::tabState
KopeteTabState tabState() const
Retrieves the tab state.
Definition: chatview.cpp:390
QDragMoveEvent
ChatMessagePart::keepScrolledDown
void keepScrolledDown()
Immediately scroll the chat to the bottom, as long as it has not been intentionally scrolled away fro...
Definition: chatmessagepart.cpp:672
ChatTextEditPart::resetConfig
void resetConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:547
ChatView::dropEvent
virtual void dropEvent(QDropEvent *)
Definition: chatview.cpp:965
QDataStream
ChatView::isDragEventAccepted
bool isDragEventAccepted(const QDragMoveEvent *) const
Definition: chatview.cpp:929
ChatView::registerContextMenuHandler
virtual void registerContextMenuHandler(QObject *target, const char *slot)
Reimplemented from KopeteView.
Definition: chatview.cpp:1022
QWidget::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *event)
KopeteChatWindow::detachChatView
void detachChatView(ChatView *chat)
Detach a chat view from this window.
Definition: kopetechatwindow.cpp:804
kopetechatwindow.h
ChatView::captionChanged
void captionChanged(bool active)
manager
virtual Kopete::ChatSession * manager(Kopete::Contact::CanCreateFlags)
Definition: chatwindowconfig.cpp:94
ChatMessagePart
Definition: chatmessagepart.h:44
ChatView::saveOptions
void saveOptions()
Saves window settings such as splitter positions.
Definition: chatview.cpp:808
QScrollBar
ChatView::addText
void addText(const QString &text)
Adds text into the edit area.
Definition: chatview.cpp:244
ChatMessagePart::formatName
QString formatName(const Kopete::Contact *contact, Qt::TextFormat format) const
Format contact's nickname/displayname according to preferences.
Definition: chatmessagepart.cpp:1250
ChatView::appendMessage
virtual void appendMessage(Kopete::Message &message)
Called when a message is received from someone.
Definition: chatview.cpp:685
ChatView::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *)
Definition: chatview.cpp:907
ChatView::canSendFile
bool canSendFile() const
Definition: chatview.cpp:202
ChatView::Normal
Definition: chatview.h:70
ChatView::nickComplete
void nickComplete()
Definition: chatview.cpp:239
QStringList::join
QString join(const QString &separator) const
chatview.h
QWidget::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *event)
QString::remove
QString & remove(int position, int n)
ChatView::editWidget
KTextEdit * editWidget()
Definition: chatview.cpp:187
ChatView::Highlighted
Definition: chatview.h:70
ChatView::clear
virtual void clear()
Clears the chat buffer.
Definition: chatview.cpp:249
ChatView::setActive
void setActive(bool value)
Tells this view it is the active view.
Definition: chatview.cpp:873
QDropEvent::provides
virtual bool provides(const char *mimeType) const
ChatTextEditPart::readConfig
void readConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:518
ChatView::isVisible
virtual bool isVisible()
Reimplemented from KopeteView.
Definition: chatview.cpp:335
QString::isNull
bool isNull() const
ChatView::remoteTyping
void remoteTyping(const Kopete::Contact *contact, bool typing)
Called when a typing event is received from a contact Updates the typing map and outputs the typing m...
Definition: chatview.cpp:432
K_PLUGIN_FACTORY
K_PLUGIN_FACTORY(KopeteAccountConfigFactory, registerPlugin< KopeteAccountConfig >();) KopeteAccountConfig
Definition: kopeteaccountconfig.cpp:56
QString::clear
void clear()
Kopete::Items::MetaContact
Definition: kopeteitembase.h:57
Q3UriDrag::canDecode
bool canDecode(const QMimeSource *source)
ChatView::statusText
const QString & statusText()
Definition: chatview.cpp:503
ChatView::mainWidget
virtual QWidget * mainWidget()
Reimplemented from KopeteView.
Definition: chatview.cpp:192
chattexteditpart.h
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
ChatView::canSend
bool canSend() const
Definition: chatview.cpp:197
QTimer
ChatTextEditPart::addText
void addText(const QString &text)
Adds text into the edit area.
Definition: chattexteditpart.cpp:382
ChatView::messageSent
void messageSent(Kopete::Message &)
Emitted when a message is sent.
QObject
ChatView::updateChatState
void updateChatState(ChatView *, int)
Emitted when the state of the chat changes.
QDropEvent
QList::isEmpty
bool isEmpty() const
KopeteChatWindow::window
static KopeteChatWindow * window(Kopete::ChatSession *manager)
Find the appropriate window for a ChatView of the given protocol to dock into.
Definition: kopetechatwindow.cpp:105
QString::isEmpty
bool isEmpty() const
ChatView::copy
void copy()
Initiates a copy action If there is text selected in the HTML view, that text is copied Otherwise...
Definition: chatview.cpp:226
ChatView::makeVisible
virtual void makeVisible()
Reimplemented from KopeteView.
Definition: chatview.cpp:312
ChatView::raise
virtual void raise(bool activate=false)
Reimplemented from KopeteView.
Definition: chatview.cpp:280
ChatView::setStatusText
void setStatusText(const QString &text)
Sets the text to be displayed on the status label.
Definition: chatview.cpp:478
ChatView::currentMessage
virtual Kopete::Message currentMessage()
Returns the message currently in the edit area.
Definition: chatview.cpp:211
ChatTextEditPart
An instant message composition part.
Definition: chattexteditpart.h:61
ChatView::KopeteTabState
KopeteTabState
the state of our chat
Definition: chatview.h:70
QList::first
T & first()
QString
QList
QMap::end
iterator end()
QMap::begin
iterator begin()
QStringList
chatmessagepart.h
ChatView::Typing
Definition: chatview.h:70
ChatView::activated
void activated(KopeteView *)
ChatView::paste
void paste()
Initiates a paste action into the edit area of the chat view.
Definition: chatview.cpp:234
ChatTextEditPart::sendMessage
void sendMessage()
Sends the text currently entered into the edit area.
Definition: chattexteditpart.cpp:263
QAbstractSlider::value
value
ChatView::sendInProgress
bool sendInProgress() const
Definition: chatview.cpp:340
ChatView::resetFontAndColor
void resetFontAndColor()
Reset font and color of the edit area and outgoing messages.
Definition: chatview.cpp:264
ChatView::saveChatSettings
void saveChatSettings()
save the chat settings (rich text, auto spelling)
Definition: chatview.cpp:817
ChatView::rtfEnabled
void rtfEnabled(ChatView *, bool)
Emitted when the state of RTF has changed.
QString::replace
QString & replace(int position, int n, QChar after)
ChatView::slotRecalculateSize
void slotRecalculateSize(int difference)
Triggers text edit's size recalculation.
Definition: chatview.cpp:485
QSplitter
ChatView::updateStatusIcon
void updateStatusIcon(ChatView *)
ChatView::setCurrentMessage
virtual void setCurrentMessage(const Kopete::Message &newMessage)
Sets the current message in the chat window.
Definition: chatview.cpp:216
QDragEnterEvent
ChatTextEditPart::contents
Kopete::Message contents()
Returns the message currently in the edit area.
Definition: chattexteditpart.cpp:412
QLatin1String
QByteArray::fromBase64
QByteArray fromBase64(const QByteArray &base64)
ChatTextEditPart::writeConfig
void writeConfig(KConfigGroup &config)
Definition: chattexteditpart.cpp:537
ChatView::setMainWindow
void setMainWindow(KopeteChatWindow *parent)
Changes the pointer to the chat window.
Definition: chatview.cpp:417
ChatView::closing
void closing(KopeteView *)
ChatView::registerTooltipHandler
virtual void registerTooltipHandler(QObject *target, const char *slot)
Reimplemented from KopeteView.
Definition: chatview.cpp:1031
QWidget::setWindowTitle
void setWindowTitle(const QString &)
ChatWindowPlugin::createView
KopeteView * createView(Kopete::ChatSession *manager)
Definition: chatview.cpp:65
QList::last
T & last()
ChatView::messageSuccess
void messageSuccess(ChatView *)
KopeteChatWindow::setActiveView
void setActiveView(QWidget *active)
Definition: kopetechatwindow.cpp:946
ChatView::Message
Definition: chatview.h:70
KopeteChatWindow::setStatus
void setStatus(const QString &)
Definition: kopetechatwindow.cpp:629
QString::fromLatin1
QString fromLatin1(const char *str, int size)
QMap::insert
iterator insert(const Key &key, const T &value)
ChatView::sendFile
void sendFile()
Send file (opens file dialog)
Definition: chatview.cpp:718
QMap::isEmpty
bool isEmpty() const
ChatView::sendMessage
virtual void sendMessage()
Sends the text currently entered into the edit area.
Definition: chatview.cpp:796
KopeteChatWindow
Definition: kopetechatwindow.h:61
ChatView::~ChatView
~ChatView()
Definition: chatview.cpp:178
ChatView::updateChatTooltip
void updateChatTooltip(ChatView *, const QString &)
Emitted when a possible tab tooltip needs updating.
ChatView::ChatView
ChatView(Kopete::ChatSession *manager, ChatWindowPlugin *parent)
Definition: chatview.cpp:82
ChatView::canSendChanged
void canSendChanged(bool)
Our send-button-enabled flag has changed.
ChatTextEditPart::setContents
void setContents(const Kopete::Message &message)
Sets the message in the edit field.
Definition: chattexteditpart.cpp:403
KopeteView
QAbstractSlider::maximum
maximum
ChatView::autoSpellCheckEnabled
void autoSpellCheckEnabled(ChatView *, bool)
ChatView::canAcceptFilesChanged
void canAcceptFilesChanged()
ChatView::messagePart
ChatMessagePart * messagePart() const
Definition: chatview.h:72
ChatMessagePart::copy
void copy(bool justselection=false)
Initiates a copy action If there is text selected in the HTML view, that text is copied Otherwise if ...
Definition: chatmessagepart.cpp:893
QMap::find
iterator find(const Key &key)
ChatTextEditPart::textEdit
KopeteRichTextWidget * textEdit()
Get the inside KTextEdit.
Definition: chattexteditpart.cpp:485
ChatView::messageSentSuccessfully
virtual void messageSentSuccessfully()
Reimplemented from KopeteView.
Definition: chatview.cpp:802
ChatView::updateChatLabel
void updateChatLabel(ChatView *, const QString &)
Emitted when a possible tab label needs updating.
QMap::remove
int remove(const Key &key)
QTimer::singleShot
singleShot
ChatView::Changed
Definition: chatview.h:70
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