1 /**************************************************************************
2 ** This file is part of LiteIDE
3 **
4 ** Copyright (c) 2011-2019 LiteIDE. All rights reserved.
5 **
6 ** This library is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU Lesser General Public
8 ** License as published by the Free Software Foundation; either
9 ** version 2.1 of the License, or (at your option) any later version.
10 **
11 ** This library is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ** Lesser General Public License for more details.
15 **
16 ** In addition, as a special exception,  that plugins developed for LiteIDE,
17 ** are allowed to remain closed sourced and can be distributed under any license .
18 ** These rights are included in the file LGPL_EXCEPTION.txt in this package.
19 **
20 **************************************************************************/
21 // Module: basefoldeview.h
22 // Creator: visualfc <visualfc@gmail.com>
23 
24 #ifndef BASEFOLDERVIEW_H
25 #define BASEFOLDERVIEW_H
26 
27 #include "liteapi/liteapi.h"
28 #include "symboltreeview/symboltreeview.h"
29 #include <QTreeView>
30 
31 class BaseFolderView : public SymbolTreeView
32 {
33     Q_OBJECT
34 public:
35     explicit BaseFolderView(LiteApi::IApplication *app,QWidget *parent = 0);
36     QDir contextDir() const;
37     QFileInfo contextFileInfo() const;
38     bool canMoveToTrash() const;
39 signals:
40     void aboutToShowContextMenu(QMenu *menu, LiteApi::FILESYSTEM_CONTEXT_FLAG flag, const QFileInfo &info);
41 public slots:
42     virtual void openBundle();
43     virtual void openInNewWindow();
44     virtual void openEditor();
45     virtual void newFile();
46     virtual void newFileWizard();
47     virtual void renameFile();
48     virtual void removeFile();
49     virtual void newFolder();
50     virtual void renameFolder();
51     virtual void removeFolder();
52     virtual void openShell();
53     virtual void openExplorer();
54     virtual void openTerminal();
55     virtual void openFolder();
56     virtual void closeFolder();
57     virtual void reloadFolder();
58     virtual void closeAllFolders();
59     virtual void copyFile();
60     virtual void pasteFile();
61     virtual bool canPasteFile();
62     virtual void copyFullPathToClipboard();
63     virtual void moveToTrash();
64     virtual QMenu *openWithMenu();
65     void openWithEditor();
66     void openWithSystemEditor();
67 public:
68     virtual QModelIndex findIndexForContext(const QString &filePath) const;
69     virtual void removeIndex(const QModelIndex &index);
70     virtual QFileInfo fileInfo(const QModelIndex &index) const;
71 protected:
72     virtual QModelIndexList selectionCopyOrRemoveList() const;
73 protected:
74     LiteApi::IApplication *m_liteApp;
75     QFileInfo m_contextInfo;
76     QModelIndex m_contextIndex;
77     QAction *m_openInNewWindowAct;
78     QAction *m_openEditorAct;
79     QAction *m_newFileAct;
80     QAction *m_newFileWizardAct;
81     QAction *m_removeFileAct;
82     QAction *m_renameFileAct;
83     QAction *m_newFolderAct;
84     QAction *m_removeFolderAct;
85     QAction *m_renameFolderAct;
86     QAction *m_openShellAct;
87     QAction *m_openTerminalAct;
88     QAction *m_openExplorerAct;
89     QAction *m_openFolderAct;
90     QAction *m_closeFolderAct;
91     QAction *m_reloadFolderAct;
92     QAction *m_closeAllFoldersAct;
93     QAction *m_openBundleAct;
94     QAction *m_copyFileAct;
95     QAction *m_pasteFileAct;
96     QAction *m_copyFullPathToClipboardAct;
97     QAction *m_moveToTrashAct;
98     QMenu *m_openWithMenu;
99     bool copy_dir(const QString &src, const QString &dest_root, const QString &newName);
100 };
101 
102 #endif // BASEFOLDERVIEW_H
103