mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Group edit widget inherits from base edit widget.
This commit is contained in:
parent
f596cc4eec
commit
eb3a0be809
@ -123,7 +123,7 @@ set(keepassx_FORMS
|
||||
gui/EditEntryWidgetIcons.ui
|
||||
gui/EditEntryWidgetMain.ui
|
||||
gui/EditEntryWidgetNotes.ui
|
||||
gui/EditGroupWidget.ui
|
||||
gui/EditGroupWidgetMain.ui
|
||||
gui/EditWidget.ui
|
||||
gui/MainWindow.ui
|
||||
)
|
||||
|
@ -16,22 +16,26 @@
|
||||
*/
|
||||
|
||||
#include "EditGroupWidget.h"
|
||||
#include "ui_EditGroupWidget.h"
|
||||
#include "ui_EditGroupWidgetMain.h"
|
||||
#include "ui_EditWidget.h"
|
||||
|
||||
EditGroupWidget::EditGroupWidget(QWidget* parent)
|
||||
: DialogyWidget(parent)
|
||||
, m_ui(new Ui::EditGroupWidget())
|
||||
: EditWidget(parent)
|
||||
, m_mainUi(new Ui::EditGroupWidgetMain())
|
||||
, m_editGroupWidgetMain(new QWidget())
|
||||
, m_group(0)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_mainUi->setupUi(m_editGroupWidgetMain);
|
||||
|
||||
QFont labelHeaderFont = m_ui->labelHeader->font();
|
||||
add(tr("Group"), m_editGroupWidgetMain);
|
||||
|
||||
QFont labelHeaderFont = headlineLabel()->font();
|
||||
labelHeaderFont.setBold(true);
|
||||
labelHeaderFont.setPointSize(labelHeaderFont.pointSize() + 2);
|
||||
m_ui->labelHeader->setFont(labelHeaderFont);
|
||||
headlineLabel()->setFont(labelHeaderFont);
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(save()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(cancel()));
|
||||
connect(this, SIGNAL(accepted()), SLOT(save()));
|
||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||
}
|
||||
|
||||
EditGroupWidget::~EditGroupWidget()
|
||||
@ -43,22 +47,24 @@ void EditGroupWidget::loadGroup(Group* group, bool create)
|
||||
m_group = group;
|
||||
|
||||
if (create) {
|
||||
m_ui->labelHeader->setText(tr("Add group"));
|
||||
headlineLabel()->setText(tr("Add group"));
|
||||
}
|
||||
else {
|
||||
m_ui->labelHeader->setText(tr("Edit group"));
|
||||
headlineLabel()->setText(tr("Edit group"));
|
||||
}
|
||||
|
||||
m_ui->editName->setText(m_group->name());
|
||||
m_ui->editNotes->setPlainText(m_group->notes());
|
||||
m_mainUi->editName->setText(m_group->name());
|
||||
m_mainUi->editNotes->setPlainText(m_group->notes());
|
||||
|
||||
m_ui->editName->setFocus();
|
||||
setCurrentRow(0);
|
||||
|
||||
m_mainUi->editName->setFocus();
|
||||
}
|
||||
|
||||
void EditGroupWidget::save()
|
||||
{
|
||||
m_group->setName(m_ui->editName->text());
|
||||
m_group->setNotes(m_ui->editNotes->toPlainText());
|
||||
m_group->setName(m_mainUi->editName->text());
|
||||
m_group->setNotes(m_mainUi->editNotes->toPlainText());
|
||||
|
||||
m_group = 0;
|
||||
Q_EMIT editFinished(true);
|
||||
|
@ -20,15 +20,15 @@
|
||||
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
#include "gui/DialogyWidget.h"
|
||||
|
||||
#include "gui/EditWidget.h"
|
||||
#include "core/Group.h"
|
||||
|
||||
namespace Ui {
|
||||
class EditGroupWidget;
|
||||
class EditGroupWidgetMain;
|
||||
class EditWidget;
|
||||
}
|
||||
|
||||
class EditGroupWidget : public DialogyWidget
|
||||
class EditGroupWidget : public EditWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -46,7 +46,8 @@ private Q_SLOTS:
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
const QScopedPointer<Ui::EditGroupWidget> m_ui;
|
||||
const QScopedPointer<Ui::EditGroupWidgetMain> m_mainUi;
|
||||
QWidget* m_editGroupWidgetMain;
|
||||
Group* m_group;
|
||||
|
||||
Q_DISABLE_COPY(EditGroupWidget)
|
||||
|
@ -1,35 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditGroupWidget</class>
|
||||
<widget class="QWidget" name="EditGroupWidget">
|
||||
<class>EditGroupWidgetMain</class>
|
||||
<widget class="QWidget" name="EditGroupWidgetMain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>263</height>
|
||||
<width>676</width>
|
||||
<height>334</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelHeader"/>
|
||||
</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="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
@ -57,16 +38,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
Loading…
Reference in New Issue
Block a user