mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
dbhub: Add foce push option to push dialog
This commit is contained in:
@@ -414,7 +414,7 @@ void RemoteDatabase::fetch(const QString& url, RequestType type, const QString&
|
||||
}
|
||||
|
||||
void RemoteDatabase::push(const QString& filename, const QString& url, const QString& clientCert, const QString& remotename,
|
||||
const QString& commitMessage, const QString& licence, bool isPublic, const QString& branch)
|
||||
const QString& commitMessage, const QString& licence, bool isPublic, const QString& branch, bool forcePush)
|
||||
{
|
||||
// Check if network is accessible. If not, abort right here
|
||||
if(m_manager->networkAccessible() == QNetworkAccessManager::NotAccessible)
|
||||
@@ -445,6 +445,7 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt
|
||||
addPart(multipart, "public", isPublic ? "true" : "false");
|
||||
addPart(multipart, "branch", branch);
|
||||
addPart(multipart, "commit", localLastCommitId(filename));
|
||||
addPart(multipart, "force", forcePush ? "true" : "false");
|
||||
|
||||
// Set SSL configuration when trying to access a file via the HTTPS protocol
|
||||
bool https = QUrl(url).scheme().compare("https", Qt::CaseInsensitive) == 0;
|
||||
|
||||
@@ -46,7 +46,8 @@ public:
|
||||
|
||||
void fetch(const QString& url, RequestType type, const QString& clientCert = QString(), QVariant userdata = QVariant());
|
||||
void push(const QString& filename, const QString& url, const QString& clientCert, const QString& remotename,
|
||||
const QString& commitMessage = QString(), const QString& licence = QString(), bool isPublic = false, const QString& branch = QString("master"));
|
||||
const QString& commitMessage = QString(), const QString& licence = QString(), bool isPublic = false,
|
||||
const QString& branch = QString("master"), bool forcePush = false);
|
||||
|
||||
signals:
|
||||
// The openFile signal is emitted whenever a remote database file shall be opened in the main window. This happens when the
|
||||
|
||||
@@ -111,7 +111,7 @@ void RemoteDock::pushDatabase()
|
||||
|
||||
// Push database
|
||||
remoteDatabase.push(mainWindow->getDb().currentFile(), url, remoteModel->currentClientCertificate(), pushDialog.name(),
|
||||
pushDialog.commitMessage(), pushDialog.licence(), pushDialog.isPublic(), pushDialog.branch());
|
||||
pushDialog.commitMessage(), pushDialog.licence(), pushDialog.isPublic(), pushDialog.branch(), pushDialog.forcePush());
|
||||
}
|
||||
|
||||
void RemoteDock::newDirectoryNode(const QModelIndex& parent)
|
||||
|
||||
@@ -43,6 +43,12 @@ void RemotePushDialog::checkInput()
|
||||
else
|
||||
ui->checkPublic->setText(tr("Database will be private. Only you have access to it."));
|
||||
|
||||
// Update the foce push check box text
|
||||
if(ui->checkForce->isChecked())
|
||||
ui->checkForce->setText(tr("Use with care. This can cause remote commits to be deleted."));
|
||||
else
|
||||
ui->checkForce->setText(" "); // The space character here is required to avoid annoying resizes when toggling the checkbox
|
||||
|
||||
// Check input
|
||||
bool valid = true;
|
||||
|
||||
@@ -88,6 +94,11 @@ QString RemotePushDialog::branch() const
|
||||
return ui->comboBranch->currentText();
|
||||
}
|
||||
|
||||
bool RemotePushDialog::forcePush() const
|
||||
{
|
||||
return ui->checkForce->isChecked();
|
||||
}
|
||||
|
||||
void RemotePushDialog::fillInLicences(const QMap<QString, QString>& licences)
|
||||
{
|
||||
// Clear licence list and add default item for unspecified licence
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
QString licence() const;
|
||||
bool isPublic() const;
|
||||
QString branch() const;
|
||||
bool forcePush() const;
|
||||
|
||||
private:
|
||||
Ui::RemotePushDialog* ui;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>277</height>
|
||||
<width>583</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -110,6 +110,19 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Force push</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>checkForce</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="checkForce"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -245,6 +258,22 @@ p, li { white-space: pre-wrap; }
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkForce</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>RemotePushDialog</receiver>
|
||||
<slot>checkInput()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>168</x>
|
||||
<y>240</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>62</x>
|
||||
<y>229</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>checkInput()</slot>
|
||||
|
||||
Reference in New Issue
Block a user