Skip to content

Commit

Permalink
Change database root group Uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
varjolintu committed Feb 11, 2020
1 parent 8dbd5b1 commit 1a9c8cf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SLOT(removeSharedEncryptionKeys()));
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SLOT(updateSharedKeyList()));
connect(m_ui->removeStoredPermissions, SIGNAL(clicked()), this, SLOT(removeStoredPermissions()));
connect(m_ui->refreshDatabaseID, SIGNAL(clicked()), this, SLOT(refreshDatabaseID()));
}

DatabaseSettingsWidgetBrowser::~DatabaseSettingsWidgetBrowser()
Expand Down Expand Up @@ -254,6 +255,22 @@ void DatabaseSettingsWidgetBrowser::convertAttributesToCustomData()
m_browserService.convertAttributesToCustomData(m_db);
}

void DatabaseSettingsWidgetBrowser::refreshDatabaseID()
{
if (MessageBox::Yes
!= MessageBox::question(this,
tr("Refresh database root group ID"),
tr("Do you really want refresh database root group ID?\n"
"This is only necessary if your database is a clone of the original one and the "
"browser extension cannot connect to it properly."),
MessageBox::Yes | MessageBox::Cancel,
MessageBox::Cancel)) {
return;
}

m_db->rootGroup()->setUuid(QUuid::createUuid());
}

// Updates the shared key list after the list is cleared
void DatabaseSettingsWidgetBrowser::updateSharedKeyList()
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private slots:
void removeSharedEncryptionKeys();
void removeStoredPermissions();
void convertAttributesToCustomData();
void refreshDatabaseID();

private:
void updateModel();
Expand Down
21 changes: 19 additions & 2 deletions src/gui/dbsettings/DatabaseSettingsWidgetBrowser.ui
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="refreshDatabaseID">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Refresh database root group ID</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand All @@ -106,10 +123,10 @@
<property name="title">
<string>Stored keys</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTableView" name="customDataTable">
<property name="accessibleName">
Expand Down

0 comments on commit 1a9c8cf

Please sign in to comment.