MCPcopy Create free account
hub / github.com/KDE/kdevelop / validateSelection

Method validateSelection

plugins/debuggercommon/dialogs/selectcoredialog.cpp:38–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void SelectCoreDialog::validateSelection()
39{
40 const auto reportError = [this](const QString& errorMessage) {
41 m_ui.selectionValidWidget->setText(errorMessage);
42 m_ui.selectionValidWidget->animatedShow();
43 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
44 };
45
46 // an empty executable is acceptable
47 if (const auto executableUrl = executableFile(); !executableUrl.isEmpty()) {
48 if (!executableUrl.isValid()) {
49 reportError(i18n("Invalid executable file name"));
50 return;
51 }
52
53 const QFileInfo executableInfo(executableUrl.toLocalFile());
54 if (!executableInfo.exists()) {
55 reportError(i18n("Executable file does not exist"));
56 return;
57 }
58 if (!executableInfo.isFile()) {
59 reportError(i18n("Executable is not a file"));
60 return;
61 }
62 if (!executableInfo.isReadable()) {
63 reportError(i18n("Executable file is not readable"));
64 return;
65 }
66 }
67
68 const auto coreUrl = core();
69 if (coreUrl.isEmpty()) {
70 reportError(i18n("Empty core file name"));
71 return;
72 }
73 if (!coreUrl.isValid()) {
74 reportError(i18n("Invalid core file name"));
75 return;
76 }
77
78 const QFileInfo coreInfo(coreUrl.toLocalFile());
79 if (!coreInfo.exists()) {
80 reportError(i18n("Core file does not exist"));
81 return;
82 }
83 if (!coreInfo.isFile()) {
84 reportError(i18n("Core is not a file"));
85 return;
86 }
87 if (!coreInfo.isReadable()) {
88 reportError(i18n("Core file is not readable"));
89 return;
90 }
91
92 m_ui.selectionValidWidget->animatedHide();
93 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
94}
95

Callers

nothing calls this directly

Calls 8

buttonMethod · 0.80
toLocalFileMethod · 0.80
existsMethod · 0.80
isReadableMethod · 0.80
setTextMethod · 0.45
setEnabledMethod · 0.45
isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected