dbhub: Add very basic support for opening remote files

This adds some initial support for opening remote files. You can enter a
URL and DB4S will try to download the file. When successful you'll be
able to specify a place and name to save the file under, and after
saving it locally to disk it'll be opened just like any local database
file.

See the included TODO comments for missing features. Most notably
missing is the HTTPS and certificate handling code. Also any support
for storing the remote source of a database is lacking.
This commit is contained in:
Martin Kleusberg
2016-10-24 22:49:32 +02:00
parent 31dffa6afc
commit 4d26624bda
6 changed files with 139 additions and 3 deletions

32
src/RemoteDatabase.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef REMOTEDATABASE_H
#define REMOTEDATABASE_H
#include <QObject>
class QNetworkAccessManager;
class QString;
class QNetworkReply;
class QSslError;
class RemoteDatabase : public QObject
{
Q_OBJECT
public:
RemoteDatabase();
virtual ~RemoteDatabase();
void fetchDatabase(const QString& url);
signals:
void openFile(QString path);
private:
void gotEncrypted(QNetworkReply* reply);
void gotReply(QNetworkReply* reply);
void gotError(QNetworkReply* reply, const QList<QSslError>& errors);
QNetworkAccessManager* m_manager;
};
#endif