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.h>
28 #include <QtCore/QObject>
30 class QAbstractItemModel
;
32 class QItemSelectionModel
;
36 class KProgressDialog
;
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 a list of all contacts.
77 * @note This model is used by the ContactSelectionDialog.
79 void setItemModel( QAbstractItemModel
*model
);
82 * Sets the @p model that contains the current selection.
84 * @note This model is used by the ContactSelectionDialog.
86 void setSelectionModel( QItemSelectionModel
*model
);
90 * Sets the @p addressBook that shall be preselected in the
91 * ContactSelectionDialog.
93 void setDefaultAddressBook( const Akonadi::Collection
&addressBook
);
96 void slotImport( const QString
& );
97 void slotExport( const QString
& );
99 void slotImportJobDone( KJob
* );
102 QAbstractItemModel
*mItemModel
;
103 QItemSelectionModel
*mSelectionModel
;
104 QWidget
*mParentWidget
;
105 XXPortFactory mFactory
;
106 QSignalMapper
*mImportMapper
;
107 QSignalMapper
*mExportMapper
;
108 Akonadi::Collection mDefaultAddressBook
;
109 KProgressDialog
*mImportProgressDialog
;