generic: remove redudndant kdelnk checks

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-21 20:13:10 +00:00
parent 6459097c59
commit d147517cd5
4 changed files with 4 additions and 15 deletions

View file

@ -633,9 +633,6 @@ KService::Ptr KService::serviceByStorageId( const QString& _storageId )
if (tmp.endsWith(QLatin1String(".desktop")))
tmp.truncate(tmp.length()-8);
if (tmp.endsWith(QLatin1String(".kdelnk")))
tmp.truncate(tmp.length()-7);
service = KService::serviceByDesktopName(tmp);
return service;

View file

@ -236,7 +236,6 @@ void KMimeTypeTest::testFindByPathUsingFileName_data()
QTest::newRow("case-sensitive-only match") << "Core" << "application/octet-stream"; // #198477
QTest::newRow("desktop file") << "foo.desktop" << "application/x-desktop";
QTest::newRow("old kdelnk file is x-desktop too") << "foo.kdelnk" << "application/x-desktop";
QTest::newRow("double-extension file") << "foo.tar.bz2" << "application/x-bzip-compressed-tar";
QTest::newRow("single-extension file") << "foo.bz2" << "application/x-bzip";
QTest::newRow(".doc should assume msword") << "somefile.doc" << "application/msword"; // #204139

View file

@ -596,11 +596,8 @@ void KNewFileMenuPrivate::fillMenu()
{
KNewFileMenuSingleton::Entry& entry = *templ;
if (entry.entryType != KNewFileMenuSingleton::Separator) {
// There might be a .desktop for that one already, if it's a kdelnk
// This assumes we read .desktop files before .kdelnk files ...
// In fact, we skip any second item that has the same text as another one.
// Duplicates in a menu look bad in any case.
// There might be a .desktop for that one already. In fact, we skip any second item
// that has the same text as another one. Duplicates in a menu look bad in any case.
const bool bSkip = seenTexts.contains(entry.text);
if (bSkip) {

View file

@ -140,11 +140,8 @@ static QString nameFromFileName(QString nameStr)
{
if ( nameStr.endsWith(QLatin1String(".desktop")) )
nameStr.truncate( nameStr.length() - 8 );
if ( nameStr.endsWith(QLatin1String(".kdelnk")) )
nameStr.truncate( nameStr.length() - 7 );
// Make it human-readable (%2F => '/', ...)
nameStr = KIO::decodeFileName( nameStr );
return nameStr;
return KIO::decodeFileName( nameStr );
}
mode_t KFilePermissionsPropsPlugin::fperm[3][4] = {
@ -1282,8 +1279,7 @@ void KFilePropsPlugin::applyChanges()
KUrl oldurl = properties->kurl();
QString newFileName = KIO::encodeFileName(n);
if (d->bDesktopFile && !newFileName.endsWith(QLatin1String(".desktop")) &&
!newFileName.endsWith(QLatin1String(".kdelnk")))
if (d->bDesktopFile && !newFileName.endsWith(QLatin1String(".desktop")))
newFileName += ".desktop";
// Tell properties. Warning, this changes the result of properties->kurl() !