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

console/kabcclient

  • sources
  • kde-4.14
  • kdepim
  • console
  • kabcclient
  • src
kabcclient.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005 - 2006 Kevin Krammer <kevin.krammer@gmx.at>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program 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
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 //
18 
19 #ifndef KABCCLIENT_H
20 #define KABCCLIENT_H
21 
22 // standard includes
23 #include <istream>
24 
25 // Qt includes
26 #include <QtCore/QObject>
27 
28 // forward declarations
29 class FormatFactory;
30 class InputFormat;
31 class OutputFormat;
32 class QTextCodec;
33 
34 namespace KABC
35 {
36  class AddressBook;
37  class Addressee;
38  class Picture;
39 }
40 
50 class KABCClient: public QObject
51 {
52  Q_OBJECT
53 
54 public:
58  enum Operation
59  {
65  List = 0,
66 
78  Add,
79 
95  Remove,
96 
112  Merge,
113 
124  Search
125  };
126 
133  KABCClient(Operation operation, FormatFactory* factory);
134 
138  virtual ~KABCClient();
139 
157  bool setInputFormat(const QByteArray& name);
158 
173  bool setOutputFormat(const QByteArray& name);
174 
188  bool setInputOptions(const QByteArray& options);
189 
203  bool setOutputOptions(const QByteArray& options);
204 
217  bool setInputCodec(const QByteArray& name);
218 
231  bool setOutputCodec(const QByteArray& name);
232 
241  void setInputStream(std::istream* stream);
242 
251  bool initOperation();
252 
260  inline void setMatchCaseSensitivity(Qt::CaseSensitivity sensitivity)
261  {
262  m_matchCaseSensitivity = sensitivity;
263  }
264 
277  inline void setAllowSaving(bool on) { m_allowSaving = on; }
278 
279 private:
280  Operation m_operation;
281 
282  FormatFactory* m_formatFactory;
283 
284  InputFormat* m_inputFormat;
285  OutputFormat* m_outputFormat;
286 
287  QTextCodec* m_inputCodec;
288  QTextCodec* m_outputCodec;
289 
290  KABC::AddressBook* m_addressBook;
291 
292  std::istream* m_inputStream;
293 
294  Qt::CaseSensitivity m_matchCaseSensitivity;
295  bool m_allowSaving;
296 
297 private:
298  int performAdd();
299  int performRemove();
300  int performMerge();
301  int performList();
302  int performSearch();
303 
304  void mergeAddressees(KABC::Addressee& master, const KABC::Addressee& slave);
305  void mergePictures(KABC::Picture& master, const KABC::Picture slave);
306 
307  QTextCodec* codecForName(const QByteArray& name);
308 
309 private slots:
310  void slotAddressBookLoaded();
311 };
312 
313 #endif
314 
315 // End of file
KABCClient
Main handler of the program.
Definition: kabcclient.h:50
KABCClient::setOutputFormat
bool setOutputFormat(const QByteArray &name)
Sets the output format to use.
Definition: kabcclient.cpp:110
KABCClient::setInputFormat
bool setInputFormat(const QByteArray &name)
Sets the input format to use.
Definition: kabcclient.cpp:79
KABCClient::Add
Adds the input to the address book.
Definition: kabcclient.h:78
QByteArray
KABCClient::Merge
Merges input data into the address book.
Definition: kabcclient.h:112
InputFormat
Interface for input format parsers.
Definition: inputformat.h:51
KABCClient::setOutputCodec
bool setOutputCodec(const QByteArray &name)
Sets the text codec for writing the output data.
Definition: kabcclient.cpp:154
KABCClient::setInputOptions
bool setInputOptions(const QByteArray &options)
Sets the options for the input format.
Definition: kabcclient.cpp:119
KABCClient::setOutputOptions
bool setOutputOptions(const QByteArray &options)
Sets the options for the output format.
Definition: kabcclient.cpp:130
OutputFormat
Interface for output formatters.
Definition: outputformat.h:53
KABCClient::KABCClient
KABCClient(Operation operation, FormatFactory *factory)
Creates and initializes the instance.
Definition: kabcclient.cpp:54
KABCClient::initOperation
bool initOperation()
Checks if Operation setup is correct and schedules execution.
Definition: kabcclient.cpp:174
KABCClient::setMatchCaseSensitivity
void setMatchCaseSensitivity(Qt::CaseSensitivity sensitivity)
Sets the string matching mode.
Definition: kabcclient.h:260
QObject::name
const char * name() const
KABCClient::setInputCodec
bool setInputCodec(const QByteArray &name)
Sets the text codec for reading the input data.
Definition: kabcclient.cpp:139
QObject
QTextCodec
KABCClient::setInputStream
void setInputStream(std::istream *stream)
Sets the input stream to read data from.
Definition: kabcclient.cpp:167
KABCClient::~KABCClient
virtual ~KABCClient()
Destroys the instance.
Definition: kabcclient.cpp:71
KABCClient::Remove
Removes matching contact from the address book.
Definition: kabcclient.h:95
FormatFactory
Factory for input parsers and output formatters.
Definition: formatfactory.h:102
KABCClient::Search
Searches for matching entries in the address book.
Definition: kabcclient.h:124
KABCClient::setAllowSaving
void setAllowSaving(bool on)
Sets the save behavior.
Definition: kabcclient.h:277
KABCClient::List
Writes all contacts of the address book.
Definition: kabcclient.h:65
KABCClient::Operation
Operation
List of supported operations.
Definition: kabcclient.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

console/kabcclient

Skip menu "console/kabcclient"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

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