2010-10-06 13:40:50 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 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_EDITENTRYWIDGET_H
|
|
|
|
#define KEEPASSX_EDITENTRYWIDGET_H
|
|
|
|
|
2012-05-20 17:08:23 -04:00
|
|
|
#include <QtCore/QModelIndex>
|
2010-10-06 13:40:50 -04:00
|
|
|
#include <QtCore/QScopedPointer>
|
2012-04-24 07:23:09 -04:00
|
|
|
|
2012-05-15 04:50:08 -04:00
|
|
|
#include "gui/EditWidget.h"
|
2010-10-06 13:40:50 -04:00
|
|
|
|
2012-07-16 11:40:28 -04:00
|
|
|
class AutoTypeAssociations;
|
|
|
|
class AutoTypeAssociationsModel;
|
2012-05-13 13:02:07 -04:00
|
|
|
class Database;
|
2012-05-15 09:30:00 -04:00
|
|
|
class EditWidgetIcons;
|
2010-10-06 13:40:50 -04:00
|
|
|
class Entry;
|
2012-04-14 09:43:41 -04:00
|
|
|
class EntryAttachments;
|
|
|
|
class EntryAttachmentsModel;
|
|
|
|
class EntryAttributes;
|
|
|
|
class EntryAttributesModel;
|
2012-05-15 14:12:05 -04:00
|
|
|
class EntryHistoryModel;
|
2012-07-16 11:40:28 -04:00
|
|
|
class QButtonGroup;
|
2012-08-15 16:47:41 -04:00
|
|
|
class QMenu;
|
2012-06-10 10:02:03 -04:00
|
|
|
class QSortFilterProxyModel;
|
2010-10-06 13:40:50 -04:00
|
|
|
class QStackedLayout;
|
|
|
|
|
|
|
|
namespace Ui {
|
2012-04-14 09:43:41 -04:00
|
|
|
class EditEntryWidgetAdvanced;
|
2012-07-16 11:40:28 -04:00
|
|
|
class EditEntryWidgetAutoType;
|
2010-10-06 13:40:50 -04:00
|
|
|
class EditEntryWidgetMain;
|
2012-05-15 14:12:05 -04:00
|
|
|
class EditEntryWidgetHistory;
|
2010-10-06 13:40:50 -04:00
|
|
|
class EditEntryWidgetNotes;
|
2012-05-15 04:50:08 -04:00
|
|
|
class EditWidget;
|
2010-10-06 13:40:50 -04:00
|
|
|
}
|
|
|
|
|
2012-05-15 04:50:08 -04:00
|
|
|
class EditEntryWidget : public EditWidget
|
2010-10-06 13:40:50 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-06-29 08:15:16 -04:00
|
|
|
explicit EditEntryWidget(QWidget* parent = Q_NULLPTR);
|
2010-10-06 13:40:50 -04:00
|
|
|
~EditEntryWidget();
|
|
|
|
|
2012-10-21 15:45:54 -04:00
|
|
|
void loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
|
2012-05-20 17:14:34 -04:00
|
|
|
Database* database);
|
2010-10-06 13:40:50 -04:00
|
|
|
|
2012-05-14 13:10:42 -04:00
|
|
|
static const QColor CorrectSoFarColor;
|
|
|
|
static const QColor ErrorColor;
|
2012-04-17 10:04:49 -04:00
|
|
|
|
2012-08-15 16:47:41 -04:00
|
|
|
void createPresetsMenu(QMenu* expirePresetsMenu);
|
2012-10-21 15:45:54 -04:00
|
|
|
QString entryTitle() const;
|
2010-10-06 13:40:50 -04:00
|
|
|
Q_SIGNALS:
|
2011-12-27 09:49:06 -05:00
|
|
|
void editFinished(bool accepted);
|
2012-05-15 14:12:05 -04:00
|
|
|
void historyEntryActivated(Entry* entry);
|
2010-10-06 13:40:50 -04:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void saveEntry();
|
|
|
|
void cancel();
|
2012-01-07 10:18:21 -05:00
|
|
|
void togglePassword(bool checked);
|
2012-04-17 10:04:49 -04:00
|
|
|
void setPasswordCheckColors();
|
2012-04-28 13:11:15 -04:00
|
|
|
void insertAttribute();
|
|
|
|
void editCurrentAttribute();
|
|
|
|
void removeCurrentAttribute();
|
|
|
|
void updateCurrentAttribute();
|
2012-05-02 05:11:28 -04:00
|
|
|
void insertAttachment();
|
|
|
|
void saveCurrentAttachment();
|
|
|
|
void removeCurrentAttachment();
|
2012-07-20 04:28:18 -04:00
|
|
|
void updateAutoTypeEnabled();
|
2012-07-16 11:40:28 -04:00
|
|
|
void insertAutoTypeAssoc();
|
|
|
|
void removeAutoTypeAssoc();
|
|
|
|
void loadCurrentAssoc(const QModelIndex& current);
|
|
|
|
void clearCurrentAssoc();
|
|
|
|
void applyCurrentAssoc();
|
2012-05-18 13:22:22 -04:00
|
|
|
void showHistoryEntry();
|
2012-05-18 14:58:34 -04:00
|
|
|
void restoreHistoryEntry();
|
2012-05-18 13:22:22 -04:00
|
|
|
void deleteHistoryEntry();
|
2012-05-18 14:15:02 -04:00
|
|
|
void deleteAllHistoryEntries();
|
2012-05-20 17:14:34 -04:00
|
|
|
void emitHistoryEntryActivated(const QModelIndex& index);
|
2012-06-10 10:02:03 -04:00
|
|
|
void histEntryActivated(const QModelIndex& index);
|
2012-05-18 13:22:22 -04:00
|
|
|
void updateHistoryButtons(const QModelIndex& current, const QModelIndex& previous);
|
2012-08-15 16:47:41 -04:00
|
|
|
void useExpiryPreset(QAction* action);
|
2010-10-06 13:40:50 -04:00
|
|
|
|
|
|
|
private:
|
2012-04-28 13:11:15 -04:00
|
|
|
bool passwordsEqual();
|
2012-07-16 11:47:21 -04:00
|
|
|
void setForms(const Entry* entry, bool restore = false);
|
2012-10-21 09:09:01 -04:00
|
|
|
QMenu* createPresetsMenu();
|
2012-04-23 13:44:43 -04:00
|
|
|
|
2010-10-06 13:40:50 -04:00
|
|
|
Entry* m_entry;
|
2012-05-13 13:02:07 -04:00
|
|
|
Database* m_database;
|
2010-10-06 13:40:50 -04:00
|
|
|
|
2012-05-10 04:29:25 -04:00
|
|
|
bool m_create;
|
2012-05-15 14:12:05 -04:00
|
|
|
bool m_history;
|
2012-04-23 13:44:43 -04:00
|
|
|
const QScopedPointer<Ui::EditEntryWidgetMain> m_mainUi;
|
|
|
|
const QScopedPointer<Ui::EditEntryWidgetNotes> m_notesUi;
|
|
|
|
const QScopedPointer<Ui::EditEntryWidgetAdvanced> m_advancedUi;
|
2012-07-16 11:40:28 -04:00
|
|
|
const QScopedPointer<Ui::EditEntryWidgetAutoType> m_autoTypeUi;
|
2012-05-15 14:12:05 -04:00
|
|
|
const QScopedPointer<Ui::EditEntryWidgetHistory> m_historyUi;
|
2012-04-23 13:44:43 -04:00
|
|
|
QWidget* const m_mainWidget;
|
|
|
|
QWidget* const m_notesWidget;
|
|
|
|
QWidget* const m_advancedWidget;
|
2012-05-15 09:30:00 -04:00
|
|
|
EditWidgetIcons* const m_iconsWidget;
|
2012-07-16 11:40:28 -04:00
|
|
|
QWidget* const m_autoTypeWidget;
|
2012-05-15 14:12:05 -04:00
|
|
|
QWidget* const m_historyWidget;
|
2012-07-16 11:47:21 -04:00
|
|
|
EntryAttachments* const m_entryAttachments;
|
|
|
|
EntryAttachmentsModel* const m_attachmentsModel;
|
|
|
|
EntryAttributes* const m_entryAttributes;
|
|
|
|
EntryAttributesModel* const m_attributesModel;
|
|
|
|
EntryHistoryModel* const m_historyModel;
|
|
|
|
QSortFilterProxyModel* const m_sortModel;
|
2012-04-28 13:11:15 -04:00
|
|
|
QPersistentModelIndex m_currentAttribute;
|
2012-07-16 11:40:28 -04:00
|
|
|
AutoTypeAssociations* const m_autoTypeAssoc;
|
|
|
|
AutoTypeAssociationsModel* const m_autoTypeAssocModel;
|
|
|
|
QButtonGroup* const m_autoTypeDefaultSequenceGroup;
|
|
|
|
QButtonGroup* const m_autoTypeWindowSequenceGroup;
|
2012-08-15 16:47:41 -04:00
|
|
|
QMenu* m_expirePresetsMenu;
|
2010-10-06 13:40:50 -04:00
|
|
|
|
|
|
|
Q_DISABLE_COPY(EditEntryWidget)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_EDITENTRYWIDGET_H
|