mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
added internet explorer import
This commit is contained in:
parent
41dba7068a
commit
59dadbbe1f
@ -21,6 +21,7 @@
|
|||||||
#include "chromeimporter.h"
|
#include "chromeimporter.h"
|
||||||
#include "operaimporter.h"
|
#include "operaimporter.h"
|
||||||
#include "htmlimporter.h"
|
#include "htmlimporter.h"
|
||||||
|
#include "ieimporter.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "bookmarksimporticonfetcher.h"
|
#include "bookmarksimporticonfetcher.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
@ -229,7 +230,20 @@ bool BookmarksImportDialog::exportedOK()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
else if (m_browser == IE) {
|
||||||
|
IeImporter ie(this);
|
||||||
|
ie.setFile(ui->fileLine->text());
|
||||||
|
|
||||||
|
if(ie.openFile()) {
|
||||||
|
m_exportedBookmarks = ie.exportBookmarks();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ie.error()) {
|
||||||
|
QMessageBox::critical(this, tr("Error!"), ie.errorString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (m_exportedBookmarks.isEmpty()) {
|
if (m_exportedBookmarks.isEmpty()) {
|
||||||
QMessageBox::critical(this, tr("Error!"), tr("The file doesn't contain any bookmark."));
|
QMessageBox::critical(this, tr("Error!"), tr("The file doesn't contain any bookmark."));
|
||||||
return false;
|
return false;
|
||||||
@ -336,7 +350,7 @@ void BookmarksImportDialog::setupBrowser(Browser browser)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IE:
|
case IE:
|
||||||
m_browserPixmap = QPixmap(":icons/browsers/ie.png");
|
m_browserPixmap = QPixmap(":icons/browsers/internet-explorer.png");
|
||||||
m_browserName = "Internet Explorer";
|
m_browserName = "Internet Explorer";
|
||||||
m_browserFileText = tr("Internet Explorer stores its bookmarks in <b>Favorites</b> folder. "
|
m_browserFileText = tr("Internet Explorer stores its bookmarks in <b>Favorites</b> folder. "
|
||||||
"This folder is usually located in ");
|
"This folder is usually located in ");
|
||||||
|
@ -78,6 +78,15 @@
|
|||||||
<normaloff>:/icons/browsers/html.png</normaloff>:/icons/browsers/html.png</iconset>
|
<normaloff>:/icons/browsers/html.png</normaloff>:/icons/browsers/html.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Internet Explorer</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../data/icons.qrc">
|
||||||
|
<normaloff>:/icons/browsers/internet-explorer.png</normaloff>:/icons/browsers/internet-explorer.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
|
64
src/lib/bookmarksimport/ieimporter.cpp
Normal file
64
src/lib/bookmarksimport/ieimporter.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#include "ieimporter.h"
|
||||||
|
|
||||||
|
#include "bookmarksimportdialog.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
IeImporter::IeImporter(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
, m_error(false)
|
||||||
|
, m_errorString(BookmarksImportDialog::tr("No Error"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IeImporter::setFile(const QString &path)
|
||||||
|
{
|
||||||
|
m_path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IeImporter::openFile()
|
||||||
|
{
|
||||||
|
QDir dir(m_path);
|
||||||
|
if(!dir.exists()) {
|
||||||
|
m_error = true;
|
||||||
|
m_errorString = BookmarksImportDialog::tr("Directory does not exists.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList filters;
|
||||||
|
filters << "*.url";
|
||||||
|
|
||||||
|
urls = dir.entryInfoList(filters);
|
||||||
|
|
||||||
|
if(urls.isEmpty()) {
|
||||||
|
m_error = true;
|
||||||
|
m_errorString = BookmarksImportDialog::tr("The directory does not contain any bookmarks.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVector<BookmarksModel::Bookmark> IeImporter::exportBookmarks()
|
||||||
|
{
|
||||||
|
QVector<BookmarksModel::Bookmark> bookmarks;
|
||||||
|
|
||||||
|
foreach (QFileInfo file, urls) {
|
||||||
|
QSettings urlFile(file.absoluteFilePath(), QSettings::IniFormat, this);
|
||||||
|
|
||||||
|
QUrl url = urlFile.value("InternetShortcut/URL").toUrl();
|
||||||
|
|
||||||
|
BookmarksModel::Bookmark bookmark;
|
||||||
|
bookmark.folder = "Internet Explorer Import";
|
||||||
|
bookmark.title = file.baseName();
|
||||||
|
bookmark.url = url;
|
||||||
|
|
||||||
|
bookmarks.append(bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bookmarks;
|
||||||
|
}
|
34
src/lib/bookmarksimport/ieimporter.h
Normal file
34
src/lib/bookmarksimport/ieimporter.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef IEIMPORTER_H
|
||||||
|
#define IEIMPORTER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "qz_namespace.h"
|
||||||
|
#include "bookmarksmodel.h"
|
||||||
|
|
||||||
|
#include <QFileInfoList>
|
||||||
|
|
||||||
|
class IeImporter : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit IeImporter(QObject *parent = 0);
|
||||||
|
|
||||||
|
void setFile(const QString &path);
|
||||||
|
bool openFile();
|
||||||
|
|
||||||
|
QVector<BookmarksModel::Bookmark> exportBookmarks();
|
||||||
|
|
||||||
|
bool error() { return m_error; }
|
||||||
|
QString errorString() { return m_errorString; }
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_error;
|
||||||
|
QString m_errorString;
|
||||||
|
QString m_path;
|
||||||
|
|
||||||
|
QFileInfoList urls;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IEIMPORTER_H
|
@ -73,5 +73,6 @@
|
|||||||
<file>icons/menu/tab.png</file>
|
<file>icons/menu/tab.png</file>
|
||||||
<file>icons/other/geolocation.png</file>
|
<file>icons/other/geolocation.png</file>
|
||||||
<file>icons/other/notification.png</file>
|
<file>icons/other/notification.png</file>
|
||||||
|
<file>icons/browsers/internet-explorer.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
src/lib/data/icons/browsers/internet-explorer.png
Normal file
BIN
src/lib/data/icons/browsers/internet-explorer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -171,6 +171,7 @@ SOURCES += \
|
|||||||
bookmarksimport/firefoximporter.cpp \
|
bookmarksimport/firefoximporter.cpp \
|
||||||
bookmarksimport/chromeimporter.cpp \
|
bookmarksimport/chromeimporter.cpp \
|
||||||
bookmarksimport/operaimporter.cpp \
|
bookmarksimport/operaimporter.cpp \
|
||||||
|
bookmarksimport/ieimporter.cpp \
|
||||||
bookmarksimport/bookmarksimportdialog.cpp \
|
bookmarksimport/bookmarksimportdialog.cpp \
|
||||||
tools/iconfetcher.cpp \
|
tools/iconfetcher.cpp \
|
||||||
tools/followredirectreply.cpp \
|
tools/followredirectreply.cpp \
|
||||||
@ -349,6 +350,7 @@ HEADERS += \
|
|||||||
bookmarksimport/firefoximporter.h \
|
bookmarksimport/firefoximporter.h \
|
||||||
bookmarksimport/chromeimporter.h \
|
bookmarksimport/chromeimporter.h \
|
||||||
bookmarksimport/operaimporter.h \
|
bookmarksimport/operaimporter.h \
|
||||||
|
bookmarksimport/ieimporter.h \
|
||||||
bookmarksimport/bookmarksimportdialog.h \
|
bookmarksimport/bookmarksimportdialog.h \
|
||||||
tools/iconfetcher.h \
|
tools/iconfetcher.h \
|
||||||
tools/followredirectreply.h \
|
tools/followredirectreply.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user