diff --git a/src/RemoteDock.cpp b/src/RemoteDock.cpp
index 9c90cef5..6b0c4ff3 100644
--- a/src/RemoteDock.cpp
+++ b/src/RemoteDock.cpp
@@ -72,18 +72,49 @@ RemoteDock::RemoteDock(MainWindow* parent)
ui->treeDatabaseCommits->expandAll();
});
+ // Prepare context menu for list of remote databases
+ connect(ui->treeRemote->selectionModel(), &QItemSelectionModel::currentChanged, [this](const QModelIndex& index, const QModelIndex&) {
+ // Only enable database actions when a database was selected
+ bool enable = index.isValid() &&
+ remoteModel->modelIndexToItem(index)->value(RemoteModelColumnType).toString() == "database";
+ ui->actionCloneDatabaseDoubleClick->setEnabled(enable);
+ });
+ ui->treeRemote->selectionModel()->currentChanged(QModelIndex(), QModelIndex()); // Enable/disable all action initially
+ connect(ui->actionCloneDatabaseDoubleClick, &QAction::triggered, [this]() {
+ fetchDatabase(ui->treeRemote->currentIndex());
+ });
+ ui->treeRemote->addAction(ui->actionCloneDatabaseDoubleClick);
+
// Prepare context menu for list of local clones
connect(ui->treeLocal->selectionModel(), &QItemSelectionModel::currentChanged, [this](const QModelIndex& index, const QModelIndex&) {
// Only enable database actions when a database was selected
bool enable = index.isValid() &&
!index.sibling(index.row(), RemoteLocalFilesModel::ColumnFile).data().isNull();
+ ui->actionOpenLocalDatabase->setEnabled(enable);
ui->actionDeleteDatabase->setEnabled(enable);
});
+ ui->treeLocal->selectionModel()->currentChanged(QModelIndex(), QModelIndex()); // Enable/disable all action initially
+ connect(ui->actionOpenLocalDatabase, &QAction::triggered, [this]() {
+ openLocalFile(ui->treeLocal->currentIndex());
+ });
connect(ui->actionDeleteDatabase, &QAction::triggered, [this]() {
deleteLocalDatabase(ui->treeLocal->currentIndex());
});
+ ui->treeLocal->addAction(ui->actionOpenLocalDatabase);
ui->treeLocal->addAction(ui->actionDeleteDatabase);
+ // Prepare context menu for list of commits
+ connect(ui->treeDatabaseCommits->selectionModel(), &QItemSelectionModel::currentChanged, [this](const QModelIndex& index, const QModelIndex&) {
+ // Only enable database actions when a commit was selected
+ bool enable = index.isValid();
+ ui->actionFetchCommit->setEnabled(enable);
+ });
+ ui->treeDatabaseCommits->selectionModel()->currentChanged(QModelIndex(), QModelIndex()); // Enable/disable all action initially
+ connect(ui->actionFetchCommit, &QAction::triggered, [this]() {
+ fetchCommit(ui->treeDatabaseCommits->currentIndex());
+ });
+ ui->treeDatabaseCommits->addAction(ui->actionFetchCommit);
+
// Initial setup
reloadSettings();
}
@@ -213,7 +244,7 @@ void RemoteDock::enableButtons()
bool logged_in = !remoteModel->currentClientCertificate().isEmpty();
ui->buttonPushDatabase->setEnabled(db_opened && logged_in);
- ui->actionCloneDatabase->setEnabled(logged_in);
+ ui->actionCloneDatabaseLink->setEnabled(logged_in);
ui->actionDatabaseOpenBrowser->setEnabled(db_opened && logged_in);
ui->actionRefresh->setEnabled(logged_in);
}
diff --git a/src/RemoteDock.ui b/src/RemoteDock.ui
index 625bc4c3..8ac7a6b5 100644
--- a/src/RemoteDock.ui
+++ b/src/RemoteDock.ui
@@ -126,12 +126,15 @@
false
-
+
-
+
+ Qt::ActionsContextMenu
+
<html><head/><body><p>In this pane, remote databases from dbhub.io website can be added to DB Browser for SQLite. First you need an identity:</p><ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Login to the dbhub.io website (use your GitHub credentials or whatever you want)</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click the button to "Generate client certificate" (that's your identity). That'll give you a certificate file (save it to your local disk).</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to the Remote tab in DB Browser for SQLite Preferences. Click the button to add a new certificate to DB Browser for SQLite and choose the just downloaded certificate file.</li></ol><p>Now the Remote panel shows your identity and you can add remote databases.</p></body></html>
@@ -290,7 +293,11 @@
-
-
+
+
+ Qt::ActionsContextMenu
+
+
@@ -398,9 +405,6 @@
-
- false
-
:/icons/close:/icons/close
@@ -418,19 +422,19 @@
:/icons/browser_open:/icons/browser_open
- Open in web browser
+ Open in Web Browser
Open the web page for the current database in your browser
-
+
:/icons/clone_database:/icons/clone_database
- Clone from link
+ Clone from Link
Use this to download a remote database for local editing using a URL as provided on the web page of the database.
@@ -451,6 +455,53 @@
F5
+
+
+
+ :/icons/clone_database:/icons/clone_database
+
+
+ Clone Database
+
+
+
+ 75
+ true
+
+
+
+
+
+
+ :/icons/db_open:/icons/db_open
+
+
+ Open Database
+
+
+ Open the local copy of this database
+
+
+
+ 75
+ true
+
+
+
+
+
+ Check out Commit
+
+
+ Download and open this specific commit
+
+
+
+ 75
+ true
+
+
+
comboUser
@@ -547,7 +598,7 @@
- actionCloneDatabase
+ actionCloneDatabaseLink
triggered()
RemoteDock
fetchDatabase()