forked from clue/reactphp-zenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02-file.php
More file actions
30 lines (22 loc) · 914 Bytes
/
02-file.php
File metadata and controls
30 lines (22 loc) · 914 Bytes
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
<?php
use React\EventLoop\Factory;
use Clue\React\Zenity\Launcher;
use Clue\React\Zenity\Dialog\FileSelectionDialog;
use Clue\React\Zenity\Builder;
use Clue\React\Zenity\Dialog\InfoDialog;
require __DIR__ . '/../vendor/autoload.php';
$loop = Factory::create();
$launcher = new Launcher($loop);
$builder = new Builder();
$launcher->launch($builder->fileSelection())->then(function (SplFileInfo $file) use ($launcher) {
var_dump($file);
$launcher->launch(new InfoDialog('Selected "' . $file->getFilename() . '". Re-opening dialog with same selection'))->then(function () use ($file, $launcher) {
$selection = new FileSelectionDialog();
$selection->setFilename($file);
$selection->setTitle('Pretend we\'re overwriting the file');
$selection->setConfirmOverwrite(true);
$selection->setSave(true);
$launcher->launch($selection);
});
});
$loop->run();