console/kabcclient
#include <kabcclient.h>
Public Types | |
enum | Operation { List = 0, Add, Remove, Merge, Search } |
Public Member Functions | |
KABCClient (Operation operation, FormatFactory *factory) | |
virtual | ~KABCClient () |
bool | initOperation () |
void | setAllowSaving (bool on) |
bool | setInputCodec (const QByteArray &name) |
bool | setInputFormat (const QByteArray &name) |
bool | setInputOptions (const QByteArray &options) |
void | setInputStream (std::istream *stream) |
void | setMatchCaseSensitivity (Qt::CaseSensitivity sensitivity) |
bool | setOutputCodec (const QByteArray &name) |
bool | setOutputFormat (const QByteArray &name) |
bool | setOutputOptions (const QByteArray &options) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
Main handler of the program.
This class is the "program", it gets configured with the options passed by the user at the command line, retrieves the necessary components from its factories (see FormatFactory) and then executes the desired Operation
Definition at line 50 of file kabcclient.h.
Member Enumeration Documentation
List of supported operations.
Enumerator | |
---|---|
List |
Writes all contacts of the address book. Does not consume any input |
Add |
Adds the input to the address book. Reads contacts from the input stream in a loop and tries to add each one to the address book. Writes the each contacts data to the output stream.
|
Remove |
Removes matching contact from the address book. Reads contacts from the input stream in a loop and checks for each which entries in the address book match. If there is more than one match, it will not remove any of them. Else (only one match) it will remove the match from the address book. Can use SearchInput and DialogInput Writes the remove contact's data to the output stream
|
Merge |
Merges input data into the address book. Reads contacts from the input stream in a loop and checks for each which entries in the address book match. If there is more than one match, it will not attempt to merge. Else (only one match) it will use the found contact and merge information from the input contact into it and then replace the one inside the address book with the merged one. Writes the merged contact's data to the output stream.
|
Search |
Searches for matching entries in the address book. Reads contacts from the input stream in a loop and checks for each which entries in the address book match. Can use SearchInput and DialogInput Writes all matches per input to the output stream. |
Definition at line 58 of file kabcclient.h.
Constructor & Destructor Documentation
KABCClient::KABCClient | ( | Operation | operation, |
FormatFactory * | factory | ||
) |
Creates and initializes the instance.
- Parameters
-
operation the operation to perform on the address book factory the factory to get the input and output format handlers from
Definition at line 54 of file kabcclient.cpp.
|
virtual |
Destroys the instance.
Definition at line 71 of file kabcclient.cpp.
Member Function Documentation
bool KABCClient::initOperation | ( | ) |
Checks if Operation setup is correct and schedules execution.
Loads the KABC::StandardAddressBook syncronously and deactivates its "auto save", so the user can operate the program in "simulate" mode
- Returns
true
when Operation can start, otherwisefalse
Definition at line 174 of file kabcclient.cpp.
|
inline |
Sets the save behavior.
When saving is on
to address book data will be written to the address book storage, otherwise they will just be performed on the in-memory data.
Default is true
- Parameters
-
on when true
write data to address book store, whenfalse
operate in "simulate" mode
Definition at line 277 of file kabcclient.h.
bool KABCClient::setInputCodec | ( | const QByteArray & | name | ) |
Sets the text codec for reading the input data.
Translates utf
, utf8
, utf-8
to UTF-8
and local
, locale
the codec for the current locale.
- Parameters
-
name the name of the QTextCodec. See QTextCodec::codecForName()
- Returns
- return value of QTextCodec::codecForName()
- See also
- setInputFormat()
Definition at line 139 of file kabcclient.cpp.
bool KABCClient::setInputFormat | ( | const QByteArray & | name | ) |
Sets the input format to use.
Checks if the given name
is a valid input format for the Operation specified at the construction. If it is not blacklisted, the respective InputFormat will be retrieved from the FormatFactory.
- Parameters
-
name the name of an InputFormat to use for parsing the input data
- Returns
true
if the format is allowed for the selected Operation and its format parser can be created, otherwisefalse
Definition at line 79 of file kabcclient.cpp.
bool KABCClient::setInputOptions | ( | const QByteArray & | options | ) |
Sets the options for the input format.
Passes the options
to the InputFormat set with setInputFormat()
- Parameters
-
options the options for the InputFormat
- Returns
true
if the InputFormat accepts the options,false
if it doesn't or if there is not InputFormat set
Definition at line 119 of file kabcclient.cpp.
void KABCClient::setInputStream | ( | std::istream * | stream | ) |
Sets the input stream to read data from.
Depending on the input mode this can be either a stringstream
on the additional command arguments or cin
- Parameters
-
stream the input stream for reading
Definition at line 167 of file kabcclient.cpp.
|
inline |
Sets the string matching mode.
Default if Qt::CaseInsensitive
- Parameters
-
sensitivity whether to do string comparisons case sensitive or not
Definition at line 260 of file kabcclient.h.
bool KABCClient::setOutputCodec | ( | const QByteArray & | name | ) |
Sets the text codec for writing the output data.
Translates utf
, utf8
, utf-8
to UTF-8
and local
, locale
the codec for the current locale.
- Parameters
-
name the name of the QTextCodec. See QTextCodec::codecForName()
- Returns
- return value of QTextCodec::codecForName()
- See also
- setOutputFormat()
Definition at line 154 of file kabcclient.cpp.
bool KABCClient::setOutputFormat | ( | const QByteArray & | name | ) |
Sets the output format to use.
Retrieves the respective OutputFormat from the FormatFactory
- Parameters
-
name the name of an OutputFormat to use for formatting the output data
- Returns
true
if the format has been created, otherwisefalse
Definition at line 110 of file kabcclient.cpp.
bool KABCClient::setOutputOptions | ( | const QByteArray & | options | ) |
Sets the options for the output format.
Passes the options
to the OutputFormat set with setOutputFormat()
- Parameters
-
options the options for the OutputFormat
- Returns
true
if the OutputFormat accepts the options,false
if it doesn't or if there is not OutputFormat set
Definition at line 130 of file kabcclient.cpp.
The documentation for this class was generated from the following files:
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.