• 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
  • xxport
  • vcard
vcardexportselectionwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 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 #include "vcardexportselectionwidget.h"
19 
20 #include <KLocalizedString>
21 
22 #include <kconfig.h>
23 #include <KConfigGroup>
24 #include <qcheckbox.h>
25 #include <qgridlayout.h>
26 #include <qgroupbox.h>
27 
28 VCardExportSelectionWidget::VCardExportSelectionWidget(QWidget *parent)
29  : QWidget(parent)
30 {
31  QGridLayout *layout = new QGridLayout( this );
32 
33  QGroupBox *gbox = new QGroupBox(
34  i18nc( "@title:group", "Fields to be exported" ), this );
35  gbox->setFlat( true );
36  layout->addWidget( gbox, 0, 0, 1, 2 );
37 
38  mPrivateBox = new QCheckBox( i18nc( "@option:check", "Private fields" ), this );
39  mPrivateBox->setToolTip(
40  i18nc( "@info:tooltip", "Export private fields" ) );
41  mPrivateBox->setWhatsThis(
42  i18nc( "@info:whatsthis",
43  "Check this box if you want to export the contact's "
44  "private fields to the vCard output file." ) );
45  layout->addWidget( mPrivateBox, 1, 0 );
46 
47  mBusinessBox = new QCheckBox( i18nc( "@option:check", "Business fields" ), this );
48  mBusinessBox->setToolTip(
49  i18nc( "@info:tooltip", "Export business fields" ) );
50  mBusinessBox->setWhatsThis(
51  i18nc( "@info:whatsthis",
52  "Check this box if you want to export the contact's "
53  "business fields to the vCard output file." ) );
54  layout->addWidget( mBusinessBox, 2, 0 );
55 
56  mOtherBox = new QCheckBox( i18nc( "@option:check", "Other fields" ), this );
57  mOtherBox->setToolTip(
58  i18nc( "@info:tooltip", "Export other fields" ) );
59  mOtherBox->setWhatsThis(
60  i18nc( "@info:whatsthis",
61  "Check this box if you want to export the contact's "
62  "other fields to the vCard output file." ) );
63  layout->addWidget( mOtherBox, 3, 0 );
64 
65  mEncryptionKeys = new QCheckBox( i18nc( "@option:check", "Encryption keys" ), this );
66  mEncryptionKeys->setToolTip(
67  i18nc( "@info:tooltip", "Export encryption keys" ) );
68  mEncryptionKeys->setWhatsThis(
69  i18nc( "@info:whatsthis",
70  "Check this box if you want to export the contact's "
71  "encryption keys to the vCard output file." ) );
72  layout->addWidget( mEncryptionKeys, 1, 1 );
73 
74  mPictureBox = new QCheckBox( i18nc( "@option:check", "Pictures" ), this );
75  mPictureBox->setToolTip(
76  i18nc( "@info:tooltip", "Export pictures" ) );
77  mPictureBox->setWhatsThis(
78  i18nc( "@info:whatsthis",
79  "Check this box if you want to export the contact's "
80  "picture to the vCard output file." ) );
81  layout->addWidget( mPictureBox, 2, 1 );
82 
83  gbox = new QGroupBox(
84  i18nc( "@title:group", "Export options" ), this );
85  gbox->setFlat( true );
86  layout->addWidget( gbox, 4, 0, 1, 2 );
87 
88  mDisplayNameBox = new QCheckBox( i18nc( "@option:check", "Display name as full name" ), this );
89  mDisplayNameBox->setToolTip(
90  i18nc( "@info:tooltip", "Export display name as full name" ) );
91  mDisplayNameBox->setWhatsThis(
92  i18nc( "@info:whatsthis",
93  "Check this box if you want to export the contact's display name "
94  "in the vCard's full name field. This may be required to get the "
95  "name shown correctly in GMail or Android." ) );
96  layout->addWidget( mDisplayNameBox, 5, 0, 1, 2 );
97 
98  readSettings();
99 }
100 
101 VCardExportSelectionWidget::~VCardExportSelectionWidget()
102 {
103  writeSettings();
104 }
105 
106 void VCardExportSelectionWidget::readSettings()
107 {
108  KConfig config( QLatin1String("kaddressbookrc") );
109  const KConfigGroup group( &config, "XXPortVCard" );
110 
111  mPrivateBox->setChecked( group.readEntry( "ExportPrivateFields", true ) );
112  mBusinessBox->setChecked( group.readEntry( "ExportBusinessFields", true ) );
113  mOtherBox->setChecked( group.readEntry( "ExportOtherFields", true ) );
114  mEncryptionKeys->setChecked( group.readEntry( "ExportEncryptionKeys", true ) );
115  mPictureBox->setChecked( group.readEntry( "ExportPictureFields", true ) );
116  mDisplayNameBox->setChecked( group.readEntry( "ExportDisplayName", false ) );
117 }
118 
119 void VCardExportSelectionWidget::writeSettings()
120 {
121  KConfig config( QLatin1String("kaddressbookrc") );
122  KConfigGroup group( &config, "XXPortVCard" );
123 
124  group.writeEntry( "ExportPrivateFields", mPrivateBox->isChecked() );
125  group.writeEntry( "ExportBusinessFields", mBusinessBox->isChecked() );
126  group.writeEntry( "ExportOtherFields", mOtherBox->isChecked() );
127  group.writeEntry( "ExportEncryptionKeys", mEncryptionKeys->isChecked() );
128  group.writeEntry( "ExportPictureFields", mPictureBox->isChecked() );
129  group.writeEntry( "ExportDisplayName", mDisplayNameBox->isChecked() );
130 }
131 
132 VCardExportSelectionWidget::ExportFields VCardExportSelectionWidget::exportType() const
133 {
134  ExportFields type = None;
135  if (mPrivateBox->isChecked()) {
136  type |= Private;
137  }
138  if (mBusinessBox->isChecked()) {
139  type |= Business;
140  }
141  if (mOtherBox->isChecked()) {
142  type |= Other;
143  }
144  if (mEncryptionKeys->isChecked()) {
145  type |= Encryption;
146  }
147  if (mPictureBox->isChecked()) {
148  type |= Picture;
149  }
150  if (mDisplayNameBox->isChecked()) {
151  type |= DiplayName;
152  }
153  return type;
154 }
QWidget::layout
QLayout * layout() const
VCardExportSelectionWidget::exportType
ExportFields exportType() const
Definition: vcardexportselectionwidget.cpp:132
QWidget
VCardExportSelectionWidget::None
Definition: vcardexportselectionwidget.h:31
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QGridLayout
QGroupBox::setFlat
void setFlat(bool flat)
VCardExportSelectionWidget::Business
Definition: vcardexportselectionwidget.h:33
VCardExportSelectionWidget::VCardExportSelectionWidget
VCardExportSelectionWidget(QWidget *parent=0)
Definition: vcardexportselectionwidget.cpp:28
QGroupBox
VCardExportSelectionWidget::Other
Definition: vcardexportselectionwidget.h:34
QCheckBox
VCardExportSelectionWidget::Private
Definition: vcardexportselectionwidget.h:32
vcardexportselectionwidget.h
VCardExportSelectionWidget::~VCardExportSelectionWidget
~VCardExportSelectionWidget()
Definition: vcardexportselectionwidget.cpp:101
QAbstractButton::setChecked
void setChecked(bool)
QWidget::setWhatsThis
void setWhatsThis(const QString &)
VCardExportSelectionWidget::DiplayName
Definition: vcardexportselectionwidget.h:37
QLatin1String
VCardExportSelectionWidget::Encryption
Definition: vcardexportselectionwidget.h:35
QWidget::setToolTip
void setToolTip(const QString &)
VCardExportSelectionWidget::Picture
Definition: vcardexportselectionwidget.h:36
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