Remoto - VFS: fileSelectField Class Reference
Remoto - VFS

The fileSelectField class adds a file selector to a form. More...

#include <fileSelectField.h>

Inheritance diagram for fileSelectField:
VFS_form_field

Public Member Functions

 fileSelectField (QJsonValue v, QString label="", QString tip="")
 
void setAllowed (QString allowed)
 Set the file types that are selectable. More...
 
void setBasePath (QString base)
 The base path is hidden from the user, and represents the top level that can be navigated. More...
 
void setMProtocol (bool p, QString base)
 Enable or disable mProtocol. More...
 
void setSourceOrDestination (QString sd)
 A fileSelectField can choose a destination path, or a source file or folder. More...
 
void setWhat (QString what)
 A fileSelectField can be used to select files or directories. More...
 
- Public Member Functions inherited from VFS_form_field
 VFS_form_field (QJsonValue val, QString type, QString label="", QString tip="")
 
 VFS_form_field (QString type)
 
void clearOption (QString o)
 Clear/remove a widget option. More...
 
int getIndex ()
 Get the field index. More...
 
QString getLabel ()
 Return the label. More...
 
void setAllowEmpty (bool e)
 Validate this field against empty-ness. More...
 
void setEnabled (bool e)
 Enable or disable this field. More...
 
void setHidden (bool e)
 Keep the field, but hide it when rendering. More...
 
void setHideLabel (bool l)
 Hide the label for this field. More...
 
void setIndex (int i)
 Set the field index for this widget. More...
 
void setLabel (QString l, bool replace=true)
 Set the label. More...
 
void setOption (QString o, QJsonValue v)
 Set a widget option. More...
 
void setSpellcheck (bool s)
 Enable or disable spellchecking on this text field. More...
 
void setTip (QString t)
 Set the tooltip. More...
 
void setValue (QJsonValue val)
 Set the value. More...
 

Static Public Attributes

static QString DESTINATION = "destination"
 used for the setSourceOrDestination command More...
 
static QString DIRECTORY = "directory"
 used for the setWhat command More...
 
static QString FILE = "file"
 used for the setWhat command More...
 
static QString SOURCE = "source"
 used for the setSourceOrDestination command More...
 

Additional Inherited Members

- Protected Attributes inherited from VFS_form_field
QJsonObject options
 Options for any widget type... this is an arbitrary list. More...
 

Detailed Description

The fileSelectField class adds a file selector to a form.

The files in the file browser correspond to VFS entries, not necessarily the underlying file system.

Definition at line 6 of file fileSelectField.h.

Constructor & Destructor Documentation

◆ fileSelectField()

fileSelectField::fileSelectField ( QJsonValue  t,
QString  label = "",
QString  tip = "" 
)
explicit
Parameters
tThe initial path value
labelThe label
tipThe tooltip

Note that the widget type is set to "stdlib:js/widgets/widgets/fileSelectWidget.js", which will use the VFS_stdlib library to load the selector widget.

See also
VFS_stdlib

Definition at line 27 of file fileSelectField.cpp.

Member Function Documentation

◆ setAllowed()

void fileSelectField::setAllowed ( QString  allowed)

Set the file types that are selectable.

Parameters
allowedA regex string, which must be javascript compliant

Definition at line 74 of file fileSelectField.cpp.

◆ setBasePath()

void fileSelectField::setBasePath ( QString  base)

The base path is hidden from the user, and represents the top level that can be navigated.

Parameters
baseThe root of this selector

It can be useful to force a user to select a file under a certain location, or to prevent them from navigating out of a specified area.

Definition at line 40 of file fileSelectField.cpp.

◆ setMProtocol()

void fileSelectField::setMProtocol ( bool  p,
QString  mbase 
)

Enable or disable mProtocol.

Parameters
penable or disable
mbaseThe filesystem base on the user's local system

mProtocol will make a link on this field allowing a user to open, for instance, a Photoshop file on their local system using a locally-installed application. This requires remoto:// protocol handlers to be installed, and requires the VFS path to be translatable to a local filesystem path.

Definition at line 89 of file fileSelectField.cpp.

◆ setSourceOrDestination()

void fileSelectField::setSourceOrDestination ( QString  sd)

A fileSelectField can choose a destination path, or a source file or folder.

Parameters
sdsource or destination?

Although not enforced, this should be either fileSelectField::SOURCE or fileSelectField::DESTINATION

Definition at line 64 of file fileSelectField.cpp.

◆ setWhat()

void fileSelectField::setWhat ( QString  what)

A fileSelectField can be used to select files or directories.

Parameters
whatwhat is being selected

Although not enforced, this should be set to either fileSelectField::FILE or fileSelectField::DIRECTORY

Definition at line 52 of file fileSelectField.cpp.

Member Data Documentation

◆ DESTINATION

QString fileSelectField::DESTINATION = "destination"
static

used for the setSourceOrDestination command

Definition at line 20 of file fileSelectField.h.

◆ DIRECTORY

QString fileSelectField::DIRECTORY = "directory"
static

used for the setWhat command

Definition at line 18 of file fileSelectField.h.

◆ FILE

QString fileSelectField::FILE = "file"
static

used for the setWhat command

Definition at line 17 of file fileSelectField.h.

◆ SOURCE

QString fileSelectField::SOURCE = "source"
static

used for the setSourceOrDestination command

Definition at line 19 of file fileSelectField.h.


The documentation for this class was generated from the following files: