source: SMSSender/src/business/contactimporters/contactfilesimporter.h @ 217:1ed3ec64fc1f

Last change on this file since 217:1ed3ec64fc1f was 217:1ed3ec64fc1f, checked in by Sämy Zehnder <saemy.zehnder@…>, 8 years ago
  • Removed all Priv stuff. Using Qts parent mechanism for memory management now.
File size: 1.8 KB
Line 
1/*
2 smssender - A frontend for fast and easy SMS sending over different gateways.
3 Copyright (C) 2007-2012, gorrión. See http://smssender.gorrion.ch
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef CONTACTFILESIMPORTER_H_
20#define CONTACTFILESIMPORTER_H_
21
22#include <QSettings>
23
24#include <icontactimporter.h>
25
26class ContactFilesImporterDataManager;
27
28class ContactFilesImporter : public IContactImporter {
29    Q_OBJECT
30    Q_INTERFACES(IContactImporter)
31
32public:
33    ContactFilesImporter(QObject* parent);
34
35public: /* IContactImporterImpl */
36    QString describingName() const;
37    bool    isApplicable() const;
38
39    void                init();
40    QList<QWizardPage*> createPreImportPages(QWidget* parent);
41    QSet<SContact>      importContacts();
42
43private:
44    struct CSVFile {
45        QStringList keys;
46        QList<QMap<QString, QString> > values; // key => value
47    };
48
49private:
50    QStringList    defaultContactsFiles() const;
51
52    QSet<SContact> readV1ContactsFile(const QSettings& ini) const;
53    QSet<SContact> readV2ContactsFile(const QSettings& ini) const;
54
55    CSVFile        parseCSV(const QString& filename) const;
56    QSet<SContact> readCSV(const CSVFile& csv) const;
57
58private:
59    ContactFilesImporterDataManager* dataManager_;
60};
61
62#endif /* CONTACTFILESIMPORTER_H_ */
Note: See TracBrowser for help on using the repository browser.