TargetDirectoryPage Class | Qt Installer Framework Manual

Qt Installer Framework Manual | TargetDirectoryPage

# TargetDirectoryPage Class

(QInstaller::TargetDirectoryPage)

The TargetDirectoryPage class specifies the target directory for the installation. More...

Header: | #include <TargetDirectoryPage>
Inherits: | QInstaller::PackageManagerPage

- List of all members, including inherited members

## Public Functions

| TargetDirectoryPage(PackageManagerCore *core)
void | initializePage()
void | setTargetDir(const QString &dirName)
QString | targetDir() const
bool | validatePage()

## Reimplemented Public Functions

virtual bool | isComplete() const

- 14 public functions inherited from QInstaller::PackageManagerPage

## Reimplemented Protected Functions

virtual void | entering()
virtual void | leaving()

- 6 protected functions inherited from QInstaller::PackageManagerPage

### Additional Inherited Members

- 2 signals inherited from QInstaller::PackageManagerPage
- 6 protected functions inherited from QInstaller::PackageManagerPage

## Detailed Description

The TargetDirectoryPage class specifies the target directory for the installation.

End users can leave the page to continue the installation only if certain criteria are fulfilled. Some of them are checked in the validatePage() function, some in the targetDirWarning() function:

- No empty path given as target.
- No relative path given as target.
- Only ASCII characters are allowed in the path if the <AllowNonAsciiCharacters> element in the configuration file is set to `false`.
- The following ambiguous characters are not allowed in the path: ["~<>|?*!@#$%^&:,;]
- No root or home directory given as target.
- On Windows, path names must be less than 260 characters long.
- No spaces in the path if the <AllowSpaceInPath> element in the configuration file is set to `false`.

## Member Function Documentation

### TargetDirectoryPage::TargetDirectoryPage(PackageManagerCore *core)

Constructs a target directory selection page with core as parent.

### `[virtual protected]` void TargetDirectoryPage::entering()

Reimplemented from PackageManagerPage::entering().

Initializes the page's fields based on values from fields on previous pages.

### void TargetDirectoryPage::initializePage()

Initializes the page.

### `[virtual]` bool TargetDirectoryPage::isComplete() const

Reimplemented from PackageManagerPage::isComplete().

Requests a warning message to be shown to end users upon invalid input. If the input is valid, the Next button is enabled.

Returns `true` if a valid path to the target directory is set; otherwise returns `false`.

### `[virtual protected]` void TargetDirectoryPage::leaving()

Reimplemented from PackageManagerPage::leaving().

Called when end users leave the page and the PackageManagerGui:currentPageChanged() signal is triggered.

### void TargetDirectoryPage::setTargetDir(const QString &dirName)

Sets the directory specified by dirName as the target directory for the installation.

See also targetDir().

### QString TargetDirectoryPage::targetDir() const

Returns the target directory for the installation.

See also setTargetDir().

### bool TargetDirectoryPage::validatePage()

Checks whether the target directory exists and has contents:

- Returns `true` if the directory exists and is empty.
- Returns `false` if the directory already exists and contains an installation.
- Returns `false` if the target is a file or a symbolic link.
- Returns `true` or `false` if the directory exists but is not empty, depending on the choice that the end users make in the displayed message box.