| 783 | } |
| 784 | |
| 785 | void Updater::applyAction(Action action, const QVector<File> &files) |
| 786 | { |
| 787 | for (const auto &file : files) { |
| 788 | LTRACE() << "applyAction" << int(action) << file.rawPath; |
| 789 | |
| 790 | if (action == Action::Remove) { |
| 791 | Installer installer; |
| 792 | installer.remove(file); |
| 793 | if (!installer.error().isEmpty()) { |
| 794 | emit error(installer.error()); |
| 795 | continue; |
| 796 | } |
| 797 | model_->updateStates(); |
| 798 | emit updated(); |
| 799 | continue; |
| 800 | } |
| 801 | |
| 802 | if (action == Action::Install) { |
| 803 | if (file.urls.isEmpty() || findDownload(file.urls.first()) != -1) |
| 804 | continue; |
| 805 | |
| 806 | Installer installer; |
| 807 | installer.checkInstall(file); |
| 808 | |
| 809 | if (!installer.error().isEmpty()) { |
| 810 | emit error(installer.error()); |
| 811 | continue; |
| 812 | } |
| 813 | |
| 814 | downloading_.push_back(file); |
| 815 | loader_->download(file.urls); |
| 816 | continue; |
| 817 | } |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | void Updater::downloaded(const QUrl &url, const QByteArray &data) |
| 822 | { |
no test coverage detected