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

kaddressbook

  • sources
  • kde-4.14
  • kdepim
  • kaddressbook
  • merge
  • widgets
mergecontactshowresulttabwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 
19 #include "mergecontactshowresulttabwidget.h"
20 #include "merge/widgets/mergecontactinfowidget.h"
21 #include <KABC/Addressee>
22 
23 #include <QTabBar>
24 #include <QDebug>
25 
26 using namespace KABMergeContacts;
27 
28 MergeContactShowResultTabWidget::MergeContactShowResultTabWidget(QWidget *parent)
29  : QTabWidget(parent)
30 {
31  updateTabWidget();
32 }
33 
34 MergeContactShowResultTabWidget::~MergeContactShowResultTabWidget()
35 {
36 }
37 
38 void MergeContactShowResultTabWidget::updateTabWidget()
39 {
40  tabBar()->setVisible(count()>1);
41 }
42 
43 bool MergeContactShowResultTabWidget::tabBarVisible() const
44 {
45  return tabBar()->isVisible();
46 }
47 
48 void MergeContactShowResultTabWidget::showMergedContacts(const Akonadi::Item::List &lstItem)
49 {
50  clear();
51  Q_FOREACH(const Akonadi::Item &item, lstItem) {
52  addMergedContact(item, false);
53  }
54  updateTabWidget();
55 }
56 
57 void MergeContactShowResultTabWidget::addMergedContact(const Akonadi::Item &item, bool updateTab)
58 {
59  if (item.hasPayload<KABC::Addressee>()) {
60  const KABC::Addressee address = item.payload<KABC::Addressee>();
61  MergeContactInfoWidget *infoWidget = new MergeContactInfoWidget;
62  infoWidget->setContact(item);
63  addTab(infoWidget, address.name());
64  if (updateTab)
65  updateTabWidget();
66  } else {
67  qDebug()<<" don't have address";
68  }
69 }
70 
KABMergeContacts::MergeContactShowResultTabWidget::updateTabWidget
void updateTabWidget()
Definition: mergecontactshowresulttabwidget.cpp:38
QWidget
KABMergeContacts::MergeContactShowResultTabWidget::tabBarVisible
bool tabBarVisible() const
Definition: mergecontactshowresulttabwidget.cpp:43
QWidget::setVisible
virtual void setVisible(bool visible)
KABMergeContacts::MergeContactShowResultTabWidget::addMergedContact
void addMergedContact(const Akonadi::Item &item, bool updateTab=false)
Definition: mergecontactshowresulttabwidget.cpp:57
QTabWidget::count
int count() const
QTabWidget
QTabWidget::clear
void clear()
KABMergeContacts::MergeContactInfoWidget::setContact
void setContact(const Akonadi::Item &item)
Definition: mergecontactinfowidget.cpp:59
QTabWidget::addTab
int addTab(QWidget *page, const QString &label)
KABMergeContacts::MergeContactInfoWidget
Definition: mergecontactinfowidget.h:31
KABMergeContacts::MergeContactShowResultTabWidget::MergeContactShowResultTabWidget
MergeContactShowResultTabWidget(QWidget *parent=0)
Definition: mergecontactshowresulttabwidget.cpp:28
mergecontactshowresulttabwidget.h
KABMergeContacts::MergeContactShowResultTabWidget::showMergedContacts
void showMergedContacts(const Akonadi::Item::List &lstItem)
Definition: mergecontactshowresulttabwidget.cpp:48
KABMergeContacts::MergeContactShowResultTabWidget::~MergeContactShowResultTabWidget
~MergeContactShowResultTabWidget()
Definition: mergecontactshowresulttabwidget.cpp:34
QTabWidget::tabBar
QTabBar * tabBar() const
mergecontactinfowidget.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

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