mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-25 06:58:23 -05:00
dbhub: Automatically switch to the correct identity when opening file
When opening a local clone of a remote database, make sure the current identity is set to the identity used for cloning this file. This avoids possible confusion and can simplify the workflow a bit.
This commit is contained in:
+9
-1
@@ -231,7 +231,15 @@ void RemoteDock::fileOpened(const QString& filename)
|
||||
ui->labelDatabaseFile->setText(QString::fromStdString(info.name));
|
||||
ui->labelDatabaseBranch->setText(QString::fromStdString(info.branch));
|
||||
|
||||
// Switch to "Current Database" tab when we have information on this database
|
||||
// Is this actually a clone of a remote database?
|
||||
if(!info.file.empty())
|
||||
{
|
||||
// Make sure the current identity matches the identity used to clone this file in the first place.
|
||||
// A mismatch is possible when the local database file has been opened using a recent files menu item or some similar technique.
|
||||
if(QString::fromStdString(info.identity) != QFileInfo(remoteModel->currentClientCertificate()).fileName())
|
||||
ui->comboUser->setCurrentIndex(ui->comboUser->findData("/" + QString::fromStdString(info.identity), Qt::UserRole, Qt::MatchEndsWith));
|
||||
|
||||
// Switch to "Current Database" tab
|
||||
ui->tabs->setCurrentIndex(2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user