Provides functionality to check the file or directory existance and permissions.
More...
#include <SUIT_FileValidator.h>
Provides functionality to check the file or directory existance and permissions.
- See also
- SUIT_FileDlg class
◆ SUIT_FileValidator()
SUIT_FileValidator::SUIT_FileValidator |
( |
QWidget * |
parent = 0 | ) |
|
Constructor.
- Parameters
-
parent | parent widget (used as parent when displaying information message boxes) |
◆ ~SUIT_FileValidator()
virtual SUIT_FileValidator::~SUIT_FileValidator |
( |
| ) |
|
|
inlinevirtual |
◆ canOpen()
bool SUIT_FileValidator::canOpen |
( |
const QString & |
fileName, |
|
|
bool |
checkPermission = true |
|
) |
| |
|
virtual |
Check if the specified file exists and (optionally) can be read.
If file does not exists or can not be read (if checkPermission is true
) and parent() is not null, shows error message box.
- Parameters
-
fileName | file path |
checkPermission | if true (default) check also file permissions |
- Returns
false
if file does not exist or if it does not have read permissions (if checkPermission is true
)
References SUIT_MessageBox::critical(), and parent().
◆ canReadDir()
bool SUIT_FileValidator::canReadDir |
( |
const QString & |
dirName, |
|
|
bool |
checkPermission = true |
|
) |
| |
|
virtual |
Check if the specified directory exists and (optionally) can be read.
If directory does not exists or can not be read (if checkPermission is true
) and parent() is not null, shows error message box.
- Parameters
-
dirName | directory path |
checkPermission | if true (default) check also directory permissions |
- Returns
false
if directory does not exist or if it does not have read permissions (if checkPermission is true
)
References SUIT_MessageBox::critical(), and parent().
◆ canSave()
bool SUIT_FileValidator::canSave |
( |
const QString & |
fileName, |
|
|
bool |
checkPermission = true |
|
) |
| |
|
virtual |
Check if the specified file can be written.
If file already exists and parent() is not null, prompts question message box to the user to confirm file overwriting.
If file can not be written (if checkPermission is true
) and parent() is not null, shows error message box.
- Parameters
-
fileName | file path |
checkPermission | if true (default) check also file permissions |
- Returns
false
if file exists and user rejects file overwriting or if file does not have write permissions (if checkPermission is true
)
Reimplemented in LightApp_PyFileValidator.
References SUIT_MessageBox::critical(), Qtx::dir(), myParent, parent(), and SUIT_MessageBox::question().
◆ canWriteDir()
bool SUIT_FileValidator::canWriteDir |
( |
const QString & |
dirName, |
|
|
bool |
checkPermission = true |
|
) |
| |
|
virtual |
Check if the specified directory can be written.
If directory does not exists or can not be modified (if checkPermission is true
) and parent() is not null, shows error message box.
- Parameters
-
dirName | directory path |
checkPermission | if true (default) check also directory permissions |
- Returns
false
if directory does not exist or if it does not have write permissions (if checkPermission is true
)
References SUIT_MessageBox::critical(), and parent().
◆ parent()
QWidget * SUIT_FileValidator::parent |
( |
| ) |
const |
Get parent widget.
- Returns
- parent widget
References myParent.
◆ myParent
QWidget* SUIT_FileValidator::myParent |
|
private |
The documentation for this class was generated from the following files: