-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilenavigator.h
92 lines (68 loc) · 2.93 KB
/
filenavigator.h
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
91
92
#ifndef FILENAVIGATOR_H
#define FILENAVIGATOR_H
#include <QLineEdit>
#include <QKeyEvent>
#include <QFocusEvent>
#include <QString>
#include <QStringList>
class FileNavigator : public QLineEdit
{
Q_OBJECT
private:
QString directory ;
QString tempdirectory ;
QStringList folders ;
QStringList files ;
QStringList backups ;
bool nofilename ;
bool selectnew, isbackup ;
int selection, folderindex, fileindex, backupindex ;
QString backupFolderPath, folderPath, encBackupFilePath, backupFilePath, editableFilePath, encFilePath, filePath, fileName ;
QString& parseBackupDate(QString backupdate) ;
void loadFolders(QString directory) ;
void loadFiles(QString directory, QString mask1);
void loadBackups(QString directory, QString mask1) ;
void keyPressEvent(QKeyEvent *event) ;
private slots:
void on_cursorPositionChanged(int from, int to) ;
public:
explicit FileNavigator(QWidget *parent = 0);
~FileNavigator() ;
// Sets and Returns the path to the database
void setPath(QString directory) ;
QString& getPath() ;
// Sets the folder / filename
// If not specified, the current folder/filename is used, and
// an appropriate refresh is performed.
void setFilename(QString folder=QString(""), QString filename=QString(""), QString backup=QString("")) ;
void setFilenameFromPath(QString path) ;
void clearFilename() ;
// Return the path to the specified folder
// if not supplied, the currently selected folder path is returned
QString& getFolderPath(QString foldername = QString("")) ; // Returns the path to the folder (defaults selected)
// Return the filen path and pretty version
// If the filename is supplied, that one is returned, otherwise
// the currently selected file path / name is returned
QString& getFilePath(QString filename = QString(""), bool preferbackups=false) ; // Returns the path to the file (defaults selected)
QString& getEditableFilePath(QString filename = QString("")) ;
QString& getFileDescription(bool includefolder=true, bool includebackupdate=false) ; // Returns the pretty version of the selected filename
// Return the temp and backup folder and file paths
QString& getTempFolderPath() ;
QString& getBackupFolderPath() ; // Returns the path to the backup file
QString& getBackupFilePath(bool create = true) ; // Returns path to new backup file, or latest one if create=false
// Returns status of current selection
bool isRenameFolder() ;
bool isDeleteFolder() ;
bool isCreateFolder() ;
bool isCreateEncryptedFolder() ;
bool isCreateFile() ;
bool isBackup() ;
// Return whether the folder or the file/backup is encrypted or not
bool isFolderEncrypted() ;
bool isFileEncrypted() ;
// TODO: should be able to make this private
void update(int cursorpos=-1) ;
signals:
public slots:
};
#endif // FILENAVIGATOR_H