mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Refactor EditWidgetProperties.
This commit is contained in:
parent
ff0d53d945
commit
771a041750
@ -75,6 +75,7 @@ set(keepassx_SOURCES
|
|||||||
gui/DragTabBar.cpp
|
gui/DragTabBar.cpp
|
||||||
gui/EditWidget.cpp
|
gui/EditWidget.cpp
|
||||||
gui/EditWidgetIcons.cpp
|
gui/EditWidgetIcons.cpp
|
||||||
|
gui/EditWidgetProperties.cpp
|
||||||
gui/FileDialog.cpp
|
gui/FileDialog.cpp
|
||||||
gui/IconModels.cpp
|
gui/IconModels.cpp
|
||||||
gui/KeePass1OpenWidget.cpp
|
gui/KeePass1OpenWidget.cpp
|
||||||
@ -136,6 +137,7 @@ set(keepassx_MOC
|
|||||||
gui/DragTabBar.h
|
gui/DragTabBar.h
|
||||||
gui/EditWidget.h
|
gui/EditWidget.h
|
||||||
gui/EditWidgetIcons.h
|
gui/EditWidgetIcons.h
|
||||||
|
gui/EditWidgetProperties.h
|
||||||
gui/IconModels.h
|
gui/IconModels.h
|
||||||
gui/KeePass1OpenWidget.h
|
gui/KeePass1OpenWidget.h
|
||||||
gui/LineEdit.h
|
gui/LineEdit.h
|
||||||
|
42
src/gui/EditWidgetProperties.cpp
Normal file
42
src/gui/EditWidgetProperties.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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 "EditWidgetProperties.h"
|
||||||
|
#include "ui_EditWidgetProperties.h"
|
||||||
|
|
||||||
|
EditWidgetProperties::EditWidgetProperties(QWidget* parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, m_ui(new Ui::EditWidgetProperties())
|
||||||
|
{
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditWidgetProperties::~EditWidgetProperties()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditWidgetProperties::setFields(TimeInfo timeInfo, Uuid uuid)
|
||||||
|
{
|
||||||
|
QString timeFormat("d MMM yyyy HH:mm:ss");
|
||||||
|
m_ui->modifiedEdit->setText(
|
||||||
|
timeInfo.lastModificationTime().toLocalTime().toString(timeFormat));
|
||||||
|
m_ui->createdEdit->setText(
|
||||||
|
timeInfo.creationTime().toLocalTime().toString(timeFormat));
|
||||||
|
m_ui->accessedEdit->setText(
|
||||||
|
timeInfo.lastAccessTime().toLocalTime().toString(timeFormat));
|
||||||
|
m_ui->uuidEdit->setText(uuid.toHex());
|
||||||
|
}
|
47
src/gui/EditWidgetProperties.h
Normal file
47
src/gui/EditWidgetProperties.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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_EDITWIDGETPROPERTIES_H
|
||||||
|
#define KEEPASSX_EDITWIDGETPROPERTIES_H
|
||||||
|
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
#include "core/Global.h"
|
||||||
|
#include "core/TimeInfo.h"
|
||||||
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EditWidgetProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EditWidgetProperties : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EditWidgetProperties(QWidget* parent = Q_NULLPTR);
|
||||||
|
~EditWidgetProperties();
|
||||||
|
|
||||||
|
void setFields(TimeInfo timeInfo, Uuid uuid);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const QScopedPointer<Ui::EditWidgetProperties> m_ui;
|
||||||
|
|
||||||
|
Q_DISABLE_COPY(EditWidgetProperties)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KEEPASSX_EDITWIDGETPROPERTIES_H
|
@ -37,6 +37,7 @@
|
|||||||
#include "core/TimeDelta.h"
|
#include "core/TimeDelta.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "gui/EditWidgetIcons.h"
|
#include "gui/EditWidgetIcons.h"
|
||||||
|
#include "gui/EditWidgetProperties.h"
|
||||||
#include "gui/FileDialog.h"
|
#include "gui/FileDialog.h"
|
||||||
#include "gui/entry/AutoTypeAssociationsModel.h"
|
#include "gui/entry/AutoTypeAssociationsModel.h"
|
||||||
#include "gui/entry/EntryAttachmentsModel.h"
|
#include "gui/entry/EntryAttachmentsModel.h"
|
||||||
@ -51,14 +52,13 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
||||||
, m_autoTypeUi(new Ui::EditEntryWidgetAutoType())
|
, m_autoTypeUi(new Ui::EditEntryWidgetAutoType())
|
||||||
, m_historyUi(new Ui::EditEntryWidgetHistory())
|
, m_historyUi(new Ui::EditEntryWidgetHistory())
|
||||||
, m_propertiesUi(new Ui::EditWidgetProperties())
|
|
||||||
, m_mainWidget(new QWidget())
|
, m_mainWidget(new QWidget())
|
||||||
, m_notesWidget(new QWidget())
|
, m_notesWidget(new QWidget())
|
||||||
, m_advancedWidget(new QWidget())
|
, m_advancedWidget(new QWidget())
|
||||||
, m_iconsWidget(new EditWidgetIcons())
|
, m_iconsWidget(new EditWidgetIcons())
|
||||||
, m_autoTypeWidget(new QWidget())
|
, m_autoTypeWidget(new QWidget())
|
||||||
|
, m_editWidgetProperties(new EditWidgetProperties())
|
||||||
, m_historyWidget(new QWidget())
|
, m_historyWidget(new QWidget())
|
||||||
, m_editWidgetProperties(new QWidget())
|
|
||||||
, m_entryAttachments(new EntryAttachments(this))
|
, m_entryAttachments(new EntryAttachments(this))
|
||||||
, m_attachmentsModel(new EntryAttachmentsModel(m_advancedWidget))
|
, m_attachmentsModel(new EntryAttachmentsModel(m_advancedWidget))
|
||||||
, m_entryAttributes(new EntryAttributes(this))
|
, m_entryAttributes(new EntryAttributes(this))
|
||||||
@ -84,7 +84,6 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
m_autoTypeUi->setupUi(m_autoTypeWidget);
|
m_autoTypeUi->setupUi(m_autoTypeWidget);
|
||||||
add(tr("Auto-Type"), m_autoTypeWidget);
|
add(tr("Auto-Type"), m_autoTypeWidget);
|
||||||
|
|
||||||
m_propertiesUi->setupUi(m_editWidgetProperties);
|
|
||||||
add(tr("Properties"), m_editWidgetProperties);
|
add(tr("Properties"), m_editWidgetProperties);
|
||||||
|
|
||||||
// when adding a new row, update setRowHidden() call
|
// when adding a new row, update setRowHidden() call
|
||||||
@ -339,6 +338,8 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
|
|||||||
}
|
}
|
||||||
updateAutoTypeEnabled();
|
updateAutoTypeEnabled();
|
||||||
|
|
||||||
|
m_editWidgetProperties->setFields(entry->timeInfo(), entry->uuid());
|
||||||
|
|
||||||
if (!m_history && !restore) {
|
if (!m_history && !restore) {
|
||||||
m_historyModel->setEntries(entry->historyItems());
|
m_historyModel->setEntries(entry->historyItems());
|
||||||
m_historyUi->historyView->sortByColumn(0, Qt::DescendingOrder);
|
m_historyUi->historyView->sortByColumn(0, Qt::DescendingOrder);
|
||||||
@ -352,15 +353,6 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
|
|||||||
|
|
||||||
updateHistoryButtons(m_historyUi->historyView->currentIndex(), QModelIndex());
|
updateHistoryButtons(m_historyUi->historyView->currentIndex(), QModelIndex());
|
||||||
|
|
||||||
QString timeFormat("d MMM yyyy HH:mm:ss");
|
|
||||||
m_propertiesUi->modifiedEdit->setText(
|
|
||||||
entry->timeInfo().lastModificationTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->createdEdit->setText(
|
|
||||||
entry->timeInfo().creationTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->accessedEdit->setText(
|
|
||||||
entry->timeInfo().lastAccessTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->uuidEdit->setText(entry->uuid().toHex());
|
|
||||||
|
|
||||||
m_mainUi->titleEdit->setFocus();
|
m_mainUi->titleEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ class AutoTypeAssociations;
|
|||||||
class AutoTypeAssociationsModel;
|
class AutoTypeAssociationsModel;
|
||||||
class Database;
|
class Database;
|
||||||
class EditWidgetIcons;
|
class EditWidgetIcons;
|
||||||
|
class EditWidgetProperties;
|
||||||
class Entry;
|
class Entry;
|
||||||
class EntryAttachments;
|
class EntryAttachments;
|
||||||
class EntryAttachmentsModel;
|
class EntryAttachmentsModel;
|
||||||
@ -44,7 +45,6 @@ namespace Ui {
|
|||||||
class EditEntryWidgetMain;
|
class EditEntryWidgetMain;
|
||||||
class EditEntryWidgetHistory;
|
class EditEntryWidgetHistory;
|
||||||
class EditEntryWidgetNotes;
|
class EditEntryWidgetNotes;
|
||||||
class EditWidgetProperties;
|
|
||||||
class EditWidget;
|
class EditWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,14 +110,13 @@ private:
|
|||||||
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
||||||
const QScopedPointer<Ui::EditEntryWidgetAutoType> m_autoTypeUi;
|
const QScopedPointer<Ui::EditEntryWidgetAutoType> m_autoTypeUi;
|
||||||
const QScopedPointer<Ui::EditEntryWidgetHistory> m_historyUi;
|
const QScopedPointer<Ui::EditEntryWidgetHistory> m_historyUi;
|
||||||
const QScopedPointer<Ui::EditWidgetProperties> m_propertiesUi;
|
|
||||||
QWidget* const m_mainWidget;
|
QWidget* const m_mainWidget;
|
||||||
QWidget* const m_notesWidget;
|
QWidget* const m_notesWidget;
|
||||||
QWidget* const m_advancedWidget;
|
QWidget* const m_advancedWidget;
|
||||||
EditWidgetIcons* const m_iconsWidget;
|
EditWidgetIcons* const m_iconsWidget;
|
||||||
QWidget* const m_autoTypeWidget;
|
QWidget* const m_autoTypeWidget;
|
||||||
|
EditWidgetProperties* const m_editWidgetProperties;
|
||||||
QWidget* const m_historyWidget;
|
QWidget* const m_historyWidget;
|
||||||
QWidget* const m_editWidgetProperties;
|
|
||||||
EntryAttachments* const m_entryAttachments;
|
EntryAttachments* const m_entryAttachments;
|
||||||
EntryAttachmentsModel* const m_attachmentsModel;
|
EntryAttachmentsModel* const m_attachmentsModel;
|
||||||
EntryAttributes* const m_entryAttributes;
|
EntryAttributes* const m_entryAttributes;
|
||||||
|
@ -17,23 +17,21 @@
|
|||||||
|
|
||||||
#include "EditGroupWidget.h"
|
#include "EditGroupWidget.h"
|
||||||
#include "ui_EditGroupWidgetMain.h"
|
#include "ui_EditGroupWidgetMain.h"
|
||||||
#include "ui_EditWidgetProperties.h"
|
|
||||||
#include "ui_EditWidget.h"
|
#include "ui_EditWidget.h"
|
||||||
|
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "gui/EditWidgetIcons.h"
|
#include "gui/EditWidgetIcons.h"
|
||||||
|
#include "gui/EditWidgetProperties.h"
|
||||||
|
|
||||||
EditGroupWidget::EditGroupWidget(QWidget* parent)
|
EditGroupWidget::EditGroupWidget(QWidget* parent)
|
||||||
: EditWidget(parent)
|
: EditWidget(parent)
|
||||||
, m_mainUi(new Ui::EditGroupWidgetMain())
|
, m_mainUi(new Ui::EditGroupWidgetMain())
|
||||||
, m_propertiesUi(new Ui::EditWidgetProperties())
|
|
||||||
, m_editGroupWidgetMain(new QWidget())
|
, m_editGroupWidgetMain(new QWidget())
|
||||||
, m_editGroupWidgetIcons(new EditWidgetIcons())
|
, m_editGroupWidgetIcons(new EditWidgetIcons())
|
||||||
, m_editWidgetProperties(new QWidget())
|
, m_editWidgetProperties(new EditWidgetProperties())
|
||||||
, m_group(Q_NULLPTR)
|
, m_group(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
m_mainUi->setupUi(m_editGroupWidgetMain);
|
m_mainUi->setupUi(m_editGroupWidgetMain);
|
||||||
m_propertiesUi->setupUi(m_editWidgetProperties);
|
|
||||||
|
|
||||||
add(tr("Group"), m_editGroupWidgetMain);
|
add(tr("Group"), m_editGroupWidgetMain);
|
||||||
add(tr("Icon"), m_editGroupWidgetIcons);
|
add(tr("Icon"), m_editGroupWidgetIcons);
|
||||||
@ -68,14 +66,6 @@ void EditGroupWidget::loadGroup(Group* group, bool create, Database* database)
|
|||||||
m_mainUi->editNotes->setPlainText(m_group->notes());
|
m_mainUi->editNotes->setPlainText(m_group->notes());
|
||||||
m_mainUi->expireCheck->setChecked(group->timeInfo().expires());
|
m_mainUi->expireCheck->setChecked(group->timeInfo().expires());
|
||||||
m_mainUi->expireDatePicker->setDateTime(group->timeInfo().expiryTime().toLocalTime());
|
m_mainUi->expireDatePicker->setDateTime(group->timeInfo().expiryTime().toLocalTime());
|
||||||
QString timeFormat("d MMM yyyy HH:mm:ss");
|
|
||||||
m_propertiesUi->modifiedEdit->setText(
|
|
||||||
group->timeInfo().lastModificationTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->createdEdit->setText(
|
|
||||||
group->timeInfo().creationTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->accessedEdit->setText(
|
|
||||||
group->timeInfo().lastAccessTime().toLocalTime().toString(timeFormat));
|
|
||||||
m_propertiesUi->uuidEdit->setText(group->uuid().toHex());
|
|
||||||
m_mainUi->searchComboBox->setCurrentIndex(indexFromTriState(group->searchingEnabled()));
|
m_mainUi->searchComboBox->setCurrentIndex(indexFromTriState(group->searchingEnabled()));
|
||||||
m_mainUi->autotypeComboBox->setCurrentIndex(indexFromTriState(group->autoTypeEnabled()));
|
m_mainUi->autotypeComboBox->setCurrentIndex(indexFromTriState(group->autoTypeEnabled()));
|
||||||
|
|
||||||
@ -84,6 +74,8 @@ void EditGroupWidget::loadGroup(Group* group, bool create, Database* database)
|
|||||||
iconStruct.number = group->iconNumber();
|
iconStruct.number = group->iconNumber();
|
||||||
m_editGroupWidgetIcons->load(group->uuid(), database, iconStruct);
|
m_editGroupWidgetIcons->load(group->uuid(), database, iconStruct);
|
||||||
|
|
||||||
|
m_editWidgetProperties->setFields(group->timeInfo(), group->uuid());
|
||||||
|
|
||||||
setCurrentRow(0);
|
setCurrentRow(0);
|
||||||
|
|
||||||
m_mainUi->editName->setFocus();
|
m_mainUi->editName->setFocus();
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
#include "gui/EditWidget.h"
|
#include "gui/EditWidget.h"
|
||||||
|
|
||||||
class EditWidgetIcons;
|
class EditWidgetIcons;
|
||||||
|
class EditWidgetProperties;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class EditGroupWidgetMain;
|
class EditGroupWidgetMain;
|
||||||
class EditWidgetProperties;
|
|
||||||
class EditWidget;
|
class EditWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,10 +55,9 @@ private:
|
|||||||
Group::TriState triStateFromIndex(int index);
|
Group::TriState triStateFromIndex(int index);
|
||||||
|
|
||||||
const QScopedPointer<Ui::EditGroupWidgetMain> m_mainUi;
|
const QScopedPointer<Ui::EditGroupWidgetMain> m_mainUi;
|
||||||
const QScopedPointer<Ui::EditWidgetProperties> m_propertiesUi;
|
|
||||||
QWidget* const m_editGroupWidgetMain;
|
QWidget* const m_editGroupWidgetMain;
|
||||||
EditWidgetIcons* const m_editGroupWidgetIcons;
|
EditWidgetIcons* const m_editGroupWidgetIcons;
|
||||||
QWidget* const m_editWidgetProperties;
|
EditWidgetProperties* const m_editWidgetProperties;
|
||||||
Group* m_group;
|
Group* m_group;
|
||||||
Database* m_database;
|
Database* m_database;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user