mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
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:
@@ -1,4 +1,5 @@
|
||||
#include <QSslCertificate>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "RemoteDock.h"
|
||||
#include "ui_RemoteDock.h"
|
||||
@@ -10,6 +11,7 @@
|
||||
RemoteDock::RemoteDock(MainWindow* parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::RemoteDock),
|
||||
mainWindow(parent),
|
||||
remoteDatabase(parent->getRemote()),
|
||||
remoteModel(new RemoteModel(this, parent->getRemote()))
|
||||
{
|
||||
@@ -58,6 +60,9 @@ void RemoteDock::setNewIdentity()
|
||||
if(cn_parts.size() < 2)
|
||||
return;
|
||||
remoteModel->setNewRootDir(QString("https://%1:5550/").arg(cn_parts.last()), cert);
|
||||
|
||||
// Enable buttons if necessary
|
||||
enableButtons();
|
||||
}
|
||||
|
||||
void RemoteDock::fetchDatabase(const QModelIndex& idx)
|
||||
@@ -72,3 +77,18 @@ void RemoteDock::fetchDatabase(const QModelIndex& idx)
|
||||
if(item->value(RemoteModelColumnType).toString() == "database")
|
||||
remoteDatabase.fetch(item->value(RemoteModelColumnUrl).toString(), RemoteDatabase::RequestTypeDatabase, remoteModel->currentClientCertificate());
|
||||
}
|
||||
|
||||
void RemoteDock::enableButtons()
|
||||
{
|
||||
bool db_opened = mainWindow->getDb().isOpen();
|
||||
bool logged_in = !remoteModel->currentClientCertificate().isEmpty();
|
||||
|
||||
ui->buttonPushDatabase->setEnabled(db_opened && logged_in);
|
||||
}
|
||||
|
||||
void RemoteDock::pushDatabase()
|
||||
{
|
||||
QString url = QInputDialog::getText(this, qApp->applicationName(), tr("Please enter the URL of the database file to save."));
|
||||
if(!url.isEmpty())
|
||||
remoteDatabase.push(mainWindow->getDb().currentFile(), url, remoteModel->currentClientCertificate());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user