forked from vnotex/vnote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvattachmentlist.h
More file actions
90 lines (58 loc) · 1.91 KB
/
vattachmentlist.h
File metadata and controls
90 lines (58 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef VATTACHMENTLIST_H
#define VATTACHMENTLIST_H
#include <QWidget>
#include <QVector>
#include <QStringList>
#include "vnotefile.h"
#include "vbuttonwithwidget.h"
#include "lineeditdelegate.h"
class QPushButton;
class QListWidget;
class QListWidgetItem;
class QLabel;
class VNoteFile;
class VAttachmentList : public QWidget, public VButtonPopupWidget
{
Q_OBJECT
public:
explicit VAttachmentList(QWidget *p_parent = 0);
// Need to call updateContent() to update the list.
void setFile(VNoteFile *p_file);
bool isAcceptDrops() const Q_DECL_OVERRIDE;
bool handleDragEnterEvent(QDragEnterEvent *p_event) Q_DECL_OVERRIDE;
bool handleDropEvent(QDropEvent *p_event) Q_DECL_OVERRIDE;
void handleAboutToShow() Q_DECL_OVERRIDE;
protected:
void keyPressEvent(QKeyEvent *p_event) Q_DECL_OVERRIDE;
void showEvent(QShowEvent *p_event) Q_DECL_OVERRIDE;
private slots:
void addAttachment();
void handleContextMenuRequested(QPoint p_pos);
void handleItemActivated(QListWidgetItem *p_item);
void deleteSelectedItems();
void sortItems();
void handleListItemCommitData(QWidget *p_itemEdit);
void attachmentInfo();
void copyAttachmentFilePath();
private:
void setupUI();
void init();
void fillAttachmentList(const QVector<VAttachment> &p_attachments);
void addAttachments(const QStringList &p_files);
// Update the state of VButtonWithWidget.
void updateButtonState() const;
// Check if there are attachments that do not exist in disk.
void checkAttachments();
// Update attachment info of m_file.
void updateContent();
bool m_initialized;
QPushButton *m_addBtn;
QPushButton *m_clearBtn;
QPushButton *m_locateBtn;
QLabel *m_numLabel;
LineEditDelegate m_listDelegate;
QListWidget *m_attachmentList;
VNoteFile *m_file;
static const QString c_infoShortcutSequence;
};
#endif // VATTACHMENTLIST_H