mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-11 06:08:33 -06:00
dbhub: Add refresh button to both tool bars
This allows updating the data in case it has changed on the DBHub.io servers.
This commit is contained in:
@@ -44,12 +44,7 @@ RemoteDock::RemoteDock(MainWindow* parent)
|
||||
connect(&remoteDatabase, &RemoteDatabase::openFile, this, &RemoteDock::openFile);
|
||||
|
||||
// Reload the directory tree and the list of local checkouts when a database upload has finished
|
||||
connect(&remoteDatabase, &RemoteDatabase::uploadFinished, remoteModel, &RemoteModel::refresh);
|
||||
connect(&remoteDatabase, &RemoteDatabase::uploadFinished, this, &RemoteDock::refreshLocalFileList);
|
||||
connect(&remoteDatabase, &RemoteDatabase::uploadFinished, [this]() {
|
||||
if(!currently_opened_file_info.file.empty())
|
||||
refreshMetadata(currently_opened_file_info.user_name(), QString::fromStdString(currently_opened_file_info.name));
|
||||
});
|
||||
connect(&remoteDatabase, &RemoteDatabase::uploadFinished, this, &RemoteDock::refresh);
|
||||
connect(&remoteDatabase, &RemoteDatabase::openFile, this, &RemoteDock::refreshLocalFileList);
|
||||
|
||||
// Whenever a new directory listing has been parsed, check if it was a new root dir and, if so, open the user's directory
|
||||
@@ -209,6 +204,7 @@ void RemoteDock::enableButtons()
|
||||
ui->buttonPushDatabase->setEnabled(db_opened && logged_in);
|
||||
ui->actionCloneDatabase->setEnabled(logged_in);
|
||||
ui->actionDatabaseOpenBrowser->setEnabled(db_opened && logged_in);
|
||||
ui->actionRefresh->setEnabled(logged_in);
|
||||
}
|
||||
|
||||
void RemoteDock::pushDatabase()
|
||||
@@ -419,3 +415,16 @@ void RemoteDock::openCurrentDatabaseInBrowser() const
|
||||
{
|
||||
QDesktopServices::openUrl(ui->actionDatabaseOpenBrowser->data().toUrl());
|
||||
}
|
||||
|
||||
void RemoteDock::refresh()
|
||||
{
|
||||
// Refresh Remote tab
|
||||
remoteModel->refresh();
|
||||
|
||||
// Refresh Local tab
|
||||
refreshLocalFileList();
|
||||
|
||||
// Refresh Current Database tab
|
||||
if(!currently_opened_file_info.file.empty())
|
||||
refreshMetadata(currently_opened_file_info.user_name(), QString::fromStdString(currently_opened_file_info.name));
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ private slots:
|
||||
const std::string& default_branch, const std::string& web_page);
|
||||
void deleteLocalDatabase(const QModelIndex& index);
|
||||
void openCurrentDatabaseInBrowser() const;
|
||||
void refresh();
|
||||
|
||||
signals:
|
||||
void openFile(QString file);
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<addaction name="actionCloneDatabase"/>
|
||||
<addaction name="actionRefresh"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -190,6 +191,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<addaction name="actionDatabaseOpenBrowser"/>
|
||||
<addaction name="actionRefresh"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -434,6 +436,21 @@
|
||||
<string>Use this to download a remote database for local editing using a URL as provided on the web page of the database.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRefresh">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/refresh</normaloff>:/icons/refresh</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reload all data and update the views</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboUser</tabstop>
|
||||
@@ -561,6 +578,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionRefresh</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>RemoteDock</receiver>
|
||||
<slot>refresh()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>51</x>
|
||||
<y>21</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>266</x>
|
||||
<y>193</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>setNewIdentity(QString)</slot>
|
||||
@@ -570,5 +603,6 @@
|
||||
<slot>openLocalFile(QModelIndex)</slot>
|
||||
<slot>fetchDatabase()</slot>
|
||||
<slot>openCurrentDatabaseInBrowser()</slot>
|
||||
<slot>refresh()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user