| 95 | } |
| 96 | |
| 97 | void OutputPagePrivate::validate() |
| 98 | { |
| 99 | QStringList invalidFiles; |
| 100 | for(QHash< QString, KUrlRequester* >::const_iterator it = outputFiles.constBegin(); |
| 101 | it != outputFiles.constEnd(); ++it) |
| 102 | { |
| 103 | if (!it.value()->url().isValid()) { |
| 104 | invalidFiles << it.key(); |
| 105 | } else if (it.value()->url().isLocalFile() && !QFileInfo(it.value()->url().adjusted(QUrl::RemoveFilename).toLocalFile()).isWritable()) { |
| 106 | invalidFiles << it.key(); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | bool valid = invalidFiles.isEmpty(); |
| 111 | if (valid) { |
| 112 | output->messageWidget->animatedHide(); |
| 113 | } else { |
| 114 | std::sort(invalidFiles.begin(), invalidFiles.end()); |
| 115 | output->messageWidget->setMessageType(KMessageWidget::Error); |
| 116 | output->messageWidget->setCloseButtonVisible(false); |
| 117 | output->messageWidget->setText(i18np("Invalid output file: %2", "Invalid output files: %2", invalidFiles.count(), invalidFiles.join(QLatin1String(", ")))); |
| 118 | output->messageWidget->animatedShow(); |
| 119 | } |
| 120 | emit page->isValid(valid); |
| 121 | } |
| 122 | |
| 123 | OutputPage::OutputPage(QWidget* parent) |
| 124 | : QWidget(parent) |
no test coverage detected