Commit 7742e14a authored by Burak Hancerli's avatar Burak Hancerli 🍻 Committed by Carl Schwan
Browse files

Fix small issues in "Saving and Loading" example

There were a couple of inconsistencies between the example code and the
sub-sections where the code is explained line by line.
parent fd4793a6
...@@ -131,7 +131,7 @@ void MainWindow::saveFileAs() ...@@ -131,7 +131,7 @@ void MainWindow::saveFileAs()
void MainWindow::saveFile() void MainWindow::saveFile()
{ {
if(!fileName.isEmpty()) { if(!fileName.isEmpty()) {
saveFileAs(fileName); saveFileToDisk(fileName);
} else { } else {
saveFileAs(); saveFileAs();
} }
...@@ -155,13 +155,13 @@ Here we use the [QUrl](https://doc.qt.io/qt-5/qurl.html) class to handle files f ...@@ -155,13 +155,13 @@ Here we use the [QUrl](https://doc.qt.io/qt-5/qurl.html) class to handle files f
Then we use the KIO library to retrieve our file. This allows us to open the file normally even if it's stored in a remote location like an FTP site. We make the following call to the [KIO::storedGet](docs:kio;KIO::storedGet) function with an argument for the file you wish to open or download: Then we use the KIO library to retrieve our file. This allows us to open the file normally even if it's stored in a remote location like an FTP site. We make the following call to the [KIO::storedGet](docs:kio;KIO::storedGet) function with an argument for the file you wish to open or download:
```c++ ```c++
const KIO::Job *job = KIO::storedGet(fileNameFromDialog); KIO::Job *job = KIO::storedGet(fileNameFromDialog);
``` ```
The function returns a handle to a [KIO::Job](docs:kio;KIO::Job), which we first connect to our `downloadFinished()` slot before "running" the job. The function returns a handle to a [KIO::Job](docs:kio;KIO::Job), which we first connect to our `downloadFinished()` slot before "running" the job.
```c++ ```c++
connect(job, &KJob::result, this, &KJob::downloadFinished); connect(job, &KJob::result, this, &MainWindow::downloadFinished);
job->exec(); job->exec();
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment