//queries (such as file exists, wrong password) on a new line, but
//freeze waiting for input. So we check for errors on the last line in
//all cases.
- // TODO: QLatin1String() might not be the best choice here.
- // The call to handleLine() at the end of the method uses
- // QString::fromLocal8Bit(), for example.
// TODO: The same check methods are called in handleLine(), this
// is suboptimal.
bool foundErrorMessage =
- (checkForErrorMessage(QLatin1String( lines.last() ), WrongPasswordPatterns) ||
- checkForErrorMessage(QLatin1String( lines.last() ), ExtractionFailedPatterns) ||
- checkForPasswordPromptMessage(QLatin1String(lines.last())) ||
- checkForFileExistsMessage(QLatin1String( lines.last() )));
+ (checkForErrorMessage(QString::fromLocal8Bit( lines.last() ), WrongPasswordPatterns) ||
+ checkForErrorMessage(QString::fromLocal8Bit( lines.last() ), ExtractionFailedPatterns) ||
+ checkForPasswordPromptMessage(QString::fromLocal8Bit(lines.last())) ||
+ checkForFileExistsMessage(QString::fromLocal8Bit( lines.last() )));
if (foundErrorMessage) {
handleAll = true;
i18nc("@title:window", "Cannot Preview File"),
KGuiItem(i18nc("@action:button", "Preview as Text"), KIcon(QLatin1String("text-plain"))),
KStandardGuiItem::cancel(),
- QString(QLatin1String("PreviewAsText_%1")).arg(mimeType->name()));
+ QString::fromLatin1("PreviewAsText_%1").arg(mimeType->name()));
}
else {
// No defined MIME type, or the default application/octet-stream.
KVBox *headerRight = new KVBox(header);
headerLayout->addWidget(headerRight);
- new QLabel(QString(QLatin1String( "<qt><b>%1</b></qt>" ))
+ new QLabel(QString::fromLatin1( "<qt><b>%1</b></qt>" )
.arg(fileUrl.fileName()), headerRight
);
new QLabel(mimeType->comment(), headerRight);
}
// Try to get a read-only kpart for the internal viewer
- KService::List offers = KMimeTypeTrader::self()->query(mimeType->name(), QString::fromLatin1("KParts/ReadOnlyPart"));
+ KService::List offers = KMimeTypeTrader::self()->query(mimeType->name(), QLatin1String("KParts/ReadOnlyPart"));
// If we can't find a kpart, try to get an external application
if (offers.size() == 0) {
- offers = KMimeTypeTrader::self()->query(mimeType->name(), QString::fromLatin1("Application"));
+ offers = KMimeTypeTrader::self()->query(mimeType->name(), QLatin1String("Application"));
}
if (offers.size() > 0) {
if (result != ARCHIVE_EOF) {
emit error(i18nc("@info", "The archive reading failed with the following error: <message>%1</message>",
- QLatin1String( archive_error_string(arch_reader.data()))));
+ QString::fromAscii( archive_error_string(arch_reader.data()))));
return false;
}
if (ret != ARCHIVE_OK) {
emit error(i18nc("@info", "Setting the compression method failed with the following error: <message>%1</message>",
- QLatin1String(archive_error_string(arch_writer.data()))));
+ QString::fromAscii(archive_error_string(arch_writer.data()))));
return false;
}
}
break;
default:
- emit error(i18n("The compression type '%1' is not supported by Ark.", QLatin1String(archive_filter_name(arch_reader.data(), 0))));
+ emit error(i18n("The compression type '%1' is not supported by Ark.", QString::fromAscii(archive_filter_name(arch_reader.data(), 0))));
return false;
}
if (ret != ARCHIVE_OK) {
- emit error(i18nc("@info", "Setting the compression method failed with the following error: <message>%1</message>", QLatin1String(archive_error_string(arch_writer.data()))));
+ emit error(i18nc("@info", "Setting the compression method failed with the following error: <message>%1</message>", QString::fromAscii(archive_error_string(arch_writer.data()))));
return false;
}
}
ret = archive_write_open_filename(arch_writer.data(), QFile::encodeName(tempFilename));
if (ret != ARCHIVE_OK) {
- emit error(i18nc("@info", "Opening the archive for writing failed with the following error: <message>%1</message>", QLatin1String(archive_error_string(arch_writer.data()))));
+ emit error(i18nc("@info", "Opening the archive for writing failed with the following error: <message>%1</message>", QString::fromAscii(archive_error_string(arch_writer.data()))));
return false;
}
}
break;
default:
- emit error(i18n("The compression type '%1' is not supported by Ark.", QLatin1String(archive_filter_name(arch_reader.data(), 0))));
+ emit error(i18n("The compression type '%1' is not supported by Ark.", QString::fromAscii(archive_filter_name(arch_reader.data(), 0))));
return false;
}
if (ret != ARCHIVE_OK) {
- emit error(i18nc("@info", "Setting the compression method failed with the following error: <message>%1</message>", QLatin1String(archive_error_string(arch_writer.data()))));
+ emit error(i18nc("@info", "Setting the compression method failed with the following error: <message>%1</message>", QString::fromAscii(archive_error_string(arch_writer.data()))));
return false;
}
ret = archive_write_open_filename(arch_writer.data(), QFile::encodeName(tempFilename));
if (ret != ARCHIVE_OK) {
- emit error(i18nc("@info", "Opening the archive for writing failed with the following error: <message>%1</message>", QLatin1String(archive_error_string(arch_writer.data()))));
+ emit error(i18nc("@info", "Opening the archive for writing failed with the following error: <message>%1</message>", QString::fromAscii(archive_error_string(arch_writer.data()))));
return false;
}
e[IsDirectory] = S_ISDIR(archive_entry_mode(aentry));
if (archive_entry_symlink(aentry)) {
- e[Link] = QLatin1String( archive_entry_symlink(aentry) );
+ e[Link] = QString::fromAscii( archive_entry_symlink(aentry) );
}
e[Timestamp] = QDateTime::fromTime_t(archive_entry_mtime(aentry));