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/kdesktop.kcfg | 2 +- kdesktop/kdiconview.cc | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 4 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/kdesktop.kcfg b/kdesktop/kdesktop.kcfg index 739e40e16..b0dd4f003 100644 --- a/kdesktop/kdesktop.kcfg +++ b/kdesktop/kdesktop.kcfg @@ -203,7 +203,7 @@ - media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted + media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted,media/builtin-mydocuments,media/builtin-mycomputer,media/builtin-mynetworkplaces,media/builtin-printers,media/builtin-trash,media/builtin-webbrowser The device types which you do not want to see on the desktop. 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