From 3b07f92513f03772805943cf9ee77921f7c8aafe Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 15 Sep 2010 21:18:46 +0000 Subject: Part 2/2 of prior commit git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1175772 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/kdiconview.cc | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 3 deletions(-) (limited to 'kdesktop/kdiconview.cc') diff --git a/kdesktop/kdiconview.cc b/kdesktop/kdiconview.cc index 5762458fd..75e8d10a7 100644 --- a/kdesktop/kdiconview.cc +++ b/kdesktop/kdiconview.cc @@ -485,7 +485,7 @@ void KDIconView::setAutoAlign( bool b ) // Auto line-up icons if ( b ) { - if (!KRootWm::self()->startup) lineupIcons(); else KRootWm::self()->startup = false; + if (!KRootWm::self()->startup) lineupIcons(); else KRootWm::self()->startup = false; connect( this, TQT_SIGNAL( iconMoved() ), this, TQT_SLOT( lineupIcons() ) ); } @@ -759,6 +759,55 @@ bool KDIconView::deleteGlobalDesktopFiles() continue; // Not a .desktop file } + // Ignore these special files + // Name URL Type OnlyShowIn + // My Documents $HOME/Documents Link KDE; + // My Computer media:/ Link KDE; + // My Network Places remote:/ Link KDE; + // Printers [exec] kjobviewer --all --show %i %m Application KDE; + // Trash trash:/ Link KDE; + // Web Browser Application KDE; + + if ( isDesktopFile(fItem) ) { + KSimpleConfig cfg( fItem->url().path(), true ); + cfg.setDesktopGroup(); + if ( cfg.readEntry( "Type" ) == "Link" && + cfg.readEntry( "URL" ) == "$HOME/Documents" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "My Documents" ) { + continue; + } + if ( cfg.readEntry( "Type" ) == "Link" && + cfg.readEntry( "URL" ) == "media:/" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "My Computer" ) { + continue; + } + if ( cfg.readEntry( "Type" ) == "Link" && + cfg.readEntry( "URL" ) == "remote:/" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "My Network Places" ) { + continue; + } + if ( cfg.readEntry( "Type" ) == "Application" && + cfg.readEntry( "Exec" ) == "kjobviewer --all --show %i %m" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "Printers" ) { + continue; + } + if ( cfg.readEntry( "Type" ) == "Link" && + cfg.readEntry( "URL" ) == "trash:/" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "Trash" ) { + continue; + } + if ( cfg.readEntry( "Type" ) == "Application" && + cfg.readEntry( "OnlyShowIn" ) == "KDE;" && + cfg.readEntry( "Name" ) == "Web Browser" ) { + continue; + } + } + KDesktopFile df(desktopPath + fItem->url().fileName()); df.writeEntry("Hidden", true); df.sync(); @@ -868,7 +917,13 @@ bool KDIconView::isDesktopFile( KFileItem * _item ) const return false; // return true if desktop file - return ( _item->mimetype() == TQString::fromLatin1("application/x-desktop") ); + return ( (_item->mimetype() == TQString::fromLatin1("application/x-desktop")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-mydocuments")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-mycomputer")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-mynetworkplaces")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-printers")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-trash")) + || (_item->mimetype() == TQString::fromLatin1("media/builtin-webbrowser")) ); } TQString KDIconView::stripDesktopExtension( const TQString & text ) @@ -1277,7 +1332,13 @@ void KDIconView::slotItemRenamed(TQIconViewItem* _item, const TQString &name) KMimeType::Ptr type = KMimeType::findByURL( fileItem->item()->url() ); bool bDesktopFile = false; - if (type->name() == "application/x-desktop") + if ( (type->name() == "application/x-desktop") + || (type->name() == "media/builtin-mydocuments") + || (type->name() == "media/builtin-mycomputer") + || (type->name() == "media/builtin-mynetworkplaces") + || (type->name() == "media/builtin-printers") + || (type->name() == "media/builtin-trash") + || (type->name() == "media/builtin-webbrowser") ) { bDesktopFile = true; if (!newName.endsWith(".desktop")) -- cgit v1.2.1