xxport.h 2.22 KB
Newer Older
1
/*
Allen Winter's avatar
Allen Winter committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  This file is part of KAddressBook.
  Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 19 20 21 22
*/

#ifndef XXPORT_H
#define XXPORT_H

Allen Winter's avatar
Allen Winter committed
23
#include <KABC/Addressee>
24

Laurent Montel's avatar
Laurent Montel committed
25
#include <QtCore/QHash>
26 27 28 29 30 31 32 33

/**
 * @short The base class for all import/export modules.
 *
 * @author Tobias Koenig <tokoe@kde.org>
 */
class XXPort
{
Laurent Montel's avatar
Laurent Montel committed
34
public:
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    /**
     * Creates a new xxport object.
     *
     * @param parent The parent widget that shall be used as parent
     *               for GUI components.
     */
    explicit XXPort( QWidget *parent = 0 );

    /**
     * Destroys the xxport object.
     */
    virtual ~XXPort();

    /**
     * Imports a list of contacts.
     */
    virtual KABC::Addressee::List importContacts() const = 0;

    /**
     * Exports the list of @p contacts.
     */
    virtual bool exportContacts( const KABC::Addressee::List &contacts ) const = 0;

    /**
     * Sets module specific options.
     *
     * @param key The option key.
     * @param value The option value.
     */
    void setOption( const QString &key, const QString &value );

    /**
     * Returns the module specific option value for the given @p key.
     */
    QString option( const QString &key ) const;

Laurent Montel's avatar
Laurent Montel committed
71
protected:
72 73 74 75 76 77 78 79 80 81 82
    /**
     * Returns the parent widget that can be used as parent for
     * GUI components.
     */
    QWidget *parentWidget() const;

    /**
     * Returns a file name depending on the passed @p contact.
     */
    QString contactFileName( const KABC::Addressee &contact ) const;

Laurent Montel's avatar
Laurent Montel committed
83
private:
84
    QWidget *mParentWidget;
Laurent Montel's avatar
Laurent Montel committed
85
    QHash<QString, QString> mOptions;
86 87 88
};

#endif