Changeset View
Changeset View
Standalone View
Standalone View
man/kio_man.cpp
Show All 12 Lines | 553 | { | |||
---|---|---|---|---|---|
559 | } | 559 | } | ||
560 | 560 | | |||
561 | lastdir = filename.left(filename.lastIndexOf('/')); | 561 | lastdir = filename.left(filename.lastIndexOf('/')); | ||
562 | 562 | | |||
563 | if ( !QFile::exists(QFile::decodeName(filename)) ) // if given file does not exist, find with suffix | 563 | if ( !QFile::exists(QFile::decodeName(filename)) ) // if given file does not exist, find with suffix | ||
564 | { | 564 | { | ||
565 | qCDebug(KIO_MAN_LOG) << "not existing " << filename; | 565 | qCDebug(KIO_MAN_LOG) << "not existing " << filename; | ||
566 | QDir mandir(lastdir); | 566 | QDir mandir(lastdir); | ||
567 | mandir.setNameFilters(QStringList() << (filename.mid(filename.lastIndexOf('/') + 1) + ".*")); | 567 | const QString nameFilter = filename.mid(filename.lastIndexOf('/') + 1) + ".*"; | ||
568 | filename = lastdir + '/' + QFile::encodeName(mandir.entryList().first()); | 568 | mandir.setNameFilters(QStringList(nameFilter)); | ||
569 | | ||||
570 | const QStringList entries = mandir.entryList(); | ||||
apol: mark `const`. | |||||
571 | if (entries.isEmpty()) | ||||
572 | { | ||||
573 | outputError(i18n("The specified man page referenced another page '%1',<br />" | ||||
574 | "but the referenced page '%2' could not be found.", | ||||
575 | QFile::decodeName(filename), | ||||
576 | QDir::cleanPath(lastdir + '/' + nameFilter))); | ||||
577 | return 0; | ||||
578 | } | ||||
579 | | ||||
580 | filename = lastdir + '/' + QFile::encodeName(entries.first()); | ||||
569 | qCDebug(KIO_MAN_LOG) << "resolved to " << filename; | 581 | qCDebug(KIO_MAN_LOG) << "resolved to " << filename; | ||
570 | } | 582 | } | ||
571 | 583 | | |||
572 | QIODevice *fd = KFilterDev::deviceForFile(filename); | 584 | QIODevice *fd = KFilterDev::deviceForFile(filename); | ||
573 | 585 | | |||
574 | if ( !fd || !fd->open(QIODevice::ReadOnly)) | 586 | if ( !fd || !fd->open(QIODevice::ReadOnly)) | ||
575 | { | 587 | { | ||
576 | delete fd; | 588 | delete fd; | ||
Show All 12 Lines |
mark const.