Part 2/2 of prior commit

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1175772 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 6eb49d190a
commit 3b07f92513

@ -539,6 +539,18 @@ bool TypesListItem::isEssential() const
return true;
if ( n == "application/x-desktop" )
return true;
if ( n == "media/builtin-mydocuments" )
return true;
if ( n == "media/builtin-mycomputer" )
return true;
if ( n == "media/builtin-mynetworkplaces" )
return true;
if ( n == "media/builtin-printers" )
return true;
if ( n == "media/builtin-trash" )
return true;
if ( n == "media/builtin-webbrowser" )
return true;
return false;
}

@ -203,7 +203,7 @@
<!-- m_enableMedia=config->readBoolEntry("enabled",false); -->
</entry>
<entry key="exclude" type="String">
<default>media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted</default>
<default>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</default>
<label>Device Types to exclude</label>
<whatsthis>The device types which you do not want to see on the desktop.</whatsthis>
<!-- kdiconview.cc:261 -->

@ -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 <dont care> 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"))

@ -93,9 +93,9 @@ ContainerArea::ContainerArea(KConfig* _c,
setBackgroundOrigin( WidgetOrigin );
m_contents = viewport();
m_layout = new ContainerAreaLayout(m_contents);
// Install an event filter to propagate layout hints coming from m_contents.
m_contents->installEventFilter(this);
@ -404,14 +404,14 @@ void ContainerArea::removeAllContainers()
void ContainerArea::configure()
{
setBackground();
for (BaseContainer::Iterator it = m_containers.begin();
it != m_containers.end();
++it)
{
(*it)->configure();
}
resizeContents();
}
@ -1277,12 +1277,12 @@ void ContainerArea::dropEvent(TQDropEvent *ev)
}
a = new ServiceMenuButtonContainer(relPath, m_opMenu, m_contents);
}
else if (url.isLocalFile())
else if (url.isLocalFile())
{
TQFileInfo fi(url.path());
if (fi.isDir())
if (fi.isDir())
{ // directory
switch (PanelDirDropMenu().exec(mapToGlobal(ev->pos())))
switch (PanelDirDropMenu().exec(mapToGlobal(ev->pos())))
{
case PanelDirDropMenu::Browser:
a = new BrowserButtonContainer(url.path(), m_opMenu,
@ -1294,7 +1294,14 @@ void ContainerArea::dropEvent(TQDropEvent *ev)
default: ;
}
}
else if ( KMimeType::findByURL(url)->name() == "application/x-desktop" )
TQString foundMimeName = KMimeType::findByURL(url)->name();
else if ( (foundMimeName == "application/x-desktop")
|| (foundMimeName == "media/builtin-mydocuments")
|| (foundMimeName == "media/builtin-mycomputer")
|| (foundMimeName == "media/builtin-mynetworkplaces")
|| (foundMimeName == "media/builtin-printers")
|| (foundMimeName == "media/builtin-trash")
|| (foundMimeName == "media/builtin-webbrowser") )
{
// a local desktop file being dragged from an external program.
// Make a copy first.
@ -1675,7 +1682,7 @@ void ContainerArea::setPosition(KPanelExtension::Position p)
resizeContents(width(), 0);
}
}
for (BaseContainer::ConstIterator it = m_containers.constBegin();
it != m_containers.constEnd();
++it)
@ -1689,7 +1696,7 @@ void ContainerArea::setPosition(KPanelExtension::Position p)
}
m_layout->setEnabled(true);
setContentsPos(0, 0);
m_contents->move(0, 0);
setBackground();
@ -1918,7 +1925,7 @@ int ContainerArea::heightForWidth(int w) const
DragIndicator::DragIndicator(TQWidget* parent, const char* name)
: TQWidget(parent, name)
: TQWidget(parent, name)
{
setBackgroundOrigin(AncestorOrigin);
}

@ -26,7 +26,8 @@ mimetype_DATA = floppy_mounted.desktop floppy_unmounted.desktop \
blankdvd.desktop \
svcd.desktop \
vcd.desktop\
gphoto2camera.desktop camera_mounted.desktop camera_unmounted.desktop
gphoto2camera.desktop camera_mounted.desktop camera_unmounted.desktop \
mydocuments.desktop mycomputer.desktop mynetworkplaces.desktop printers.desktop trash.desktop webbrowser.desktop
EXTRA_DIST = $(mimetype_DATA)

@ -0,0 +1,8 @@
[Desktop Entry]
Icon=system
Type=MimeType
MimeType=media/builtin-mycomputer
Comment=My Computer
Patterns=My Computer
X-KDE-AutoEmbed=false

@ -0,0 +1,8 @@
[Desktop Entry]
Icon=folder_wordprocessing
Type=MimeType
MimeType=media/builtin-mydocuments
Comment=My Documents
Patterns=My Documents
X-KDE-AutoEmbed=false

@ -0,0 +1,8 @@
[Desktop Entry]
Icon=network
Type=MimeType
MimeType=media/builtin-mynetworkplaces
Comment=My Network Places
Patterns=My Network Places
X-KDE-AutoEmbed=false

@ -0,0 +1,8 @@
[Desktop Entry]
Icon=kjobviewer
Type=MimeType
MimeType=media/builtin-printers
Comment=Printers
Patterns=Printers
X-KDE-AutoEmbed=false

@ -0,0 +1,9 @@
[Desktop Entry]
Icon=trashcan_full
EmptyIcon=trashcan_empty
Type=MimeType
MimeType=media/builtin-trash
Comment=Trash
Patterns=Trash
X-KDE-AutoEmbed=false

@ -0,0 +1,8 @@
[Desktop Entry]
Icon=konqueror
Type=MimeType
MimeType=media/builtin-webbrowser
Comment=Web Browser
Patterns=Web Browser
X-KDE-AutoEmbed=false

@ -680,7 +680,14 @@ void KonqSidebarTree::scanDir( KonqSidebarTreeItem *parent, const TQString &path
TQString filePath = TQString( *eIt ).prepend( path );
KURL u;
u.setPath( filePath );
if ( KMimeType::findByURL( u, 0, true )->name() == "application/x-desktop" )
TQString foundMimeName = KMimeType::findByURL( u, 0, true )->name();
if ( (foundMimeName == "application/x-desktop")
|| (foundMimeName == "media/builtin-mydocuments")
|| (foundMimeName == "media/builtin-mycomputer")
|| (foundMimeName == "media/builtin-mynetworkplaces")
|| (foundMimeName == "media/builtin-printers")
|| (foundMimeName == "media/builtin-trash")
|| (foundMimeName == "media/builtin-webbrowser") )
loadTopLevelItem( parent, filePath );
}

@ -417,7 +417,13 @@ void KonqOperations::asyncDrop( const KFileItem * destItem )
delete this;
return;
}
if ( destItem->mimetype() == "application/x-desktop")
if ( (destItem->mimetype() == "application/x-desktop")
|| (destItem->mimetype() == "media/builtin-mydocuments")
|| (destItem->mimetype() == "media/builtin-mycomputer")
|| (destItem->mimetype() == "media/builtin-mynetworkplaces")
|| (destItem->mimetype() == "media/builtin-printers")
|| (destItem->mimetype() == "media/builtin-trash")
|| (destItem->mimetype() == "media/builtin-webbrowser") )
{
// Local .desktop file. What type ?
KDesktopFile desktopFile( m_destURL.path() );

@ -424,7 +424,13 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
//kdDebug(1203) << "View path is " << url.url() << endl;
//kdDebug(1203) << "First popup path is " << firstPopupURL.url() << endl;
currentDir = firstPopupURL.equals( url, true /* ignore_trailing */ );
if ( isLocal && m_sMimeType == "application/x-desktop" ) {
if ( isLocal && ((m_sMimeType == "application/x-desktop")
|| (m_sMimeType == "media/builtin-mydocuments")
|| (m_sMimeType == "media/builtin-mycomputer")
|| (m_sMimeType == "media/builtin-mynetworkplaces")
|| (m_sMimeType == "media/builtin-printers")
|| (m_sMimeType == "media/builtin-trash")
|| (m_sMimeType == "media/builtin-webbrowser")) ) {
KSimpleConfig cfg( firstPopupURL.path(), true );
cfg.setDesktopGroup();
isTrashLink = ( cfg.readEntry("Type") == "Link" && cfg.readEntry("URL") == "trash:/" );
@ -629,7 +635,13 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
}
// 1 - Look for builtin and user-defined services
if ( m_sMimeType == "application/x-desktop" && isSingleLocal ) // .desktop file
if ( ((m_sMimeType == "application/x-desktop")
|| (m_sMimeType == "media/builtin-mydocuments")
|| (m_sMimeType == "media/builtin-mycomputer")
|| (m_sMimeType == "media/builtin-mynetworkplaces")
|| (m_sMimeType == "media/builtin-printers")
|| (m_sMimeType == "media/builtin-trash")
|| (m_sMimeType == "media/builtin-webbrowser")) && isSingleLocal ) // .desktop file
{
// get builtin services, like mount/unmount
s.builtin = KDEDesktopMimeType::builtinServices( urlForServiceMenu );

Loading…
Cancel
Save