2 This file is part of KAddressBook.
4 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef XXPORTMANAGER_H
22 #define XXPORTMANAGER_H
24 #include "xxport/xxportfactory.h"
26 #include <Akonadi/Collection>
28 #include <QtCore/QObject>
31 class KProgressDialog
;
33 class QAbstractItemModel
;
35 class QItemSelectionModel
;
39 * @short The class that manages import and export of contacts.
41 class XXPortManager
: public QObject
47 * Creates a new xxport manager.
49 * @param parent The widget that is used as parent for dialogs.
51 XXPortManager( QWidget
*parent
= 0 );
54 * Destroys the xxport manager.
59 * Adds a new action to import contacts.
61 * @param action The action object.
62 * @param identifier The identifier that will be passed to the xxport module.
64 void addImportAction( QAction
*action
, const QString
&identifier
);
67 * Adds a new action to export contacts.
69 * @param action The action object.
70 * @param identifier The identifier that will be passed to the xxport module.
72 void addExportAction( QAction
*action
, const QString
&identifier
);
75 * Sets the @p model that contains the current selection.
77 * @note This model is used by the ContactSelectionDialog.
79 void setSelectionModel( QItemSelectionModel
*model
);
83 * Sets the @p addressBook that shall be preselected in the
84 * ContactSelectionDialog.
86 void setDefaultAddressBook( const Akonadi::Collection
&addressBook
);
89 void slotImport( const QString
& );
90 void slotExport( const QString
& );
92 void slotImportJobDone( KJob
* );
95 QItemSelectionModel
*mSelectionModel
;
96 QWidget
*mParentWidget
;
97 XXPortFactory mFactory
;
98 QSignalMapper
*mImportMapper
;
99 QSignalMapper
*mExportMapper
;
100 Akonadi::Collection mDefaultAddressBook
;
101 KProgressDialog
*mImportProgressDialog
;