mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add a new tab to the entry widget that shows attributes and attachments.
This commit is contained in:
parent
2b16648370
commit
849f83e030
@ -103,6 +103,7 @@ set(keepassx_FORMS
|
|||||||
gui/ChangeMasterKeyWidget.ui
|
gui/ChangeMasterKeyWidget.ui
|
||||||
gui/DatabaseOpenDialog.ui
|
gui/DatabaseOpenDialog.ui
|
||||||
gui/EditEntryWidget.ui
|
gui/EditEntryWidget.ui
|
||||||
|
gui/EditEntryWidgetAdvanced.ui
|
||||||
gui/EditEntryWidgetMain.ui
|
gui/EditEntryWidgetMain.ui
|
||||||
gui/EditEntryWidgetNotes.ui
|
gui/EditEntryWidgetNotes.ui
|
||||||
gui/EditGroupWidget.ui
|
gui/EditGroupWidget.ui
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "EditEntryWidget.h"
|
#include "EditEntryWidget.h"
|
||||||
#include "ui_EditEntryWidget.h"
|
#include "ui_EditEntryWidget.h"
|
||||||
|
#include "ui_EditEntryWidgetAdvanced.h"
|
||||||
#include "ui_EditEntryWidgetMain.h"
|
#include "ui_EditEntryWidgetMain.h"
|
||||||
#include "ui_EditEntryWidgetNotes.h"
|
#include "ui_EditEntryWidgetNotes.h"
|
||||||
|
|
||||||
@ -25,6 +26,8 @@
|
|||||||
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
#include "gui/EntryAttachmentsModel.h"
|
||||||
|
#include "gui/EntryAttributesModel.h"
|
||||||
|
|
||||||
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -32,8 +35,10 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
, m_ui(new Ui::EditEntryWidget())
|
, 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_mainWidget(new QWidget(this))
|
, m_mainWidget(new QWidget(this))
|
||||||
, m_notesWidget(new QWidget(this))
|
, m_notesWidget(new QWidget(this))
|
||||||
|
, m_advancedWidget(new QWidget(this))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
@ -44,6 +49,7 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
|
|
||||||
m_ui->categoryList->addItem(tr("Entry"));
|
m_ui->categoryList->addItem(tr("Entry"));
|
||||||
m_ui->categoryList->addItem(tr("Description"));
|
m_ui->categoryList->addItem(tr("Description"));
|
||||||
|
m_ui->categoryList->addItem(tr("Advanced"));
|
||||||
|
|
||||||
m_mainUi->setupUi(m_mainWidget);
|
m_mainUi->setupUi(m_mainWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_mainWidget);
|
m_ui->stackedWidget->addWidget(m_mainWidget);
|
||||||
@ -51,6 +57,16 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
m_notesUi->setupUi(m_notesWidget);
|
m_notesUi->setupUi(m_notesWidget);
|
||||||
m_ui->stackedWidget->addWidget(m_notesWidget);
|
m_ui->stackedWidget->addWidget(m_notesWidget);
|
||||||
|
|
||||||
|
m_advancedUi->setupUi(m_advancedWidget);
|
||||||
|
m_ui->stackedWidget->addWidget(m_advancedWidget);
|
||||||
|
|
||||||
|
m_attachmentsModel = new EntryAttachmentsModel(m_advancedWidget);
|
||||||
|
m_advancedUi->attachmentsView->setModel(m_attachmentsModel);
|
||||||
|
m_entryAttributes = new EntryAttributes(this);
|
||||||
|
|
||||||
|
m_attributesModel = new EntryAttributesModel(m_advancedWidget);
|
||||||
|
m_advancedUi->attributesView->setModel(m_attributesModel);
|
||||||
|
|
||||||
Q_ASSERT(m_ui->categoryList->model()->rowCount() == m_ui->stackedWidget->count());
|
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_ui->categoryList, SIGNAL(currentRowChanged(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
|
||||||
@ -88,6 +104,11 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, const QString& groupN
|
|||||||
|
|
||||||
m_notesUi->notesEdit->setPlainText(entry->notes());
|
m_notesUi->notesEdit->setPlainText(entry->notes());
|
||||||
|
|
||||||
|
m_entryAttributes->copyFrom(entry->attributes());
|
||||||
|
m_attributesModel->setEntryAttributes(m_entryAttributes);
|
||||||
|
m_entryAttachments->copyFrom(entry->attachments());
|
||||||
|
m_attachmentsModel->setEntryAttachments(m_entryAttachments);
|
||||||
|
|
||||||
m_ui->categoryList->setCurrentRow(0);
|
m_ui->categoryList->setCurrentRow(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +124,11 @@ void EditEntryWidget::saveEntry()
|
|||||||
|
|
||||||
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
|
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
|
||||||
|
|
||||||
|
m_entry->attributes()->copyFrom(m_entryAttributes);
|
||||||
|
m_entryAttributes->clear();
|
||||||
|
m_entry->attachments()->copyFrom(m_entryAttachments);
|
||||||
|
m_entryAttachments->clear();
|
||||||
|
|
||||||
m_entry = 0;
|
m_entry = 0;
|
||||||
Q_EMIT editFinished(true);
|
Q_EMIT editFinished(true);
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,16 @@
|
|||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
class Entry;
|
class Entry;
|
||||||
|
class EntryAttachments;
|
||||||
|
class EntryAttachmentsModel;
|
||||||
|
class EntryAttributes;
|
||||||
|
class EntryAttributesModel;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QStackedLayout;
|
class QStackedLayout;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class EditEntryWidget;
|
class EditEntryWidget;
|
||||||
|
class EditEntryWidgetAdvanced;
|
||||||
class EditEntryWidgetMain;
|
class EditEntryWidgetMain;
|
||||||
class EditEntryWidgetNotes;
|
class EditEntryWidgetNotes;
|
||||||
}
|
}
|
||||||
@ -55,8 +60,14 @@ private:
|
|||||||
QScopedPointer<Ui::EditEntryWidget> m_ui;
|
QScopedPointer<Ui::EditEntryWidget> m_ui;
|
||||||
QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
||||||
QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
||||||
|
QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
||||||
QWidget* m_mainWidget;
|
QWidget* m_mainWidget;
|
||||||
QWidget* m_notesWidget;
|
QWidget* m_notesWidget;
|
||||||
|
QWidget* m_advancedWidget;
|
||||||
|
EntryAttachmentsModel* m_attachmentsModel;
|
||||||
|
EntryAttributesModel* m_attributesModel;
|
||||||
|
EntryAttachments* m_entryAttachments;
|
||||||
|
EntryAttributes* m_entryAttributes;
|
||||||
|
|
||||||
Q_DISABLE_COPY(EditEntryWidget)
|
Q_DISABLE_COPY(EditEntryWidget)
|
||||||
};
|
};
|
||||||
|
126
src/gui/EditEntryWidgetAdvanced.ui
Normal file
126
src/gui/EditEntryWidgetAdvanced.ui
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>EditEntryWidgetAdvanced</class>
|
||||||
|
<widget class="QWidget" name="EditEntryWidgetAdvanced">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>299</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="attributesBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Additional attributes</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="attributesView">
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addAttributeButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editAttributeButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeAttributeButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="attachmentsBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Attachments</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="attachmentsView">
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addAttachmentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeAttachmentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveAttachmentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue
Block a user