dbhub: Remove remote menu, add push button to remote dock

This commit removes the File -> Remote menu entirely. The only menu item
that was left was the Save to Remote item which is replaces by a button
in the remote dock.

The button is only enabled when a database file is opened and the user
has logged in using a certificate.

Clicking the button opens the same dialog and performs the same actions
as before. The only difference is that we don't use the first client
certificate - no matter which one it is - but instead use the client
certificate that was used for logging in.
This commit is contained in:
Martin Kleusberg
2017-08-03 17:35:36 +02:00
parent dfa9ad7c03
commit d14fb1fbb1
9 changed files with 57 additions and 27 deletions

View File

@@ -1480,7 +1480,8 @@ void MainWindow::activateFields(bool enable)
ui->buttonClearFilters->setEnabled(enable);
ui->dockEdit->setEnabled(enable && write);
ui->dockPlot->setEnabled(enable);
ui->actionSave_Remote->setEnabled(enable);
remoteDock->enableButtons();
}
void MainWindow::enableEditing(bool enable_edit, bool enable_insertdelete)
@@ -1790,9 +1791,8 @@ void MainWindow::reloadSettings()
populateStructure();
populateTable();
// Hide or show the File → Remote menu as needed
// Hide or show the remote dock as needed
bool showRemoteActions = Settings::getValue("remote", "active").toBool();
ui->menuRemote->menuAction()->setVisible(showRemoteActions);
ui->viewMenu->actions().at(4)->setVisible(showRemoteActions);
if(!showRemoteActions)
ui->dockRemote->setHidden(true);
@@ -1862,16 +1862,6 @@ void MainWindow::checkNewVersion(const QString& versionstring, const QString& ur
}
}
void MainWindow::on_actionSave_Remote_triggered()
{
QString url = QInputDialog::getText(this, qApp->applicationName(), tr("Please enter the URL of the database file to save."));
if(!url.isEmpty())
{
QStringList certs = Settings::getValue("remote", "client_certificates").toStringList();
m_remoteDb->push(db.currentFile(), url, (certs.size() ? certs.at(0) : ""));
}
}
void MainWindow::on_actionWiki_triggered()
{
QDesktopServices::openUrl(QUrl("https://github.com/sqlitebrowser/sqlitebrowser/wiki"));