summaryrefslogtreecommitdiffstats
path: root/kio
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-07-14 16:27:09 -0500
committerSlávek Banko <slavek.banko@axis.cz>2015-12-23 02:22:44 +0100
commit9a335db701c9170e20284c5d62404b4bb5f49a37 (patch)
treef2ebdef424bff0956a179423bc0da1de94466bf6 /kio
parent146b36680e3c2985a0f5df0a587b55487c737f99 (diff)
downloadtdelibs-9a335db701c9170e20284c5d62404b4bb5f49a37.tar.gz
tdelibs-9a335db701c9170e20284c5d62404b4bb5f49a37.zip
Display correct icon and icon widget type in Properties dialog of media device nodes
This relates to Bug 1612 (cherry picked from commit 5a3c9e46415b103f33ccd5b848eadfb0f8b50d3d)
Diffstat (limited to 'kio')
-rw-r--r--kio/kfile/kpropertiesdialog.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/kio/kfile/kpropertiesdialog.cpp b/kio/kfile/kpropertiesdialog.cpp
index 6b3adaed1..f3a20ab88 100644
--- a/kio/kfile/kpropertiesdialog.cpp
+++ b/kio/kfile/kpropertiesdialog.cpp
@@ -738,6 +738,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
TQString filename = TQString::null;
bool isTrash = false;
bool isDevice = false;
+ bool isMediaNode = false;
m_bFromTemplate = false;
// And those only to 'multiple' mode
@@ -761,13 +762,19 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
TQString path;
if ( !m_bFromTemplate ) {
isTrash = ( properties->kurl().protocol().find( "trash", 0, false)==0 );
- if ( properties->kurl().protocol().find("device", 0, false)==0)
- isDevice = true;
+ if ( properties->kurl().protocol().find("device", 0, false)==0) {
+ isDevice = true;
+ }
+ if (d->mimeType.startsWith("media/")) {
+ isMediaNode = true;
+ }
// Extract the full name, but without file: for local files
- if ( isReallyLocal )
+ if ( isReallyLocal ) {
path = properties->kurl().path();
- else
+ }
+ else {
path = properties->kurl().prettyURL();
+ }
} else {
path = properties->currentDir().path(1) + properties->defaultName();
directory = properties->currentDir().prettyURL();
@@ -857,7 +864,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
directory += ')';
}
- if ( !isDevice && !isTrash && (bDesktopFile || S_ISDIR(mode)) && !d->bMultiple /*not implemented for multiple*/ )
+ if ( !isDevice && !isMediaNode && !isTrash && (bDesktopFile || S_ISDIR(mode)) && !d->bMultiple /*not implemented for multiple*/ )
{
KIconButton *iconButton = new KIconButton( d->m_frame );
int bsize = 66 + 2 * iconButton->style().pixelMetric(TQStyle::PM_ButtonMargin);
@@ -867,17 +874,20 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
// This works for everything except Device icons on unmounted devices
// So we have to really open .desktop files
TQString iconStr = KMimeType::findByURL( url, mode )->icon( url, isLocal );
- if ( bDesktopFile && isLocal )
- {
+ if ( bDesktopFile && isLocal ) {
KDesktopFile config( url.path(), true );
config.setDesktopGroup();
iconStr = config.readEntry( "Icon" );
- if ( config.hasDeviceType() )
+ if ( config.hasDeviceType() ) {
iconButton->setIconType( KIcon::Desktop, KIcon::Device );
- else
+ }
+ else {
iconButton->setIconType( KIcon::Desktop, KIcon::Application );
- } else
+ }
+ }
+ else {
iconButton->setIconType( KIcon::Desktop, KIcon::FileSystem );
+ }
iconButton->setIcon(iconStr);
iconArea = iconButton;
connect( iconButton, TQT_SIGNAL( iconChanged(TQString) ),
@@ -886,12 +896,19 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
TQLabel *iconLabel = new TQLabel( d->m_frame );
int bsize = 66 + 2 * iconLabel->style().pixelMetric(TQStyle::PM_ButtonMargin);
iconLabel->setFixedSize(bsize, bsize);
- iconLabel->setPixmap( KGlobal::iconLoader()->loadIcon( iconStr, KIcon::Desktop, 48) );
+ if (isMediaNode) {
+ // Display the correct device icon
+ iconLabel->setPixmap( KGlobal::iconLoader()->loadIcon( item->iconName(), KIcon::Desktop, 48) );
+ }
+ else {
+ // Display the generic folder icon
+ iconLabel->setPixmap( KGlobal::iconLoader()->loadIcon( iconStr, KIcon::Desktop, 48) );
+ }
iconArea = iconLabel;
}
grid->addWidget(iconArea, curRow, 0, Qt::AlignLeft);
- if (d->bMultiple || isTrash || isDevice || hasRoot)
+ if (d->bMultiple || isTrash || isDevice || isMediaNode || hasRoot)
{
TQLabel *lab = new TQLabel(d->m_frame );
if ( d->bMultiple )
@@ -929,7 +946,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
++curRow;
TQLabel *l;
- if ( !mimeComment.isEmpty() && !isDevice && !isTrash)
+ if ( !mimeComment.isEmpty() && !isDevice && !isMediaNode && !isTrash)
{
l = new TQLabel(i18n("Type:"), d->m_frame );