Merge branch 'develop' into feature/yubikey

This commit is contained in:
Janek Bevendorff 2017-02-25 22:04:57 +01:00
commit 3230206b69
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53
6 changed files with 96 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 16 16"
version="1.1"
id="svg6"
sodipodi:docname="tab-close.svg"
inkscape:version="0.92.1 r">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="791"
inkscape:window-height="480"
id="namedview8"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-x="1301"
inkscape:window-y="443"
inkscape:window-maximized="0"
inkscape:current-layer="svg6" />
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#f2f2f2;
}
.ColorScheme-NegativeText {
color:#da4453;
}
</style>
</defs>
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
class="ColorScheme-NegativeText"
d="M 8,2 A 6,6 0 0 0 2,8 6,6 0 0 0 8,14 6,6 0 0 0 14,8 6,6 0 0 0 8,2 Z M 5.70703,5 8,7.29297 10.29297,5 11,5.70703 8.70703,8 11,10.29297 10.29297,11 8,8.70703 5.70703,11 5,10.29297 7.29297,8 5,5.70703 5.70703,5 Z"
id="path4" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -21,6 +21,7 @@
#include <QLockFile> #include <QLockFile>
#include <QSaveFile> #include <QSaveFile>
#include <QTabWidget> #include <QTabWidget>
#include <QPushButton>
#include "autotype/AutoType.h" #include "autotype/AutoType.h"
#include "core/Config.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 // for now silently ignore if we can't create a lock file
// due to lack of permissions // due to lack of permissions
if (lockFile->error() != QLockFile::PermissionError) { if (lockFile->error() != QLockFile::PermissionError) {
QMessageBox::StandardButton result = MessageBox::question(this, tr("Open database"), QMessageBox msgBox;
tr("The database you are trying to open is locked by another instance of KeePassXC.\n" msgBox.setWindowTitle(tr("Database already opened"));
"Do you want to open it anyway? Alternatively the database is opened read-only."), msgBox.setText(tr("The database you are trying to open is locked by another instance of KeePassXC.\n\n"
QMessageBox::Yes | QMessageBox::No); "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; dbStruct.readOnly = true;
delete lockFile; delete lockFile;
lockFile = nullptr; lockFile = nullptr;
} } else if (result == QMessageBox::Yes) {
else {
// take over the lock file if possible // take over the lock file if possible
if (lockFile->removeStaleLockFile()) { if (lockFile->removeStaleLockFile()) {
lockFile->tryLock(); lockFile->tryLock();
} }
} else {
return;
} }
} }
} }

View File

@ -287,7 +287,7 @@ void DatabaseWidget::createEntry()
void DatabaseWidget::setIconFromParent() void DatabaseWidget::setIconFromParent()
{ {
if (!config()->get("UseGroupIconOnEntryCreation", true).toBool()) { if (!config()->get("UseGroupIconOnEntryCreation").toBool()) {
return; return;
} }
@ -1073,8 +1073,7 @@ void DatabaseWidget::reloadDatabaseFile()
// Merge the old database into the new one // Merge the old database into the new one
m_db->setEmitModified(false); m_db->setEmitModified(false);
db->merge(m_db); db->merge(m_db);
} } else {
else {
// Since we are accepting the new file as-is, internally mark as unmodified // 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 // TODO: when saving is moved out of DatabaseTabWidget, this should be replaced
m_databaseModified = false; m_databaseModified = false;
@ -1098,16 +1097,10 @@ void DatabaseWidget::reloadDatabaseFile()
restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload); restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload);
} }
else { } else {
m_messageWidget->showMessage(
tr("Could not parse or unlock the new database file while attempting"
" to autoreload this database."), MessageWidget::Error);
}
}
else {
m_messageWidget->showMessage( m_messageWidget->showMessage(
tr("Could not open the new database file while attempting to autoreload this database."), tr("Could not open the new database file while attempting to autoreload this database."),
MessageWidget::Error); MessageWidget::Error);
} }
// Rewatch the database file // Rewatch the database file

View File

@ -20,6 +20,8 @@
*/ */
#include "KMessageWidget.h" #include "KMessageWidget.h"
#include "core/FilePath.h"
#include <QAction> #include <QAction>
#include <QEvent> #include <QEvent>
#include <QGridLayout> #include <QGridLayout>
@ -89,13 +91,19 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
QAction *closeAction = new QAction(q); QAction *closeAction = new QAction(q);
closeAction->setText(KMessageWidget::tr("&Close")); closeAction->setText(KMessageWidget::tr("&Close"));
closeAction->setToolTip(KMessageWidget::tr("Close message")); 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())); QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));
closeButton = new QToolButton(content); closeButton = new QToolButton(content);
closeButton->setAutoRaise(true); closeButton->setAutoRaise(true);
closeButton->setDefaultAction(closeAction); 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); q->setMessageType(KMessageWidget::Information);
} }
@ -285,7 +293,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
} }
// Colors // Colors
fg = palette().highlightedText().color(); fg = palette().light().color();
bg0 = bg1.lighter(110); bg0 = bg1.lighter(110);
bg2 = bg1.darker(110); bg2 = bg1.darker(110);
border = darkShade(bg1); border = darkShade(bg1);
@ -299,6 +307,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
"border-radius: 5px;" "border-radius: 5px;"
"border: 1px solid %4;" "border: 1px solid %4;"
"margin: %5px;" "margin: %5px;"
"padding: 5px;"
"}" "}"
".QLabel { color: %6; }" ".QLabel { color: %6; }"
)) ))