Entry edit: merge notes and main widget.

Closes #59
This commit is contained in:
Florian Geyer 2013-03-10 19:47:08 +01:00
parent 4daac65cc5
commit 36ad91b447
5 changed files with 23 additions and 48 deletions

View File

@ -181,7 +181,6 @@ set(keepassx_FORMS
gui/entry/EditEntryWidgetAutoType.ui
gui/entry/EditEntryWidgetHistory.ui
gui/entry/EditEntryWidgetMain.ui
gui/entry/EditEntryWidgetNotes.ui
gui/group/EditGroupWidgetMain.ui
)

View File

@ -45,12 +45,10 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
: EditWidget(parent)
, m_entry(Q_NULLPTR)
, m_mainUi(new Ui::EditEntryWidgetMain())
, m_notesUi(new Ui::EditEntryWidgetNotes())
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
, m_autoTypeUi(new Ui::EditEntryWidgetAutoType())
, m_historyUi(new Ui::EditEntryWidgetHistory())
, m_mainWidget(new QWidget())
, m_notesWidget(new QWidget())
, m_advancedWidget(new QWidget())
, m_iconsWidget(new EditWidgetIcons())
, m_autoTypeWidget(new QWidget())
@ -68,7 +66,6 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
, m_autoTypeWindowSequenceGroup(new QButtonGroup(this))
{
setupMain();
setupNotes();
setupAdvanced();
setupIcon();
setupAutoType();
@ -100,12 +97,6 @@ void EditEntryWidget::setupMain()
connect(m_mainUi->expirePresets->menu(), SIGNAL(triggered(QAction*)), this, SLOT(useExpiryPreset(QAction*)));
}
void EditEntryWidget::setupNotes()
{
m_notesUi->setupUi(m_notesWidget);
add(tr("Description"), m_notesWidget);
}
void EditEntryWidget::setupAdvanced()
{
m_advancedUi->setupUi(m_advancedWidget);
@ -284,7 +275,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
m_mainUi->passwordRepeatEdit->setReadOnly(m_history);
m_mainUi->expireCheck->setEnabled(!m_history);
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_notesUi->notesEdit->setReadOnly(m_history);
m_mainUi->notesEdit->setReadOnly(m_history);
m_advancedUi->addAttachmentButton->setEnabled(!m_history);
m_advancedUi->removeAttachmentButton->setEnabled(!m_history);
m_advancedUi->addAttributeButton->setEnabled(!m_history);
@ -316,7 +307,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
m_mainUi->expirePresets->setEnabled(!m_history);
m_mainUi->togglePasswordButton->setChecked(true);
m_notesUi->notesEdit->setPlainText(entry->notes());
m_mainUi->notesEdit->setPlainText(entry->notes());
m_entryAttachments->copyDataFrom(entry->attachments());
m_entryAttributes->copyCustomKeysFrom(entry->attributes());
@ -412,7 +403,7 @@ void EditEntryWidget::saveEntry()
m_entry->setExpires(m_mainUi->expireCheck->isChecked());
m_entry->setExpiryTime(m_mainUi->expireDatePicker->dateTime().toUTC());
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
m_entry->setNotes(m_mainUi->notesEdit->toPlainText());
m_entry->attributes()->copyCustomKeysFrom(m_entryAttributes);
m_entry->attachments()->copyDataFrom(m_entryAttachments);

View File

@ -44,7 +44,6 @@ namespace Ui {
class EditEntryWidgetAutoType;
class EditEntryWidgetMain;
class EditEntryWidgetHistory;
class EditEntryWidgetNotes;
class EditWidget;
}
@ -97,7 +96,6 @@ private Q_SLOTS:
private:
void setupMain();
void setupNotes();
void setupAdvanced();
void setupIcon();
void setupAutoType();
@ -114,12 +112,10 @@ private:
bool m_create;
bool m_history;
const QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
const QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
const QScopedPointer<Ui::EditEntryWidgetAutoType> m_autoTypeUi;
const QScopedPointer<Ui::EditEntryWidgetHistory> m_historyUi;
QWidget* const m_mainWidget;
QWidget* const m_notesWidget;
QWidget* const m_advancedWidget;
EditWidgetIcons* const m_iconsWidget;
QWidget* const m_autoTypeWidget;

View File

@ -89,6 +89,13 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="expireCheck">
<property name="text">
<string>Expires</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -110,10 +117,20 @@
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="expireCheck">
<item row="6" column="0">
<widget class="QLabel" name="notesLabel">
<property name="text">
<string>Expires</string>
<string>Notes:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPlainTextEdit" name="notesEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditEntryWidgetNotes</class>
<widget class="QWidget" name="EditEntryWidgetNotes">
<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="notesLabel">
<property name="text">
<string>Notes:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="notesEdit"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>