PCManFM-Qt
pathedit.h
1 /*
2 
3  Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef FM_PATHEDIT_H
22 #define FM_PATHEDIT_H
23 
24 #include "libfmqtglobals.h"
25 #include <QLineEdit>
26 #include <gio/gio.h>
27 
28 class QCompleter;
29 class QStringListModel;
30 
31 namespace Fm {
32 
33 struct JobData;
34 
35 class LIBFM_QT_API PathEdit : public QLineEdit {
36 Q_OBJECT
37 public:
38  explicit PathEdit(QWidget* parent = 0);
39  virtual ~PathEdit();
40 
41 protected:
42  virtual void focusInEvent(QFocusEvent* e);
43  virtual void focusOutEvent(QFocusEvent* e);
44 
45 private Q_SLOTS:
46  void onTextChanged(const QString & text);
47 
48 private:
49  void reloadCompleter(bool triggeredByFocusInEvent = false);
50  void freeCompleter();
51  static gboolean jobFunc(GIOSchedulerJob *job, GCancellable *cancellable, gpointer user_data);
52  static gboolean _onJobFinished(gpointer user_data);
53  void onJobFinished(JobData* data);
54 
55 private:
56  QCompleter* completer_;
57  QStringListModel* model_;
58  QString currentPrefix_;
59  GCancellable* cancellable_;
60 };
61 
62 }
63 
64 #endif // FM_PATHEDIT_H
Definition: pathedit.cpp:79
Definition: appchoosercombobox.cpp:26
Definition: pathedit.h:35