mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add base edit widget.
This commit is contained in:
parent
7986fd3e31
commit
f596cc4eec
@ -60,6 +60,7 @@ set(keepassx_SOURCES
|
||||
gui/DialogyWidget.cpp
|
||||
gui/EditEntryWidget.cpp
|
||||
gui/EditGroupWidget.cpp
|
||||
gui/EditWidget.cpp
|
||||
gui/EntryAttachmentsModel.cpp
|
||||
gui/EntryAttributesModel.cpp
|
||||
gui/EntryModel.cpp
|
||||
@ -96,6 +97,7 @@ set(keepassx_MOC
|
||||
gui/DialogyWidget.h
|
||||
gui/EditEntryWidget.h
|
||||
gui/EditGroupWidget.h
|
||||
gui/EditWidget.h
|
||||
gui/EntryAttachmentsModel.h
|
||||
gui/EntryAttributesModel.h
|
||||
gui/EntryModel.h
|
||||
@ -122,6 +124,7 @@ set(keepassx_FORMS
|
||||
gui/EditEntryWidgetMain.ui
|
||||
gui/EditEntryWidgetNotes.ui
|
||||
gui/EditGroupWidget.ui
|
||||
gui/EditWidget.ui
|
||||
gui/MainWindow.ui
|
||||
)
|
||||
|
||||
|
53
src/gui/EditWidget.cpp
Normal file
53
src/gui/EditWidget.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EditWidget.h"
|
||||
#include "ui_EditWidget.h"
|
||||
|
||||
EditWidget::EditWidget(QWidget *parent)
|
||||
: DialogyWidget(parent)
|
||||
, m_ui(new Ui::EditWidget())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->categoryList, SIGNAL(currentRowChanged(int)),
|
||||
m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(accepted()), SIGNAL(accepted()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SIGNAL(rejected()));
|
||||
}
|
||||
|
||||
EditWidget::~EditWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void EditWidget::add(const QString& labelText, QWidget* widget)
|
||||
{
|
||||
m_ui->categoryList->addItem(labelText);
|
||||
m_ui->stackedWidget->addWidget(widget);
|
||||
}
|
||||
|
||||
void EditWidget::setCurrentRow(int index)
|
||||
{
|
||||
m_ui->categoryList->setCurrentRow(index);
|
||||
}
|
||||
|
||||
QLabel* EditWidget::headlineLabel()
|
||||
{
|
||||
return m_ui->headerLabel;
|
||||
}
|
||||
|
53
src/gui/EditWidget.h
Normal file
53
src/gui/EditWidget.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEEPASSX_EDITWIDGET_H
|
||||
#define KEEPASSX_EDITWIDGET_H
|
||||
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
#include <gui/DialogyWidget.h>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class EditWidget;
|
||||
}
|
||||
|
||||
class EditWidget : public DialogyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditWidget(QWidget *parent = 0);
|
||||
~EditWidget();
|
||||
|
||||
void add(const QString& labelText, QWidget* widget);
|
||||
void setCurrentRow(int index);
|
||||
QLabel* headlineLabel();
|
||||
|
||||
Q_SIGNALS:
|
||||
void accepted();
|
||||
void rejected();
|
||||
|
||||
private:
|
||||
const QScopedPointer<Ui::EditWidget> m_ui;
|
||||
|
||||
Q_DISABLE_COPY(EditWidget)
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_EDITWIDGET_H
|
69
src/gui/EditWidget.ui
Normal file
69
src/gui/EditWidget.ui
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditWidget</class>
|
||||
<widget class="QWidget" name="EditWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>612</width>
|
||||
<height>255</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