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

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
  • private
kopeteviewmanager.cpp
Go to the documentation of this file.
1 /*
2  kopeteviewmanager.cpp - View Manager
3 
4  Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
5  Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 
17 #include "kopeteviewmanager.h"
18 
19 #include <QList>
20 #include <QTextDocument>
21 #include <QtAlgorithms>
22 
23 #include <kconfig.h>
24 #include <kdebug.h>
25 #include <klocale.h>
26 #include <kplugininfo.h>
27 #include <knotification.h>
28 #include <kglobal.h>
29 #include <kwindowsystem.h>
30 
31 #include "kopetebehaviorsettings.h"
32 #include "kopeteaccount.h"
33 #include "kopetepluginmanager.h"
34 #include "kopeteviewplugin.h"
35 #include "kopetechatsessionmanager.h"
36 #include "kopetemetacontact.h"
37 #include "kopetecontact.h"
38 #include "kopetemessageevent.h"
39 #include "kopeteview.h"
40 #include "kopetechatsession.h"
41 #include "kopetegroup.h"
42 #include "kopetepicture.h"
43 #include "kopeteemoticons.h"
44 #include "kopeteactivenotification.h"
45 
52 static QString squashMessage( const Kopete::Message& msg, const int len = 30 )
53 {
54  QString msgText = msg.parsedBody();
55 
56  QRegExp rx( "(<a.*>((http://)?(.+))</a>)" );
57  rx.setMinimal( true );
58  if ( rx.indexIn( msgText ) == -1 )
59  {
60  // no URLs in text, just pick the first chars of
61  // the parsed text if necessary. We used parsed text
62  // so that things like "<knuff>" show correctly
63  // Escape it after snipping it to not snip entities
64  msgText = msg.plainBody();
65  if( msgText.length() > len )
66  msgText = msgText.left( len ) + QString::fromLatin1( " ..." );
67  msgText=Kopete::Emoticons::parseEmoticons(Qt::escape(msgText));
68  }
69  else
70  {
71  QString plainText = msg.plainBody();
72  if ( plainText.length() > len )
73  {
74  QString fullUrl = rx.cap( 2 );
75  QString shorterUrl;
76  if ( fullUrl.length() > len )
77  {
78  QString urlWithoutProtocol = rx.cap( 4 );
79  shorterUrl = urlWithoutProtocol.left( len - 3 )
80  + QString::fromLatin1( "... " );
81  }
82  else
83  {
84  shorterUrl = fullUrl.left( len - 3 )
85  + QString::fromLatin1( "... " );
86  }
87  // remove message text
88  msgText = QString::fromLatin1( "... " ) +
89  rx.cap( 1 ) +
90  QString::fromLatin1( " ..." );
91  // find last occurrence of URL (the one inside the <a> tag)
92  int revUrlOffset = msgText.lastIndexOf( fullUrl );
93  msgText.replace( revUrlOffset,
94  fullUrl.length(), shorterUrl );
95  }
96  }
97  kDebug(14000) << msgText;
98  return msgText;
99 }
100 
101 typedef QMap<Kopete::ChatSession*, KopeteView*> SessionMap;
102 typedef QList<Kopete::MessageEvent*> EventList;
103 
104 struct KopeteViewManagerPrivate
105 {
106  ~KopeteViewManagerPrivate()
107  {
108  qDeleteAll(sessionMap);
109  sessionMap.clear();
110  qDeleteAll(eventList);
111  eventList.clear();
112  }
113 
114  SessionMap sessionMap;
115  EventList eventList;
116  KopeteView *activeView;
117 
118  bool useQueue;
119  bool raiseWindow;
120  bool queueUnreadMessages;
121  bool queueOnlyHighlightedMessagesInGroupChats;
122  bool queueOnlyMessagesOnAnotherDesktop;
123  bool balloonNotifyIgnoreClosesChatView;
124  bool balloonGroupMessageNotificationsPerSender;
125  bool foreignMessage;
126  bool animateOnMessageWithOpenChat;
127  bool enableEventsWhileAway;
128  Kopete::ActiveNotifications activeNotifications;
129 };
130 
131 KopeteViewManager *KopeteViewManager::s_viewManager = 0L;
132 
133 KopeteViewManager *KopeteViewManager::viewManager()
134 {
135  if( !s_viewManager )
136  s_viewManager = new KopeteViewManager();
137  return s_viewManager;
138 }
139 
140 KopeteViewManager::KopeteViewManager()
141 {
142  s_viewManager=this;
143  d = new KopeteViewManagerPrivate;
144  d->activeView = 0L;
145  d->foreignMessage=false;
146 
147  connect( Kopete::BehaviorSettings::self(), SIGNAL(configChanged()), this, SLOT(slotPrefsChanged()) );
148 
149  connect( Kopete::ChatSessionManager::self() , SIGNAL(display(Kopete::Message&,Kopete::ChatSession*)),
150  this, SLOT (messageAppended(Kopete::Message&,Kopete::ChatSession*)) );
151 
152  connect( Kopete::ChatSessionManager::self() , SIGNAL(readMessage()),
153  this, SLOT (nextEvent()) );
154 
155  slotPrefsChanged();
156 }
157 
158 KopeteViewManager::~KopeteViewManager()
159 {
160 // kDebug(14000) ;
161 
162  //delete all open chatwindow.
163  SessionMap::Iterator it;
164  for ( it = d->sessionMap.begin(); it != d->sessionMap.end(); ++it )
165  {
166  it.value()->closeView( true ); //this does not clean the map, but we don't care
167  }
168 
169  delete d;
170 }
171 
172 void KopeteViewManager::slotPrefsChanged()
173 {
174  Kopete::BehaviorSettings *const bs = Kopete::BehaviorSettings::self();
175 
176  d->useQueue = bs->useMessageQueue();
177  d->raiseWindow = bs->raiseMessageWindow();
178  d->queueUnreadMessages = bs->queueUnreadMessages();
179  d->queueOnlyHighlightedMessagesInGroupChats = bs->queueOnlyHighlightedMessagesInGroupChats();
180  d->queueOnlyMessagesOnAnotherDesktop = bs->queueOnlyMessagesOnAnotherDesktop();
181  d->balloonNotifyIgnoreClosesChatView = bs->balloonNotifyIgnoreClosesChatView();
182  d->balloonGroupMessageNotificationsPerSender = bs->balloonGroupMessageNotificationsPerSender();
183  d->animateOnMessageWithOpenChat = bs->animateOnMessageWithOpenChat();
184  d->enableEventsWhileAway = bs->enableEventsWhileAway();
185 }
186 
187 KopeteView *KopeteViewManager::view( Kopete::ChatSession* session, const QString &requestedPlugin )
188 {
189  // kDebug(14000) ;
190 
191  if( d->sessionMap.contains( session ) && d->sessionMap[ session ] )
192  {
193  return d->sessionMap[ session ];
194  }
195  else
196  {
197  Kopete::PluginManager *pluginManager = Kopete::PluginManager::self();
198  Kopete::ViewPlugin *viewPlugin = 0L;
199 
200  QString pluginName = requestedPlugin.isEmpty() ? Kopete::BehaviorSettings::self()->viewPlugin() : requestedPlugin;
201  if( !pluginName.isEmpty() )
202  {
203  viewPlugin = (Kopete::ViewPlugin*)pluginManager->loadPlugin( pluginName );
204 
205  if( !viewPlugin )
206  {
207  kWarning(14000) << "Requested view plugin, " << pluginName
208  << ", was not found. Falling back to chat window plugin" << endl;
209  }
210  }
211 
212  if( !viewPlugin )
213  {
214  viewPlugin = (Kopete::ViewPlugin*)pluginManager->loadPlugin( QLatin1String("kopete_chatwindow") );
215  }
216 
217  if( viewPlugin )
218  {
219  KopeteView *newView = viewPlugin->createView(session);
220 
221  d->foreignMessage = false;
222  d->sessionMap.insert( session, newView );
223 
224  connect( session, SIGNAL(closing(Kopete::ChatSession*)),
225  this, SLOT(slotChatSessionDestroyed(Kopete::ChatSession*)) );
226 
227  return newView;
228  }
229  else
230  {
231  kError(14000) << "Could not create a view, no plugins available!" << endl;
232  return 0L;
233  }
234  }
235 }
236 
237 
238 void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSession *session)
239 {
240  const bool isOutboundMessage = msg.direction() == Kopete::Message::Outbound;
241 
242  if ( isOutboundMessage && !d->sessionMap.contains( session ) )
243  return;
244 
245  // Get an early copy of the plain message body before the chat view works on it
246  // Otherwise toPlainBody() will ignore smileys if they were turned into images during
247  // the html conversion. See bug 161651.
248  const QString squashedMessage = squashMessage( msg, 300 );
249 
250  d->foreignMessage = !isOutboundMessage; // for the view we are about to create
251  session->view( true, msg.requestedPlugin() )->appendMessage( msg );
252  d->foreignMessage = false; // the view has been created, reset the flag
253 
254  bool appendMessageEvent = d->useQueue;
255  bool isViewOnCurrentDesktop = true;
256 
257  QWidget *w = dynamic_cast< QWidget * >( view( session ) );
258 #ifdef Q_WS_X11
259  if ( w )
260  {
261  isViewOnCurrentDesktop = KWindowSystem::windowInfo( w->topLevelWidget()->winId(),
262  NET::WMDesktop ).isOnCurrentDesktop();
263  }
264 #endif
265 
266  if ( w && d->queueUnreadMessages )
267  {
268  // append msg event to queue if chat window is active but not the chat view in it...
269  appendMessageEvent = appendMessageEvent && !( w->isActiveWindow()
270  && session->view() == d->activeView );
271  // ...and chat window is on another desktop
272  appendMessageEvent = appendMessageEvent && !( d->queueOnlyMessagesOnAnotherDesktop
273  && isViewOnCurrentDesktop );
274  }
275  else
276  {
277  // append if no chat window exists already
278  appendMessageEvent = appendMessageEvent && !view( session )->isVisible();
279  }
280 
281  // in groupchats, don't notify on non-highlighted messages if configured that way.
282  const bool isIgnoredGroupChatMessage = session->members().count() > 1
283  && d->queueOnlyHighlightedMessagesInGroupChats
284  && msg.importance() != Kopete::Message::Highlight;
285 
286  appendMessageEvent = appendMessageEvent && !isIgnoredGroupChatMessage;
287 
288  QWidget *viewWidget = 0;
289  bool showNotification = false;
290  bool isActiveWindow = false;
291  Kopete::MessageEvent *event = 0;
292 
293  if ( !isOutboundMessage )
294  {
295  if ( ( !session->account()->isAway() || d->enableEventsWhileAway )
296  && msg.direction() != Kopete::Message::Internal )
297  {
298  viewWidget = dynamic_cast< QWidget * >( session->view( false ) );
299  // note that session->view( true [default value] ) can create a view, so watch the
300  // side-effects...
301  isActiveWindow = session->view( false ) && viewWidget
302  && session->view() == d->activeView && viewWidget->isActiveWindow();
303  showNotification = msg.from() != 0;
304  }
305 
306  if ( appendMessageEvent || showNotification )
307  {
308  if ( msg.from() && d->eventList.isEmpty() ) { // may happen for internal messages
309  if ( session->account()->isBusy() || ( session->account()->isAway() && !d->enableEventsWhileAway ) )
310  showNotification = false;
311  else
312  showNotification = true;
313  }
314 
315  event = new Kopete::MessageEvent( msg, session );
316  d->eventList.append( event );
317 
318  // Don't call readMessages twice. We call it later in this method. Fixes bug 168978.
319  if ( d->useQueue )
320  connect( event, SIGNAL(done(Kopete::MessageEvent*)),
321  this, SLOT(slotEventDeleted(Kopete::MessageEvent*)) );
322  }
323  }
324 
325  if ( msg.delayed() )
326  showNotification = false;
327 
328  if ( showNotification )
329  createNotification( msg, squashedMessage, session, event, viewWidget,
330  isActiveWindow, isViewOnCurrentDesktop );
331 
332  if (!d->useQueue)
333  {
334  // "Open messages instantly" setting
335  readMessages( session, isOutboundMessage );
336  }
337 
338  KopeteView *view = session->view( false );
339  if ( d->raiseWindow && view && view->isVisible() )
340  {
341  // "Raise window on incoming message" setting
342  view->raise();
343  }
344 
345  if ( event && ( appendMessageEvent || ( d->animateOnMessageWithOpenChat && !isActiveWindow ) )
346  && !isIgnoredGroupChatMessage )
347  Kopete::ChatSessionManager::self()->postNewEvent(event);
348 }
349 
350 void KopeteViewManager::createNotification( Kopete::Message &msg, const QString &squashedMessage,
351  Kopete::ChatSession *session, Kopete::MessageEvent *event,
352  QWidget *viewWidget,
353  bool isActiveWindow, bool isViewOnCurrentDesktop )
354 {
355 
356  if ( msg.from()->account()->isBusy() )
357  return;
358 
359  if ( d->balloonGroupMessageNotificationsPerSender )
360  {
361  Kopete::ActiveNotifications::iterator notifyIt =
362  d->activeNotifications.find( msg.from()->account()->accountLabel() + msg.from()->contactId() );
363  if (notifyIt != d->activeNotifications.end())
364  {
365  ( *notifyIt )->incrementMessages();
366  return;
367  }
368  }
369 
370  const QString msgFrom = msg.from()->metaContact() ? msg.from()->metaContact()->displayName()
371  : msg.from()->contactId();
372 
373  QString eventId, titleString;
374  QString bodyString = squashedMessage;
375  if ( msg.type() == Kopete::Message::TypeFileTransferRequest)
376  {
377  eventId = QLatin1String( "kopete_incoming_file_transfer" );
378  titleString = i18nc( "@title %1 is contact's name", "Incoming file transfer request from <i>%1</i>", Qt::escape( msgFrom ) );
379  if ( squashedMessage.isEmpty() )
380  {
381  bodyString = i18nc( "@info", "A user is trying to send you a file <filename>%1</filename>", Qt::escape( msg.fileName() ) );
382  }
383  else
384  {
385  bodyString = i18nc( "@info %2 is message", "A user is trying to send you a file <filename>%1</filename> with the message:<nl/>\"%2\"",
386  Qt::escape( msg.fileName() ), squashedMessage );
387  }
388  }
389  else
390  {
391  KLocalizedString title = ki18n( "Incoming message from <i>%1</i>" );
392  switch( msg.importance() )
393  {
394  case Kopete::Message::Low:
395  eventId = QLatin1String( "kopete_contact_lowpriority" );
396  break;
397  case Kopete::Message::Highlight:
398  eventId = QLatin1String( "kopete_contact_highlight" );
399  title = ki18n( "A highlighted message arrived from <i>%1</i>" );
400  break;
401  default:
402  if ( isActiveWindow || (d->queueOnlyMessagesOnAnotherDesktop
403  && isViewOnCurrentDesktop ) )
404  {
405  eventId = QLatin1String( "kopete_contact_incoming_active_window" );
406  }
407  else
408  {
409  eventId = QLatin1String( "kopete_contact_incoming" );
410  }
411  }
412  }
413  KNotification *notify = new KNotification(eventId, viewWidget, isActiveWindow
414  ? KNotification::CloseOnTimeout
415  : KNotification::Persistent);
416  notify->setPixmap( QPixmap::fromImage( msg.from()->metaContact()->picture().image() ) );
417  notify->setActions( QStringList() << i18nc( "@action", "View" )
418  << i18nc( "@action", "Close" ) );
419 
420  if ( d->balloonGroupMessageNotificationsPerSender )
421  {
422  // notify is parent, will die with it
423  new Kopete::ActiveNotification( notify,
424  msg.from()->account()->accountLabel() + msg.from()->contactId(),
425  d->activeNotifications,
426  titleString,
427  bodyString );
428  }
429  else
430  {
431  notify->setTitle( titleString );
432  notify->setText( squashedMessage );
433  }
434 
435  foreach ( const QString& cl , msg.classes() )
436  notify->addContext( qMakePair( QString::fromLatin1("class"), cl ) );
437 
438  Kopete::MetaContact *mc= msg.from()->metaContact();
439  if ( mc )
440  {
441  notify->addContext( qMakePair( QString::fromLatin1("contact"),
442  mc->metaContactId().toString()) );
443  foreach( Kopete::Group *g , mc->groups() )
444  {
445  notify->addContext( qMakePair( QString::fromLatin1("group"),
446  QString::number(g->groupId())) );
447  }
448  }
449  connect( notify, SIGNAL(activated()), session, SLOT(raiseView()) );
450  connect( notify, SIGNAL(action1Activated()), session, SLOT(raiseView()) );
451  connect( notify, SIGNAL(action2Activated()), event, SLOT(discard()) );
452  connect( event, SIGNAL(done(Kopete::MessageEvent*)), notify, SLOT(close()) );
453  notify->sendEvent();
454 }
455 
456 void KopeteViewManager::readMessages( Kopete::ChatSession *session, bool isOutboundMessage, bool activate )
457 {
458  // kDebug( 14000 ) ;
459  d->foreignMessage = !isOutboundMessage; //for the view we are about to create
460  KopeteView *thisView = session->view( true );
461  d->foreignMessage = false; //the view is created, reset the flag
462  if ( ( isOutboundMessage && !thisView->isVisible() ) || d->raiseWindow || activate )
463  thisView->raise( activate );
464  else if ( !thisView->isVisible() )
465  thisView->makeVisible();
466 
467  foreach ( Kopete::MessageEvent *event, d->eventList )
468  {
469  if ( event->message().manager() == session )
470  {
471  event->apply();
472  d->eventList.removeAll( event );
473  }
474  }
475 }
476 
477 void KopeteViewManager::slotEventDeleted( Kopete::MessageEvent *event )
478 {
479  // d->eventList.remove( event );
480  d->eventList.removeAll(event);
481 
482 // kDebug(14000) ;
483  Kopete::ChatSession *kmm=event->message().manager();
484  if(!kmm)
485  {
486  // this can be NULL for example if KopeteViewManager::slotViewActivated()
487  // got called which does deleteLater() the event what may result in the
488  // case, that the QPointer<ChatSession> in Message::Private got removed
489  // aka set to NULL already.
490  return;
491  }
492 
493  if ( event->state() == Kopete::MessageEvent::Applied )
494  {
495  readMessages( kmm, false, true );
496  }
497  else if ( event->state() == Kopete::MessageEvent::Ignored && d->balloonNotifyIgnoreClosesChatView )
498  {
499  bool bAnotherWithThisManager = false;
500  foreach (Kopete::MessageEvent *event, d->eventList)
501  {
502  if ( event->message().manager() == kmm )
503  {
504  bAnotherWithThisManager = true;
505  }
506  }
507  if ( !bAnotherWithThisManager && kmm->view( false ) )
508  kmm->view()->closeView( true );
509  }
510 }
511 
512 void KopeteViewManager::nextEvent()
513 {
514  // kDebug( 14000 ) ;
515 
516  if( d->eventList.isEmpty() )
517  return;
518 
519  Kopete::MessageEvent* event = d->eventList.first();
520 
521  if ( event )
522  event->apply();
523 }
524 
525 void KopeteViewManager::slotViewActivated( KopeteView *view )
526 {
527  // kDebug( 14000 ) ;
528  d->activeView = view;
529 
530  foreach (Kopete::MessageEvent *event, d->eventList)
531  {
532  if ( event->message().manager() == view->msgManager() )
533  {
534  event->deleteLater();
535  }
536  }
537 }
538 
539 void KopeteViewManager::slotViewDestroyed( KopeteView *closingView )
540 {
541  // kDebug( 14000 ) ;
542 
543  if ( d->sessionMap.contains( closingView->msgManager() ) )
544  {
545  d->sessionMap.remove( closingView->msgManager() );
546  // closingView->msgManager()->setCanBeDeleted( true );
547  }
548 
549  if( closingView == d->activeView )
550  d->activeView = 0L;
551 }
552 
553 void KopeteViewManager::slotChatSessionDestroyed( Kopete::ChatSession *session )
554 {
555  // kDebug( 14000 ) ;
556 
557  if ( d->sessionMap.contains( session ) )
558  {
559  KopeteView *v = d->sessionMap[ session ];
560  v->closeView( true );
561  delete v; //closeView call deleteLater, but in this case this is not enough, because some signal are called that case crash
562  d->sessionMap.remove( session );
563  }
564 }
565 
566 KopeteView* KopeteViewManager::activeView() const
567 {
568  return d->activeView;
569 }
570 
571 
572 QList<Kopete::MessageEvent*> KopeteViewManager::pendingMessages( Kopete::Contact *contact )
573 {
574  QList<Kopete::MessageEvent*> pending;
575  foreach (Kopete::MessageEvent *event, d->eventList)
576  {
577  const Kopete::Message &message = event->message();
578  if ( event->state() == Kopete::MessageEvent::Nothing
579  && message.direction() == Kopete::Message::Inbound
580  && message.from() == contact )
581  {
582  pending << event;
583  }
584  }
585 
586  return pending;
587 }
588 
589 #include "kopeteviewmanager.moc"
590 
591 // vim: set noet ts=4 sts=4 sw=4:
592 
Kopete::Account::accountLabel
QString accountLabel() const
The label for this account.
Definition: kopeteaccount.cpp:292
kopeteviewmanager.h
Kopete::BehaviorSettings::queueOnlyHighlightedMessagesInGroupChats
static bool queueOnlyHighlightedMessagesInGroupChats()
Get Queue only highlighted messages in group chats.
Definition: kopetebehaviorsettings.h:288
kopetemetacontact.h
Kopete::MessageEvent
Definition: kopetemessageevent.h:41
Kopete::Message::Low
almost no notifications. automatically used in groupChat
Definition: kopetemessage.h:111
QWidget
Kopete::ViewPlugin::createView
virtual KopeteView * createView(ChatSession *)
Creates a view to be associated with the passed in session.
Definition: kopeteviewplugin.h:49
KopeteViewManager::slotPrefsChanged
void slotPrefsChanged()
Definition: kopeteviewmanager.cpp:172
EventList
QList< Kopete::MessageEvent * > EventList
Definition: kopeteviewmanager.cpp:102
QRegExp::cap
QString cap(int nth) const
kopetechatsessionmanager.h
KopeteView::closeView
virtual bool closeView(bool force=false)=0
Close this view.
KopeteView::msgManager
Kopete::ChatSession * msgManager() const
Get the message manager.
Definition: kopeteview.cpp:26
Kopete::Message::fileName
QString fileName() const
Accessor method for the file name of incoming file transfer.
Definition: kopetemessage.cpp:679
Kopete::Emoticons::parseEmoticons
static QString parseEmoticons(const QString &text, KEmoticonsTheme::ParseMode mode=KEmoticonsTheme::DefaultParse, const QStringList &exclude=QStringList())
Definition: kopeteemoticons.cpp:36
KopeteViewManager::pendingMessages
QList< Kopete::MessageEvent * > pendingMessages(Kopete::Contact *contact)
Returns unread messages for the given contact.
Definition: kopeteviewmanager.cpp:572
kopeteaccount.h
Kopete::MessageEvent::Ignored
Definition: kopetemessageevent.h:66
Kopete::BehaviorSettings::balloonGroupMessageNotificationsPerSender
static bool balloonGroupMessageNotificationsPerSender()
Get Single notification for messages from the same sender.
Definition: kopetebehaviorsettings.h:342
KopeteView::raise
virtual void raise(bool activate=false)=0
Raises the view above other windows.
QRegExp::setMinimal
void setMinimal(bool minimal)
Kopete::Contact::contactId
QString contactId
Definition: kopetecontact.h:70
Kopete::Message::TypeFileTransferRequest
A incoming file transfer request message.
Definition: kopetemessage.h:102
Kopete::Message::type
MessageType type() const
Accessor method for the message type.
Definition: kopetemessage.cpp:520
QMap< Kopete::ChatSession *, KopeteView * >
KopeteView::isVisible
virtual bool isVisible()=0
Get the current visibility of the view.
Kopete::PluginManager::loadPlugin
Plugin * loadPlugin(const QString &pluginId, PluginLoadMode mode=LoadSync)
Load a single plugin by plugin name.
Definition: kopetepluginmanager.cpp:340
kopetegroup.h
Kopete::Contact::account
Account * account() const
Get the account that this contact belongs to.
Definition: kopetecontact.cpp:538
QPixmap::fromImage
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
KopeteViewManager::~KopeteViewManager
~KopeteViewManager()
Definition: kopeteviewmanager.cpp:158
Kopete::ChatSession
Definition: kopetechatsession.h:74
Kopete::BehaviorSettings::animateOnMessageWithOpenChat
static bool animateOnMessageWithOpenChat()
Get Animate on message with open chat.
Definition: kopetebehaviorsettings.h:450
Kopete::Message::Outbound
Message sent by the user.
Definition: kopetemessage.h:91
Kopete::Message::Internal
(Default) Message which are not sent via the network. This is just a notification a plugin can show i...
Definition: kopetemessage.h:92
QString::lastIndexOf
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
Kopete::Picture::image
QImage image()
Return the current picture as QImage.
Definition: kopetepicture.cpp:78
QObject::event
virtual bool event(QEvent *e)
Kopete::Message::direction
MessageDirection direction() const
Accessor method for the direction of the message.
Definition: kopetemessage.cpp:580
QRegExp::indexIn
int indexIn(const QString &str, int offset, CaretMode caretMode) const
QRegExp
Kopete::BehaviorSettings::enableEventsWhileAway
static bool enableEventsWhileAway()
Get Enable events while away.
Definition: kopetebehaviorsettings.h:504
Kopete::BehaviorSettings::queueUnreadMessages
static bool queueUnreadMessages()
Get Queue unread messages.
Definition: kopetebehaviorsettings.h:126
QString::number
QString number(int n, int base)
QList::count
int count(const T &value) const
QWidget::topLevelWidget
QWidget * topLevelWidget() const
Kopete::MetaContact::picture
Picture & picture() const
Return the correct Kopete::Picture object depending of the metacontact photo source.
Definition: kopetemetacontact.cpp:750
kopeteemoticons.h
QHash< QString, ActiveNotification * >
Kopete::Group::groupId
uint groupId
Definition: kopetegroup.h:47
kopetepicture.h
Kopete::BehaviorSettings
Definition: kopetebehaviorsettings.h:14
Kopete::MetaContact::metaContactId
QUuid metaContactId
Definition: kopetemetacontact.h:66
QString::isEmpty
bool isEmpty() const
kopetechatsession.h
KopeteViewManager::KopeteViewManager
KopeteViewManager()
Definition: kopeteviewmanager.cpp:140
Kopete::MetaContact::displayName
QString displayName
Definition: kopetemetacontact.h:58
Kopete::MessageEvent::state
EventState state()
Definition: kopetemessageevent.cpp:68
Kopete::BehaviorSettings::queueOnlyMessagesOnAnotherDesktop
static bool queueOnlyMessagesOnAnotherDesktop()
Get Queue Only Messages On Another Desktop.
Definition: kopetebehaviorsettings.h:315
Kopete::Message::Inbound
Message is from the chat partner.
Definition: kopetemessage.h:90
QWidget::winId
WId winId() const
Kopete::Account::isAway
bool isAway
Definition: kopeteaccount.h:82
QString
QList< Kopete::MessageEvent * >
QWidget::isActiveWindow
isActiveWindow
Kopete::BehaviorSettings::raiseMessageWindow
static bool raiseMessageWindow()
Get Raise message view on new messages.
Definition: kopetebehaviorsettings.h:234
Kopete::Contact
Definition: kopetecontact.h:58
Kopete::MessageEvent::Nothing
Definition: kopetemessageevent.h:66
QStringList
KopeteViewManager::slotViewActivated
void slotViewActivated(KopeteView *)
Definition: kopeteviewmanager.cpp:525
Kopete::Message::delayed
bool delayed() const
Accessor method for the "delayed" attribute of the message.
Definition: kopetemessage.cpp:814
Kopete::BehaviorSettings::viewPlugin
static QString viewPlugin()
Get Selected view plugin for Chat Window.
Definition: kopetebehaviorsettings.h:774
KopeteViewManager::readMessages
void readMessages(Kopete::ChatSession *manager, bool isOutboundMessage, bool activate=false)
Make a view visible and on top.
Definition: kopeteviewmanager.cpp:456
Kopete::PluginManager::self
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
Kopete::Message::requestedPlugin
QString requestedPlugin() const
Accessor method for the preferred plugin If null, Kopete will use the user's preferred plugin...
Definition: kopetemessage.cpp:530
Kopete::ChatSessionManager::self
static ChatSessionManager * self()
Definition: kopetechatsessionmanager.cpp:39
Kopete::BehaviorSettings::balloonNotifyIgnoreClosesChatView
static bool balloonNotifyIgnoreClosesChatView()
Get Balloon Notification Ignore Closes Chat View.
Definition: kopetebehaviorsettings.h:369
squashMessage
static QString squashMessage(const Kopete::Message &msg, const int len=30)
Used to exrtract the message that will be shown in the notification popup.
Definition: kopeteviewmanager.cpp:52
KopeteViewManager::activeView
KopeteView * activeView() const
Provide access to the list of KopeteChatWindow the class maintains.
Definition: kopeteviewmanager.cpp:566
QString::replace
QString & replace(int position, int n, QChar after)
KopeteView::makeVisible
virtual void makeVisible()=0
Make the view visible.
KopeteViewManager
Relates an actual chat to the means used to view it.
Definition: kopeteviewmanager.h:38
Kopete::ViewPlugin
Factory plugin for creating KopeteView objects.
Definition: kopeteviewplugin.h:38
Kopete::Contact::metaContact
MetaContact * metaContact() const
Get the metacontact for this contact.
Definition: kopetecontact.cpp:523
Kopete::ChatSession::account
Account * account() const
get the account
Definition: kopetechatsession.cpp:668
KopeteViewManager::nextEvent
void nextEvent()
Definition: kopeteviewmanager.cpp:512
QLatin1String
Kopete::ChatSessionManager::postNewEvent
void postNewEvent(Kopete::MessageEvent *)
Post a new event.
Definition: kopetechatsessionmanager.cpp:182
Qt::escape
QString escape(const QString &plain)
Kopete::Message::classes
QStringList classes() const
Definition: kopetemessage.cpp:797
Kopete::Message::importance
MessageImportance importance() const
Accessor method for the importance.
Definition: kopetemessage.cpp:590
Kopete::BehaviorSettings::self
static BehaviorSettings * self()
Definition: kopetebehaviorsettings.cpp:23
Kopete::ChatSession::members
const ContactPtrList & members() const
Get a list of all contacts in the session.
Definition: kopetechatsession.cpp:210
kopetemessageevent.h
Kopete::MetaContact::groups
QList< Group * > groups() const
The groups the contact is stored in.
Definition: kopetemetacontact.cpp:1069
Kopete::Group
Class which represents the Group.
Definition: kopetegroup.h:44
QString::length
int length() const
Kopete::MessageEvent::Applied
Definition: kopetemessageevent.h:66
KopeteViewManager::viewManager
static KopeteViewManager * viewManager()
This is a singleton class.
Definition: kopeteviewmanager.cpp:133
Kopete::PluginManager
Definition: kopetepluginmanager.h:40
Kopete::MessageEvent::message
Kopete::Message message()
Definition: kopetemessageevent.cpp:58
QString::left
QString left(int n) const
Kopete::MetaContact
Definition: kopetemetacontact.h:54
QString::fromLatin1
QString fromLatin1(const char *str, int size)
kopeteviewplugin.h
kopeteview.h
Kopete::Utils::notify
void notify(QPixmap pic, const QString &eventid, const QString &caption, const QString &message, const QString explanation, const QString debugInfo)
Definition: kopeteutils.cpp:65
QMap< Kopete::ChatSession *, KopeteView * >::Iterator
typedef Iterator
KopeteViewManager::slotEventDeleted
void slotEventDeleted(Kopete::MessageEvent *)
An event has been deleted.
Definition: kopeteviewmanager.cpp:477
Kopete::Message::plainBody
QString plainBody() const
Get the message body back as plain text.
Definition: kopetemessage.cpp:366
Kopete::ChatSession::view
KopeteView * view(bool canCreate=false, const QString &requestedPlugin=QString())
the manager's view
Definition: kopetechatsession.cpp:641
KopeteView
Definition: kopeteview.h:40
Kopete::Message::parsedBody
QString parsedBody() const
Get the message body as parsed HTML with Emoticons, and URL parsed This should be ready to be shown i...
Definition: kopetemessage.cpp:400
Kopete::ActiveNotification
Definition: kopeteactivenotification.h:30
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Kopete::Message::from
const Contact * from() const
Accessor method for the Contact that sent this message.
Definition: kopetemessage.cpp:510
kopetebehaviorsettings.h
Kopete::Message::manager
ChatSession * manager() const
Get the related message manager.
Definition: kopetemessage.cpp:605
QUuid::toString
QString toString() const
Kopete::Message
Representation of a message in Kopete.
Definition: kopetemessage.h:82
kopetepluginmanager.h
Kopete::Account::isBusy
bool isBusy() const
Indicate whether the account is busy.
Definition: kopeteaccount.cpp:509
Kopete::Message::Highlight
Highlight notification, for most important messages, which require particular attentions.
Definition: kopetemessage.h:113
kopetecontact.h
KopeteViewManager::messageAppended
void messageAppended(Kopete::Message &msg, Kopete::ChatSession *manager)
Called when a new message has been appended to the given Kopete::ChatSession.
Definition: kopeteviewmanager.cpp:238
kopeteactivenotification.h
Kopete::BehaviorSettings::useMessageQueue
static bool useMessageQueue()
Get Use message queue.
Definition: kopetebehaviorsettings.h:99
KopeteViewManager::view
KopeteView * view(Kopete::ChatSession *session, const QString &requestedPlugin=QString())
Return a view for the supplied Kopete::ChatSession.
Definition: kopeteviewmanager.cpp:187
SessionMap
QMap< Kopete::ChatSession *, KopeteView * > SessionMap
Definition: kopeteviewmanager.cpp:101
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • 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