• 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
  • ui
addresseeitem.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "addresseeitem.h"
21 
22 #include <qlayout.h>
23 #include <qpushbutton.h>
24 #include <q3groupbox.h>
25 #include <qregexp.h>
26 #include <QPixmap>
27 
28 #include <klocale.h>
29 #include <kdebug.h>
30 
31 AddresseeItem::AddresseeItem( Q3ListView *parent, const KABC::Addressee &addressee) :
32  K3ListViewItem( parent ),
33  mAddressee( addressee )
34 {
35  //We can't save showphoto because we don't have a d pointer
36  KABC::Picture pic = mAddressee.photo();
37  if(!pic.isIntern())
38  pic = mAddressee.logo();
39  if(pic.isIntern())
40  {
41  QPixmap qpixmap = QPixmap::fromImage( pic.data().scaledToWidth(60) ); //60 pixels seems okay.. kmail uses 60 btw
42  setPixmap( Photo,qpixmap );
43  }
44 
45  setText( Name, addressee.realName() );
46  setText( Email, addressee.preferredEmail() );
47 }
48 
49 QString AddresseeItem::key( int column, bool ) const
50 {
51  if (column == Email) {
52  QString value = text(Email);
53  QRegExp emailRe(QString::fromLatin1("<\\S*>"));
54  int match = emailRe.indexIn(value);
55  if (match > -1)
56  value = value.mid(match + 1, emailRe.matchedLength() - 2);
57 
58  return value.toLower();
59  }
60 
61  return text(column).toLower();
62 }
63 
64 
AddresseeItem::AddresseeItem
AddresseeItem(Q3ListView *parent, const KABC::Addressee &addressee)
Constructor.
Definition: addresseeitem.cpp:31
AddresseeItem::Email
Definition: addresseeitem.h:41
QPixmap::fromImage
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
QRegExp::matchedLength
int matchedLength() const
QRegExp::indexIn
int indexIn(const QString &str, int offset, CaretMode caretMode) const
QRegExp
AddresseeItem::Photo
Definition: addresseeitem.h:41
AddresseeItem::Name
Definition: addresseeitem.h:41
QString
QPixmap
QString::toLower
QString toLower() const
addresseeitem.h
QString::mid
QString mid(int position, int n) const
QString::fromLatin1
QString fromLatin1(const char *str, int size)
AddresseeItem::key
virtual QString key(int column, bool ascending) const
Method used by QListView to sort the items.
Definition: addresseeitem.cpp:49
Q3ListView
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