Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
editor_file_dialog.h
1 /* editor_file_dialog.h
2  *
3  * File dialog that can be used as an "inline editor" in a table
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef EDITOR_FILE_DIALOG_H_
13 #define EDITOR_FILE_DIALOG_H_
14 
15 #include <QModelIndex>
16 #include <QLineEdit>
17 #include <QFileDialog>
18 #include <QPushButton>
19 
20 class EditorFileDialog : public QLineEdit
21 {
22  Q_OBJECT
23 public:
24  enum FileMode { ExistingFile, Directory };
25 
26  explicit EditorFileDialog(const QModelIndex& index, enum FileMode mode, QWidget* parent = 0, const QString & caption = QString(), const QString & directory = QString(), const QString & filter = QString());
27 
28  void setOption(QFileDialog::Option option, bool on = true);
29  virtual void focusInEvent(QFocusEvent *event);
30  virtual void focusOutEvent(QFocusEvent *event);
31  virtual bool eventFilter(QObject *obj, QEvent *event);
32 
33 signals:
34  void acceptEdit(const QModelIndex& index);
35 
36 private slots:
37  void applyFilename();
38 
39 protected:
40  void resizeEvent(QResizeEvent *);
41  QPushButton* file_dialog_button_;
42  const QModelIndex index_; //saved index of table cell
43  enum FileMode mode_;
44  QString caption_;
45  QString directory_;
46  QString filter_;
47  QFileDialog::Options options_;
48 };
49 
50 #endif /* EDITOR_FILE_DIALOG_H_ */
51 
52 /*
53  * Editor modelines
54  *
55  * Local Variables:
56  * c-basic-offset: 4
57  * tab-width: 8
58  * indent-tabs-mode: nil
59  * End:
60  *
61  * ex: set shiftwidth=4 tabstop=8 expandtab:
62  * :indentSize=4:tabSize=8:noTabs=true:
63  */
Definition: pcapng.c:148
Definition: editor_file_dialog.h:20