Merge branch 'develop' into bleo5

This commit is contained in:
Blessio 2024-10-16 17:54:32 +02:00 committed by GitHub
commit 1f9fae9140
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 478 additions and 37 deletions

View File

@ -541,6 +541,10 @@
<source>Export settings</source> <source>Export settings</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Open browser on double clicking URL field in entry view</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ApplicationSettingsWidgetSecurity</name> <name>ApplicationSettingsWidgetSecurity</name>
@ -2194,6 +2198,50 @@ removed from the database.</source>
<source>Autosave delay since last change checkbox</source> <source>Autosave delay since last change checkbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Public Database Metadata</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Warning: the following settings are not encrypted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Publically visible display name used on the unlock dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Database public display name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display color:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Publically visible color used on the unlock dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Database public display color chooser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display icon:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Database Icon</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>DatabaseSettingsWidgetKeeShare</name> <name>DatabaseSettingsWidgetKeeShare</name>

View File

@ -66,6 +66,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::UseDirectWriteSaves,{QS("UseDirectWriteSaves"), Local, false}}, {Config::UseDirectWriteSaves,{QS("UseDirectWriteSaves"), Local, false}},
{Config::SearchLimitGroup,{QS("SearchLimitGroup"), Roaming, false}}, {Config::SearchLimitGroup,{QS("SearchLimitGroup"), Roaming, false}},
{Config::MinimizeOnOpenUrl,{QS("MinimizeOnOpenUrl"), Roaming, false}}, {Config::MinimizeOnOpenUrl,{QS("MinimizeOnOpenUrl"), Roaming, false}},
{Config::OpenURLOnDoubleClick, {QS("OpenURLOnDoubleClick"), Roaming, true}},
{Config::HideWindowOnCopy,{QS("HideWindowOnCopy"), Roaming, false}}, {Config::HideWindowOnCopy,{QS("HideWindowOnCopy"), Roaming, false}},
{Config::MinimizeOnCopy,{QS("MinimizeOnCopy"), Roaming, true}}, {Config::MinimizeOnCopy,{QS("MinimizeOnCopy"), Roaming, true}},
{Config::MinimizeAfterUnlock,{QS("MinimizeAfterUnlock"), Roaming, false}}, {Config::MinimizeAfterUnlock,{QS("MinimizeAfterUnlock"), Roaming, false}},

View File

@ -49,6 +49,7 @@ public:
UseDirectWriteSaves, UseDirectWriteSaves,
SearchLimitGroup, SearchLimitGroup,
MinimizeOnOpenUrl, MinimizeOnOpenUrl,
OpenURLOnDoubleClick,
HideWindowOnCopy, HideWindowOnCopy,
MinimizeOnCopy, MinimizeOnCopy,
MinimizeAfterUnlock, MinimizeAfterUnlock,

View File

@ -1051,6 +1051,54 @@ QUuid Database::publicUuid()
return QUuid::fromRfc4122(publicCustomData()["KPXC_PUBLIC_UUID"].toByteArray()); return QUuid::fromRfc4122(publicCustomData()["KPXC_PUBLIC_UUID"].toByteArray());
} }
QString Database::publicName()
{
return publicCustomData().value("KPXC_PUBLIC_NAME").toString();
}
void Database::setPublicName(const QString& name)
{
if (name.isEmpty()) {
publicCustomData().remove("KPXC_PUBLIC_NAME");
} else {
publicCustomData().insert("KPXC_PUBLIC_NAME", name);
}
markAsModified();
}
QString Database::publicColor()
{
return publicCustomData().value("KPXC_PUBLIC_COLOR").toString();
}
void Database::setPublicColor(const QString& color)
{
if (color.isEmpty()) {
publicCustomData().remove("KPXC_PUBLIC_COLOR");
} else {
publicCustomData().insert("KPXC_PUBLIC_COLOR", color);
}
markAsModified();
}
int Database::publicIcon()
{
if (publicCustomData().contains("KPXC_PUBLIC_ICON")) {
return publicCustomData().value("KPXC_PUBLIC_ICON").toInt();
}
return -1;
}
void Database::setPublicIcon(int iconIndex)
{
if (iconIndex < 0) {
publicCustomData().remove("KPXC_PUBLIC_ICON");
} else {
publicCustomData().insert("KPXC_PUBLIC_ICON", iconIndex);
}
markAsModified();
}
void Database::markAsTemporaryDatabase() void Database::markAsTemporaryDatabase()
{ {
m_isTemporaryDatabase = true; m_isTemporaryDatabase = true;

View File

@ -108,6 +108,13 @@ public:
QString canonicalFilePath() const; QString canonicalFilePath() const;
void setFilePath(const QString& filePath); void setFilePath(const QString& filePath);
QString publicName();
void setPublicName(const QString& name);
QString publicColor();
void setPublicColor(const QString& color);
int publicIcon();
void setPublicIcon(int iconIndex);
Metadata* metadata(); Metadata* metadata();
const Metadata* metadata() const; const Metadata* metadata() const;
Group* rootGroup(); Group* rootGroup();

View File

@ -71,7 +71,8 @@ void KdbxWriter::extractDatabase(QByteArray& xmlOutput, Database* db)
QBuffer buffer; QBuffer buffer;
buffer.setBuffer(&xmlOutput); buffer.setBuffer(&xmlOutput);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
KdbxXmlWriter writer(db->formatVersion()); KdbxXmlWriter::BinaryIdxMap idxMap;
KdbxXmlWriter writer(db->formatVersion(), idxMap);
writer.disableInnerStreamProtection(true); writer.disableInnerStreamProtection(true);
writer.writeDatabase(&buffer, db); writer.writeDatabase(&buffer, db);
} }

View File

@ -225,6 +225,7 @@ void ApplicationSettingsWidget::loadSettings()
m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get(Config::AutoReloadOnChange).toBool()); m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get(Config::AutoReloadOnChange).toBool());
m_generalUi->minimizeAfterUnlockCheckBox->setChecked(config()->get(Config::MinimizeAfterUnlock).toBool()); m_generalUi->minimizeAfterUnlockCheckBox->setChecked(config()->get(Config::MinimizeAfterUnlock).toBool());
m_generalUi->minimizeOnOpenUrlCheckBox->setChecked(config()->get(Config::MinimizeOnOpenUrl).toBool()); m_generalUi->minimizeOnOpenUrlCheckBox->setChecked(config()->get(Config::MinimizeOnOpenUrl).toBool());
m_generalUi->openUrlOnDoubleClick->setChecked(config()->get(Config::OpenURLOnDoubleClick).toBool());
m_generalUi->hideWindowOnCopyCheckBox->setChecked(config()->get(Config::HideWindowOnCopy).toBool()); m_generalUi->hideWindowOnCopyCheckBox->setChecked(config()->get(Config::HideWindowOnCopy).toBool());
hideWindowOnCopyCheckBoxToggled(m_generalUi->hideWindowOnCopyCheckBox->isChecked()); hideWindowOnCopyCheckBoxToggled(m_generalUi->hideWindowOnCopyCheckBox->isChecked());
m_generalUi->minimizeOnCopyRadioButton->setChecked(config()->get(Config::MinimizeOnCopy).toBool()); m_generalUi->minimizeOnCopyRadioButton->setChecked(config()->get(Config::MinimizeOnCopy).toBool());
@ -382,6 +383,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::AutoReloadOnChange, m_generalUi->autoReloadOnChangeCheckBox->isChecked()); config()->set(Config::AutoReloadOnChange, m_generalUi->autoReloadOnChangeCheckBox->isChecked());
config()->set(Config::MinimizeAfterUnlock, m_generalUi->minimizeAfterUnlockCheckBox->isChecked()); config()->set(Config::MinimizeAfterUnlock, m_generalUi->minimizeAfterUnlockCheckBox->isChecked());
config()->set(Config::MinimizeOnOpenUrl, m_generalUi->minimizeOnOpenUrlCheckBox->isChecked()); config()->set(Config::MinimizeOnOpenUrl, m_generalUi->minimizeOnOpenUrlCheckBox->isChecked());
config()->set(Config::OpenURLOnDoubleClick, m_generalUi->openUrlOnDoubleClick->isChecked());
config()->set(Config::HideWindowOnCopy, m_generalUi->hideWindowOnCopyCheckBox->isChecked()); config()->set(Config::HideWindowOnCopy, m_generalUi->hideWindowOnCopyCheckBox->isChecked());
config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked()); config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked());
config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked()); config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked());

View File

@ -57,9 +57,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-419</y>
<width>568</width> <width>573</width>
<height>1153</height> <height>1397</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
@ -543,6 +543,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="openUrlOnDoubleClick">
<property name="text">
<string>Open browser on double clicking URL field in entry view</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="useGroupIconOnEntryCreationCheckBox"> <widget class="QCheckBox" name="useGroupIconOnEntryCreationCheckBox">
<property name="text"> <property name="text">
@ -1351,6 +1361,7 @@
<tabstop>alternativeSaveComboBox</tabstop> <tabstop>alternativeSaveComboBox</tabstop>
<tabstop>ConfirmMoveEntryToRecycleBinCheckBox</tabstop> <tabstop>ConfirmMoveEntryToRecycleBinCheckBox</tabstop>
<tabstop>EnableCopyOnDoubleClickCheckBox</tabstop> <tabstop>EnableCopyOnDoubleClickCheckBox</tabstop>
<tabstop>openUrlOnDoubleClick</tabstop>
<tabstop>useGroupIconOnEntryCreationCheckBox</tabstop> <tabstop>useGroupIconOnEntryCreationCheckBox</tabstop>
<tabstop>minimizeOnOpenUrlCheckBox</tabstop> <tabstop>minimizeOnOpenUrlCheckBox</tabstop>
<tabstop>hideWindowOnCopyCheckBox</tabstop> <tabstop>hideWindowOnCopyCheckBox</tabstop>

View File

@ -72,7 +72,6 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
font.setPointSize(font.pointSize() + 4); font.setPointSize(font.pointSize() + 4);
font.setBold(true); font.setBold(true);
m_ui->labelHeadline->setFont(font); m_ui->labelHeadline->setFont(font);
m_ui->labelHeadline->setText(tr("Unlock KeePassXC Database"));
m_ui->quickUnlockButton->setFont(font); m_ui->quickUnlockButton->setFont(font);
m_ui->quickUnlockButton->setIcon( m_ui->quickUnlockButton->setIcon(
@ -229,6 +228,31 @@ void DatabaseOpenWidget::load(const QString& filename)
m_ui->fileNameLabel->setRawText(m_filename); m_ui->fileNameLabel->setRawText(m_filename);
// Set the public name if defined
auto label = tr("Unlock KeePassXC Database");
if (!m_db->publicName().isEmpty()) {
label.append(QString(": %1").arg(m_db->publicName()));
}
m_ui->labelHeadline->setText(label);
// Apply the public color to the central unlock stack if defined
auto color = m_db->publicColor();
if (!color.isEmpty()) {
m_ui->centralStack->setStyleSheet(QString("QStackedWidget {border: 4px solid %1}").arg(color));
} else {
m_ui->centralStack->setStyleSheet("");
}
// Show the database icon if defined
auto iconIndex = m_db->publicIcon();
if (iconIndex >= 0 && iconIndex < databaseIcons()->count()) {
m_ui->dbIconLabel->setPixmap(databaseIcons()->icon(iconIndex, IconSize::Large));
m_ui->dbIconLabel->setVisible(true);
} else {
m_ui->dbIconLabel->setPixmap({});
m_ui->dbIconLabel->setVisible(false);
}
if (config()->get(Config::RememberLastKeyFiles).toBool()) { if (config()->get(Config::RememberLastKeyFiles).toBool()) {
auto lastKeyFiles = config()->get(Config::LastKeyFiles).toHash(); auto lastKeyFiles = config()->get(Config::LastKeyFiles).toHash();
if (lastKeyFiles.contains(m_filename)) { if (lastKeyFiles.contains(m_filename)) {

View File

@ -55,18 +55,54 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelHeadline"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="font"> <property name="spacing">
<font> <number>9</number>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="text"> <item>
<string>Unlock KeePassXC Database</string> <widget class="QLabel" name="dbIconLabel">
</property> <property name="minimumSize">
</widget> <size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHeadline">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Unlock KeePassXC Database</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="ElidedLabel" name="fileNameLabel"> <widget class="ElidedLabel" name="fileNameLabel">

View File

@ -1495,11 +1495,6 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod
switchToEntryEdit(entry); switchToEntryEdit(entry);
} }
break; break;
case EntryModel::Url:
if (!entry->url().isEmpty()) {
openUrlForEntry(entry);
}
break;
case EntryModel::Totp: case EntryModel::Totp:
if (entry->hasTotp()) { if (entry->hasTotp()) {
setClipboardTextAndMinimize(entry->totp()); setClipboardTextAndMinimize(entry->totp());
@ -1520,6 +1515,13 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod
// TODO: switch to 'Attachments' tab in details view/pane // TODO: switch to 'Attachments' tab in details view/pane
// case EntryModel::Attachments: // case EntryModel::Attachments:
// break; // break;
case EntryModel::Url:
if (!entry->url().isEmpty() && config()->get(Config::OpenURLOnDoubleClick).toBool()) {
openUrlForEntry(entry);
break;
}
// Note, order matters here. We want to fall into the default case.
[[fallthrough]];
default: default:
switchToEntryEdit(entry); switchToEntryEdit(entry);
} }

View File

@ -18,9 +18,16 @@
#include "DatabaseSettingsWidgetGeneral.h" #include "DatabaseSettingsWidgetGeneral.h"
#include "ui_DatabaseSettingsWidgetGeneral.h" #include "ui_DatabaseSettingsWidgetGeneral.h"
#include <QColorDialog>
#include <QDialogButtonBox>
#include <QInputDialog>
#include <QListView>
#include "core/Clock.h" #include "core/Clock.h"
#include "core/Group.h" #include "core/Group.h"
#include "core/Metadata.h" #include "core/Metadata.h"
#include "gui/DatabaseIcons.h"
#include "gui/IconModels.h"
#include "gui/MessageBox.h" #include "gui/MessageBox.h"
DatabaseSettingsWidgetGeneral::DatabaseSettingsWidgetGeneral(QWidget* parent) DatabaseSettingsWidgetGeneral::DatabaseSettingsWidgetGeneral(QWidget* parent)
@ -29,6 +36,11 @@ DatabaseSettingsWidgetGeneral::DatabaseSettingsWidgetGeneral(QWidget* parent)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
connect(m_ui->dbPublicColorButton, &QPushButton::clicked, this, &DatabaseSettingsWidgetGeneral::pickPublicColor);
connect(m_ui->dbPublicColorClearButton, &QPushButton::clicked, this, [this] { setupPublicColorButton({}); });
connect(m_ui->dbPublicIconButton, &QPushButton::clicked, this, &DatabaseSettingsWidgetGeneral::pickPublicIcon);
connect(m_ui->dbPublicIconClearButton, &QPushButton::clicked, this, [this] { setupPublicIconButton(-1); });
connect(m_ui->historyMaxItemsCheckBox, SIGNAL(toggled(bool)), m_ui->historyMaxItemsSpinBox, SLOT(setEnabled(bool))); connect(m_ui->historyMaxItemsCheckBox, SIGNAL(toggled(bool)), m_ui->historyMaxItemsSpinBox, SLOT(setEnabled(bool)));
connect(m_ui->historyMaxSizeCheckBox, SIGNAL(toggled(bool)), m_ui->historyMaxSizeSpinBox, SLOT(setEnabled(bool))); connect(m_ui->historyMaxSizeCheckBox, SIGNAL(toggled(bool)), m_ui->historyMaxSizeSpinBox, SLOT(setEnabled(bool)));
connect(m_ui->autosaveDelayCheckBox, SIGNAL(toggled(bool)), m_ui->autosaveDelaySpinBox, SLOT(setEnabled(bool))); connect(m_ui->autosaveDelayCheckBox, SIGNAL(toggled(bool)), m_ui->autosaveDelaySpinBox, SLOT(setEnabled(bool)));
@ -46,6 +58,10 @@ void DatabaseSettingsWidgetGeneral::initialize()
m_ui->defaultUsernameEdit->setText(meta->defaultUserName()); m_ui->defaultUsernameEdit->setText(meta->defaultUserName());
m_ui->compressionCheckbox->setChecked(m_db->compressionAlgorithm() != Database::CompressionNone); m_ui->compressionCheckbox->setChecked(m_db->compressionAlgorithm() != Database::CompressionNone);
m_ui->dbPublicName->setText(m_db->publicName());
setupPublicColorButton(m_db->publicColor());
setupPublicIconButton(m_db->publicIcon());
if (meta->historyMaxItems() > -1) { if (meta->historyMaxItems() > -1) {
m_ui->historyMaxItemsSpinBox->setValue(meta->historyMaxItems()); m_ui->historyMaxItemsSpinBox->setValue(meta->historyMaxItems());
m_ui->historyMaxItemsCheckBox->setChecked(true); m_ui->historyMaxItemsCheckBox->setChecked(true);
@ -116,6 +132,10 @@ bool DatabaseSettingsWidgetGeneral::saveSettings()
meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked()); meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked());
meta->setSettingsChanged(Clock::currentDateTimeUtc()); meta->setSettingsChanged(Clock::currentDateTimeUtc());
m_db->setPublicName(m_ui->dbPublicName->text());
m_db->setPublicColor(m_ui->dbPublicColorButton->property("color").toString());
m_db->setPublicIcon(m_ui->dbPublicIconButton->property("iconIndex").toInt());
bool truncate = false; bool truncate = false;
int historyMaxItems; int historyMaxItems;
@ -155,3 +175,79 @@ bool DatabaseSettingsWidgetGeneral::saveSettings()
return true; return true;
} }
void DatabaseSettingsWidgetGeneral::pickPublicColor()
{
auto oldColor = QColor(m_ui->dbPublicColorButton->property("color").toString());
auto newColor = QColorDialog::getColor(oldColor);
if (newColor.isValid()) {
setupPublicColorButton(newColor);
}
}
void DatabaseSettingsWidgetGeneral::setupPublicColorButton(const QColor& color)
{
m_ui->dbPublicColorClearButton->setVisible(color.isValid());
if (color.isValid()) {
m_ui->dbPublicColorButton->setStyleSheet(QString("background-color:%1").arg(color.name()));
m_ui->dbPublicColorButton->setProperty("color", color.name());
} else {
m_ui->dbPublicColorButton->setStyleSheet("");
m_ui->dbPublicColorButton->setProperty("color", {});
}
}
void DatabaseSettingsWidgetGeneral::pickPublicIcon()
{
QDialog dialog(this);
dialog.setSizeGripEnabled(false);
dialog.setWindowTitle(tr("Select Database Icon"));
auto iconList = new QListView;
iconList->setFlow(QListView::LeftToRight);
iconList->setMovement(QListView::Static);
iconList->setResizeMode(QListView::Adjust);
iconList->setWrapping(true);
iconList->setSpacing(4);
auto iconModel = new DefaultIconModel;
iconList->setModel(iconModel);
if (m_ui->dbPublicIconButton->property("iconIndex").toInt() >= 0) {
iconList->setCurrentIndex(iconModel->index(m_ui->dbPublicIconButton->property("iconIndex").toInt(), 0));
} else {
iconList->setCurrentIndex(iconModel->index(0, 0));
}
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
auto layout = new QVBoxLayout(&dialog);
layout->addWidget(iconList);
layout->addWidget(buttonBox);
// Resize the dialog to fit the default icon list
auto cellSize = iconList->sizeHintForIndex(iconModel->index(0, 0));
auto spacing = iconList->spacing() * 2;
dialog.resize((cellSize.width() + spacing) * 15, (cellSize.height() + spacing) * 6 + 16);
connect(iconList, &QListView::doubleClicked, &dialog, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
connect(
&dialog, &QDialog::accepted, this, [this, iconList] { setupPublicIconButton(iconList->currentIndex().row()); });
dialog.exec();
}
void DatabaseSettingsWidgetGeneral::setupPublicIconButton(int iconIndex)
{
auto valid = iconIndex >= 0 && iconIndex < databaseIcons()->count();
m_ui->dbPublicIconClearButton->setVisible(valid);
if (valid) {
m_ui->dbPublicIconButton->setIcon(databaseIcons()->icon(iconIndex));
m_ui->dbPublicIconButton->setProperty("iconIndex", iconIndex);
m_ui->dbPublicIconClearButton->setVisible(true);
} else {
m_ui->dbPublicIconButton->setIcon(QIcon());
m_ui->dbPublicIconButton->setProperty("iconIndex", -1);
m_ui->dbPublicIconClearButton->setVisible(false);
}
}

View File

@ -20,6 +20,8 @@
#include "DatabaseSettingsWidget.h" #include "DatabaseSettingsWidget.h"
#include <QColor>
class Database; class Database;
namespace Ui namespace Ui
{ {
@ -43,6 +45,13 @@ public slots:
protected: protected:
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;
private slots:
void pickPublicColor();
void setupPublicColorButton(const QColor& color);
void pickPublicIcon();
void setupPublicIconButton(int iconIndex);
private:
const QScopedPointer<Ui::DatabaseSettingsWidgetGeneral> m_ui; const QScopedPointer<Ui::DatabaseSettingsWidgetGeneral> m_ui;
}; };

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>453</width> <width>453</width>
<height>394</height> <height>647</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -92,6 +92,151 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Public Database Metadata</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="warningLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Warning: the following settings are not encrypted.</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="dbPublicSummaryLabel">
<property name="text">
<string>Display name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dbPublicName">
<property name="toolTip">
<string>Publically visible display name used on the unlock dialog</string>
</property>
<property name="accessibleName">
<string>Database public display name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dbPublicColorLabel">
<property name="text">
<string>Display color:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="dbPublicColorButton">
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Publically visible color used on the unlock dialog</string>
</property>
<property name="accessibleName">
<string>Database public display color chooser</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="dbPublicColorClearButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="dbPublicIconLabel">
<property name="text">
<string>Display icon:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="dbPublicIconButton">
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="dbPublicIconClearButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
@ -113,6 +258,19 @@ of entries remain at most.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QCheckBox" name="recycleBinEnabledCheckBox">
<property name="toolTip">
<string>Move entries to a recycle bin group
instead of deleting them from the database.
Entries deleted from the recycle bin are
removed from the database.</string>
</property>
<property name="text">
<string>Use recycle bin</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="historyMaxSizeCheckBox"> <widget class="QCheckBox" name="historyMaxSizeCheckBox">
<property name="toolTip"> <property name="toolTip">
@ -158,19 +316,6 @@ add up to the specified amount at most.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QCheckBox" name="recycleBinEnabledCheckBox">
<property name="toolTip">
<string>Move entries to a recycle bin group
instead of deleting them from the database.
Entries deleted from the recycle bin are
removed from the database.</string>
</property>
<property name="text">
<string>Use recycle bin</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -913,6 +913,7 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_mainUi->expireDatePicker->setReadOnly(m_history); m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->revealNotesButton->setIcon(icons()->onOffIcon("password-show", false)); m_mainUi->revealNotesButton->setIcon(icons()->onOffIcon("password-show", false));
m_mainUi->revealNotesButton->setVisible(config()->get(Config::Security_HideNotes).toBool()); m_mainUi->revealNotesButton->setVisible(config()->get(Config::Security_HideNotes).toBool());
m_mainUi->revealNotesButton->setChecked(false);
m_mainUi->notesEdit->setReadOnly(m_history); m_mainUi->notesEdit->setReadOnly(m_history);
m_mainUi->notesEdit->setVisible(!config()->get(Config::Security_HideNotes).toBool()); m_mainUi->notesEdit->setVisible(!config()->get(Config::Security_HideNotes).toBool());
if (config()->get(Config::GUI_MonospaceNotes).toBool()) { if (config()->get(Config::GUI_MonospaceNotes).toBool()) {

View File

@ -38,7 +38,7 @@ EntryPreviewWidget TagsEdit
padding-left: 0px; padding-left: 0px;
} }
DatabaseOpenWidget #centralStack { DatabaseOpenWidget #centralStack, DatabaseOpenWidget #publicSummaryLabel {
border: 1px solid palette(mid); border: 1px solid palette(mid);
background: palette(light); background: palette(light);
} }

View File

@ -1,4 +1,4 @@
DatabaseOpenWidget #centralStack { DatabaseOpenWidget #centralStack, DatabaseOpenWidget #publicSummaryLabel {
border: 2px groove palette(mid); border: 2px groove palette(mid);
background: palette(light); background: palette(light);
} }

View File

@ -10,6 +10,15 @@ EntryPreviewWidget TagsEdit:disabled {
background-color: #424242; background-color: #424242;
} }
QMenu {
border: 1px solid #56565A;
}
QMenu::separator {
height: 1px;
background-color: #56565A;
}
QPushButton:!default:hover { QPushButton:!default:hover {
/* Using slightly darker shade from palette(button) */ /* Using slightly darker shade from palette(button) */
background: #252528; background: #252528;