1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
28 **************************************************************************/
30 #ifndef FOLDERNAVIGATIONWIDGET_H
31 #define FOLDERNAVIGATIONWIDGET_H
33 #include <coreplugin/inavigationwidgetfactory.h>
35 #include <QtGui/QWidget>
40 class QSortFilterProxyModel;
42 class QFileSystemModel;
47 namespace ProjectExplorer {
49 class ProjectExplorerPlugin;
55 class FolderNavigationWidget : public QWidget
58 Q_PROPERTY(bool autoSynchronization READ autoSynchronization WRITE setAutoSynchronization)
60 FolderNavigationWidget(QWidget *parent = 0);
62 bool autoSynchronization() const;
65 // Helpers for common directory browser options.
66 static void showInGraphicalShell(QWidget *parent, const QString &path);
67 static void openTerminal(const QString &path);
68 // Platform-dependent action descriptions
69 static QString msgGraphicalShellAction();
70 static QString msgTerminalAction();
73 void setAutoSynchronization(bool sync);
74 void toggleAutoSynchronization();
77 void setCurrentFile(const QString &filePath);
78 void slotOpenItem(const QModelIndex &viewIndex);
81 virtual void contextMenuEvent(QContextMenuEvent *ev);
84 void setCurrentTitle(const QString &dirName, const QString &fullPath);
85 bool setCurrentDirectory(const QString &directory);
86 void openItem(const QModelIndex &srcIndex);
87 QModelIndex currentItem() const;
88 QString currentDirectory() const;
90 QListView *m_listView;
91 QFileSystemModel *m_fileSystemModel;
92 QSortFilterProxyModel *m_filterModel;
97 class FolderNavigationWidgetFactory : public Core::INavigationWidgetFactory
101 FolderNavigationWidgetFactory();
102 ~FolderNavigationWidgetFactory();
104 QString displayName() const;
106 QKeySequence activationSequence() const;
107 Core::NavigationView createWidget();
110 } // namespace Internal
111 } // namespace ProjectExplorer
113 #endif // FOLDERNAVIGATIONWIDGET_H