Merge pull request #340 from keepassxreboot/feature/rework-settings

User interface rework of settings and "About" dialog
This commit is contained in:
Janek Bevendorff 2017-02-25 01:08:45 +01:00 committed by GitHub
commit 0b48e68a3c
46 changed files with 1724 additions and 872 deletions

View File

@ -22,10 +22,10 @@ install(FILES ${DATABASE_ICONS} DESTINATION ${DATA_INSTALL_DIR}/icons/database)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
FILES_MATCHING PATTERN "keepassx*.png" PATTERN "keepassx*.svgz" FILES_MATCHING PATTERN "keepassx*.png" PATTERN "keepassx*.svgz"
PATTERN "status" EXCLUDE PATTERN "actions" EXCLUDE) PATTERN "status" EXCLUDE PATTERN "actions" EXCLUDE PATTERN "categories" EXCLUDE)
install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
FILES_MATCHING PATTERN "application-x-keepassxc.png" PATTERN "application-x-keepassxc.svgz" FILES_MATCHING PATTERN "application-x-keepassxc.png" PATTERN "application-x-keepassxc.svgz"
PATTERN "status" EXCLUDE PATTERN "actions" EXCLUDE) PATTERN "status" EXCLUDE PATTERN "actions" EXCLUDE PATTERN "categories" EXCLUDE)
install(FILES linux/keepassxc.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES linux/keepassxc.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES linux/keepassxc.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages) install(FILES linux/keepassxc.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
endif(UNIX AND NOT APPLE) endif(UNIX AND NOT APPLE)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -70,6 +70,7 @@ set(keepassx_SOURCES
format/KeePass2XmlWriter.cpp format/KeePass2XmlWriter.cpp
gui/AboutDialog.cpp gui/AboutDialog.cpp
gui/Application.cpp gui/Application.cpp
gui/CategoryListWidget.cpp
gui/ChangeMasterKeyWidget.cpp gui/ChangeMasterKeyWidget.cpp
gui/Clipboard.cpp gui/Clipboard.cpp
gui/DatabaseOpenWidget.cpp gui/DatabaseOpenWidget.cpp
@ -132,6 +133,7 @@ set(keepassx_FORMS
gui/ChangeMasterKeyWidget.ui gui/ChangeMasterKeyWidget.ui
gui/DatabaseOpenWidget.ui gui/DatabaseOpenWidget.ui
gui/DatabaseSettingsWidget.ui gui/DatabaseSettingsWidget.ui
gui/CategoryListWidget.ui
gui/EditWidget.ui gui/EditWidget.ui
gui/EditWidgetIcons.ui gui/EditWidgetIcons.ui
gui/EditWidgetProperties.ui gui/EditWidgetProperties.ui

View File

@ -102,10 +102,11 @@ void Config::init(const QString& fileName)
m_defaults.insert("MinimizeOnCopy", false); m_defaults.insert("MinimizeOnCopy", false);
m_defaults.insert("UseGroupIconOnEntryCreation", false); m_defaults.insert("UseGroupIconOnEntryCreation", false);
m_defaults.insert("AutoTypeEntryTitleMatch", true); m_defaults.insert("AutoTypeEntryTitleMatch", true);
m_defaults.insert("UseGroupIconOnEntryCreation", true);
m_defaults.insert("security/clearclipboard", true); m_defaults.insert("security/clearclipboard", true);
m_defaults.insert("security/clearclipboardtimeout", 10); m_defaults.insert("security/clearclipboardtimeout", 10);
m_defaults.insert("security/lockdatabaseidle", false); m_defaults.insert("security/lockdatabaseidle", false);
m_defaults.insert("security/lockdatabaseidlesec", 10); m_defaults.insert("security/lockdatabaseidlesec", 240);
m_defaults.insert("security/lockdatabaseminimize", false); m_defaults.insert("security/lockdatabaseminimize", false);
m_defaults.insert("security/passwordsrepeat", false); m_defaults.insert("security/passwordsrepeat", false);
m_defaults.insert("security/passwordscleartext", false); m_defaults.insert("security/passwordscleartext", false);

View File

@ -23,15 +23,21 @@
#include "core/FilePath.h" #include "core/FilePath.h"
#include "crypto/Crypto.h" #include "crypto/Crypto.h"
#include <QClipboard>
#include <QSysInfo>
AboutDialog::AboutDialog(QWidget* parent) AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent),
, m_ui(new Ui::AboutDialog()) m_ui(new Ui::AboutDialog())
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
resize(minimumSize());
setWindowFlags(Qt::Sheet);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->nameLabel->setText(m_ui->nameLabel->text() + " " + KEEPASSX_VERSION); m_ui->nameLabel->setText(m_ui->nameLabel->text() + " " + KEEPASSX_VERSION);
QFont nameLabelFont = m_ui->nameLabel->font(); QFont nameLabelFont = m_ui->nameLabel->font();
nameLabelFont.setBold(true);
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4); nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
m_ui->nameLabel->setFont(nameLabelFont); m_ui->nameLabel->setFont(nameLabelFont);
@ -45,37 +51,56 @@ AboutDialog::AboutDialog(QWidget* parent)
commitHash = DIST_HASH; commitHash = DIST_HASH;
} }
QString debugInfo = "KeePassXC - ";
debugInfo.append(tr("Version %1\n").arg(KEEPASSX_VERSION));
if (!commitHash.isEmpty()) { if (!commitHash.isEmpty()) {
QString labelText = tr("Revision").append(": ").append(commitHash); debugInfo.append(tr("Revision: %1").arg(commitHash).append("\n\n"));
m_ui->label_git->setText(labelText);
} }
QString libs = QString("%1\n- Qt %2\n- %3") debugInfo.append(QString("%1\n- Qt %2\n- %3\n\n")
.arg(m_ui->label_libs->text()) .arg(tr("Libraries:"))
.arg(QString::fromLocal8Bit(qVersion())) .arg(QString::fromLocal8Bit(qVersion()))
.arg(Crypto::backendVersion()); .arg(Crypto::backendVersion()));
m_ui->label_libs->setText(libs);
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
.arg(QSysInfo::prettyProductName())
.arg(QSysInfo::currentCpuArchitecture())
.arg(QSysInfo::kernelType())
.arg(QSysInfo::kernelVersion()));
debugInfo.append("\n\n");
#endif
QString extensions; QString extensions;
#ifdef WITH_XC_HTTP #ifdef WITH_XC_HTTP
extensions += "- KeePassHTTP\n"; extensions += "\n- KeePassHTTP";
#endif #endif
#ifdef WITH_XC_AUTOTYPE #ifdef WITH_XC_AUTOTYPE
extensions += "- Autotype\n"; extensions += "\n- Auto-Type";
#endif #endif
#ifdef WITH_XC_YUBIKEY #ifdef WITH_XC_YUBIKEY
extensions += "- Yubikey\n"; extensions += "\n- YubiKey";
#endif #endif
if (extensions.isEmpty()) if (extensions.isEmpty())
extensions = "None"; extensions = " None";
m_ui->label_features->setText(m_ui->label_features->text() + extensions); debugInfo.append(tr("Enabled extensions:").append(extensions));
m_ui->debugInfo->setPlainText(debugInfo);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
connect(m_ui->copyToClipboard, SIGNAL(clicked()), SLOT(copyToClipboard()));
} }
AboutDialog::~AboutDialog() AboutDialog::~AboutDialog()
{ {
} }
void AboutDialog::copyToClipboard()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(m_ui->debugInfo->toPlainText());
}

View File

@ -33,6 +33,9 @@ public:
explicit AboutDialog(QWidget* parent = nullptr); explicit AboutDialog(QWidget* parent = nullptr);
~AboutDialog(); ~AboutDialog();
protected slots:
void copyToClipboard();
private: private:
QScopedPointer<Ui::AboutDialog> m_ui; QScopedPointer<Ui::AboutDialog> m_ui;
}; };

View File

@ -6,20 +6,23 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>455</width> <width>479</width>
<height>266</height> <height>478</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>About KeePassXC</string> <string>About KeePassXC</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <property name="topMargin">
<number>15</number>
</property>
<property name="bottomMargin">
<number>20</number>
</property>
<item alignment="Qt::AlignVCenter">
<widget class="QLabel" name="iconLabel"> <widget class="QLabel" name="iconLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -27,9 +30,21 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item alignment="Qt::AlignVCenter">
<widget class="QLabel" name="nameLabel"> <widget class="QLabel" name="nameLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -37,6 +52,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string notr="true"> KeePassXC</string> <string notr="true"> KeePassXC</string>
</property> </property>
@ -45,66 +66,161 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy"> <property name="currentIndex">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <number>0</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;a href=&quot;https://keepassxc.org/&quot;&gt;https://keepassxc.org/&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>KeePassXC is distributed under the terms of the GNU General Public License (GPL) version 2 or (at your option) version 3.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_git">
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_libs">
<property name="text">
<string>Using:</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_features">
<property name="text">
<string>Extensions:
</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;p&gt;Website: &lt;a href=&quot;https://keepassxc.org/&quot;&gt;https://keepassxc.org/&lt;/a&gt;&lt;/p&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;p&gt;Report bugs at: &lt;a href=&quot;https://github.com/keepassxreboot/keepassxc/issues&quot;&gt;https://github.com/&lt;/a&gt;&lt;/p&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>KeePassXC is distributed under the terms of the GNU General Public License (GPL) version 2 or (at your option) version 3.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;p&gt;Main contributors:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;debfx (KeePassX)&lt;/li&gt;
&lt;li&gt;droidmonkey&lt;/li&gt;
&lt;li&gt;louib&lt;/li&gt;
&lt;li&gt;phoerious&lt;li&gt;
&lt;li&gt;thezero&lt;/li&gt;
&lt;/ul&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Debug Info</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Include the following information whenever you report a bug:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="debugInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyToClipboard">
<property name="text">
<string>Copy to clipboard</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>

View File

@ -0,0 +1,252 @@
/*
* Copyright (C) 2017 KeePassXC Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CategoryListWidget.h"
#include "ui_CategoryListWidget.h"
#include <QListWidget>
#include <QScrollBar>
#include <QSize>
#include <QStyledItemDelegate>
#include <QPainter>
CategoryListWidget::CategoryListWidget(QWidget* parent)
: QWidget(parent),
m_itemDelegate(nullptr),
m_ui(new Ui::CategoryListWidget())
{
m_ui->setupUi(this);
m_itemDelegate = new CategoryListWidgetDelegate(m_ui->categoryList);
m_ui->categoryList->setItemDelegate(m_itemDelegate);
connect(m_ui->categoryList, SIGNAL(currentRowChanged(int)), SLOT(emitCategoryChanged(int)));
connect(m_ui->scrollUp, SIGNAL(clicked()), SLOT(scrollCategoriesUp()));
connect(m_ui->scrollDown, SIGNAL(clicked()), SLOT(scrollCategoriesDown()));
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateCategoryScrollButtons()));
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int, int)), SLOT(updateCategoryScrollButtons()));
}
CategoryListWidget::~CategoryListWidget()
{
}
QSize CategoryListWidget::sizeHint() const
{
QSize sizeHint = QWidget::sizeHint();
int width = m_ui->categoryList->width();
int min = minimumSizeHint().width();
if (width < min) {
width = min;
}
sizeHint.setWidth(width);
return sizeHint;
}
QSize CategoryListWidget::minimumSizeHint() const
{
return QSize(m_itemDelegate->minWidth() + m_ui->categoryList->frameWidth() * 2,
m_ui->categoryList->sizeHintForRow(0) * 2);
}
int CategoryListWidget::addCategory(const QString& labelText, const QIcon& icon)
{
QListWidgetItem* item = new QListWidgetItem(m_ui->categoryList);
item->setText(labelText);
item->setIcon(icon);
m_ui->categoryList->addItem(item);
return m_ui->categoryList->count() - 1;
}
void CategoryListWidget::removeCategory(int index)
{
m_ui->categoryList->removeItemWidget(m_ui->categoryList->item(index));
}
int CategoryListWidget::currentCategory()
{
return m_ui->categoryList->currentRow();
}
void CategoryListWidget::setCurrentCategory(int index)
{
m_ui->categoryList->setCurrentRow(index);
}
void CategoryListWidget::setCategoryHidden(int index, bool hidden)
{
m_ui->categoryList->item(index)->setHidden(hidden);
}
bool CategoryListWidget::isCategoryHidden(int index)
{
return m_ui->categoryList->item(index)->isHidden();
}
void CategoryListWidget::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
updateCategoryScrollButtons();
}
void CategoryListWidget::resizeEvent(QResizeEvent* event)
{
auto newDelegate = new CategoryListWidgetDelegate(m_ui->categoryList);
m_ui->categoryList->setItemDelegate(newDelegate);
m_itemDelegate->deleteLater();
m_itemDelegate = newDelegate;
QWidget::resizeEvent(event);
}
void CategoryListWidget::updateCategoryScrollButtons()
{
m_ui->scrollUp->setEnabled(m_ui->categoryList->verticalScrollBar()->value() != 0);
m_ui->scrollDown->setEnabled(m_ui->categoryList->verticalScrollBar()->value()
!= m_ui->categoryList->verticalScrollBar()->maximum());
m_ui->scrollUp->setVisible(m_ui->categoryList->verticalScrollBar()->maximum() > 0);
m_ui->scrollDown->setVisible(m_ui->scrollUp->isVisible());
}
void CategoryListWidget::scrollCategoriesUp()
{
m_ui->categoryList->verticalScrollBar()->setValue(
m_ui->categoryList->verticalScrollBar()->value() - m_ui->categoryList->verticalScrollBar()->pageStep()
);
}
void CategoryListWidget::scrollCategoriesDown()
{
m_ui->categoryList->verticalScrollBar()->setValue(
m_ui->categoryList->verticalScrollBar()->value() + m_ui->categoryList->verticalScrollBar()->pageStep()
);
}
void CategoryListWidget::emitCategoryChanged(int index)
{
emit categoryChanged(index);
}
/* =============================================================================================== */
CategoryListWidgetDelegate::CategoryListWidgetDelegate(QListWidget* parent)
: QStyledItemDelegate(parent),
m_listWidget(parent),
m_size(minWidth(), 96)
{
if (m_listWidget && m_listWidget->width() > m_size.width()) {
m_size.setWidth(m_listWidget->width());
}
}
#ifdef Q_OS_WIN
#include <QProxyStyle>
class WindowsCorrectedStyle : public QProxyStyle
{
public:
void drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override
{
painter->save();
if (PE_PanelItemViewItem == element) {
// Qt on Windows draws selection backgrounds only for the actual text/icon
// bounding box, not over the full width of a list item.
// We therefore need to translate and stretch the painter before we can
// tell Qt to draw its native styles.
// Since we are scaling horizontally, we also need to move the right and left
// edge pixels outside the drawing area to avoid thick border lines.
QRect itemRect = subElementRect(QStyle::SE_ItemViewItemFocusRect, option, widget).adjusted(1, 0, 1, 0);
painter->scale(static_cast<float>(option->rect.width()) / itemRect.width(), 1.0);
painter->translate(option->rect.left() - itemRect.left() + 1, 0);
}
QProxyStyle::drawPrimitive(element, option, painter, widget);
painter->restore();
}
};
#endif
void CategoryListWidgetDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
painter->save();
QIcon icon = opt.icon;
QSize iconSize = opt.icon.actualSize(QSize(ICON_SIZE, ICON_SIZE));
opt.icon = QIcon();
opt.decorationAlignment = Qt::AlignHCenter | Qt::AlignVCenter;
opt.decorationPosition = QStyleOptionViewItem::Top;
#ifdef Q_OS_WIN
QScopedPointer<QStyle> style(new WindowsCorrectedStyle());
#else
QStyle* style = opt.widget ? opt.widget->style() : QApplication::style();
#endif
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
QRect fontRect = painter->fontMetrics().boundingRect(
QRect(0, 0, minWidth(), m_size.height()), Qt::AlignHCenter | Qt::AlignBottom | Qt::TextWordWrap, opt.text);
int paddingTop = fontRect.height() < 30 ? 15 : 10;
int left = opt.rect.left() + opt.rect.width() / 2 - iconSize.width() / 2;
painter->drawPixmap(left, opt.rect.top() + paddingTop, icon.pixmap(iconSize));
painter->restore();
}
int CategoryListWidgetDelegate::minWidth() const
{
int c = m_listWidget->count();
int maxWidth = 0;
for (int i = 0; i < c; ++i) {
QFontMetrics fm(m_listWidget->font());
QRect fontRect = fm.boundingRect(
QRect(0, 0, 0, 0), Qt::TextWordWrap | Qt::ElideNone, m_listWidget->item(i)->text());
if (fontRect.width() > maxWidth) {
maxWidth = fontRect.width();
}
}
// add some padding
maxWidth += 10;
return maxWidth < m_size.height() ? m_size.height() : maxWidth;
}
QSize CategoryListWidgetDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
int w = minWidth();
if (m_listWidget->width() > w) {
w = m_listWidget->width();
}
return QSize(w, m_size.height());
}

View File

@ -0,0 +1,90 @@
/*
* Copyright (C) 2017 KeePassXC Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QWidget>
#include <QStyledItemDelegate>
#include <QPointer>
class CategoryListWidgetDelegate;
class QListWidget;
namespace Ui {
class CategoryListWidget;
}
class CategoryListWidget : public QWidget
{
Q_OBJECT
public:
CategoryListWidget(QWidget* parent = 0);
~CategoryListWidget();
int currentCategory();
void setCurrentCategory(int index);
int addCategory(const QString& labelText, const QIcon& icon);
void setCategoryHidden(int index, bool hidden);
bool isCategoryHidden(int index);
void removeCategory(int index);
signals:
void categoryChanged(int index);
protected:
void showEvent(QShowEvent* event) override;
void resizeEvent(QResizeEvent * event) override;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
protected slots:
void updateCategoryScrollButtons();
void scrollCategoriesDown();
void scrollCategoriesUp();
void emitCategoryChanged(int index);
private:
QPointer<CategoryListWidgetDelegate> m_itemDelegate;
const QScopedPointer<Ui::CategoryListWidget> m_ui;
Q_DISABLE_COPY(CategoryListWidget)
};
/* =============================================================================================== */
class CategoryListWidgetDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit CategoryListWidgetDelegate(QListWidget* parent = nullptr);
int minWidth() const;
protected:
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
const int ICON_SIZE = 32;
QPointer<QListWidget> m_listWidget;
QSize m_size;
Q_DISABLE_COPY(CategoryListWidgetDelegate)
};

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CategoryListWidget</class>
<widget class="QWidget" name="CategoryListWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>182</width>
<height>418</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="scrollUp">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="arrowType">
<enum>Qt::UpArrow</enum>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="categoryList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="scrollDown">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="arrowType">
<enum>Qt::DownArrow</enum>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>categoryList</tabstop>
<tabstop>scrollUp</tabstop>
<tabstop>scrollDown</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -287,7 +287,7 @@ void DatabaseWidget::createEntry()
void DatabaseWidget::setIconFromParent() void DatabaseWidget::setIconFromParent()
{ {
if (!config()->get("UseGroupIconOnEntryCreation").toBool()) { if (!config()->get("UseGroupIconOnEntryCreation", true).toBool()) {
return; return;
} }

View File

@ -18,6 +18,8 @@
#include "EditWidget.h" #include "EditWidget.h"
#include "ui_EditWidget.h" #include "ui_EditWidget.h"
#include "core/FilePath.h"
EditWidget::EditWidget(QWidget* parent) EditWidget::EditWidget(QWidget* parent)
: DialogyWidget(parent) : DialogyWidget(parent)
, m_ui(new Ui::EditWidget()) , m_ui(new Ui::EditWidget())
@ -32,7 +34,7 @@ EditWidget::EditWidget(QWidget* parent)
headerLabelFont.setPointSize(headerLabelFont.pointSize() + 2); headerLabelFont.setPointSize(headerLabelFont.pointSize() + 2);
headlineLabel()->setFont(headerLabelFont); headlineLabel()->setFont(headerLabelFont);
connect(m_ui->categoryList, SIGNAL(currentRowChanged(int)), connect(m_ui->categoryList, SIGNAL(categoryChanged(int)),
m_ui->stackedWidget, SLOT(setCurrentIndex(int))); m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_ui->buttonBox, SIGNAL(accepted()), SIGNAL(accepted())); connect(m_ui->buttonBox, SIGNAL(accepted()), SIGNAL(accepted()));
@ -43,23 +45,32 @@ EditWidget::~EditWidget()
{ {
} }
void EditWidget::add(const QString& labelText, QWidget* widget) void EditWidget::addPage(const QString& labelText, const QIcon& icon, QWidget* widget)
{ {
m_ui->categoryList->addItem(labelText);
m_ui->stackedWidget->addWidget(widget); m_ui->stackedWidget->addWidget(widget);
m_ui->categoryList->addCategory(labelText, icon);
} }
void EditWidget::setRowHidden(QWidget* widget, bool hide) void EditWidget::setPageHidden(QWidget* widget, bool hidden)
{ {
int row = m_ui->stackedWidget->indexOf(widget); int index = m_ui->stackedWidget->indexOf(widget);
if (row != -1) { if (index != -1) {
m_ui->categoryList->item(row)->setHidden(hide); m_ui->categoryList->setCategoryHidden(index, hidden);
}
if (index == m_ui->stackedWidget->currentIndex()) {
int newIndex = m_ui->stackedWidget->currentIndex() - 1;
if (newIndex < 0) {
newIndex = m_ui->stackedWidget->count() - 1;
}
m_ui->stackedWidget->setCurrentIndex(newIndex);
} }
} }
void EditWidget::setCurrentRow(int index) void EditWidget::setCurrentPage(int index)
{ {
m_ui->categoryList->setCurrentRow(index); m_ui->categoryList->setCurrentCategory(index);
m_ui->stackedWidget->setCurrentIndex(index);
} }
void EditWidget::setHeadline(const QString& text) void EditWidget::setHeadline(const QString& text)

View File

@ -19,6 +19,8 @@
#define KEEPASSX_EDITWIDGET_H #define KEEPASSX_EDITWIDGET_H
#include <QScopedPointer> #include <QScopedPointer>
#include <QtWidgets/QStyledItemDelegate>
#include <QStyledItemDelegate>
#include "gui/DialogyWidget.h" #include "gui/DialogyWidget.h"
#include "gui/MessageWidget.h" #include "gui/MessageWidget.h"
@ -37,19 +39,19 @@ public:
explicit EditWidget(QWidget* parent = nullptr); explicit EditWidget(QWidget* parent = nullptr);
~EditWidget(); ~EditWidget();
void add(const QString& labelText, QWidget* widget); void addPage(const QString& labelText, const QIcon& icon, QWidget* widget);
void setRowHidden(QWidget* widget, bool hide); void setPageHidden(QWidget* widget, bool hidden);
void setCurrentRow(int index); void setCurrentPage(int index);
void setHeadline(const QString& text); void setHeadline(const QString& text);
QLabel* headlineLabel(); QLabel* headlineLabel();
void setReadOnly(bool readOnly); void setReadOnly(bool readOnly);
bool readOnly() const; bool readOnly() const;
Q_SIGNALS: signals:
void accepted(); void accepted();
void rejected(); void rejected();
protected Q_SLOTS: protected slots:
void showMessage(const QString& text, MessageWidget::MessageType type); void showMessage(const QString& text, MessageWidget::MessageType type);
void hideMessage(); void hideMessage();

View File

@ -38,9 +38,16 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<item> <item>
<widget class="CategoryListWidget" name="categoryList"/> <widget class="CategoryListWidget" name="categoryList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
@ -52,7 +59,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin"> <property name="topMargin">
<number>5</number> <number>5</number>
</property> </property>
@ -76,13 +83,11 @@
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>CategoryListWidget</class> <class>CategoryListWidget</class>
<extends>QListWidget</extends> <extends>QWidget</extends>
<header>gui/entry/EditEntryWidget_p.h</header> <header>gui/CategoryListWidget.h</header>
<container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>categoryList</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -277,7 +277,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
bg1 = palette().highlight().color(); bg1 = palette().highlight().color();
break; break;
case Warning: case Warning:
bg1.setRgb(176, 128, 0); // values taken from kcolorscheme.cpp (Neutral) bg1.setRgb(181, 102, 0); // values taken from kcolorscheme.cpp (Neutral)
break; break;
case Error: case Error:
bg1.setRgb(191, 3, 3); // values taken from kcolorscheme.cpp (Negative) bg1.setRgb(191, 3, 3); // values taken from kcolorscheme.cpp (Negative)

View File

@ -54,34 +54,47 @@
#ifdef WITH_XC_HTTP #ifdef WITH_XC_HTTP
class HttpPlugin: public ISettingsPage class HttpPlugin: public ISettingsPage
{ {
public: public:
HttpPlugin(DatabaseTabWidget * tabWidget) { HttpPlugin(DatabaseTabWidget * tabWidget)
m_service = new Service(tabWidget); {
} m_service = new Service(tabWidget);
virtual ~HttpPlugin() { }
//delete m_service;
} ~HttpPlugin() = default;
virtual QString name() {
return QObject::tr("Http"); QString name() override
} {
virtual QWidget * createWidget() { return QObject::tr("Browser Integration");
OptionDialog * dlg = new OptionDialog(); }
QObject::connect(dlg, SIGNAL(removeSharedEncryptionKeys()), m_service, SLOT(removeSharedEncryptionKeys()));
QObject::connect(dlg, SIGNAL(removeStoredPermissions()), m_service, SLOT(removeStoredPermissions())); QIcon icon() override
return dlg; {
} return FilePath::instance()->icon("apps", "internet-web-browser");
virtual void loadSettings(QWidget * widget) { }
qobject_cast<OptionDialog*>(widget)->loadSettings();
} QWidget * createWidget() override
virtual void saveSettings(QWidget * widget) { {
qobject_cast<OptionDialog*>(widget)->saveSettings(); OptionDialog * dlg = new OptionDialog();
if (HttpSettings::isEnabled()) QObject::connect(dlg, SIGNAL(removeSharedEncryptionKeys()), m_service, SLOT(removeSharedEncryptionKeys()));
m_service->start(); QObject::connect(dlg, SIGNAL(removeStoredPermissions()), m_service, SLOT(removeStoredPermissions()));
else return dlg;
m_service->stop(); }
}
private: void loadSettings(QWidget * widget) override
Service *m_service; {
qobject_cast<OptionDialog*>(widget)->loadSettings();
}
void saveSettings(QWidget * widget) override
{
qobject_cast<OptionDialog*>(widget)->saveSettings();
if (HttpSettings::isEnabled())
m_service->start();
else
m_service->stop();
}
private:
Service *m_service;
}; };
#endif #endif
@ -510,7 +523,7 @@ void MainWindow::updateWindowTitle()
void MainWindow::showAboutDialog() void MainWindow::showAboutDialog()
{ {
AboutDialog* aboutDialog = new AboutDialog(this); AboutDialog* aboutDialog = new AboutDialog(this);
aboutDialog->show(); aboutDialog->open();
} }
void MainWindow::switchToDatabases() void MainWindow::switchToDatabases()

View File

@ -22,6 +22,7 @@
#include "autotype/AutoType.h" #include "autotype/AutoType.h"
#include "core/Config.h" #include "core/Config.h"
#include "core/Translator.h" #include "core/Translator.h"
#include "core/FilePath.h"
class SettingsWidget::ExtraPage class SettingsWidget::ExtraPage
{ {
@ -57,16 +58,16 @@ SettingsWidget::SettingsWidget(QWidget* parent)
m_secUi->setupUi(m_secWidget); m_secUi->setupUi(m_secWidget);
m_generalUi->setupUi(m_generalWidget); m_generalUi->setupUi(m_generalWidget);
add(tr("General"), m_generalWidget); addPage(tr("General"), FilePath::instance()->icon("categories", "preferences-other"), m_generalWidget);
add(tr("Security"), m_secWidget); addPage(tr("Security"), FilePath::instance()->icon("status", "security-high"), m_secWidget);
if (!autoType()->isAvailable()) {
m_generalUi->generalSettingsTabWidget->removeTab(1);
}
m_generalUi->autoTypeShortcutWidget->setVisible(autoType()->isAvailable());
m_generalUi->autoTypeShortcutLabel->setVisible(autoType()->isAvailable());
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// systray not useful on OS X // systray not useful on OS X
m_generalUi->systrayShowCheckBox->setVisible(false); m_generalUi->systraySettings->setVisible(false);
m_generalUi->systrayMinimizeOnCloseCheckBox->setVisible(false);
m_generalUi->systrayMinimizeToTrayCheckBox->setVisible(false);
#endif #endif
connect(this, SIGNAL(accepted()), SLOT(saveSettings())); connect(this, SIGNAL(accepted()), SLOT(saveSettings()));
@ -87,12 +88,12 @@ SettingsWidget::~SettingsWidget()
{ {
} }
void SettingsWidget::addSettingsPage(ISettingsPage *page) void SettingsWidget::addSettingsPage(ISettingsPage* page)
{ {
QWidget * widget = page->createWidget(); QWidget* widget = page->createWidget();
widget->setParent(this); widget->setParent(this);
m_extraPages.append(ExtraPage(page, widget)); m_extraPages.append(ExtraPage(page, widget));
add(page->name(), widget); addPage(page->name(), page->icon(), widget);
} }
void SettingsWidget::loadSettings() void SettingsWidget::loadSettings()
@ -122,6 +123,7 @@ void SettingsWidget::loadSettings()
m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool()); m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool());
m_generalUi->systrayMinimizeOnCloseCheckBox->setChecked(config()->get("GUI/MinimizeOnClose").toBool()); m_generalUi->systrayMinimizeOnCloseCheckBox->setChecked(config()->get("GUI/MinimizeOnClose").toBool());
m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get("GUI/MinimizeOnStartup").toBool()); m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get("GUI/MinimizeOnStartup").toBool());
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool());
if (autoType()->isAvailable()) { if (autoType()->isAvailable()) {
m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt()); m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt());
@ -141,12 +143,11 @@ void SettingsWidget::loadSettings()
m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool()); m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool());
m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool()); m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool());
m_secUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool());
Q_FOREACH (const ExtraPage& page, m_extraPages) Q_FOREACH (const ExtraPage& page, m_extraPages)
page.loadSettings(); page.loadSettings();
setCurrentRow(0); setCurrentPage(0);
} }
void SettingsWidget::saveSettings() void SettingsWidget::saveSettings()
@ -172,6 +173,8 @@ void SettingsWidget::saveSettings()
config()->set("GUI/MinimizeOnClose", m_generalUi->systrayMinimizeOnCloseCheckBox->isChecked()); config()->set("GUI/MinimizeOnClose", m_generalUi->systrayMinimizeOnCloseCheckBox->isChecked());
config()->set("GUI/MinimizeOnStartup", m_generalUi->systrayMinimizeOnStartup->isChecked()); config()->set("GUI/MinimizeOnStartup", m_generalUi->systrayMinimizeOnStartup->isChecked());
config()->set("security/autotypeask", m_generalUi->autoTypeAskCheckBox->isChecked());
if (autoType()->isAvailable()) { if (autoType()->isAvailable()) {
config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key()); config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key());
config()->set("GlobalAutoTypeModifiers", config()->set("GlobalAutoTypeModifiers",
@ -187,8 +190,6 @@ void SettingsWidget::saveSettings()
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked()); config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked()); config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked());
config()->set("security/autotypeask", m_secUi->autoTypeAskCheckBox->isChecked());
Q_FOREACH (const ExtraPage& page, m_extraPages) Q_FOREACH (const ExtraPage& page, m_extraPages)
page.saveSettings(); page.saveSettings();

View File

@ -29,6 +29,7 @@ class ISettingsPage {
public: public:
virtual ~ISettingsPage() {} virtual ~ISettingsPage() {}
virtual QString name() = 0; virtual QString name() = 0;
virtual QIcon icon() = 0;
virtual QWidget * createWidget() = 0; virtual QWidget * createWidget() = 0;
virtual void loadSettings(QWidget * widget) = 0; virtual void loadSettings(QWidget * widget) = 0;
virtual void saveSettings(QWidget * widget) = 0; virtual void saveSettings(QWidget * widget) = 0;

View File

@ -7,187 +7,357 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>684</width> <width>684</width>
<height>452</height> <height>732</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="fieldGrowthPolicy"> <property name="leftMargin">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <number>0</number>
</property> </property>
<item row="0" column="0"> <property name="topMargin">
<widget class="QCheckBox" name="rememberLastDatabasesCheckBox"> <number>0</number>
<property name="text"> </property>
<string>Remember last databases</string> <property name="rightMargin">
</property> <number>0</number>
<property name="checked"> </property>
<bool>true</bool> <property name="bottomMargin">
</property> <number>0</number>
</widget> </property>
</item> <item>
<item row="1" column="0"> <widget class="QTabWidget" name="generalSettingsTabWidget">
<widget class="QCheckBox" name="rememberLastKeyFilesCheckBox"> <property name="currentIndex">
<property name="text"> <number>0</number>
<string>Remember last key files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="openPreviousDatabasesOnStartupCheckBox">
<property name="text">
<string>Load previous databases on startup</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="autoSaveOnExitCheckBox">
<property name="text">
<string>Automatically save on exit</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="autoSaveAfterEveryChangeCheckBox">
<property name="text">
<string>Automatically save after every change</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoReloadOnChangeCheckBox">
<property name="text">
<string>Automatically reload the database when modified externally</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="minimizeOnCopyCheckBox">
<property name="text">
<string>Minimize when copying to clipboard</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="useGroupIconOnEntryCreationCheckBox">
<property name="text">
<string>Use group icon on entry creation</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="autoTypeShortcutLabel">
<property name="text">
<string>Global Auto-Type shortcut</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="ShortcutWidget" name="autoTypeShortcutWidget"/>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="autoTypeEntryTitleMatchCheckBox">
<property name="text">
<string>Use entry title to match windows for global auto-type</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="languageComboBox"/>
</item>
<item row="12" column="0">
<layout class="QHBoxLayout" name="systray1Layout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeToTrayCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hide window to system tray when minimized</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="13" column="0">
<layout class="QHBoxLayout" name="systray2Layout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<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>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnCloseCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hide window to system tray instead of app exit</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="14" column="0">
<layout class="QHBoxLayout" name="systray3Layout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnStartup">
<property name="text">
<string>Minimize window at application startup</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="systrayShowCheckBox">
<property name="text">
<string>Show a system tray icon</string>
</property> </property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
<string>Basic Settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="rememberLastDatabasesCheckBox">
<property name="text">
<string>Remember last databases</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="rememberLastKeyFilesCheckBox">
<property name="text">
<string>Remember last key files and security dongles</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="openPreviousDatabasesOnStartupCheckBox">
<property name="text">
<string>Load previous databases on startup</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoSaveOnExitCheckBox">
<property name="text">
<string>Automatically save on exit</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoSaveAfterEveryChangeCheckBox">
<property name="text">
<string>Automatically save after every change</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoReloadOnChangeCheckBox">
<property name="text">
<string>Automatically reload the database when modified externally</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="minimizeOnCopyCheckBox">
<property name="text">
<string>Minimize when copying to clipboard</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnStartup">
<property name="text">
<string>Minimize window at application startup</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useGroupIconOnEntryCreationCheckBox">
<property name="text">
<string>Use group icon on entry creation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="systraySettings" native="true">
<layout class="QVBoxLayout" name="systrayLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayShowCheckBox">
<property name="text">
<string>Show a system tray icon</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeToTrayCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hide window to system tray when minimized</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnCloseCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hide window to system tray instead of app exit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="trayIconSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="languageLabelLayout_2">
<property name="spacing">
<number>15</number>
</property>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="languageLabel_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAutotype">
<attribute name="title">
<string>Auto-Type</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="autoTypeEntryTitleMatchCheckBox">
<property name="text">
<string>Use entry title to match windows for global Auto-Type</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoTypeAskCheckBox">
<property name="text">
<string>Always ask before performing Auto-Type</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>15</number>
</property>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="autoTypeShortcutLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Global Auto-Type shortcut</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading</set>
</property>
</widget>
</item>
<item>
<widget class="ShortcutWidget" name="autoTypeShortcutWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -199,15 +369,6 @@
<header>autotype/ShortcutWidget.h</header> <header>autotype/ShortcutWidget.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>rememberLastDatabasesCheckBox</tabstop>
<tabstop>rememberLastKeyFilesCheckBox</tabstop>
<tabstop>openPreviousDatabasesOnStartupCheckBox</tabstop>
<tabstop>autoSaveOnExitCheckBox</tabstop>
<tabstop>autoSaveAfterEveryChangeCheckBox</tabstop>
<tabstop>minimizeOnCopyCheckBox</tabstop>
<tabstop>autoTypeShortcutWidget</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -6,91 +6,144 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>374</width> <width>595</width>
<height>303</height> <height>443</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <property name="leftMargin">
<widget class="QCheckBox" name="clearClipboardCheckBox"> <number>0</number>
<property name="text"> </property>
<string>Clear clipboard after</string> <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Timeouts</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QSpinBox" name="clearClipboardSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> sec</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="lockDatabaseIdleSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> sec</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>240</number>
</property>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="clearClipboardCheckBox">
<property name="text">
<string>Clear clipboard after</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="lockDatabaseIdleCheckBox">
<property name="text">
<string>Lock databases after inactivity of</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="QSpinBox" name="clearClipboardSpinBox"> <widget class="QGroupBox" name="groupBox_2">
<property name="enabled"> <property name="title">
<bool>false</bool> <string>Convenience</string>
</property>
<property name="suffix">
<string> sec</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="passwordRepeatCheckBox">
<property name="text">
<string>Don't require password repeat when it is visible</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="passwordCleartextCheckBox">
<property name="text">
<string>Show passwords in cleartext by default</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="lockDatabaseMinimizeCheckBox">
<property name="text">
<string>Lock databases after minimizing the window</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QCheckBox" name="lockDatabaseIdleCheckBox"> <spacer name="verticalSpacer_2">
<property name="text"> <property name="orientation">
<string>Lock databases after inactivity of</string> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeType">
</item> <enum>QSizePolicy::Expanding</enum>
<item row="1" column="1">
<widget class="QSpinBox" name="lockDatabaseIdleSpinBox">
<property name="enabled">
<bool>false</bool>
</property> </property>
<property name="suffix"> <property name="sizeHint" stdset="0">
<string> sec</string> <size>
<width>20</width>
<height>30</height>
</size>
</property> </property>
<property name="minimum"> </spacer>
<number>10</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="lockDatabaseMinimizeCheckBox">
<property name="text">
<string>Lock databases after minimizing the window</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="passwordCleartextCheckBox">
<property name="text">
<string>Show passwords in cleartext by default</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="passwordRepeatCheckBox">
<property name="text">
<string>Don't require password repeat when it is visible</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoTypeAskCheckBox">
<property name="text">
<string>Always ask before performing auto-type</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>clearClipboardCheckBox</tabstop>
<tabstop>clearClipboardSpinBox</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -90,7 +90,7 @@ EditEntryWidget::~EditEntryWidget()
void EditEntryWidget::setupMain() void EditEntryWidget::setupMain()
{ {
m_mainUi->setupUi(m_mainWidget); m_mainUi->setupUi(m_mainWidget);
add(tr("Entry"), m_mainWidget); addPage(tr("Entry"), FilePath::instance()->icon("actions", "document-edit"), m_mainWidget);
m_mainUi->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show")); m_mainUi->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
m_mainUi->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false)); m_mainUi->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
@ -115,7 +115,7 @@ void EditEntryWidget::setupMain()
void EditEntryWidget::setupAdvanced() void EditEntryWidget::setupAdvanced()
{ {
m_advancedUi->setupUi(m_advancedWidget); m_advancedUi->setupUi(m_advancedWidget);
add(tr("Advanced"), m_advancedWidget); addPage(tr("Advanced"), FilePath::instance()->icon("categories", "preferences-other"), m_advancedWidget);
m_attachmentsModel->setEntryAttachments(m_entryAttachments); m_attachmentsModel->setEntryAttachments(m_entryAttachments);
m_advancedUi->attachmentsView->setModel(m_attachmentsModel); m_advancedUi->attachmentsView->setModel(m_attachmentsModel);
@ -139,13 +139,13 @@ void EditEntryWidget::setupAdvanced()
void EditEntryWidget::setupIcon() void EditEntryWidget::setupIcon()
{ {
add(tr("Icon"), m_iconsWidget); addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_iconsWidget);
} }
void EditEntryWidget::setupAutoType() void EditEntryWidget::setupAutoType()
{ {
m_autoTypeUi->setupUi(m_autoTypeWidget); m_autoTypeUi->setupUi(m_autoTypeWidget);
add(tr("Auto-Type"), m_autoTypeWidget); addPage(tr("Auto-Type"), FilePath::instance()->icon("actions", "key-enter"), m_autoTypeWidget);
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton);
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton);
@ -177,13 +177,13 @@ void EditEntryWidget::setupAutoType()
void EditEntryWidget::setupProperties() void EditEntryWidget::setupProperties()
{ {
add(tr("Properties"), m_editWidgetProperties); addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties);
} }
void EditEntryWidget::setupHistory() void EditEntryWidget::setupHistory()
{ {
m_historyUi->setupUi(m_historyWidget); m_historyUi->setupUi(m_historyWidget);
add(tr("History"), m_historyWidget); addPage(tr("History"), FilePath::instance()->icon("actions", "view-history"), m_historyWidget);
m_sortModel->setSourceModel(m_historyModel); m_sortModel->setSourceModel(m_historyModel);
m_sortModel->setDynamicSortFilter(true); m_sortModel->setDynamicSortFilter(true);
@ -291,8 +291,8 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const Q
setForms(entry); setForms(entry);
setReadOnly(m_history); setReadOnly(m_history);
setCurrentRow(0); setCurrentPage(0);
setRowHidden(m_historyWidget, m_history); setPageHidden(m_historyWidget, m_history || m_entry->historyItems().count() < 1);
} }
void EditEntryWidget::setForms(const Entry* entry, bool restore) void EditEntryWidget::setForms(const Entry* entry, bool restore)

View File

@ -88,167 +88,183 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,2"> <widget class="QGroupBox" name="windowsBox">
<item> <property name="title">
<layout class="QVBoxLayout" name="verticalLayout_3"> <string>Window Associations</string>
<item> </property>
<widget class="QTreeView" name="assocView"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="rootIsDecorated"> <item>
<bool>false</bool> <layout class="QVBoxLayout" name="verticalLayout_3">
</property> <item>
<property name="uniformRowHeights"> <widget class="QTreeView" name="assocView">
<bool>true</bool> <property name="rootIsDecorated">
</property> <bool>false</bool>
</widget> </property>
</item> <property name="uniformRowHeights">
<item> <bool>true</bool>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="2,1,1"> </property>
<item> <property name="sortingEnabled">
<spacer name="horizontalSpacer_3"> <bool>false</bool>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <attribute name="headerVisible">
</property> <bool>false</bool>
<property name="sizeHint" stdset="0"> </attribute>
<size> </widget>
<width>40</width> </item>
<height>20</height> <item>
</size> <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="2,1,1">
</property> <item>
</spacer> <spacer name="horizontalSpacer_3">
</item> <property name="orientation">
<item> <enum>Qt::Horizontal</enum>
<widget class="QToolButton" name="assocAddButton"> </property>
<property name="enabled"> <property name="sizeHint" stdset="0">
<bool>false</bool> <size>
</property> <width>40</width>
<property name="sizePolicy"> <height>20</height>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> </size>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </spacer>
</sizepolicy> </item>
</property> <item>
<property name="minimumSize"> <widget class="QToolButton" name="assocAddButton">
<size> <property name="enabled">
<width>0</width> <bool>false</bool>
<height>25</height> </property>
</size> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<property name="text"> <horstretch>0</horstretch>
<string>+</string> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimumSize">
<item> <size>
<widget class="QToolButton" name="assocRemoveButton"> <width>0</width>
<property name="enabled"> <height>25</height>
<bool>false</bool> </size>
</property> </property>
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <string>+</string>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </widget>
</sizepolicy> </item>
</property> <item>
<property name="minimumSize"> <widget class="QToolButton" name="assocRemoveButton">
<size> <property name="enabled">
<width>0</width> <bool>false</bool>
<height>25</height> </property>
</size> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<property name="text"> <horstretch>0</horstretch>
<string>-</string> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimumSize">
</layout> <size>
</item> <width>0</width>
</layout> <height>25</height>
</item> </size>
<item> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <property name="text">
<item> <string>-</string>
<widget class="QLabel" name="windowTitleLabel"> </property>
<property name="text"> </widget>
<string>Window title:</string> </item>
</property> </layout>
</widget> </item>
</item> </layout>
<item> </item>
<widget class="WindowSelectComboBox" name="windowTitleCombo"/> <item>
</item> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<spacer name="verticalSpacer_3"> <widget class="QLabel" name="windowTitleLabel">
<property name="orientation"> <property name="text">
<enum>Qt::Vertical</enum> <string>Window title:</string>
</property> </property>
<property name="sizeType"> </widget>
<enum>QSizePolicy::Fixed</enum> </item>
</property> <item>
<property name="sizeHint" stdset="0"> <widget class="WindowSelectComboBox" name="windowTitleCombo"/>
<size> </item>
<width>1</width> <item>
<height>10</height> <spacer name="verticalSpacer_3">
</size> <property name="orientation">
</property> <enum>Qt::Vertical</enum>
</spacer> </property>
</item> <property name="sizeType">
<item> <enum>QSizePolicy::Fixed</enum>
<widget class="QRadioButton" name="defaultWindowSequenceButton"> </property>
<property name="text"> <property name="sizeHint" stdset="0">
<string>Use default se&amp;quence</string> <size>
</property> <width>1</width>
</widget> <height>10</height>
</item> </size>
<item> </property>
<widget class="QRadioButton" name="customWindowSequenceButton"> </spacer>
<property name="text"> </item>
<string>Set custo&amp;m sequence:</string> <item>
</property> <widget class="QRadioButton" name="defaultWindowSequenceButton">
</widget> <property name="text">
</item> <string>Use default se&amp;quence</string>
<item> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </widget>
<item> </item>
<spacer name="horizontalSpacer_2"> <item>
<property name="orientation"> <widget class="QRadioButton" name="customWindowSequenceButton">
<enum>Qt::Horizontal</enum> <property name="text">
</property> <string>Set custo&amp;m sequence:</string>
<property name="sizeType"> </property>
<enum>QSizePolicy::Fixed</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <layout class="QHBoxLayout" name="horizontalLayout_2">
<width>20</width> <item>
<height>1</height> <spacer name="horizontalSpacer_2">
</size> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
</spacer> </property>
</item> <property name="sizeType">
<item> <enum>QSizePolicy::Fixed</enum>
<widget class="QLineEdit" name="windowSequenceEdit"> </property>
<property name="enabled"> <property name="sizeHint" stdset="0">
<bool>false</bool> <size>
</property> <width>20</width>
</widget> <height>1</height>
</item> </size>
</layout> </property>
</item> </spacer>
<item> </item>
<spacer name="verticalSpacer"> <item>
<property name="orientation"> <widget class="QLineEdit" name="windowSequenceEdit">
<enum>Qt::Vertical</enum> <property name="enabled">
</property> <bool>false</bool>
<property name="sizeHint" stdset="0"> </property>
<size> </widget>
<width>20</width> </item>
<height>40</height> </layout>
</size> </item>
</property> <item>
</spacer> <spacer name="verticalSpacer">
</item> <property name="orientation">
</layout> <enum>Qt::Vertical</enum>
</item> </property>
</layout> <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -25,9 +25,15 @@
</property> </property>
<item> <item>
<widget class="QTreeView" name="historyView"> <widget class="QTreeView" name="historyView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled"> <property name="sortingEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="headerDefaultSectionSize">
<number>160</number>
</attribute>
</widget> </widget>
</item> </item>
<item> <item>

View File

@ -18,46 +18,8 @@
#ifndef KEEPASSX_EDITENTRYWIDGET_P_H #ifndef KEEPASSX_EDITENTRYWIDGET_P_H
#define KEEPASSX_EDITENTRYWIDGET_P_H #define KEEPASSX_EDITENTRYWIDGET_P_H
#include <QListWidget> #include <QListView>
#include <QScrollBar> #include <QScrollBar>
#include <QSize>
#include <QStyledItemDelegate>
class CategoryListViewDelegate : public QStyledItemDelegate
{
public:
explicit CategoryListViewDelegate(QObject* parent) : QStyledItemDelegate(parent) {}
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QSize size = QStyledItemDelegate::sizeHint(option, index);
size.setHeight(qMax(size.height(), 22));
return size;
}
};
class CategoryListWidget : public QListWidget
{
public:
explicit CategoryListWidget(QWidget* parent = 0) : QListWidget(parent)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
setItemDelegate(new CategoryListViewDelegate(this));
}
virtual QSize sizeHint() const
{
QSize sizeHint = QListWidget::sizeHint();
int width = sizeHintForColumn(0) + frameWidth() * 2 + 5;
if (verticalScrollBar()->isVisible()) {
width += verticalScrollBar()->width();
}
sizeHint.setWidth(width);
return sizeHint;
}
};
class AttributesListView : public QListView class AttributesListView : public QListView
{ {
@ -65,14 +27,13 @@ public:
explicit AttributesListView(QWidget* parent = 0) : QListView(parent) explicit AttributesListView(QWidget* parent = 0) : QListView(parent)
{ {
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
setItemDelegate(new CategoryListViewDelegate(this));
} }
virtual QSize sizeHint() const QSize sizeHint() const override
{ {
QSize sizeHint = QListView::sizeHint(); QSize sizeHint = QListView::sizeHint();
int width = sizeHintForColumn(0) + frameWidth() * 2 + 5; int width = sizeHintForColumn(0) + frameWidth() * 2;
if (verticalScrollBar()->isVisible()) { if (verticalScrollBar()->isVisible()) {
width += verticalScrollBar()->width(); width += verticalScrollBar()->width();
} }

View File

@ -19,6 +19,7 @@
#include "ui_EditGroupWidgetMain.h" #include "ui_EditGroupWidgetMain.h"
#include "core/Metadata.h" #include "core/Metadata.h"
#include "core/FilePath.h"
#include "gui/EditWidgetIcons.h" #include "gui/EditWidgetIcons.h"
#include "gui/EditWidgetProperties.h" #include "gui/EditWidgetProperties.h"
@ -33,9 +34,9 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
{ {
m_mainUi->setupUi(m_editGroupWidgetMain); m_mainUi->setupUi(m_editGroupWidgetMain);
add(tr("Group"), m_editGroupWidgetMain); addPage(tr("Group"), FilePath::instance()->icon("actions", "document-edit"), m_editGroupWidgetMain);
add(tr("Icon"), m_editGroupWidgetIcons); addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_editGroupWidgetIcons);
add(tr("Properties"), m_editWidgetProperties); addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties);
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool))); connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
connect(m_mainUi->autoTypeSequenceCustomRadio, SIGNAL(toggled(bool)), connect(m_mainUi->autoTypeSequenceCustomRadio, SIGNAL(toggled(bool)),
@ -94,7 +95,7 @@ void EditGroupWidget::loadGroup(Group* group, bool create, Database* database)
m_editWidgetProperties->setFields(group->timeInfo(), group->uuid()); m_editWidgetProperties->setFields(group->timeInfo(), group->uuid());
setCurrentRow(0); setCurrentPage(0);
m_mainUi->editName->setFocus(); m_mainUi->editName->setFocus();
} }

View File

@ -6,116 +6,147 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>676</width> <width>579</width>
<height>356</height> <height>407</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QGridLayout" name="gridLayout">
<item> <property name="leftMargin">
<layout class="QFormLayout" name="formLayout"> <number>10</number>
<property name="fieldGrowthPolicy"> </property>
<enum>QFormLayout::ExpandingFieldsGrow</enum> <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name</string>
</property> </property>
<item row="0" column="0"> </widget>
<widget class="QLabel" name="labelName"> </item>
<property name="text"> <item row="0" column="1">
<string>Name</string> <widget class="QLineEdit" name="editName"/>
</item>
<item row="1" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
<widget class="QLabel" name="labelNotes">
<property name="text">
<string>Notes</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="editNotes">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="expireCheck">
<property name="text">
<string>Expires</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="autotypeComboBox"/>
</item>
<item row="2" column="1">
<widget class="QDateTimeEdit" name="expireDatePicker">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="searchLabel">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="searchComboBox"/>
</item>
<item row="4" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="autotypeLabel">
<property name="text">
<string>Auto-Type</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QRadioButton" name="autoTypeSequenceInherit">
<property name="text">
<string>&amp;Use default Auto-Type sequence of parent group</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QRadioButton" name="autoTypeSequenceCustomRadio">
<property name="text">
<string>Set default Auto-Type se&amp;quence</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> <property name="sizeType">
</item> <enum>QSizePolicy::Fixed</enum>
<item row="0" column="1">
<widget class="QLineEdit" name="editName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelNotes">
<property name="text">
<string>Notes</string>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
</item> <size>
<item row="1" column="1"> <width>13</width>
<widget class="QPlainTextEdit" name="editNotes"/> <height>1</height>
</item> </size>
<item row="2" column="0">
<widget class="QCheckBox" name="expireCheck">
<property name="text">
<string>Expires</string>
</property> </property>
</widget> </spacer>
</item> </item>
<item row="2" column="1"> <item>
<widget class="QDateTimeEdit" name="expireDatePicker"> <widget class="QLineEdit" name="autoTypeSequenceCustomEdit">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="searchLabel">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="searchComboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="autotypeLabel">
<property name="text">
<string>Auto-type</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="autotypeComboBox"/>
</item>
<item row="5" column="1">
<widget class="QRadioButton" name="autoTypeSequenceInherit">
<property name="text">
<string>Use default auto-type sequence of parent group</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QRadioButton" name="autoTypeSequenceCustomRadio">
<property name="text">
<string>Set default auto-type sequence</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="autoTypeSequenceCustomEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
<item row="8" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>

View File

@ -32,13 +32,10 @@ HttpPasswordGeneratorWidget::HttpPasswordGeneratorWidget(QWidget* parent)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
connect(m_ui->buttonApply, SIGNAL(clicked()), SLOT(saveSettings()));
connect(m_ui->sliderLength, SIGNAL(valueChanged(int)), SLOT(sliderMoved())); connect(m_ui->sliderLength, SIGNAL(valueChanged(int)), SLOT(sliderMoved()));
connect(m_ui->spinBoxLength, SIGNAL(valueChanged(int)), SLOT(spinBoxChanged())); connect(m_ui->spinBoxLength, SIGNAL(valueChanged(int)), SLOT(spinBoxChanged()));
connect(m_ui->optionButtons, SIGNAL(buttonClicked(int)), SLOT(updateGenerator())); connect(m_ui->optionButtons, SIGNAL(buttonClicked(int)), SLOT(updateGenerator()));
m_ui->buttonApply->setEnabled(true);
loadSettings(); loadSettings();
reset(); reset();

View File

@ -35,10 +35,10 @@ public:
explicit HttpPasswordGeneratorWidget(QWidget* parent = nullptr); explicit HttpPasswordGeneratorWidget(QWidget* parent = nullptr);
~HttpPasswordGeneratorWidget(); ~HttpPasswordGeneratorWidget();
void loadSettings(); void loadSettings();
void saveSettings();
void reset(); void reset();
private Q_SLOTS: private Q_SLOTS:
void saveSettings();
void sliderMoved(); void sliderMoved();
void spinBoxChanged(); void spinBoxChanged();

View File

@ -6,14 +6,26 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>434</width> <width>500</width>
<height>250</height> <height>181</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string/> <string/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0"> <item row="1" column="0">
@ -168,42 +180,8 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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>
<item>
<widget class="QPushButton" name="buttonApply">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Accept</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>PasswordComboBox</class>
<extends>QComboBox</extends>
<header location="global">gui/PasswordComboBox.h</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>sliderLength</tabstop> <tabstop>sliderLength</tabstop>
<tabstop>spinBoxLength</tabstop> <tabstop>spinBoxLength</tabstop>
@ -213,7 +191,6 @@
<tabstop>checkBoxSpecialChars</tabstop> <tabstop>checkBoxSpecialChars</tabstop>
<tabstop>checkBoxExcludeAlike</tabstop> <tabstop>checkBoxExcludeAlike</tabstop>
<tabstop>checkBoxEnsureEvery</tabstop> <tabstop>checkBoxEnsureEvery</tabstop>
<tabstop>buttonApply</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -15,15 +15,24 @@
#include "ui_OptionDialog.h" #include "ui_OptionDialog.h"
#include "HttpSettings.h" #include "HttpSettings.h"
#include "core/FilePath.h"
#include <QMessageBox> #include <QMessageBox>
OptionDialog::OptionDialog(QWidget *parent) : OptionDialog::OptionDialog(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::OptionDialog()) m_ui(new Ui::OptionDialog())
{ {
ui->setupUi(this); m_ui->setupUi(this);
connect(ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SIGNAL(removeSharedEncryptionKeys())); connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SIGNAL(removeSharedEncryptionKeys()));
connect(ui->removeStoredPermissions, SIGNAL(clicked()), this, SIGNAL(removeStoredPermissions())); connect(m_ui->removeStoredPermissions, SIGNAL(clicked()), this, SIGNAL(removeStoredPermissions()));
m_ui->warningWidget->showMessage(tr("The following options can be dangerous!\nChange them only if you know what you are doing."), MessageWidget::Warning);
m_ui->warningWidget->setIcon(FilePath::instance()->icon("status", "dialog-warning"));
m_ui->warningWidget->setCloseButtonVisible(false);
m_ui->tabWidget->setEnabled(m_ui->enableHttpServer->isChecked());
connect(m_ui->enableHttpServer, SIGNAL(toggled(bool)), m_ui->tabWidget, SLOT(setEnabled(bool)));
} }
OptionDialog::~OptionDialog() OptionDialog::~OptionDialog()
@ -33,65 +42,48 @@ OptionDialog::~OptionDialog()
void OptionDialog::loadSettings() void OptionDialog::loadSettings()
{ {
HttpSettings settings; HttpSettings settings;
ui->enableHttpServer->setChecked(settings.isEnabled()); m_ui->enableHttpServer->setChecked(settings.isEnabled());
ui->showNotification->setChecked(settings.showNotification()); m_ui->showNotification->setChecked(settings.showNotification());
ui->bestMatchOnly->setChecked(settings.bestMatchOnly()); m_ui->bestMatchOnly->setChecked(settings.bestMatchOnly());
ui->unlockDatabase->setChecked(settings.unlockDatabase()); m_ui->unlockDatabase->setChecked(settings.unlockDatabase());
ui->matchUrlScheme->setChecked(settings.matchUrlScheme()); m_ui->matchUrlScheme->setChecked(settings.matchUrlScheme());
if (settings.sortByUsername()) if (settings.sortByUsername())
ui->sortByUsername->setChecked(true); m_ui->sortByUsername->setChecked(true);
else else
ui->sortByTitle->setChecked(true); m_ui->sortByTitle->setChecked(true);
ui->httpPort->setText(QString::number(settings.httpPort())); m_ui->httpPort->setText(QString::number(settings.httpPort()));
/* m_ui->alwaysAllowAccess->setChecked(settings.alwaysAllowAccess());
ui->checkBoxLower->setChecked(settings.passwordUseLowercase()); m_ui->alwaysAllowUpdate->setChecked(settings.alwaysAllowUpdate());
ui->checkBoxNumbers->setChecked(settings.passwordUseNumbers()); m_ui->searchInAllDatabases->setChecked(settings.searchInAllDatabases());
ui->checkBoxUpper->setChecked(settings.passwordUseUppercase()); m_ui->supportKphFields->setChecked(settings.supportKphFields());
ui->checkBoxSpecialChars->setChecked(settings.passwordUseSpecial());
ui->checkBoxEnsureEvery->setChecked(settings.passwordEveryGroup());
ui->checkBoxExcludeAlike->setChecked(settings.passwordExcludeAlike());
ui->spinBoxLength->setValue(settings.passwordLength());
*/
ui->alwaysAllowAccess->setChecked(settings.alwaysAllowAccess()); m_ui->passwordGenerator->loadSettings();
ui->alwaysAllowUpdate->setChecked(settings.alwaysAllowUpdate());
ui->searchInAllDatabases->setChecked(settings.searchInAllDatabases());
ui->supportKphFields->setChecked(settings.supportKphFields());
} }
void OptionDialog::saveSettings() void OptionDialog::saveSettings()
{ {
HttpSettings settings; HttpSettings settings;
settings.setEnabled(ui->enableHttpServer->isChecked()); settings.setEnabled(m_ui->enableHttpServer->isChecked());
settings.setShowNotification(ui->showNotification->isChecked()); settings.setShowNotification(m_ui->showNotification->isChecked());
settings.setBestMatchOnly(ui->bestMatchOnly->isChecked()); settings.setBestMatchOnly(m_ui->bestMatchOnly->isChecked());
settings.setUnlockDatabase(ui->unlockDatabase->isChecked()); settings.setUnlockDatabase(m_ui->unlockDatabase->isChecked());
settings.setMatchUrlScheme(ui->matchUrlScheme->isChecked()); settings.setMatchUrlScheme(m_ui->matchUrlScheme->isChecked());
settings.setSortByUsername(ui->sortByUsername->isChecked()); settings.setSortByUsername(m_ui->sortByUsername->isChecked());
int port = ui->httpPort->text().toInt(); int port = m_ui->httpPort->text().toInt();
if (port < 1024) { if (port < 1024) {
QMessageBox::warning(this, tr("Cannot bind to privileged ports"), QMessageBox::warning(this, tr("Cannot bind to privileged ports"),
tr("Cannot bind to privileged ports below 1024!\nUsing default port 19455.")); tr("Cannot bind to privileged ports below 1024!\nUsing default port 19455."));
port = 19455; port = 19455;
} }
settings.setHttpPort(port); settings.setHttpPort(port);
settings.setAlwaysAllowAccess(m_ui->alwaysAllowAccess->isChecked());
settings.setAlwaysAllowUpdate(m_ui->alwaysAllowUpdate->isChecked());
settings.setSearchInAllDatabases(m_ui->searchInAllDatabases->isChecked());
settings.setSupportKphFields(m_ui->supportKphFields->isChecked());
/* m_ui->passwordGenerator->saveSettings();
settings.setPasswordUseLowercase(ui->checkBoxLower->isChecked());
settings.setPasswordUseNumbers(ui->checkBoxNumbers->isChecked());
settings.setPasswordUseUppercase(ui->checkBoxUpper->isChecked());
settings.setPasswordUseSpecial(ui->checkBoxSpecialChars->isChecked());
settings.setPasswordEveryGroup(ui->checkBoxEnsureEvery->isChecked());
settings.setPasswordExcludeAlike(ui->checkBoxExcludeAlike->isChecked());
settings.setPasswordLength(ui->spinBoxLength->value());
*/
settings.setAlwaysAllowAccess(ui->alwaysAllowAccess->isChecked());
settings.setAlwaysAllowUpdate(ui->alwaysAllowUpdate->isChecked());
settings.setSearchInAllDatabases(ui->searchInAllDatabases->isChecked());
settings.setSupportKphFields(ui->supportKphFields->isChecked());
} }

View File

@ -38,7 +38,7 @@ Q_SIGNALS:
void removeStoredPermissions(); void removeStoredPermissions();
private: private:
QScopedPointer<Ui::OptionDialog> ui; QScopedPointer<Ui::OptionDialog> m_ui;
}; };
#endif // OPTIONDIALOG_H #endif // OPTIONDIALOG_H

View File

@ -6,27 +6,38 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>605</width> <width>577</width>
<height>429</height> <height>404</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="enableHttpServer"> <widget class="QCheckBox" name="enableHttpServer">
<property name="toolTip">
<string>This is required for accessing your databases from ChromeIPass or PassIFox</string>
</property>
<property name="text"> <property name="text">
<string>Enable KeepassXC HTTP protocol <string>Enable KeePassHTTP server</string>
This is required for accessing your databases from ChromeIPass or PassIFox</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
@ -40,13 +51,18 @@ This is required for accessing your databases from ChromeIPass or PassIFox</stri
<property name="text"> <property name="text">
<string>Sh&amp;ow a notification when credentials are requested</string> <string>Sh&amp;ow a notification when credentials are requested</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="bestMatchOnly"> <widget class="QCheckBox" name="bestMatchOnly">
<property name="toolTip">
<string>Only returns the best matches for a specific URL instead of all entries for the whole domain.</string>
</property>
<property name="text"> <property name="text">
<string>&amp;Return only best matching entries for a URL instead <string>&amp;Return only best matching entries</string>
of all entries for the whole domain</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -55,13 +71,18 @@ of all entries for the whole domain</string>
<property name="text"> <property name="text">
<string>Re&amp;quest to unlock the database if it is locked</string> <string>Re&amp;quest to unlock the database if it is locked</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="matchUrlScheme"> <widget class="QCheckBox" name="matchUrlScheme">
<property name="toolTip">
<string>Only entries with the same scheme (http://, https://, ftp://, ...) are returned.</string>
</property>
<property name="text"> <property name="text">
<string>&amp;Match URL schemes <string>&amp;Match URL schemes</string>
Only entries with the same scheme (http://, https://, ftp://, ...) are returned</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -110,7 +131,7 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
<string>Password generator</string> <string>Password Generator</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
@ -135,20 +156,14 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
<attribute name="title"> <attribute name="title">
<string>Advanced</string> <string>Advanced</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<widget class="QLabel" name="label"> <widget class="MessageWidget" name="warningWidget" native="true">
<property name="font"> <property name="sizePolicy">
<font> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<weight>75</weight> <horstretch>0</horstretch>
<bold>true</bold> <verstretch>0</verstretch>
</font> </sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 0, 0);</string>
</property>
<property name="text">
<string>The following options can be dangerous. Change them only if you know what you are doing.</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -168,35 +183,21 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
</item> </item>
<item> <item>
<widget class="QCheckBox" name="searchInAllDatabases"> <widget class="QCheckBox" name="searchInAllDatabases">
<property name="toolTip">
<string>Only the selected database has to be connected with a client.</string>
</property>
<property name="text"> <property name="text">
<string>Searc&amp;h in all opened databases for matching entries</string> <string>Searc&amp;h in all opened databases for matching entries</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Only the selected database has to be connected with a client!</string>
</property>
<property name="indent">
<number>30</number>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="supportKphFields"> <widget class="QCheckBox" name="supportKphFields">
<property name="text"> <property name="toolTip">
<string>&amp;Return advanced string fields which start with &quot;KPH: &quot;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Automatically creating or updating string fields is not supported.</string> <string>Automatically creating or updating string fields is not supported.</string>
</property> </property>
<property name="indent"> <property name="text">
<number>30</number> <string>&amp;Return advanced string fields which start with &quot;KPH: &quot;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -217,25 +218,8 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QFormLayout" name="formLayout">
<item row="1" column="1"> <item row="0" column="0">
<widget class="QLineEdit" name="httpPort">
<property name="inputMask">
<string notr="true">d0000</string>
</property>
<property name="placeholderText">
<string>Default port: 19455</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>KeePassXC will listen to this port on 127.0.0.1</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -251,6 +235,29 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="httpPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="inputMask">
<string notr="true">d0000</string>
</property>
<property name="placeholderText">
<string>Default port: 19455</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>KeePassXC will listen to this port on 127.0.0.1</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -279,6 +286,12 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
<header>http/HttpPasswordGeneratorWidget.h</header> <header>http/HttpPasswordGeneratorWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>MessageWidget</class>
<extends>QWidget</extends>
<header>gui/MessageWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>