diff --git a/share/icons/application/16x16/actions/message-close.png b/share/icons/application/16x16/actions/message-close.png
new file mode 100644
index 000000000..4b2f9ca4d
Binary files /dev/null and b/share/icons/application/16x16/actions/message-close.png differ
diff --git a/share/icons/application/22x22/actions/message-close.png b/share/icons/application/22x22/actions/message-close.png
new file mode 100644
index 000000000..4b2f9ca4d
Binary files /dev/null and b/share/icons/application/22x22/actions/message-close.png differ
diff --git a/share/icons/svg/message-close.svg b/share/icons/svg/message-close.svg
new file mode 100644
index 000000000..44b643072
--- /dev/null
+++ b/share/icons/svg/message-close.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 0503531ab..5ff357f57 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include "autotype/AutoType.h"
#include "core/Config.h"
@@ -158,21 +159,29 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
// for now silently ignore if we can't create a lock file
// due to lack of permissions
if (lockFile->error() != QLockFile::PermissionError) {
- QMessageBox::StandardButton result = MessageBox::question(this, tr("Open database"),
- tr("The database you are trying to open is locked by another instance of KeePassXC.\n"
- "Do you want to open it anyway? Alternatively the database is opened read-only."),
- QMessageBox::Yes | QMessageBox::No);
+ QMessageBox msgBox;
+ msgBox.setWindowTitle(tr("Database already opened"));
+ msgBox.setText(tr("The database you are trying to open is locked by another instance of KeePassXC.\n\n"
+ "Do you want to open it anyway?"));
+ msgBox.setIcon(QMessageBox::Question);
+ msgBox.addButton(QMessageBox::Yes);
+ msgBox.addButton(QMessageBox::No);
+ auto readOnlyButton = msgBox.addButton(tr("Open read-only"), QMessageBox::AcceptRole);
+ msgBox.setDefaultButton(readOnlyButton);
+ msgBox.setEscapeButton(QMessageBox::No);
+ auto result = msgBox.exec();
- if (result == QMessageBox::No) {
+ if (msgBox.clickedButton() == readOnlyButton) {
dbStruct.readOnly = true;
delete lockFile;
lockFile = nullptr;
- }
- else {
+ } else if (result == QMessageBox::Yes) {
// take over the lock file if possible
if (lockFile->removeStaleLockFile()) {
lockFile->tryLock();
}
+ } else {
+ return;
}
}
}
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 9bdd9ce90..c1ac9422a 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -287,7 +287,7 @@ void DatabaseWidget::createEntry()
void DatabaseWidget::setIconFromParent()
{
- if (!config()->get("UseGroupIconOnEntryCreation", true).toBool()) {
+ if (!config()->get("UseGroupIconOnEntryCreation").toBool()) {
return;
}
@@ -1073,8 +1073,7 @@ void DatabaseWidget::reloadDatabaseFile()
// Merge the old database into the new one
m_db->setEmitModified(false);
db->merge(m_db);
- }
- else {
+ } else {
// Since we are accepting the new file as-is, internally mark as unmodified
// TODO: when saving is moved out of DatabaseTabWidget, this should be replaced
m_databaseModified = false;
@@ -1098,16 +1097,10 @@ void DatabaseWidget::reloadDatabaseFile()
restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload);
}
- else {
- m_messageWidget->showMessage(
- tr("Could not parse or unlock the new database file while attempting"
- " to autoreload this database."), MessageWidget::Error);
- }
- }
- else {
+ } else {
m_messageWidget->showMessage(
tr("Could not open the new database file while attempting to autoreload this database."),
- MessageWidget::Error);
+ MessageWidget::Error);
}
// Rewatch the database file
diff --git a/src/gui/KMessageWidget.cpp b/src/gui/KMessageWidget.cpp
index e2c22574c..b88c3bc12 100644
--- a/src/gui/KMessageWidget.cpp
+++ b/src/gui/KMessageWidget.cpp
@@ -20,6 +20,8 @@
*/
#include "KMessageWidget.h"
+#include "core/FilePath.h"
+
#include
#include
#include
@@ -89,13 +91,19 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
QAction *closeAction = new QAction(q);
closeAction->setText(KMessageWidget::tr("&Close"));
closeAction->setToolTip(KMessageWidget::tr("Close message"));
- closeAction->setIcon(q->style()->standardIcon(QStyle::SP_DialogCloseButton));
+ closeAction->setIcon(FilePath::instance()->icon("actions", "message-close", false));
QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));
closeButton = new QToolButton(content);
closeButton->setAutoRaise(true);
closeButton->setDefaultAction(closeAction);
+#ifdef Q_OS_MAC
+ closeButton->setStyleSheet("QToolButton { background: transparent;"
+ "border-radius: 2px; padding: 3px; }"
+ "QToolButton::hover, QToolButton::focus {"
+ "border: 1px solid rgb(90, 200, 250); }");
+#endif
q->setMessageType(KMessageWidget::Information);
}
@@ -285,7 +293,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
}
// Colors
- fg = palette().highlightedText().color();
+ fg = palette().light().color();
bg0 = bg1.lighter(110);
bg2 = bg1.darker(110);
border = darkShade(bg1);
@@ -299,6 +307,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
"border-radius: 5px;"
"border: 1px solid %4;"
"margin: %5px;"
+ "padding: 5px;"
"}"
".QLabel { color: %6; }"
))