mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-24 22:48:23 -05:00
dbhub: In Push dialog preselect the current branch
Instead of always selecting the default branch select the currently used branch in the Push Database dialog. Only default to the default branch if no current branch is available.
This commit is contained in:
+1
-1
@@ -270,7 +270,7 @@ void RemoteDock::pushDatabase()
|
||||
|
||||
// Show the user a dialog for setting all the commit details
|
||||
QString host = remoteDatabase.getInfoFromClientCert(remoteModel->currentClientCertificate(), RemoteDatabase::CertInfoServer);
|
||||
RemotePushDialog pushDialog(this, remoteDatabase, host, remoteModel->currentClientCertificate(), name);
|
||||
RemotePushDialog pushDialog(this, remoteDatabase, host, remoteModel->currentClientCertificate(), name, QString::fromStdString(currently_opened_file_info.branch));
|
||||
if(pushDialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
#include "ui_RemotePushDialog.h"
|
||||
#include "RemoteDatabase.h"
|
||||
|
||||
RemotePushDialog::RemotePushDialog(QWidget* parent, RemoteDatabase& remote, const QString& host, const QString& clientCert, const QString& name) :
|
||||
RemotePushDialog::RemotePushDialog(QWidget* parent, RemoteDatabase& remote, const QString& host, const QString& clientCert,
|
||||
const QString& name, const QString& branch) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RemotePushDialog),
|
||||
m_host(host),
|
||||
m_clientCert(clientCert),
|
||||
m_suggestedBranch(branch),
|
||||
remoteDatabase(remote),
|
||||
m_nameValidator(new QRegExpValidator(QRegExp("^[a-z,A-Z,0-9,\\.,\\-,\\_,\\(,\\),\\+,\\ ]+$"), this)),
|
||||
m_branchValidator(new QRegExpValidator(QRegExp("^[a-z,A-Z,0-9,\\^,\\.,\\-,\\_,\\/,\\(,\\),\\:,\\&,\\ )]+$"), this))
|
||||
@@ -126,6 +128,10 @@ void RemotePushDialog::fillInBranches(const std::vector<std::string>& branches,
|
||||
if(branch != default_branch)
|
||||
ui->comboBranch->addItem(QString::fromStdString(branch));
|
||||
}
|
||||
|
||||
// If a branch was suggested, select it now
|
||||
if(!m_suggestedBranch.isEmpty())
|
||||
ui->comboBranch->setCurrentIndex(ui->comboBranch->findText(m_suggestedBranch));
|
||||
}
|
||||
|
||||
void RemotePushDialog::reloadBranchList()
|
||||
|
||||
@@ -15,7 +15,8 @@ class RemotePushDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RemotePushDialog(QWidget* parent, RemoteDatabase& remote, const QString& host, const QString& clientCert, const QString& name = QString());
|
||||
explicit RemotePushDialog(QWidget* parent, RemoteDatabase& remote, const QString& host, const QString& clientCert,
|
||||
const QString& name = QString(), const QString& branch = QString());
|
||||
~RemotePushDialog() override;
|
||||
|
||||
QString name() const;
|
||||
@@ -32,6 +33,9 @@ private:
|
||||
QString m_host;
|
||||
QString m_clientCert;
|
||||
|
||||
// Suggested branch to preselect
|
||||
QString m_suggestedBranch;
|
||||
|
||||
// Reference to the remote database object which is stored somewhere in the main window
|
||||
RemoteDatabase& remoteDatabase;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user