mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-08 06:00:59 -07:00
Use QSaveFile wherever applicable
expected.hpp was fetched from:
b803e3c07b/include/nonstd/expected.hpp
This commit is contained in:
parent
81139c0098
commit
21f72baae2
17 changed files with 2597 additions and 88 deletions
|
@ -49,6 +49,7 @@
|
|||
#include "base/rss/rss_session.h"
|
||||
#include "base/utils/compare.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "gui/autoexpandabledialog.h"
|
||||
#include "gui/torrentcategorydialog.h"
|
||||
|
@ -452,12 +453,12 @@ void AutomatedRssDownloader::on_exportBtn_clicked()
|
|||
path += EXT_LEGACY;
|
||||
}
|
||||
|
||||
const QByteArray rules {RSS::AutoDownloader::instance()->exportRules(format)};
|
||||
QFile file {path};
|
||||
if (!file.open(QFile::WriteOnly) || (file.write(rules) != rules.length()))
|
||||
const QByteArray rules = RSS::AutoDownloader::instance()->exportRules(format);
|
||||
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(path, rules);
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(this, tr("I/O Error")
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(file.errorString()));
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(result.error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue