mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-24 22:48:23 -05:00
dbhub: Show a warning when trying to push unsaved changes
When clicking the Upload Database button when there are unsaved changes show a warning to the user.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
|
||||
@@ -152,6 +153,17 @@ void RemoteDock::pushDatabase()
|
||||
return;
|
||||
}
|
||||
|
||||
// Show a warning when trying to push a database with unsaved changes
|
||||
if(mainWindow->getDb().getDirty())
|
||||
{
|
||||
if(QMessageBox::warning(this,
|
||||
QApplication::applicationName(),
|
||||
tr("The database has unsaved changes. Are you sure you want to push it before saving?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel,
|
||||
QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
}
|
||||
|
||||
// The default suggestion for a database name is the local file name. If it is a remote file (like when it initially was fetched using DB4S),
|
||||
// the extra bit of information at the end of the name gets removed first.
|
||||
QString name = QFileInfo(mainWindow->getDb().currentFile()).fileName();
|
||||
|
||||
Reference in New Issue
Block a user