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/DatabaseOpenDialog.ui
|
||||
gui/DatabaseSettingsWidget.ui
|
||||
gui/EditEntryWidget.ui
|
||||
gui/EditEntryWidgetAdvanced.ui
|
||||
gui/EditEntryWidgetIcons.ui
|
||||
gui/EditEntryWidgetMain.ui
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "EditEntryWidget.h"
|
||||
#include "ui_EditEntryWidget.h"
|
||||
#include "ui_EditWidget.h"
|
||||
#include "ui_EditEntryWidgetAdvanced.h"
|
||||
#include "ui_EditEntryWidgetMain.h"
|
||||
#include "ui_EditEntryWidgetNotes.h"
|
||||
@ -36,9 +36,8 @@
|
||||
#include "gui/FileDialog.h"
|
||||
|
||||
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||
: DialogyWidget(parent)
|
||||
: EditWidget(parent)
|
||||
, m_entry(0)
|
||||
, m_ui(new Ui::EditEntryWidget())
|
||||
, m_mainUi(new Ui::EditEntryWidgetMain())
|
||||
, m_notesUi(new Ui::EditEntryWidgetNotes())
|
||||
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
||||
@ -48,29 +47,22 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||
, m_advancedWidget(new QWidget(this))
|
||||
, m_iconsWidget(new QWidget(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
QFont headerLabelFont = m_ui->headerLabel->font();
|
||||
QFont headerLabelFont = headlineLabel()->font();
|
||||
headerLabelFont.setBold(true);
|
||||
headerLabelFont.setPointSize(headerLabelFont.pointSize() + 2);
|
||||
m_ui->headerLabel->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"));
|
||||
headlineLabel()->setFont(headerLabelFont);
|
||||
|
||||
m_mainUi->setupUi(m_mainWidget);
|
||||
m_ui->stackedWidget->addWidget(m_mainWidget);
|
||||
add(tr("Entry"), m_mainWidget);
|
||||
|
||||
m_notesUi->setupUi(m_notesWidget);
|
||||
m_ui->stackedWidget->addWidget(m_notesWidget);
|
||||
add(tr("Description"), m_notesWidget);
|
||||
|
||||
m_advancedUi->setupUi(m_advancedWidget);
|
||||
m_ui->stackedWidget->addWidget(m_advancedWidget);
|
||||
add(tr("Advanced"), m_advancedWidget);
|
||||
|
||||
m_iconsUi->setupUi(m_iconsWidget);
|
||||
m_ui->stackedWidget->addWidget(m_iconsWidget);
|
||||
add(tr("Icon"), m_iconsWidget);
|
||||
|
||||
m_entryAttachments = new EntryAttachments(this);
|
||||
m_attachmentsModel = new EntryAttachmentsModel(m_advancedWidget);
|
||||
@ -91,10 +83,6 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
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->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
|
||||
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->deleteButton, SIGNAL(clicked()), SLOT(removeCustomIcon()));
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(saveEntry()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(cancel()));
|
||||
connect(this, SIGNAL(accepted()), SLOT(saveEntry()));
|
||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||
}
|
||||
|
||||
EditEntryWidget::~EditEntryWidget()
|
||||
@ -136,10 +124,10 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, const QString& groupN
|
||||
m_create = create;
|
||||
|
||||
if (create) {
|
||||
m_ui->headerLabel->setText(groupName+" > "+tr("Add entry"));
|
||||
headlineLabel()->setText(groupName+" > "+tr("Add entry"));
|
||||
}
|
||||
else {
|
||||
m_ui->headerLabel->setText(groupName+" > "+tr("Edit entry"));
|
||||
headlineLabel()->setText(groupName+" > "+tr("Edit entry"));
|
||||
}
|
||||
|
||||
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_entryAttachments = *entry->attachments();
|
||||
|
||||
m_ui->categoryList->setCurrentRow(0);
|
||||
setCurrentRow(0);
|
||||
|
||||
if (m_attributesModel->rowCount() != 0) {
|
||||
m_advancedUi->attributesView->setCurrentIndex(m_attributesModel->index(0, 0));
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
#include "gui/DialogyWidget.h"
|
||||
#include "gui/EditWidget.h"
|
||||
|
||||
class Database;
|
||||
class Entry;
|
||||
@ -35,14 +35,14 @@ class Metadata;
|
||||
class QStackedLayout;
|
||||
|
||||
namespace Ui {
|
||||
class EditEntryWidget;
|
||||
class EditEntryWidgetAdvanced;
|
||||
class EditEntryWidgetMain;
|
||||
class EditEntryWidgetNotes;
|
||||
class EditEntryWidgetIcons;
|
||||
class EditWidget;
|
||||
}
|
||||
|
||||
class EditEntryWidget : public DialogyWidget
|
||||
class EditEntryWidget : public EditWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -84,7 +84,6 @@ private:
|
||||
Database* m_database;
|
||||
|
||||
bool m_create;
|
||||
const QScopedPointer<Ui::EditEntryWidget> m_ui;
|
||||
const QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
||||
const QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
||||
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