• 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
kopetecontact.cpp
Go to the documentation of this file.
1 /*
2  kopetecontact.cpp - Kopete Contact
3 
4  Copyright (c) 2002-2004 by Duncan Mac-Vicar Prett <duncan@kde.org>
5  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
6  Copyright (c) 2002-2004 by Olivier Goffart <ogoffart @ kde.org>
7 
8  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
9 
10  *************************************************************************
11  * *
12  * This library is free software; you can redistribute it and/or *
13  * modify it under the terms of the GNU Lesser General Public *
14  * License as published by the Free Software Foundation; either *
15  * version 2 of the License, or (at your option) any later version. *
16  * *
17  *************************************************************************
18 */
19 
20 #include "kopetecontact.h"
21 
22 #include <QApplication>
23 #include <QTextDocument>
24 #include <QTimer>
25 
26 #include <KDebug>
27 
28 #include <kdeversion.h>
29 #include <kinputdialog.h>
30 
31 #include <kabcpersistence.h>
32 #include <kdialog.h>
33 #include <klocale.h>
34 #include <kicon.h>
35 #include <kmenu.h>
36 #include <kmessagebox.h>
37 #include <k3listviewsearchline.h>
38 
39 #include "kopetecontactlist.h"
40 #include "kopeteglobal.h"
41 #include "kopeteuiglobal.h"
42 #include "kopeteprotocol.h"
43 #include "kopeteaccount.h"
44 #include "kopetestdaction.h"
45 #include "kopetechatsession.h"
46 #include "kopeteview.h"
47 #include "kopetemetacontact.h"
48 #include "kopeteappearancesettings.h"
49 #include "kopetebehaviorsettings.h"
50 #include "metacontactselectorwidget.h"
51 #include "kopeteemoticons.h"
52 #include "kopetestatusmessage.h"
53 #include "kopeteinfodialog.h"
54 #include "kopetedeletecontacttask.h"
55 
56 //For the moving to another metacontact dialog
57 #include <qlabel.h>
58 #include <qimage.h>
59 #include <qmime.h>
60 #include <kvbox.h>
61 #include <k3listview.h>
62 #include <qcheckbox.h>
63 
64 
65 namespace Kopete {
66 
67 class Contact::Private
68 {
69 public:
70  bool fileCapable;
71 
72  OnlineStatus onlineStatus;
73  Account *account;
74 
75  MetaContact *metaContact;
76 
77  QString contactId;
78  QString icon;
79 
80  QTime idleTimer;
81  unsigned long int idleTime;
82 
83  Kopete::StatusMessage statusMessage;
84  KToggleAction* toggleAlwaysVisibleAction;
85 
86  Kopete::Contact::NameType preferredNameType;
87  QString oldName;
88 };
89 
90 /* static */
91 Kopete::Contact::NameType Kopete::Contact::nameTypeFromString(const QString &nameType)
92 {
93  if (nameType == "nickName")
94  return Kopete::Contact::NickName;
95  else if (nameType == "customName")
96  return Kopete::Contact::CustomName;
97  else if (nameType == "formattedName")
98  return Kopete::Contact::FormattedName;
99  else if (nameType == "contactId")
100  return Kopete::Contact::ContactId;
101  else // fallback to custom name
102  return Kopete::Contact::CustomName;
103 }
104 
105 /* static */
106 const QString Kopete::Contact::nameTypeToString(Kopete::Contact::NameType nameType)
107 {
108  switch (nameType)
109  {
110  case Kopete::Contact::NickName:
111  return QString("nickName");
112  case Kopete::Contact::FormattedName:
113  return QString("formattedName");
114  case Kopete::Contact::ContactId:
115  return QString("contactId");
116  case Kopete::Contact::CustomName:
117  default: // fallback to custom name
118  return QString("customName");
119  }
120 }
121 
122 Contact::Contact( Account *account, const QString &contactId,
123  MetaContact *parent, const QString &icon )
124  : ContactListElement( parent ), d(new Private())
125 {
126  //kDebug( 14010 ) << "Creating contact with id " << contactId;
127 
128  d->contactId = contactId;
129  d->metaContact = parent;
130  connect( d->metaContact, SIGNAL(destroyed(QObject*)), this, SLOT(slotMetaContactDestroyed(QObject*)) );
131 
132  d->fileCapable = false;
133  d->account = account;
134  d->idleTime = 0;
135  d->icon = icon;
136  d->preferredNameType = Kopete::Contact::CustomName;
137  d->oldName = displayName();
138 
139  connect( this, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)),
140  this, SLOT(slotPropertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)) );
141 
142  bool duplicate = false;
143  // If can happend that a MetaContact may be used without a account
144  // (ex: for unit tests or chat window style preview)
145  if ( account )
146  {
147  // Don't register myself contacts because otherwise we can't have own contact in contact list.
148  if ( d->metaContact != Kopete::ContactList::self()->myself() )
149  duplicate = !account->registerContact( this );
150 
151  connect( account, SIGNAL(isConnectedChanged()), SLOT(slotAccountIsConnectedChanged()) );
152  }
153 
154  // Need to check this because myself() may have no parent
155  // Maybe too the metaContact doesn't have a valid protocol()
156  // (ex: for unit tests or chat window style preview)
157 
158  // if alreadyRegistered is true (which mean that this is duplicate contact) we will not add
159  // parent and the contact will die out on next Kopete restart.
160  if( !duplicate && parent && protocol() )
161  parent->addContact( this );
162 }
163 
164 Contact::~Contact()
165 {
166  //kDebug(14010) ;
167  emit( contactDestroyed( this ) );
168  delete d;
169 }
170 
171 
172 
173 OnlineStatus Contact::onlineStatus() const
174 {
175  if ( this == account()->myself() || account()->isConnected() )
176  return d->onlineStatus;
177  else
178  return protocol()->accountOfflineStatus();
179 }
180 
181 void Contact::setOnlineStatus( const OnlineStatus &status )
182 {
183  if( status == d->onlineStatus )
184  return;
185 
186  const bool oldCanAcceptFiles = canAcceptFiles();
187  OnlineStatus oldStatus = d->onlineStatus;
188  d->onlineStatus = status;
189 
190  Kopete::Global::Properties *globalProps = Kopete::Global::Properties::self();
191 
192  // Contact changed from Offline to another known online status
193  if( oldStatus.status() == OnlineStatus::Offline &&
194  status.status() != OnlineStatus::Unknown &&
195  status.status() != OnlineStatus::Offline )
196  {
197  if ( !hasProperty( globalProps->onlineSince().key() ) )
198  setProperty( globalProps->onlineSince(), QDateTime::currentDateTime() );
199  // kDebug(14010) << "REMOVING lastSeen property for " << nickName();
200  removeProperty( globalProps->lastSeen() );
201  }
202  else if( oldStatus.status() != OnlineStatus::Offline &&
203  oldStatus.status() != OnlineStatus::Unknown &&
204  status.status() == OnlineStatus::Offline ) // Contact went back offline
205  {
206  removeProperty( globalProps->onlineSince() );
207  // kDebug(14010) << "SETTING lastSeen property for " << nickName();
208  setProperty( globalProps->lastSeen(), QDateTime::currentDateTime() );
209  }
210 
211  if ( this == account()->myself() || account()->isConnected() )
212  emit onlineStatusChanged( this, status, oldStatus );
213 
214  if ( oldCanAcceptFiles != canAcceptFiles() )
215  emit canAcceptFilesChanged();
216 }
217 
218 Kopete::StatusMessage Contact::statusMessage() const
219 {
220  return d->statusMessage;
221 }
222 
223 void Contact::setStatusMessage( const Kopete::StatusMessage &statusMessage )
224 {
225  bool emitUpdate = true;
226 
227  if ( d->statusMessage.title() == statusMessage.title() && d->statusMessage.message() == statusMessage.message() )
228  emitUpdate = false;
229 
230  d->statusMessage = statusMessage;
231 
232  kDebug(14010) << "Setting up the status title property with this: " << statusMessage.title();
233  if( !statusMessage.title().isEmpty() )
234  setProperty( Kopete::Global::Properties::self()->statusTitle(), statusMessage.title() );
235  else
236  removeProperty( Kopete::Global::Properties::self()->statusTitle() );
237 
238  kDebug(14010) << "Setting up the status message property with this: " << statusMessage.message();
239  if( !statusMessage.message().isEmpty() )
240  setProperty( Kopete::Global::Properties::self()->statusMessage(), statusMessage.message() );
241  else
242  removeProperty( Kopete::Global::Properties::self()->statusMessage() );
243 
244  if ( emitUpdate )
245  emit statusMessageChanged( this );
246 }
247 
248 void Contact::slotAccountIsConnectedChanged()
249 {
250  if ( this == account()->myself() )
251  return;
252 
253  if ( account()->isConnected() )
254  emit onlineStatusChanged( this, d->onlineStatus, protocol()->accountOfflineStatus() );
255  else
256  emit onlineStatusChanged( this, protocol()->accountOfflineStatus(), d->onlineStatus );
257 }
258 
259 
260 void Contact::sendFile( const KUrl &, const QString &, uint )
261 {
262  kWarning( 14010 ) << "Plugin "
263  << protocol()->pluginId() << " has enabled file sending, "
264  << "but didn't implement it!" << endl;
265 }
266 
267 void Contact::slotAddContact()
268 {
269  if( metaContact() )
270  {
271  metaContact()->setTemporary( false );
272  ContactList::self()->addMetaContact( metaContact() );
273  }
274 }
275 
276 KMenu* Contact::popupMenu( ChatSession * )
277 {
278  return popupMenu();
279 }
280 
281 KMenu* Contact::popupMenu()
282 {
283  KMenu *menu = new KMenu();
284 
285  QString titleText;
286  const QString nick = displayName();
287  if( nick == contactId() )
288  titleText = QString::fromLatin1( "%1 (%2)" ).arg( contactId(), onlineStatus().description() );
289  else
290  titleText = QString::fromLatin1( "%1 <%2> (%3)" ).arg( nick, contactId(), onlineStatus().description() );
291  menu->addTitle( titleText );
292 
293  if( metaContact() && metaContact()->isTemporary() && contactId() != account()->myself()->contactId() )
294  {
295  KAction *actionAddContact = new KAction( KIcon("list-add-user"), i18n( "&Add to Your Contact List" ), menu );
296  connect( actionAddContact, SIGNAL(triggered(bool)), this, SLOT(slotAddContact()) );
297 
298  menu->addAction(actionAddContact);
299  menu->addSeparator();
300  }
301 
302  // FIXME: After KDE 3.2 we should make isReachable do the isConnected call so it can be removed here - Martijn
303  const bool reach = account()->isConnected() && isReachable();
304  const bool myself = (this == account()->myself());
305 
306  KAction *actionSendMessage = KopeteStdAction::sendMessage( this, SLOT(sendMessage()), menu );
307  actionSendMessage->setEnabled( reach && !myself );
308  menu->addAction( actionSendMessage );
309 
310  KAction *actionChat = KopeteStdAction::chat( this, SLOT(startChat()), menu );
311  actionChat->setEnabled( reach && !myself );
312  menu->addAction( actionChat );
313 
314  KAction *actionSendFile = KopeteStdAction::sendFile( this, SLOT(sendFile()), menu );
315  actionSendFile->setEnabled( reach && d->fileCapable && !myself );
316  menu->addAction( actionSendFile );
317 
318  // Protocol specific options will go below this separator
319  // through the use of the customContextMenuActions() function
320 
321  // Get the custom actions from the protocols ( pure virtual function )
322  QList<KAction*> *customActions = customContextMenuActions();
323  if( customActions && !customActions->isEmpty() )
324  {
325  menu->addSeparator();
326  QList<KAction*>::iterator it, itEnd = customActions->end();
327  for( it = customActions->begin(); it != itEnd; ++it )
328  menu->addAction( (*it) );
329  }
330  delete customActions;
331 
332  menu->addSeparator();
333 
334  if( metaContact() && !metaContact()->isTemporary() )
335  {
336  KAction* changeMetaContact = KopeteStdAction::changeMetaContact( this, SLOT(changeMetaContact()), menu );
337  menu->addAction( changeMetaContact );
338 
339  d->toggleAlwaysVisibleAction = new KToggleAction( i18n( "Visible when offline" ), menu );
340  d->toggleAlwaysVisibleAction->setChecked( property( Kopete::Global::Properties::self()->isAlwaysVisible() ).value().toBool() );
341  menu->addAction( d->toggleAlwaysVisibleAction );
342  connect( d->toggleAlwaysVisibleAction, SIGNAL(toggled(bool)), this, SLOT(toggleAlwaysVisible()) );
343  }
344 
345  menu->addAction( KopeteStdAction::contactInfo( this, SLOT(slotUserInfo()), menu ) );
346 
347 #if 0 //this is not fully implemented yet (and doesn't work). disable for now - Olivier 2005-01-11
348  if ( account()->isBlocked( d->contactId ) )
349  KopeteStdAction::unblockContact( this, SLOT(slotUnblock()), menu, "actionUnblockContact" )->plug( menu );
350  else
351  KopeteStdAction::blockContact( this, SLOT(slotBlock()), menu, "actionBlockContact" )->plug( menu );
352 #endif
353 
354  if( metaContact() && !metaContact()->isTemporary() )
355  menu->addAction( KopeteStdAction::deleteContact( this, SLOT(slotDelete()), menu ) );
356 
357  return menu;
358 }
359 
360 void Contact::toggleAlwaysVisible()
361 {
362  bool alwaysVisible = property( Kopete::Global::Properties::self()->isAlwaysVisible() ).value().toBool();
363  setProperty( Kopete::Global::Properties::self()->isAlwaysVisible(), !alwaysVisible );
364  d->toggleAlwaysVisibleAction->setChecked( !alwaysVisible );
365 }
366 
367 void Contact::changeMetaContact()
368 {
369  QPointer <KDialog> moveDialog = new KDialog( Kopete::UI::Global::mainWidget() );
370  moveDialog->setCaption( i18n( "Move Contact" ) );
371  moveDialog->setButtons( KDialog::Ok | KDialog::Cancel );
372  moveDialog->setDefaultButton( KDialog::Ok );
373  moveDialog->showButtonSeparator( true );
374 
375  KVBox *w = new KVBox( moveDialog );
376  w->setSpacing( KDialog::spacingHint() );
377  Kopete::UI::MetaContactSelectorWidget *selector = new Kopete::UI::MetaContactSelectorWidget(w);
378  selector->setLabelMessage(i18n( "Select the meta contact to which you want to move this contact:" ));
379  // exclude this metacontact as a target metacontact for the move
380  selector->excludeMetaContact( metaContact() );
381  QCheckBox *chkCreateNew = new QCheckBox( i18n( "Create a new metacontact for this contact" ), w );
382  chkCreateNew ->setWhatsThis( i18n( "If you select this option, a new metacontact will be created in the top-level group "
383  "with the name of this contact and the contact will be moved to it." ) );
384  QObject::connect( chkCreateNew , SIGNAL(toggled(bool)) , selector , SLOT (setDisabled(bool)) ) ;
385 
386  moveDialog->setMainWidget(w);
387  if( moveDialog->exec() == QDialog::Accepted )
388  {
389  Kopete::MetaContact *mc = selector->metaContact();
390  if(chkCreateNew->isChecked())
391  {
392  mc=new Kopete::MetaContact();
393 
394  if ( metaContact() )
395  { // Add new metaContact to old groups so we don't move it to Top Level group
396  foreach ( Kopete::Group* group, metaContact()->groups() )
397  mc->addToGroup( group );
398  }
399 
400  Kopete::ContactList::self()->addMetaContact(mc);
401  }
402  if( mc )
403  {
404  setMetaContact( mc );
405  }
406  }
407 
408  if ( moveDialog )
409  moveDialog->deleteLater();
410 }
411 
412 void Contact::slotMetaContactDestroyed( QObject* mc )
413 {
414  if (mc != d->metaContact)
415  return;
416 
417  d->metaContact = 0;
418 }
419 
420 void Contact::setMetaContact( MetaContact *m )
421 {
422  MetaContact *old = d->metaContact;
423  if(old==m) //that make no sens
424  return;
425 
426  if( old )
427  {
428  old->removeContact( this );
429  disconnect( old, SIGNAL(destroyed(QObject*)), this, SLOT(slotMetaContactDestroyed(QObject*)) );
430 
431  if(old->contacts().isEmpty())
432  {
433  //remove the old metacontact. (this delete the MC)
434  ContactList::self()->removeMetaContact(old);
435  }
436  else
437  {
438  d->metaContact = m; //i am forced to do that now if i want the next line works
439  //remove cached data for this protocol which will not be removed since we disconnected
440  protocol()->serialize( old );
441  }
442  }
443 
444  d->metaContact = m;
445  setParent( m );
446 
447  if( m )
448  {
449  m->addContact( this );
450  connect( m, SIGNAL(destroyed(QObject*)), this, SLOT(slotMetaContactDestroyed(QObject*)) );
451  // it is necessary to call this write here, because MetaContact::addContact() does not differentiate
452  // between adding completely new contacts (which should be written to kabc) and restoring upon restart
453  // (where no write is needed).
454  KABCPersistence::self()->write( m );
455  }
456  sync();
457 }
458 
459 void Contact::serialize( QMap<QString, QString> &/*serializedData*/,
460  QMap<QString, QString> & /* addressBookData */ )
461 {
462 }
463 
464 bool Contact::isReachable()
465 {
466  // The default implementation returns false when offline and true
467  // otherwise. Subclass if you need more control over the process.
468  return onlineStatus().status() != OnlineStatus::Offline;
469 }
470 
471 
472 void Contact::startChat()
473 {
474  KopeteView *v=manager( CanCreate )->view(true, QString::fromLatin1("kopete_chatwindow") );
475  if(v)
476  v->raise(true);
477 }
478 
479 void Contact::sendMessage()
480 {
481  KopeteView *v=manager( CanCreate )->view(true, QString::fromLatin1("kopete_emailwindow") );
482  if(v)
483  v->raise(true);
484 }
485 
486 void Contact::execute()
487 {
488  // FIXME: After KDE 3.2 remove the isConnected check and move it to isReachable - Martijn
489  if ( account()->isConnected() && isReachable() )
490  {
491  KopeteView *v=manager( CanCreate )->view(true, Kopete::BehaviorSettings::self()->viewPlugin() );
492  if(v)
493  v->raise(true);
494  }
495  else
496  {
497  KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
498  i18n( "This user is not reachable at the moment. Please try a protocol that supports offline sending, or wait "
499  "until this user comes online." ), i18n( "User is Not Reachable" ) );
500  }
501 }
502 
503 void Contact::slotDelete()
504 {
505  if ( KMessageBox::warningContinueCancel( Kopete::UI::Global::mainWidget(),
506  i18n( "Are you sure you want to remove the contact '%1' from your contact list?" ,
507  d->contactId ), i18n( "Remove Contact" ), KGuiItem(i18n("Remove"), QString::fromLatin1("list-remove-user") ), KStandardGuiItem::cancel(),
508  QString::fromLatin1("askRemoveContact"), KMessageBox::Notify | KMessageBox::Dangerous )
509  == KMessageBox::Continue )
510  {
511  Kopete::DeleteContactTask *deleteTask = new Kopete::DeleteContactTask(this);
512  deleteTask->start();
513  }
514 }
515 
516 void Contact::deleteContact()
517 {
518  // Default implementation simply deletes the contact
519  deleteLater();
520 }
521 
522 
523 MetaContact * Contact::metaContact() const
524 {
525  return d->metaContact;
526 }
527 
528 QString Contact::contactId() const
529 {
530  return d->contactId;
531 }
532 
533 Protocol * Contact::protocol() const
534 {
535  return d->account ? d->account->protocol() : 0L;
536 }
537 
538 Account * Contact::account() const
539 {
540  return d->account;
541 }
542 
543 
544 
545 void Contact::sync(unsigned int)
546 {
547  /* Default implementation does nothing */
548 }
549 
550 QString& Contact::icon() const
551 {
552  return d->icon;
553 }
554 
555 void Contact::setIcon( const QString& icon )
556 {
557  d->icon = icon;
558  return;
559 }
560 
561 QList<KAction *> *Contact::customContextMenuActions()
562 {
563  return 0L;
564 }
565 
566 QList<KAction*> *Contact::customContextMenuActions( ChatSession * /* manager */ )
567 {
568  return customContextMenuActions();
569 }
570 
571 bool Contact::isOnline() const
572 {
573  return onlineStatus().isDefinitelyOnline();
574 }
575 
576 bool Contact::isFileCapable() const
577 {
578  return d->fileCapable;
579 }
580 
581 void Contact::setFileCapable( bool filecap )
582 {
583  if ( d->fileCapable != filecap )
584  {
585  d->fileCapable = filecap;
586  emit canAcceptFilesChanged();
587  }
588 }
589 
590 bool Contact::canAcceptFiles() const
591 {
592  return isOnline() && d->fileCapable;
593 }
594 
595 unsigned long int Contact::idleTime() const
596 {
597  if(d->idleTime==0)
598  return 0;
599 
600  return d->idleTime+(d->idleTimer.elapsed()/1000);
601 }
602 
603 void Contact::setIdleTime( unsigned long int t )
604 {
605  bool idleChanged = false;
606  if(d->idleTime != t)
607  idleChanged = true;
608  d->idleTime=t;
609  if(t > 0)
610  d->idleTimer.start();
611 //FIXME: if t == 0, idleTime() will now return garbage
612 // else
613 // d->idleTimer.stop();
614  if(idleChanged)
615  emit idleStateChanged(this);
616 }
617 
618 QString Contact::toolTip() const
619 {
620  Kopete::Property p;
621  QString tip;
622  const QStringList shownProps = Kopete::AppearanceSettings::self()->toolTipContents();
623 
624  // --------------------------------------------------------------------------
625  // Fixed part of tooltip
626 
627  QString iconName;
628  if ( this == account()->myself() )
629  {
630  iconName = QString::fromLatin1("kopete-account-icon:%1:%2")
631  .arg( QString(QUrl::toPercentEncoding( protocol()->pluginId() )),
632  QString(QUrl::toPercentEncoding( account()->accountId() )) );
633 
634  }
635  else
636  {
637  iconName = QString::fromLatin1("kopete-contact-icon:%1:%2:%3")
638  .arg( QString(QUrl::toPercentEncoding( protocol()->pluginId() )),
639  QString(QUrl::toPercentEncoding( account()->accountId() )),
640  QString(QUrl::toPercentEncoding( contactId() )) );
641  }
642 
643  QString nick = displayName();
644  if ( nick == contactId() )
645  {
646  tip = i18nc( "@label:textbox %3 is contact-display-name, %1 is its status",
647  "<b><nobr>%3</nobr></b><br /><img src=\"%2\">&nbsp;%1",
648  Kopete::Message::escape( onlineStatus().description() ), iconName,
649  Kopete::Message::escape( d->contactId ) );
650  }
651  else
652  {
653  tip = i18nc( "@label:textbox %4 is contact-display-name, %3 is contact-id, %1 is its status",
654  "<nobr><b>%4</b> (%3)</nobr><br /><img src=\"%2\">&nbsp;%1",
655  Kopete::Message::escape( onlineStatus().description() ), iconName,
656  Kopete::Message::escape( contactId() ),
657  Kopete::Emoticons::parseEmoticons( Kopete::Message::escape( nick ) ) );
658  }
659 
660  // --------------------------------------------------------------------------
661  // Configurable part of tooltip
662 
663  // FIXME: It shouldn't use QString to identity the properties. Instead it should use PropertyTmpl::key()
664  for(QStringList::ConstIterator it=shownProps.constBegin(); it!=shownProps.constEnd(); ++it)
665  {
666  if((*it) == Kopete::Global::Properties::self()->fullName().key())
667  {
668  const QString name = formattedName();
669  if(!name.isEmpty())
670  {
671  tip += i18nc("@label:textbox formatted name",
672  "<br /><b>Full Name:</b>&nbsp;<nobr>%1</nobr>", Qt::escape(name));
673  }
674  }
675  else if ((*it) == Kopete::Global::Properties::self()->idleTime().key())
676  {
677  const QString time = formattedIdleTime();
678  if(!time.isEmpty())
679  {
680  tip += i18nc("@label:textbox formatted idle time",
681  "<br /><b>Idle:</b>&nbsp;<nobr>%1</nobr>", time);
682  }
683  }
684  else if ((*it) == QString::fromLatin1("homePage"))
685  {
686  const QString url = property(*it).value().toString();
687  if(!url.isEmpty())
688  {
689  tip += i18nc("@label:textbox formatted url",
690  "<br /><b>Home Page:</b>&nbsp;<a href=\"%1\"><nobr>%2</nobr></a>",
691  QString(QUrl::toPercentEncoding( url )), Kopete::Message::escape( Qt::escape(url) ) );
692  }
693  }
694  else if ((*it) == Kopete::Global::Properties::self()->statusTitle().key() )
695  {
696  const QString statusTitle = property(*it).value().toString();
697  if(!statusTitle.isEmpty())
698  {
699  tip += i18nc("@label:textbox formatted status title",
700  "<br /><b>Status&nbsp;Title:</b>&nbsp;%1", Kopete::Emoticons::parseEmoticons( Kopete::Message::escape(statusTitle) ) );
701  }
702  }
703  else if ((*it) == Kopete::Global::Properties::self()->statusMessage().key() )
704  {
705  const QString statusmsg = property(*it).value().toString();
706  if(!statusmsg.isEmpty())
707  {
708  tip += i18nc("@label:textbox formatted status message",
709  "<br /><b>Status&nbsp;Message:</b>&nbsp;%1", Kopete::Emoticons::parseEmoticons( Kopete::Message::escape(statusmsg) ) );
710  }
711  }
712  else
713  {
714  p = property(*it);
715  if(!p.isNull())
716  {
717  QVariant val = p.value();
718  QString valueText;
719 
720  switch(val.type())
721  {
722  case QVariant::DateTime:
723  valueText = KGlobal::locale()->formatDateTime(val.toDateTime());
724  valueText = Kopete::Message::escape( valueText );
725  break;
726  case QVariant::Date:
727  valueText = KGlobal::locale()->formatDate(val.toDate());
728  valueText = Kopete::Message::escape( valueText );
729  break;
730  case QVariant::Time:
731  valueText = KGlobal::locale()->formatTime(val.toTime());
732  valueText = Kopete::Message::escape( valueText );
733  break;
734  default:
735  if( p.isRichText() )
736  {
737  valueText = val.toString();
738  }
739  else
740  {
741  valueText = Kopete::Message::escape( val.toString() );
742  }
743  }
744 
745  if (valueText.size() > 1000) {
746  valueText.truncate(997);
747  valueText += "...";
748  }
749 
750  tip += i18nc("@label:textbox property label %2 is name, %1 is value",
751  "<br /><nobr><b>%2:</b></nobr>&nbsp;%1",
752  valueText, Qt::escape(p.tmpl().label()) );
753  }
754  }
755  }
756 
757  return tip;
758 }
759 
760 QString Kopete::Contact::formattedName() const
761 {
762  if( hasProperty( Kopete::Global::Properties::self()->fullName().key() ) )
763  return property( Kopete::Global::Properties::self()->fullName() ).value().toString();
764 
765  QString ret;
766  Kopete::Property first, last;
767 
768  first = property( Kopete::Global::Properties::self()->firstName() );
769  last = property( Kopete::Global::Properties::self()->lastName() );
770  if(!first.isNull())
771  {
772  if(!last.isNull()) // contact has both first and last name
773  {
774  ret = i18nc("firstName lastName", "%2 %1",
775  last.value().toString(),
776  first.value().toString());
777  }
778  else // only first name set
779  {
780  ret = first.value().toString();
781  }
782  }
783  else if(!last.isNull()) // only last name set
784  {
785  ret = last.value().toString();
786  }
787 
788  return ret;
789 }
790 
791 QString Kopete::Contact::formattedIdleTime() const
792 {
793  QString ret;
794  unsigned long int leftTime = idleTime();
795 
796  if ( leftTime > 0 )
797  { // FIXME: duplicated from code in kopetecontact listview.cpp
798  unsigned long int days, hours, mins, secs;
799 
800  days = leftTime / ( 60*60*24 );
801  leftTime = leftTime % ( 60*60*24 );
802  hours = leftTime / ( 60*60 );
803  leftTime = leftTime % ( 60*60 );
804  mins = leftTime / 60;
805  secs = leftTime % 60;
806 
807  if ( days != 0 )
808  {
809  ret = i18nc( "<days>d <hours>h <minutes>m <seconds>s",
810  "%4d %3h %2m %1s" ,
811  secs ,
812  mins ,
813  hours ,
814  days );
815  }
816  else if ( hours != 0 )
817  {
818  ret = i18nc( "<hours>h <minutes>m <seconds>s", "%3h %2m %1s" ,
819  secs ,
820  mins ,
821  hours );
822  }
823  else
824  {
825  // xgettext: no-c-format
826  ret = i18nc( "<minutes>m <seconds>s", "%2m %1s" ,
827  secs ,
828  mins );
829  }
830  }
831  return ret;
832 }
833 
834 void Kopete::Contact::slotBlock()
835 {
836  account()->block( d->contactId );
837 }
838 
839 void Kopete::Contact::slotUnblock()
840 {
841  account()->unblock( d->contactId );
842 }
843 
844 void Kopete::Contact::setNickName( const QString &name )
845 {
846  setProperty( Kopete::Global::Properties::self()->nickName(), name );
847 }
848 
849 QString Kopete::Contact::nickName() const
850 {
851  const QString nick = property( Kopete::Global::Properties::self()->nickName() ).value().toString();
852  if( !nick.isEmpty() )
853  return nick;
854 
855  return contactId();
856 }
857 
858 void Kopete::Contact::setCustomName( const QString &name )
859 {
860  setProperty( Kopete::Global::Properties::self()->customName(), name );
861 }
862 
863 QString Kopete::Contact::customName() const
864 {
865  const QString name = property( Kopete::Global::Properties::self()->customName() ).value().toString();
866  if (!name.isEmpty())
867  return name;
868  return nickName();
869 }
870 
871 void Kopete::Contact::setPhoto(const QString &photoPath)
872 {
873  setProperty( Kopete::Global::Properties::self()->photo(), photoPath );
874 }
875 
876 void Kopete::Contact::slotPropertyChanged(Kopete::PropertyContainer *, const QString &key,
877  const QVariant &, const QVariant &)
878 {
879  if (key != Kopete::Global::Properties::self()->customName().key()
880  && key != Kopete::Global::Properties::self()->fullName().key()
881  && key != Kopete::Global::Properties::self()->firstName().key()
882  && key != Kopete::Global::Properties::self()->lastName().key()
883  && key != Kopete::Global::Properties::self()->nickName().key())
884  return;
885 
886  const QString oldName = d->oldName;
887  const QString newName = displayName();
888  if (oldName != newName) {
889  d->oldName = newName;
890  emit displayNameChanged(oldName, newName);
891  }
892 }
893 
894 void Kopete::Contact::setPreferredNameType(Kopete::Contact::NameType preferredNameType)
895 {
896  if (d->preferredNameType != preferredNameType)
897  {
898  const QString oldName = displayName();
899  d->preferredNameType = preferredNameType;
900  const QString newName = displayName();
901  if (oldName != newName) {
902  d->oldName = newName;
903  emit displayNameChanged(oldName, newName);
904  }
905  }
906 }
907 
908 Kopete::Contact::NameType Kopete::Contact::preferredNameType() const
909 {
910  return d->preferredNameType;
911 }
912 
913 QString Kopete::Contact::displayName() const
914 {
915  QString name;
916  switch (d->preferredNameType)
917  {
918  case NickName:
919  name = nickName();
920  break;
921  case FormattedName:
922  name = formattedName();
923  break;
924  case ContactId:
925  name = contactId();
926  break;
927  case CustomName:
928  default: // fallback to custom name
929  name = customName();
930  break;
931  }
932  if (name.isEmpty())
933  return contactId();
934  else
935  return name;
936 }
937 
938 
939 } //END namespace Kopete
940 
941 #include "kopetecontact.moc"
Kopete::Contact::isReachable
virtual bool isReachable()
Get whether this contact can receive messages.
Definition: kopetecontact.cpp:464
Kopete::Contact::setStatusMessage
void setStatusMessage(const Kopete::StatusMessage &statusMessage)
Set the contact's status message.
Definition: kopetecontact.cpp:223
Kopete::ContactList::myself
MetaContact * myself()
return the metacontact that represent the user itself.
Definition: kopetecontactlist.cpp:349
Kopete::Contact::NameType
NameType
Definition: kopetecontact.h:84
kopetemetacontact.h
Kopete::ContactList::self
static ContactList * self()
The contact list is a singleton object.
Definition: kopetecontactlist.cpp:71
Kopete::OnlineStatus
Definition: kopeteonlinestatus.h:68
status
OnlineStatus::StatusType status
Definition: kopeteonlinestatus.cpp:103
Kopete::DeleteContactTask::start
virtual void start()
Begin the task.
Definition: kopetedeletecontacttask.cpp:52
KopeteStdAction::changeMetaContact
static KAction * changeMetaContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to change a contacts Kopete::MetaContact.
Definition: kopetestdaction.cpp:116
Kopete::Account::myself
Contact * myself() const
Retrieve the 'myself' contact.
Definition: kopeteaccount.cpp:537
Kopete::MetaContact::addToGroup
void addToGroup(Kopete::Group *to)
Add a contact to another group.
Definition: kopetemetacontact.cpp:1045
QString::truncate
void truncate(int position)
kopeteappearancesettings.h
Kopete::MetaContact::setTemporary
void setTemporary(bool b=true, Kopete::Group *group=0L)
Set if this is a temporary contact.
Definition: kopetemetacontact.cpp:1150
Kopete::PropertyContainer::propertyChanged
void propertyChanged(Kopete::PropertyContainer *container, const QString &key, const QVariant &oldValue, const QVariant &newValue)
Kopete::Emoticons::parseEmoticons
static QString parseEmoticons(const QString &text, KEmoticonsTheme::ParseMode mode=KEmoticonsTheme::DefaultParse, const QStringList &exclude=QStringList())
Definition: kopeteemoticons.cpp:36
Kopete::Global::Properties::self
static Properties * self()
Singleton accessor for this class.
Definition: kopeteglobal.cpp:49
Kopete::Contact::toggleAlwaysVisible
void toggleAlwaysVisible()
Toggle the visibility of this contact even if offline.
Definition: kopetecontact.cpp:360
Kopete::Contact::execute
void execute()
The user clicked on the contact, do the default action.
Definition: kopetecontact.cpp:486
Kopete::Contact::canAcceptFilesChanged
void canAcceptFilesChanged()
Emitted when the file transfer capability of this contact has changed.
kopeteaccount.h
Kopete::UI::MetaContactSelectorWidget::excludeMetaContact
void excludeMetaContact(Kopete::MetaContact *mc)
excludes a metacontact from being shown in the list if the metacontact is already excluded...
Definition: metacontactselectorwidget.cpp:262
metacontactselectorwidget.h
Kopete::Contact::onlineStatusChanged
void onlineStatusChanged(Kopete::Contact *contact, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldStatus)
The contact's online status changed.
Kopete::Contact::icon
QString & icon() const
Returns the name of the icon to use for this contact If null, the protocol icon need to be used...
KopeteView::raise
virtual void raise(bool activate=false)=0
Raises the view above other windows.
Kopete::Contact::setMetaContact
void setMetaContact(MetaContact *m)
Move this contact to a new MetaContact.
Definition: kopetecontact.cpp:420
Kopete::StatusMessage
This class encapsulate a status message.
Definition: kopetestatusmessage.h:48
QVariant::toDateTime
QDateTime toDateTime() const
KopeteStdAction::unblockContact
static KAction * unblockContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to unblock a contact.
Definition: kopetestdaction.cpp:139
Kopete::KABCPersistence::write
void write(MetaContact *mc)
Change the KABC data associated with this metacontact.
Definition: kabcpersistence.cpp:102
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
kabcpersistence.h
Kopete::Contact::idleStateChanged
void idleStateChanged(Kopete::Contact *contact)
The contact's idle state changed.
Kopete::Account::isConnected
bool isConnected
Definition: kopeteaccount.h:81
Kopete::DeleteContactTask
Delete a contact in Kopete.
Definition: kopetedeletecontacttask.h:52
QMap
QVariant::toTime
QTime toTime() const
QString::size
int size() const
Kopete::OnlineStatus::Unknown
Refers to protocols where state cannot be determined.
Definition: kopeteonlinestatus.h:90
Kopete::PropertyContainer::property
const Kopete::Property & property(const QString &key) const
Get the value of a property with key "key".
Definition: kopetepropertycontainer.cpp:111
QPointer
Kopete::OnlineStatus::Offline
State where you really cannot be contacted.
Definition: kopeteonlinestatus.h:98
Kopete::Contact::account
Account * account() const
Get the account that this contact belongs to.
Definition: kopetecontact.cpp:538
KDialog
Kopete::MetaContact::removeContact
void removeContact(Contact *c, bool deleted=false)
remove the contact from this metacontact
Definition: kopetemetacontact.cpp:165
Kopete::OnlineStatus::status
StatusType status() const
Return the status.
Definition: kopeteonlinestatus.cpp:242
Kopete::OnlineStatus::isDefinitelyOnline
bool isDefinitelyOnline() const
Definition: kopeteonlinestatus.cpp:287
Kopete::Property::isRichText
bool isRichText() const
Returns true if this property is HTML formatted.
Definition: kopeteproperty.cpp:244
Kopete::Global::Properties
Global facility to query/store templates that are needed by KopeteProperty.
Definition: kopeteglobal.h:45
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
Kopete::ChatSession
Definition: kopetechatsession.h:74
QTime
Kopete::Contact::canAcceptFiles
bool canAcceptFiles() const
Get whether or not this contact can accept file transfers.
Kopete::Contact::nickName
QString nickName() const
Convenience method to retrieve the nickName property.
Kopete::Contact::statusMessageChanged
void statusMessageChanged(Kopete::Contact *contact)
The contact's status message changed.
Kopete::Contact::FormattedName
Formatted name (first and/or last name)
Definition: kopetecontact.h:87
kopeteuiglobal.h
Kopete::Contact::formattedName
QString formattedName() const
Returns a formatted string of "firstName" and/or "lastName" properties if present.
Kopete::Contact::contactDestroyed
void contactDestroyed(Kopete::Contact *contact)
The contact is about to be destroyed.
kopeteinfodialog.h
Kopete::Global::Properties::fullName
const PropertyTmpl & fullName() const
Definition: kopeteglobal.cpp:128
Kopete::Contact::CustomName
Custom name set by user and stored on server contact list, can be changed.
Definition: kopetecontact.h:86
Kopete::UI::MetaContactSelectorWidget::setLabelMessage
void setLabelMessage(const QString &msg)
sets the widget label message example: Please select a contact or, Choose a contact to delete ...
Definition: metacontactselectorwidget.cpp:296
QObject::name
const char * name() const
KopeteStdAction::sendFile
static KAction * sendFile(const QObject *recvr, const char *slot, QObject *parent)
Standard action to initiate sending a file to a contact.
Definition: kopetestdaction.cpp:96
Kopete::Contact::onlineStatus
OnlineStatus onlineStatus() const
Get the online status of the contact.
Definition: kopetecontact.cpp:173
Kopete::Contact::ContactId
Contact id, will never change.
Definition: kopetecontact.h:88
Kopete::Contact::slotUserInfo
virtual void slotUserInfo()
Method to retrieve user information.
Definition: kopetecontact.h:454
Kopete::Contact::protocol
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:533
Kopete::Message::escape
static QString escape(const QString &)
Transform a plaintext message into HTML.
Definition: kopetemessage.cpp:351
Kopete::ContactListElement
Definition: kopetecontactlistelement.h:46
Kopete::Property::tmpl
const PropertyTmpl & tmpl() const
Getter for this properties template.
Definition: kopeteproperty.cpp:234
kopeteemoticons.h
kopetedeletecontacttask.h
QObject
Kopete::Plugin::pluginId
QString pluginId() const
Get the plugin id.
Definition: kopeteplugin.cpp:46
QCheckBox
kopetestatusmessage.h
Kopete::Contact::popupMenu
KMenu * popupMenu()
Get the Context Menu for this contact.
Definition: kopetecontact.cpp:281
kopeteprotocol.h
Kopete::Contact::sendFile
virtual void sendFile(const KUrl &sourceURL=KUrl(), const QString &fileName=QString(), uint fileSize=0L)
This is the Contact level slot for sending files.
Definition: kopetecontact.cpp:260
QList::isEmpty
bool isEmpty() const
Kopete::StatusMessage::message
QString message() const
Return the current status message.
Definition: kopetestatusmessage.cpp:75
Kopete::Contact::setPhoto
void setPhoto(const QString &photoPath)
Convience method to set the photo property.
Definition: kopetecontact.cpp:871
KopeteStdAction::sendMessage
static KAction * sendMessage(const QObject *recvr, const char *slot, QObject *parent)
Standard action to send a single message.
Definition: kopetestdaction.cpp:86
Kopete::Contact::manager
virtual ChatSession * manager(CanCreateFlags canCreate=CannotCreate)=0
Returns the primary message manager affiliated with this contact Although a contact can have more tha...
QString::isEmpty
bool isEmpty() const
kopetechatsession.h
KopeteStdAction::blockContact
static KAction * blockContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to block a contact.
Definition: kopetestdaction.cpp:134
kopetecontactlist.h
KopeteStdAction::contactInfo
static KAction * contactInfo(const QObject *recvr, const char *slot, QObject *parent)
Standard action to open a user info dialog.
Definition: kopetestdaction.cpp:91
Kopete::MetaContact::contacts
QList< Contact * > contacts() const
Retrieve the list of contacts that are part of the meta contact.
Definition: kopetemetacontact.cpp:1279
Kopete::PropertyContainer::hasProperty
bool hasProperty(const QString &key) const
Check for existence of a certain property stored using "key".
Definition: kopetepropertycontainer.cpp:106
QObject::deleteLater
void deleteLater()
QString
QList< KAction * >
Kopete::Contact::startChat
void startChat()
This should typically pop up a KopeteChatWindow.
Definition: kopetecontact.cpp:472
Kopete::Contact::formattedIdleTime
QString formattedIdleTime() const
Returns a formatted string of idleTime().
KopeteStdAction::chat
static KAction * chat(const QObject *recvr, const char *slot, QObject *parent)
Standard action to start a chat.
Definition: kopetestdaction.cpp:81
QStringList
Kopete::Contact::changeMetaContact
void changeMetaContact()
Changes the MetaContact that this contact is a part of.
Definition: kopetecontact.cpp:367
QList::end
iterator end()
QObject::setParent
void setParent(QObject *parent)
Kopete::Contact::statusMessage
Kopete::StatusMessage statusMessage() const
Get the current status message of the contact.
Definition: kopetecontact.cpp:218
Kopete::AppearanceSettings::self
static AppearanceSettings * self()
Definition: kopeteappearancesettings.cpp:23
Kopete::Account::registerContact
bool registerContact(Contact *c)
Definition: kopeteaccount.cpp:310
Kopete::Global::Properties::lastSeen
const PropertyTmpl & lastSeen() const
Definition: kopeteglobal.cpp:146
Kopete::PropertyContainer::removeProperty
void removeProperty(const Kopete::PropertyTmpl &tmpl)
Remove a property if it exists.
Definition: kopetepropertycontainer.cpp:158
Kopete::UI::Global::mainWidget
KOPETE_EXPORT QWidget * mainWidget()
Returns the main widget - this is the widget that message boxes and KNotify stuff should use as a par...
Definition: kopeteuiglobal.cpp:37
Kopete::ContactList::addMetaContact
void addMetaContact(Kopete::MetaContact *c)
Add the metacontact into the contact list When calling this method, the contact has to be already pla...
Definition: kopetecontactlist.cpp:235
Kopete::Contact::NickName
Nick name, comes from contact.
Definition: kopetecontact.h:85
Kopete::Contact::deleteContact
virtual KDE_DEPRECATED void deleteContact()
Definition: kopetecontact.cpp:516
QAbstractButton::isChecked
bool isChecked() const
Kopete::Global::Properties::statusMessage
const PropertyTmpl & statusMessage() const
Definition: kopeteglobal.cpp:158
Kopete::UI::MetaContactSelectorWidget
Definition: metacontactselectorwidget.h:38
Kopete::Contact::isOnline
bool isOnline() const
Get whether this contact is online.
QVariant::toDate
QDate toDate() const
QWidget::setWhatsThis
void setWhatsThis(const QString &)
QDateTime::currentDateTime
QDateTime currentDateTime()
Kopete::Contact::metaContact
MetaContact * metaContact() const
Get the metacontact for this contact.
Definition: kopetecontact.cpp:523
Kopete::MetaContact::addContact
void addContact(Contact *c)
Add a contact which has just been deserialised to the meta contact.
Definition: kopetemetacontact.cpp:91
Kopete::Protocol::serialize
void serialize(Kopete::MetaContact *metaContact)
Serialize meta contact into the metacontact's plugin data Call serialize() for all contained contacts...
Definition: kopeteprotocol.cpp:175
Kopete::Contact::preferredNameType
NameType preferredNameType() const
Returns prefered name type, used by displayName function Default is CustomName.
Definition: kopetecontact.cpp:908
Kopete::Property
Definition: kopeteproperty.h:150
Qt::escape
QString escape(const QString &plain)
Kopete::Global::Properties::onlineSince
const PropertyTmpl & onlineSince() const
Return default template for a contact's online-since time (i.e.
Definition: kopeteglobal.cpp:140
Kopete::Contact::nameTypeToString
static const QString nameTypeToString(NameType nameType)
Definition: kopetecontact.cpp:106
Kopete::Contact::setFileCapable
void setFileCapable(bool filecap)
Set the file transfer capability of this contact.
Definition: kopetecontact.cpp:581
Kopete::Contact::setPreferredNameType
void setPreferredNameType(NameType type)
Set preferred name type, used by displayName function.
Definition: kopetecontact.cpp:894
Kopete::BehaviorSettings::self
static BehaviorSettings * self()
Definition: kopetebehaviorsettings.cpp:23
Kopete::Contact::customName
QString customName() const
Convenience method to retrieve the customName property.
Definition: kopetecontact.cpp:863
KAction
QList::ConstIterator
typedef ConstIterator
Kopete::Group
Class which represents the Group.
Definition: kopetegroup.h:44
Kopete::PropertyContainer
Definition: kopetepropertycontainer.h:39
QUrl::toPercentEncoding
QByteArray toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include)
Kopete::ContactList::removeMetaContact
void removeMetaContact(Kopete::MetaContact *contact)
Remove a metacontact from the contact list.
Definition: kopetecontactlist.cpp:251
Kopete::Contact::displayName
QString displayName() const
Returns display name of contact.
Definition: kopetecontact.cpp:913
Kopete::Contact::toolTip
QString toolTip() const
Get the tooltip for this contact Makes use of formattedName() and formattedIdleTime().
Kopete::Contact::Contact
Contact(Account *account, const QString &id, MetaContact *parent, const QString &icon=QString())
Create new contact.
Definition: kopetecontact.cpp:122
QVariant::toBool
bool toBool() const
Kopete::Contact::sendMessage
void sendMessage()
Pops up an email type window.
Definition: kopetecontact.cpp:479
Kopete::Property::value
const QVariant & value() const
Getter for this properties value.
Definition: kopeteproperty.cpp:229
Kopete::PropertyContainer::setProperty
void setProperty(const Kopete::PropertyTmpl &tmpl, const QVariant &value)
Add or Set a property for this contact.
Definition: kopetepropertycontainer.cpp:129
Kopete::Contact::sync
virtual void sync(unsigned int changed=0xFF)
Syncronise the server and the metacontact.
Definition: kopetecontact.cpp:545
Kopete::MetaContact
Definition: kopetemetacontact.h:54
QString::fromLatin1
QString fromLatin1(const char *str, int size)
Kopete::PropertyTmpl::label
const QString & label() const
Getter for i18ned label.
Definition: kopeteproperty.cpp:142
Kopete::Contact::customContextMenuActions
virtual QList< KAction * > * customContextMenuActions()
Get the set of custom menu items for this contact.
Definition: kopetecontact.cpp:561
Kopete::Contact::isFileCapable
bool isFileCapable() const
Get whether or not this contact is capable of file transfers.
Definition: kopetecontact.cpp:576
Kopete::Contact::nameTypeFromString
static NameType nameTypeFromString(const QString &nameType)
These functions do conversion between enum NameType and QString Usefull for protocol serialize/deseri...
Definition: kopetecontact.cpp:91
Kopete::Protocol::accountOfflineStatus
Kopete::OnlineStatus accountOfflineStatus() const
Returns the status used for contacts when accounts of this protocol are offline.
Definition: kopeteprotocol.cpp:94
Kopete::Contact::CanCreate
Definition: kopetecontact.h:297
kopeteview.h
Kopete::Contact::setNickName
void setNickName(const QString &name)
Convenience method to set the nickName property to the specified value.
Definition: kopetecontact.cpp:844
Kopete::Property::isNull
bool isNull() const
Returns true if this object is an empty Property (i.e.
Definition: kopeteproperty.cpp:239
Kopete::Contact::setIcon
void setIcon(const QString &icon)
Change the icon to use for this contact If you don't want to have the protocol icon as icon for this ...
Definition: kopetecontact.cpp:555
Kopete::Contact::idleTime
virtual unsigned long int idleTime() const
Get the time (in seconds) this contact has been idle It will return the time set in setIdleTime() wit...
Definition: kopetecontact.cpp:595
Kopete::Contact::contactId
QString contactId() const
Get the unique id that identifies a contact.
QList::constEnd
const_iterator constEnd() const
Kopete::PropertyTmpl::key
const QString & key() const
Getter for the unique key.
Definition: kopeteproperty.cpp:137
QList::constBegin
const_iterator constBegin() const
QVariant::type
Type type() const
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::KABCPersistence::self
static KABCPersistence * self()
Retrieve the instance of AccountManager.
Definition: kabcpersistence.cpp:86
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::parent
QObject * parent() const
Kopete::Contact::setCustomName
void setCustomName(const QString &name)
Convenience method to set the customkName property to the specified value.
Definition: kopetecontact.cpp:858
kopetebehaviorsettings.h
Kopete::Contact::serialize
virtual void serialize(QMap< QString, QString > &serializedData, QMap< QString, QString > &addressBookData)
Serialize the contact for storage in the contact list.
Definition: kopetecontact.cpp:459
Kopete::Account
The Kopete::Account class handles one account.
Definition: kopeteaccount.h:72
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QVariant::toString
QString toString() const
Kopete::Contact::setOnlineStatus
void setOnlineStatus(const OnlineStatus &status)
Set the contact's online status.
Definition: kopetecontact.cpp:181
Kopete::AppearanceSettings::toolTipContents
static QStringList toolTipContents()
Get Contact properties that contact tooltip will show.
Definition: kopeteappearancesettings.h:384
Kopete::Contact::~Contact
~Contact()
Definition: kopetecontact.cpp:164
Kopete::UI::MetaContactSelectorWidget::metaContact
Kopete::MetaContact * metaContact()
Definition: metacontactselectorwidget.cpp:231
QList::begin
iterator begin()
kopetestdaction.h
QObject::destroyed
void destroyed(QObject *obj)
kopetecontact.h
kopeteglobal.h
Kopete::StatusMessage::title
QString title() const
Return the current status title.
Definition: kopetestatusmessage.cpp:109
Kopete::Contact::setIdleTime
void setIdleTime(unsigned long int)
Set the current idle time in seconds.
Definition: kopetecontact.cpp:603
Kopete::Global::Properties::statusTitle
const PropertyTmpl & statusTitle() const
Definition: kopeteglobal.cpp:152
name
const char * name
Definition: kopeteonlinestatus.cpp:104
KopeteStdAction::deleteContact
static KAction * deleteContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to delete a contact.
Definition: kopetestdaction.cpp:121
Kopete::Contact::fileCapable
bool fileCapable
Definition: kopetecontact.h:67
QVariant
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