| 117 | } |
| 118 | |
| 119 | void Worker::executeDeferredOperations() { |
| 120 | if (d->deferredOperations.empty()) { |
| 121 | qDebug() << "No deferred operations to execute"; |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | std::cout << "Executing deferred operations" << std::endl; |
| 126 | |
| 127 | auto outputMutex = std::make_shared<QMutex>(); |
| 128 | |
| 129 | while (!d->deferredOperations.empty()) { |
| 130 | auto operation = d->deferredOperations.front(); |
| 131 | d->deferredOperations.pop_front(); |
| 132 | QThreadPool::globalInstance()->start(new PrivateData::OperationTask(operation, outputMutex)); |
| 133 | } |
| 134 | |
| 135 | // wait until all AppImages have been integrated |
| 136 | QThreadPool::globalInstance()->waitForDone(); |
| 137 | |
| 138 | std::cout << "Cleaning up old desktop integration files" << std::endl; |
| 139 | if (!cleanUpOldDesktopIntegrationResources(true)) { |
| 140 | std::cout << "Failed to clean up old desktop integration files" << std::endl; |
| 141 | } |
| 142 | |
| 143 | // make sure the icons in the launcher are refreshed |
| 144 | std::cout << "Updating desktop database and icon caches" << std::endl; |
| 145 | if (!updateDesktopDatabaseAndIconCaches()) |
| 146 | std::cout << "Failed to update desktop database and icon caches" << std::endl; |
| 147 | |
| 148 | std::cout << "Done" << std::endl; |
| 149 | } |
| 150 | |
| 151 | void Worker::scheduleForIntegration(const QString& path) { |
| 152 | auto operation = std::make_pair(path, INTEGRATE); |
no test coverage detected