1 /**************************************************************************
2 * Otter Browser: Web browser controlled by the user, not vice-versa.
3 * Copyright (C) 2014 Piotr Wójcik <chocimier@tlen.pl>
4 * Copyright (C) 2014 - 2017 Michal Dutkiewicz aka Emdek <michal@emdek.pl>
5 *
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 3 of the License, or
9 * (at your option) any later version.
10 *
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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 **************************************************************************/
20 
21 #ifndef OTTER_HTMLBOOKMARKSIMPORTER_H
22 #define OTTER_HTMLBOOKMARKSIMPORTER_H
23 
24 #include "../../../core/BookmarksImporter.h"
25 
26 #ifdef OTTER_ENABLE_QTWEBKIT
27 #include <QtWebKit/QWebElement>
28 #endif
29 
30 namespace Otter
31 {
32 
33 class BookmarksImporterWidget;
34 
35 class HtmlBookmarksImporter final : public BookmarksImporter
36 {
37 	Q_OBJECT
38 
39 public:
40 	explicit HtmlBookmarksImporter(QObject *parent = nullptr);
41 
42 	QWidget* createOptionsWidget(QWidget *parent) override;
43 	QString getTitle() const override;
44 	QString getDescription() const override;
45 	QString getVersion() const override;
46 	QString getSuggestedPath(const QString &path = {}) const override;
47 	QString getBrowser() const override;
48 	QUrl getHomePage() const override;
49 	QStringList getFileFilters() const override;
50 
51 public slots:
52 	bool import(const QString &path) override;
53 
54 #ifdef OTTER_ENABLE_QTWEBKIT
55 protected:
56 	void processElement(const QWebElement &element);
57 	static QDateTime getDateTime(const QWebElement &element, const QString &attribute);
58 #endif
59 
60 private:
61 	BookmarksImporterWidget *m_optionsWidget;
62 	int m_currentAmount;
63 	int m_totalAmount;
64 };
65 
66 }
67 
68 #endif
69