| 221 | } |
| 222 | |
| 223 | void 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 | |
| 258 | void ProjectSourcePage::locationChanged() |
| 259 | { |
nothing calls this directly
no test coverage detected