mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-10 23:12:10 -05:00
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
|
#ifndef ENTRYATTACHMENTSWIDGET_H
|
||
|
#define ENTRYATTACHMENTSWIDGET_H
|
||
|
|
||
|
#include <QPointer>
|
||
|
#include <QWidget>
|
||
|
|
||
|
namespace Ui {
|
||
|
class EntryAttachmentsWidget;
|
||
|
}
|
||
|
|
||
|
class EntryAttachments;
|
||
|
class EntryAttachmentsModel;
|
||
|
|
||
|
class EntryAttachmentsWidget : public QWidget
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
|
||
|
Q_PROPERTY(bool isButtonsVisible READ isButtonsVisible WRITE setButtonsVisible NOTIFY buttonsVisibleChanged)
|
||
|
public:
|
||
|
explicit EntryAttachmentsWidget(QWidget* parent = nullptr);
|
||
|
~EntryAttachmentsWidget();
|
||
|
|
||
|
const EntryAttachments* entryAttachments() const;
|
||
|
bool isReadOnly() const;
|
||
|
bool isButtonsVisible() const;
|
||
|
|
||
|
public slots:
|
||
|
void setEntryAttachments(const EntryAttachments* attachments);
|
||
|
void clearAttachments();
|
||
|
void setReadOnly(bool readOnly);
|
||
|
void setButtonsVisible(bool isButtonsVisible);
|
||
|
|
||
|
signals:
|
||
|
void errorOccurred(const QString& error);
|
||
|
void readOnlyChanged(bool readOnly);
|
||
|
void buttonsVisibleChanged(bool isButtonsVisible);
|
||
|
|
||
|
private slots:
|
||
|
void insertAttachments();
|
||
|
void removeSelectedAttachments();
|
||
|
void saveSelectedAttachments();
|
||
|
void openAttachment(const QModelIndex& index);
|
||
|
void openSelectedAttachments();
|
||
|
void updateButtonsEnabled();
|
||
|
|
||
|
private:
|
||
|
bool insertAttachments(const QStringList& fileNames, QString& errorMessage);
|
||
|
bool openAttachment(const QModelIndex& index, QString& errorMessage);
|
||
|
|
||
|
bool eventFilter(QObject* watched, QEvent* event) override;
|
||
|
|
||
|
QScopedPointer<Ui::EntryAttachmentsWidget> m_ui;
|
||
|
QPointer<EntryAttachments> m_entryAttachments;
|
||
|
QPointer<EntryAttachmentsModel> m_attachmentsModel;
|
||
|
bool m_readOnly;
|
||
|
bool m_buttonsVisible;
|
||
|
};
|
||
|
|
||
|
#endif // ENTRYATTACHMENTSWIDGET_H
|