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

Method reevaluateCorrection

kdevplatform/shell/projectsourcepage.cpp:223–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void ProjectSourcePage::reevaluateCorrection()
224{
225 //TODO: Probably we should just ignore remote URL's, I don't think we're ever going
226 //to support checking out to remote directories
227 const QUrl cwd = m_ui->workingDir->url();
228 const QDir dir = cwd.toLocalFile();
229
230 // case where we import a project from local file system
231 if (m_ui->sources->currentIndex() == FROM_FILESYSTEM_SOURCE_INDEX) {
232 emit isCorrect(dir.exists());
233 return;
234 }
235
236 // all other cases where remote locations need to be specified
237 bool correct=!cwd.isRelative() && (!cwd.isLocalFile() || QDir(cwd.adjusted(QUrl::RemoveFilename).toLocalFile()).exists());
238 emit isCorrect(correct && m_ui->creationProgress->value() == m_ui->creationProgress->maximum());
239
240 const bool validWidget = ((m_locationWidget && m_locationWidget->isCorrect()) ||
241 (m_providerWidget && m_providerWidget->isCorrect()));
242 const bool isFolderEmpty = (correct && cwd.isLocalFile() && dir.exists() && dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot).isEmpty());
243 const bool validToCheckout = correct && validWidget && (!dir.exists() || isFolderEmpty);
244
245 m_ui->get->setEnabled(validToCheckout);
246 m_ui->creationProgress->setEnabled(validToCheckout);
247
248 if(!correct)
249 setStatus(i18n("You need to specify a valid or nonexistent directory to check out a project"));
250 else if(!m_ui->get->isEnabled() && m_ui->workingDir->isEnabled() && !validWidget)
251 setStatus(i18n("You need to specify the source for your remote project"));
252 else if(!m_ui->get->isEnabled() && m_ui->workingDir->isEnabled() && !isFolderEmpty)
253 setStatus(i18n("You need to specify an empty folder as your project destination"));
254 else
255 clearStatus();
256}
257
258void ProjectSourcePage::locationChanged()
259{

Callers

nothing calls this directly

Calls 11

toLocalFileMethod · 0.80
existsMethod · 0.80
isLocalFileMethod · 0.80
QDirClass · 0.50
urlMethod · 0.45
currentIndexMethod · 0.45
valueMethod · 0.45
isCorrectMethod · 0.45
isEmptyMethod · 0.45
setEnabledMethod · 0.45
isEnabledMethod · 0.45

Tested by

no test coverage detected