fix using custom account-wide proxy when importing feeds
This commit is contained in:
parent
8dcf72aa86
commit
c41ca13ad1
@ -20,7 +20,7 @@
|
|||||||
FormStandardImportExport::FormStandardImportExport(StandardServiceRoot* service_root, QWidget* parent)
|
FormStandardImportExport::FormStandardImportExport(StandardServiceRoot* service_root, QWidget* parent)
|
||||||
: QDialog(parent), m_ui(new Ui::FormStandardImportExport), m_serviceRoot(service_root) {
|
: QDialog(parent), m_ui(new Ui::FormStandardImportExport), m_serviceRoot(service_root) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_model = new FeedsImportExportModel(m_ui->m_treeFeeds);
|
m_model = new FeedsImportExportModel(service_root, m_ui->m_treeFeeds);
|
||||||
connect(m_model, &FeedsImportExportModel::parsingStarted, this, &FormStandardImportExport::onParsingStarted);
|
connect(m_model, &FeedsImportExportModel::parsingStarted, this, &FormStandardImportExport::onParsingStarted);
|
||||||
connect(m_model, &FeedsImportExportModel::parsingFinished, this, &FormStandardImportExport::onParsingFinished);
|
connect(m_model, &FeedsImportExportModel::parsingFinished, this, &FormStandardImportExport::onParsingFinished);
|
||||||
connect(m_model, &FeedsImportExportModel::parsingProgress, this, &FormStandardImportExport::onParsingProgress);
|
connect(m_model, &FeedsImportExportModel::parsingProgress, this, &FormStandardImportExport::onParsingProgress);
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include <QStack>
|
#include <QStack>
|
||||||
#include <QtConcurrentMap>
|
#include <QtConcurrentMap>
|
||||||
|
|
||||||
FeedsImportExportModel::FeedsImportExportModel(QObject* parent)
|
FeedsImportExportModel::FeedsImportExportModel(StandardServiceRoot* account, QObject* parent)
|
||||||
: AccountCheckSortedModel(parent), m_mode(Mode::Import), m_newRoot(nullptr) {
|
: AccountCheckSortedModel(parent), m_account(account), m_mode(Mode::Import), m_newRoot(nullptr) {
|
||||||
|
|
||||||
connect(&m_watcherLookup, &QFutureWatcher<bool>::progressValueChanged, this, [=](int prog) {
|
connect(&m_watcherLookup, &QFutureWatcher<bool>::progressValueChanged, this, [=](int prog) {
|
||||||
emit parsingProgress(prog, m_lookup.size());
|
emit parsingProgress(prog, m_lookup.size());
|
||||||
@ -279,8 +279,8 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
|
|||||||
QStack<RootItem*> model_items;
|
QStack<RootItem*> model_items;
|
||||||
QNetworkProxy custom_proxy;
|
QNetworkProxy custom_proxy;
|
||||||
|
|
||||||
if (sourceModel()->rootItem() != nullptr && sourceModel()->rootItem()->getParentServiceRoot() != nullptr) {
|
if (m_account != nullptr) {
|
||||||
custom_proxy = sourceModel()->rootItem()->getParentServiceRoot()->networkProxy();
|
custom_proxy = m_account->networkProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
model_items.push(m_newRoot);
|
model_items.push(m_newRoot);
|
||||||
@ -416,8 +416,8 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
|
|||||||
m_newRoot = new StandardServiceRoot();
|
m_newRoot = new StandardServiceRoot();
|
||||||
QNetworkProxy custom_proxy;
|
QNetworkProxy custom_proxy;
|
||||||
|
|
||||||
if (sourceModel()->rootItem() != nullptr && sourceModel()->rootItem()->getParentServiceRoot() != nullptr) {
|
if (m_account != nullptr) {
|
||||||
custom_proxy = sourceModel()->rootItem()->getParentServiceRoot()->networkProxy();
|
custom_proxy = m_account->networkProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QByteArray> urls = data.split('\n');
|
QList<QByteArray> urls = data.split('\n');
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
class StandardFeed;
|
class StandardFeed;
|
||||||
|
class StandardServiceRoot;
|
||||||
|
|
||||||
struct FeedLookup {
|
struct FeedLookup {
|
||||||
RootItem* parent;
|
RootItem* parent;
|
||||||
@ -26,7 +27,7 @@ class FeedsImportExportModel : public AccountCheckSortedModel {
|
|||||||
public:
|
public:
|
||||||
enum class Mode { Import, Export };
|
enum class Mode { Import, Export };
|
||||||
|
|
||||||
explicit FeedsImportExportModel(QObject* parent = nullptr);
|
explicit FeedsImportExportModel(StandardServiceRoot* account, QObject* parent = nullptr);
|
||||||
virtual ~FeedsImportExportModel();
|
virtual ~FeedsImportExportModel();
|
||||||
|
|
||||||
// Exports to OPML 2.0
|
// Exports to OPML 2.0
|
||||||
@ -53,6 +54,7 @@ class FeedsImportExportModel : public AccountCheckSortedModel {
|
|||||||
bool produceFeed(const FeedLookup& feed_lookup);
|
bool produceFeed(const FeedLookup& feed_lookup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
StandardServiceRoot* m_account;
|
||||||
QMutex m_mtxLookup;
|
QMutex m_mtxLookup;
|
||||||
QList<FeedLookup> m_lookup;
|
QList<FeedLookup> m_lookup;
|
||||||
RootItem* m_newRoot;
|
RootItem* m_newRoot;
|
||||||
|
@ -71,7 +71,7 @@ void StandardServiceRoot::start(bool freshly_activated) {
|
|||||||
file_to_load = target_opml_file.arg(QSL(DEFAULT_LOCALE));
|
file_to_load = target_opml_file.arg(QSL(DEFAULT_LOCALE));
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsImportExportModel model;
|
FeedsImportExportModel model(this);
|
||||||
QString output_msg;
|
QString output_msg;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user