| 337 | } |
| 338 | |
| 339 | AuthProfile* DialogConnect::StartDialog() |
| 340 | { |
| 341 | toConnect = false; |
| 342 | exec(); |
| 343 | if (!toConnect) |
| 344 | return nullptr; |
| 345 | |
| 346 | QString projectDir = lineEdit_ProjectDir->text().trimmed(); |
| 347 | if (projectDir.isEmpty()) |
| 348 | projectDir = defaultProjectDir(lineEdit_Project->text()); |
| 349 | |
| 350 | QString host, port, endpoint; |
| 351 | parseUrl(host, port, endpoint); |
| 352 | |
| 353 | auto* newProfile = new AuthProfile(lineEdit_Project->text(), lineEdit_User->text(), lineEdit_Password->text(), host, port, endpoint, projectDir); |
| 354 | |
| 355 | QStringList selectedSubs; |
| 356 | for (int i = 0; i < dataListWidget->count(); ++i) { |
| 357 | auto *item = dataListWidget->item(i); |
| 358 | if (item && item->data(Qt::UserRole).toBool()) |
| 359 | continue; |
| 360 | if (item->checkState() == Qt::Checked) |
| 361 | selectedSubs.append(item->text()); |
| 362 | } |
| 363 | for (int i = 0; i < agentListWidget->count(); ++i) { |
| 364 | auto *item = agentListWidget->item(i); |
| 365 | if (item && item->data(Qt::UserRole).toBool()) |
| 366 | continue; |
| 367 | if (item->checkState() == Qt::Checked) |
| 368 | selectedSubs.append(item->text()); |
| 369 | } |
| 370 | |
| 371 | auto agentsOnlyActiveCheck = subsPopupDialog ? subsPopupDialog->findChild<QCheckBox*>("agentsOnlyActiveCheck") : nullptr; |
| 372 | if (agentsOnlyActiveCheck && agentsOnlyActiveCheck->isChecked()) |
| 373 | selectedSubs.append("agents_only_active"); |
| 374 | |
| 375 | auto tasksOnlyJobsCheck = subsPopupDialog ? subsPopupDialog->findChild<QCheckBox*>("tasksOnlyJobsCheck") : nullptr; |
| 376 | if (tasksOnlyJobsCheck && tasksOnlyJobsCheck->isChecked()) |
| 377 | selectedSubs.append("tasks_only_jobs"); |
| 378 | |
| 379 | newProfile->SetSubscriptions(selectedSubs); |
| 380 | newProfile->SetRegisteredCategories(selectedSubs); |
| 381 | |
| 382 | updateSubsDisplay(); |
| 383 | newProfile->SetConsoleMultiuser(multiuserCheck->isChecked()); |
| 384 | |
| 385 | if (GlobalClient->storage->ExistsProject(lineEdit_Project->text())) |
| 386 | GlobalClient->storage->UpdateProject(*newProfile); |
| 387 | else |
| 388 | GlobalClient->storage->AddProject(*newProfile); |
| 389 | |
| 390 | return newProfile; |
| 391 | } |
| 392 | |
| 393 | void DialogConnect::updateSubsDisplay() |
| 394 | { |
nothing calls this directly
no test coverage detected