QStringList KRecentDocument::recentDocuments() { QDir d(recentDocumentDirectory(), QStringLiteral("*.desktop"), QDir::Time, QDir::Files | QDir::Readable | QDir::Hidden); if (!d.exists()) { d.mkdir(recentDocumentDirectory()); } const QStringList list = d.entryList(); QStringList fullList; for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { QString fileName = *it; QString pathDesktop; if (fileName.startsWith(QLatin1String(":"))) { // See: https://bugreports.qt.io/browse/QTBUG-11223 pathDesktop = KRecentDocument::recentDocumentDirectory() + *it; } else { pathDesktop = d.absoluteFilePath(*it); } KDesktopFile tmpDesktopFile(pathDesktop); QUrl urlDesktopFile(tmpDesktopFile.desktopGroup().readPathEntry("URL", QString())); if (urlDesktopFile.isLocalFile() && !QFile(urlDesktopFile.toLocalFile()).exists()) { d.remove(pathDesktop); } else { fullList.append(pathDesktop); } } return fullList; }
TQStringList TDERecentDocument::recentDocuments() { TQDir d(recentDocumentDirectory(), "*.desktop", TQDir::Time, TQDir::Files | TQDir::Readable | TQDir::Hidden); if (!d.exists()) d.mkdir(recentDocumentDirectory()); TQStringList list = d.entryList(); TQStringList fullList; for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { TQString pathDesktop = d.absFilePath( *it ); KDesktopFile tmpDesktopFile( pathDesktop, false); KURL urlDesktopFile(tmpDesktopFile.readURL()); if( urlDesktopFile.isLocalFile() && !TQFile(urlDesktopFile.path()).exists()) d.remove(pathDesktop); else fullList.append( pathDesktop ); } return fullList; }