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

View File

@@ -223,6 +223,7 @@ void MainWindow::init()
connect(ui->dataTable->horizontalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDataColumnPopupMenu(QPoint)));
connect(ui->dataTable->verticalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showRecordPopupMenu(QPoint)));
connect(ui->dockEdit, SIGNAL(visibilityChanged(bool)), this, SLOT(toggleEditDock(bool)));
connect(&m_remoteDb, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString)));
// plot widgets
ui->treePlotColumns->setSelectionMode(QAbstractItemView::NoSelection);
@@ -2107,7 +2108,11 @@ void MainWindow::on_butSavePlot_clicked()
void MainWindow::on_actionOpen_Remote_triggered()
{
QDesktopServices::openUrl(QUrl("https://dbhub.io"));
QString url = QInputDialog::getText(this, qApp->applicationName(), tr("Please enter the URL of the database file to open."));
if(!url.isEmpty())
{
m_remoteDb.fetchDatabase(url);
}
}
void MainWindow::on_actionSave_Remote_triggered()