mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Entry edit widget inherits from base edit widget.
This commit is contained in:
parent
eb3a0be809
commit
0c7e1f1a6b
@ -118,7 +118,6 @@ set(keepassx_FORMS
|
|||||||
gui/ChangeMasterKeyWidget.ui
|
gui/ChangeMasterKeyWidget.ui
|
||||||
gui/DatabaseOpenDialog.ui
|
gui/DatabaseOpenDialog.ui
|
||||||
gui/DatabaseSettingsWidget.ui
|
gui/DatabaseSettingsWidget.ui
|
||||||
gui/EditEntryWidget.ui
|
|
||||||
gui/EditEntryWidgetAdvanced.ui
|
gui/EditEntryWidgetAdvanced.ui
|
||||||
gui/EditEntryWidgetIcons.ui
|
gui/EditEntryWidgetIcons.ui
|
||||||
gui/EditEntryWidgetMain.ui
|
gui/EditEntryWidgetMain.ui
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "EditEntryWidget.h"
|
#include "EditEntryWidget.h"
|
||||||
#include "ui_EditEntryWidget.h"
|
#include "ui_EditWidget.h"
|
||||||
#include "ui_EditEntryWidgetAdvanced.h"
|
#include "ui_EditEntryWidgetAdvanced.h"
|
||||||
#include "ui_EditEntryWidgetMain.h"
|
#include "ui_EditEntryWidgetMain.h"
|
||||||
#include "ui_EditEntryWidgetNotes.h"
|
#include "ui_EditEntryWidgetNotes.h"
|
||||||
@ -36,9 +36,8 @@
|
|||||||
#include "gui/FileDialog.h"
|
#include "gui/FileDialog.h"
|
||||||
|
|
||||||
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||||
: DialogyWidget(parent)
|
: EditWidget(parent)
|
||||||
, m_entry(0)
|
, m_entry(0)
|
||||||
, m_ui(new Ui::EditEntryWidget())
|
|
||||||
, m_mainUi(new Ui::EditEntryWidgetMain())
|
, m_mainUi(new Ui::EditEntryWidgetMain())
|
||||||
, m_notesUi(new Ui::EditEntryWidgetNotes())
|
, m_notesUi(new Ui::EditEntryWidgetNotes())
|
||||||
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
||||||
@ -48,29 +47,22 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
, m_advancedWidget(new QWidget(this))
|
, m_advancedWidget(new QWidget(this))
|
||||||
, m_iconsWidget(new QWidget(this))
|
, m_iconsWidget(new QWidget(this))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
QFont headerLabelFont = headlineLabel()->font();
|
||||||
|
|
||||||
QFont headerLabelFont = m_ui->headerLabel->font();
|
|
||||||
headerLabelFont.setBold(true);
|
headerLabelFont.setBold(true);
|
||||||
headerLabelFont.setPointSize(headerLabelFont.pointSize() + 2);
|
headerLabelFont.setPointSize(headerLabelFont.pointSize() + 2);
|
||||||
m_ui->headerLabel->setFont(headerLabelFont);
|
headlineLabel()->setFont(headerLabelFont);
|
||||||
|
|
||||||
m_ui->categoryList->addItem(tr("Entry"));
|
|
||||||
m_ui->categoryList->addItem(tr("Description"));
|
|
||||||
m_ui->categoryList->addItem(tr("Advanced"));
|
|
||||||
m_ui->categoryList->addItem(tr("Icon"));
|
|
||||||
|
|
||||||
m_mainUi->setupUi(m_mainWidget);
|
m_mainUi->setupUi(m_mainWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_mainWidget);
|
add(tr("Entry"), m_mainWidget);
|
||||||
|
|
||||||
m_notesUi->setupUi(m_notesWidget);
|
m_notesUi->setupUi(m_notesWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_notesWidget);
|
add(tr("Description"), m_notesWidget);
|
||||||
|
|
||||||
m_advancedUi->setupUi(m_advancedWidget);
|
m_advancedUi->setupUi(m_advancedWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_advancedWidget);
|
add(tr("Advanced"), m_advancedWidget);
|
||||||
|
|
||||||
m_iconsUi->setupUi(m_iconsWidget);
|
m_iconsUi->setupUi(m_iconsWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_iconsWidget);
|
add(tr("Icon"), m_iconsWidget);
|
||||||
|
|
||||||
m_entryAttachments = new EntryAttachments(this);
|
m_entryAttachments = new EntryAttachments(this);
|
||||||
m_attachmentsModel = new EntryAttachmentsModel(m_advancedWidget);
|
m_attachmentsModel = new EntryAttachmentsModel(m_advancedWidget);
|
||||||
@ -91,10 +83,6 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
SLOT(updateCurrentAttribute()));
|
SLOT(updateCurrentAttribute()));
|
||||||
|
|
||||||
Q_ASSERT(m_ui->categoryList->model()->rowCount() == m_ui->stackedWidget->count());
|
|
||||||
|
|
||||||
connect(m_ui->categoryList, SIGNAL(currentRowChanged(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
|
|
||||||
|
|
||||||
connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
|
connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
|
||||||
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->passwordEdit, SIGNAL(textEdited(QString)), SLOT(setPasswordCheckColors()));
|
connect(m_mainUi->passwordEdit, SIGNAL(textEdited(QString)), SLOT(setPasswordCheckColors()));
|
||||||
@ -117,8 +105,8 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
connect(m_iconsUi->addButton, SIGNAL(clicked()), SLOT(addCustomIcon()));
|
connect(m_iconsUi->addButton, SIGNAL(clicked()), SLOT(addCustomIcon()));
|
||||||
connect(m_iconsUi->deleteButton, SIGNAL(clicked()), SLOT(removeCustomIcon()));
|
connect(m_iconsUi->deleteButton, SIGNAL(clicked()), SLOT(removeCustomIcon()));
|
||||||
|
|
||||||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(saveEntry()));
|
connect(this, SIGNAL(accepted()), SLOT(saveEntry()));
|
||||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(cancel()));
|
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
EditEntryWidget::~EditEntryWidget()
|
EditEntryWidget::~EditEntryWidget()
|
||||||
@ -136,10 +124,10 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, const QString& groupN
|
|||||||
m_create = create;
|
m_create = create;
|
||||||
|
|
||||||
if (create) {
|
if (create) {
|
||||||
m_ui->headerLabel->setText(groupName+" > "+tr("Add entry"));
|
headlineLabel()->setText(groupName+" > "+tr("Add entry"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->headerLabel->setText(groupName+" > "+tr("Edit entry"));
|
headlineLabel()->setText(groupName+" > "+tr("Edit entry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainUi->titleEdit->setText(entry->title());
|
m_mainUi->titleEdit->setText(entry->title());
|
||||||
@ -157,7 +145,7 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, const QString& groupN
|
|||||||
m_entryAttributes->copyCustomKeysFrom(entry->attributes());
|
m_entryAttributes->copyCustomKeysFrom(entry->attributes());
|
||||||
*m_entryAttachments = *entry->attachments();
|
*m_entryAttachments = *entry->attachments();
|
||||||
|
|
||||||
m_ui->categoryList->setCurrentRow(0);
|
setCurrentRow(0);
|
||||||
|
|
||||||
if (m_attributesModel->rowCount() != 0) {
|
if (m_attributesModel->rowCount() != 0) {
|
||||||
m_advancedUi->attributesView->setCurrentIndex(m_attributesModel->index(0, 0));
|
m_advancedUi->attributesView->setCurrentIndex(m_attributesModel->index(0, 0));
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <QtCore/QAbstractItemModel>
|
#include <QtCore/QAbstractItemModel>
|
||||||
#include <QtCore/QScopedPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
|
|
||||||
#include "gui/DialogyWidget.h"
|
#include "gui/EditWidget.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class Entry;
|
class Entry;
|
||||||
@ -35,14 +35,14 @@ class Metadata;
|
|||||||
class QStackedLayout;
|
class QStackedLayout;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class EditEntryWidget;
|
|
||||||
class EditEntryWidgetAdvanced;
|
class EditEntryWidgetAdvanced;
|
||||||
class EditEntryWidgetMain;
|
class EditEntryWidgetMain;
|
||||||
class EditEntryWidgetNotes;
|
class EditEntryWidgetNotes;
|
||||||
class EditEntryWidgetIcons;
|
class EditEntryWidgetIcons;
|
||||||
|
class EditWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class EditEntryWidget : public DialogyWidget
|
class EditEntryWidget : public EditWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -84,7 +84,6 @@ private:
|
|||||||
Database* m_database;
|
Database* m_database;
|
||||||
|
|
||||||
bool m_create;
|
bool m_create;
|
||||||
const QScopedPointer<Ui::EditEntryWidget> m_ui;
|
|
||||||
const QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
const QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
||||||
const QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
const QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
||||||
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>EditEntryWidget</class>
|
|
||||||
<widget class="QWidget" name="EditEntryWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>400</width>
|
|
||||||
<height>300</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="headerLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<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>1</width>
|
|
||||||
<height>3</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="CategoryListWidget" name="categoryList"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>CategoryListWidget</class>
|
|
||||||
<extends>QListWidget</extends>
|
|
||||||
<header>gui/EditEntryWidget_p.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Loading…
Reference in New Issue
Block a user