2 // C++ Implementation: mediadevicepluginmanager
7 // Authors: Jeff Mitchell <kde-dev@emailgoeshere.com>, (C) 2005, 2006
8 // Martin Aumueller <aumuell@reserv.at>, (C) 2006
10 // Copyright: See COPYING file that comes with this distribution
13 #include "MediaDevicePluginManager.h"
17 #include "deviceconfiguredialog.h"
18 #include "hintlineedit.h"
19 #include "mediabrowser.h"
20 #include "MediaDeviceCache.h"
21 #include "plugin/pluginconfig.h"
22 #include "pluginmanager.h"
23 #include "ContextStatusBar.h"
25 #include <KApplication>
28 #include <KIconLoader>
31 #include <KPushButton>
33 #include <Solid/Device>
37 #include <QHeaderView>
39 #include <QMessageBox>
40 #include <QTextDocument>
41 #include <QTableWidget>
45 MediaDevicePluginManagerDialog::MediaDevicePluginManagerDialog()
46 : KDialog( Amarok::mainWindow() )
47 , m_genericDevices( 0 )
53 setObjectName( "mediadevicepluginmanagerdialog" );
55 setButtons( Ok
| Cancel
);
56 setDefaultButton( Ok
);
58 kapp
->setTopWidget( this );
59 setCaption( KDialog::makeStandardCaption( i18n( "Manage Devices and Plugins" ) ) );
61 KVBox
*vbox
= new KVBox( this );
62 setMainWidget( vbox
);
64 vbox
->setSpacing( KDialog::spacingHint() );
65 vbox
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Expanding
) );
67 m_location
= new QGroupBox( i18n( "Devices" ), vbox
);
68 m_location
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Preferred
) );
69 m_devicesBox
= new KVBox( m_location
);
70 m_devicesBox
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Expanding
) );
72 m_manager
= new MediaDevicePluginManager( m_devicesBox
);
74 KHBox
*hbox
= new KHBox( vbox
);
75 m_genericDevices
= new KPushButton( i18n( "Generic Devices and Volumes..." ), hbox
);
76 m_genericDevices
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Fixed
) );
77 connect( m_genericDevices
, SIGNAL( clicked() ), m_manager
, SLOT( slotGenericVolumes() ) );
79 m_addButton
= new KPushButton( i18n( "Add Device..." ), hbox
);
80 m_addButton
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Fixed
) );
81 connect( m_addButton
, SIGNAL( clicked() ), m_manager
, SLOT( slowNewDevice() ) );
82 connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
85 MediaDevicePluginManagerDialog::~MediaDevicePluginManagerDialog()
87 disconnect( m_genericDevices
, SIGNAL( clicked() ), m_manager
, SLOT( slotGenericVolumes() ) );
88 disconnect( m_addButton
, SIGNAL( clicked() ), m_manager
, SLOT( slotNewDevice() ) );
93 MediaDevicePluginManagerDialog::slotOk()
95 m_manager
->finished();
96 disconnect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
99 MediaDevicePluginManager::MediaDevicePluginManager( QWidget
*widget
)
104 connect( this, SIGNAL( selectedPlugin( const QString
&, const QString
& ) ), MediaBrowser::instance(), SLOT( pluginSelected( const QString
&, const QString
& ) ) );
105 connect( MediaDeviceCache::instance(), SIGNAL( deviceAdded(const QString
&) ), this, SLOT( slotSolidDeviceAdded(const QString
&) ) );
106 connect( MediaDeviceCache::instance(), SIGNAL( deviceRemoved(const QString
&) ), this, SLOT( slotSolidDeviceRemoved(const QString
&) ) );
109 MediaDevicePluginManager::~MediaDevicePluginManager()
111 foreach( MediaDeviceConfig
* mdc
, m_deviceList
)
112 disconnect( mdc
, SIGNAL(deleteDevice(const QString
&)), this, SLOT(slotDeleteDevice(const QString
&)) );
113 disconnect( this, SIGNAL( selectedPlugin( const QString
&, const QString
& ) ), MediaBrowser::instance(), SLOT( pluginSelected( const QString
&, const QString
& ) ) );
114 disconnect( MediaDeviceCache::instance(), SIGNAL( deviceAdded(const QString
&) ), this, SLOT( slotSolidDeviceAdded(const QString
&) ) );
115 disconnect( MediaDeviceCache::instance(), SIGNAL( deviceRemoved(const QString
&) ), this, SLOT( slotSolidDeviceRemoved(const QString
&) ) );
119 MediaDevicePluginManager::slotGenericVolumes()
121 MediaDeviceVolumeMarkerDialog
*mdvmd
= new MediaDeviceVolumeMarkerDialog();
128 MediaDevicePluginManager::detectDevices()
131 bool foundNew
= false;
132 KConfigGroup config
= Amarok::config( "PortableDevices" );
133 MediaDeviceCache::instance()->refreshCache();
134 QStringList udiList
= MediaDeviceCache::instance()->getAll();
135 foreach( const QString
&udi
, udiList
)
137 debug() << "Checking device udi " << udi
;
139 bool skipflag
= false;
141 foreach( MediaDeviceConfig
* mediadevice
, m_deviceList
)
143 if( udi
== mediadevice
->udi() )
146 debug() << "skipping: already listed";
147 //TODO: Handle case where no longer has .is_audio_player
154 if( MediaDeviceCache::instance()->deviceType( udi
) == MediaDeviceCache::SolidVolumeType
&&
155 !MediaDeviceCache::instance()->isGenericEnabled( udi
) )
157 debug() << "Device generic but not enabled, skipping.";
162 MediaDeviceConfig
*dev
= new MediaDeviceConfig( udi
, m_widget
);
163 m_deviceList
.append( dev
);
164 connect( dev
, SIGNAL(deleteDevice(const QString
&)), this, SLOT(slotDeleteDevice(const QString
&)) );
173 MediaDevicePluginManager::slotSolidDeviceAdded( const QString
&udi
)
175 foreach( MediaDeviceConfig
* mediadevice
, m_deviceList
)
177 if( udi
== mediadevice
->udi() )
179 debug() << "skipping: already listed";
183 int deviceType
= MediaDeviceCache::instance()->deviceType( udi
);
184 if( deviceType
== MediaDeviceCache::SolidPMPType
||
185 ( deviceType
== MediaDeviceCache::SolidVolumeType
&&
186 MediaDeviceCache::instance()->isGenericEnabled( udi
) ) )
188 MediaDeviceConfig
*dev
= new MediaDeviceConfig( udi
, m_widget
);
189 m_deviceList
.append( dev
);
190 connect( dev
, SIGNAL(deleteDevice(const QString
&)), this, SLOT(slotDeleteDevice(const QString
&)) );
194 debug() << "device wasn't PMP, or was volume but not enabled" << endl
;
199 MediaDevicePluginManager::slotSolidDeviceRemoved( const QString
&udi
)
202 debug() << "Trying to remove udi " << udi
;
203 for( int i
= 0; i
< m_deviceList
.size(); ++i
)
205 if( i
< m_deviceList
.size() && m_deviceList
[i
] && m_deviceList
[i
]->udi() == udi
)
207 MediaDeviceConfig
* config
= m_deviceList
[i
];
208 m_deviceList
.removeAt( i
);
216 MediaDevicePluginManager::slotDeleteDevice( const QString
&udi
)
220 while( i
< m_deviceList
.size() )
222 if( m_deviceList
[i
]->udi() == udi
)
224 debug() << "putting device " << udi
<< " on deleted map";
225 m_deletedMap
[udi
] = m_deviceList
[i
];
226 m_deviceList
.removeAt( i
);
234 MediaDevicePluginManager::finished()
237 foreach( MediaDeviceConfig
* device
, m_deviceList
)
239 int deviceType
= MediaDeviceCache::instance()->deviceType( device
->udi() );
240 if( deviceType
== MediaDeviceCache::SolidPMPType
|| deviceType
== MediaDeviceCache::SolidVolumeType
)
242 debug() << "checking device " << device
->udi();
243 debug() << "plugin = " << device
->plugin();
244 debug() << "oldPlugin = " << device
->oldPlugin();
245 device
->setOldPlugin( device
->plugin() );
246 emit
selectedPlugin( device
->udi(), device
->plugin() );
249 KConfigGroup config
= Amarok::config( "PortableDevices" );
250 foreach( const QString
&udi
, m_deletedMap
.keys() )
252 config
.deleteEntry( udi
);
253 MediaBrowser::instance()->deviceRemoved( udi
);
255 MediaDeviceCache::instance()->refreshCache();
256 m_deletedMap
.clear();
260 MediaDevicePluginManager::slotNewDevice()
263 ManualDeviceAdder
* mda
= new ManualDeviceAdder();
264 int accepted
= mda
->exec();
265 if( accepted
== QDialog::Accepted
&& mda
->successful() )
267 if( !Amarok::config( "PortableDevices" ).readEntry( mda
->getId(), QString() ).isNull() )
269 //abort! Can't have the same device defined twice...should never
270 //happen due to name checking earlier...right?
271 Amarok::ContextStatusBar::instance()->longMessageThreadSafe( i18n("Sorry, you cannot define two devices\n"
272 "with the same name and mountpoint!") );
276 Amarok::config( "PortableDevices" ).writeEntry( mda
->getId(), mda
->getPlugin() );
277 MediaDeviceCache::instance()->refreshCache();
284 /////////////////////////////////////////////////////////////////////
286 ManualDeviceAdder::ManualDeviceAdder()
287 : KDialog( Amarok::mainWindow() )
289 setObjectName( "manualdeviceadder" );
291 setButtons( Ok
| Cancel
);
292 setDefaultButton( Ok
);
295 m_successful
= false;
298 kapp
->setTopWidget( this );
299 setCaption( KDialog::makeStandardCaption( i18n( "Add New Device") ) );
301 KHBox
* hbox
= new KHBox( this );
302 setMainWidget( hbox
);
303 hbox
->setSpacing( KDialog::spacingHint() );
305 KVBox
* vbox1
= new KVBox( hbox
);
307 new QLabel( i18n( "Select the plugin to use with this device:"), vbox1
);
308 m_mdaCombo
= new KComboBox( false, vbox1
);
309 m_mdaCombo
->setObjectName( "m_mdacombo" );
310 for( KService::List::ConstIterator it
= MediaBrowser::instance()->getPlugins().begin();
311 it
!= MediaBrowser::instance()->getPlugins().end();
313 m_mdaCombo
->addItem( (*it
)->name() );
314 if( m_mdaCombo
->count() > 0 )
315 m_selectedPlugin
= MediaBrowser::instance()->getInternalPluginName( m_mdaCombo
->itemText( 0 ) );
317 new QLabel( "", vbox1
);
318 QLabel
* nameLabel
= new QLabel( vbox1
);
319 nameLabel
->setText( i18n( "Enter a &name for this device (required):" ) );
320 m_mdaName
= new HintLineEdit( QString(), vbox1
);
321 nameLabel
->setBuddy( m_mdaName
);
322 m_mdaName
->setHint( i18n( "Example: My_Ipod" ) );
323 m_mdaName
->setToolTip( i18n( "Enter a name for the device. The name must be unique across all manually added devices. It must not contain the pipe ( | ) character." ) );
325 new QLabel( "", vbox1
);
326 QLabel
* mpLabel
= new QLabel( vbox1
);
327 mpLabel
->setText( i18n( "Enter the &mount point of the device, if applicable:" ) );
328 m_mdaMountPoint
= new HintLineEdit( QString(), vbox1
);
329 mpLabel
->setBuddy( m_mdaMountPoint
);
330 m_mdaMountPoint
->setHint( i18n( "Example: /mnt/ipod" ) );
331 m_mdaMountPoint
->setToolTip( i18n( "Enter the device's mount point. Some devices (such as MTP devices) may not have a mount point and this can be ignored. All other devices (iPods, UMS/VFAT devices) should enter the mount point here." ) );
333 connect( m_mdaCombo
, SIGNAL( activated(const QString
&) ), this, SLOT( slotComboChanged(const QString
&) ) );
336 ManualDeviceAdder::~ManualDeviceAdder()
338 disconnect( m_mdaCombo
, SIGNAL( activated(const QString
&) ), this, SLOT( slotComboChanged(const QString
&) ) );
341 delete m_mdaMountPoint
;
345 ManualDeviceAdder::slotButtonClicked( int button
)
348 if( button
!= KDialog::Ok
)
350 debug() << "mda dialog canceled";
351 KDialog::slotButtonClicked( button
);
353 if( !getId( true ).isEmpty() &&
354 MediaDeviceCache::instance()->deviceType( m_newId
) == MediaDeviceCache::InvalidType
)
356 debug() << "returning with m_successful = true";
358 KDialog::slotButtonClicked( button
);
362 Amarok::ContextStatusBar::instance()->longMessageThreadSafe( i18n("Sorry, every device must have a name and\n"
363 "you cannot define two devices with the\n"
364 "same name. These names must be unique\n"
365 "across autodetected devices as well.\n") );
370 ManualDeviceAdder::slotComboChanged( const QString
&string
)
373 //best thing to do here would be to find out if the plugin selected
374 //has m_hasMountPoint set to false...but any way to do this
375 //without instantiating it? This way will suffice for now...
376 if( MediaBrowser::instance()->getInternalPluginName( string
) == "ifp-mediadevice" ||
377 MediaBrowser::instance()->getInternalPluginName( string
) == "daap-mediadevice" ||
378 MediaBrowser::instance()->getInternalPluginName( string
) == "mtp-mediadevice" ||
379 MediaBrowser::instance()->getInternalPluginName( string
) == "njb-mediadevice" )
381 m_mountPointOldText
= m_mdaMountPoint
->text();
382 m_mdaMountPoint
->setText( "No mount point needed" );
383 m_mdaMountPoint
->setEnabled(false);
385 else if( m_mdaMountPoint
->isEnabled() == false )
387 m_mdaMountPoint
->setText( m_mountPointOldText
);
388 m_mdaMountPoint
->setEnabled(true);
390 m_selectedPlugin
= MediaBrowser::instance()->getInternalPluginName( string
);
391 debug() << "Selected plugin = " << m_selectedPlugin
;
395 ManualDeviceAdder::getId( bool recreate
)
400 debug() << "No recreate, returning " << m_newId
;
404 if( !m_newId
.isEmpty() && recreate
)
409 if( m_mdaMountPoint
->isEnabled() == false && m_mdaName
->text().isNull() )
411 debug() << "Mount point not enabled, device name is null";
414 if( m_mdaMountPoint
->text().isNull() && m_mdaName
->text().isNull() )
416 debug() << "Mount point text is null and device name is null";
419 if( m_mdaName
->text().count( '|' ) )
421 Amarok::ContextStatusBar::instance()->longMessageThreadSafe( i18n( "The device name cannot contain the '|' character" ) );
424 m_newId
= "manual|" + m_mdaName
->text() + '|' +
425 ( m_mdaMountPoint
->text().isNull() ||
426 m_mdaMountPoint
->isEnabled() == false ?
427 "(none)" : m_mdaMountPoint
->text() );
428 debug() << "returning id = " << m_newId
;
432 MediaDeviceConfig::MediaDeviceConfig( QString udi
, QWidget
*parent
, const char *name
)
435 , m_name( MediaDeviceCache::instance()->deviceName( udi
) )
436 , m_oldPlugin( QString() )
437 , m_details( QString() )
439 , m_removeButton( 0 )
440 , m_label_details( 0 )
444 setObjectName( name
);
446 KConfigGroup config
= Amarok::config( "PortableDevices" );
447 m_oldPlugin
= config
.readEntry( m_udi
, QString() );
448 debug() << "oldPlugin = " << m_oldPlugin
;
449 if( !m_oldPlugin
.isEmpty() )
452 setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Fixed
) );
455 const QString labelTextNone
= i18n( "(none)" );
456 QString row
= "<tr><td>%1</td><td>%2</td></tr>";
458 int deviceType
= MediaDeviceCache::instance()->deviceType( m_udi
);
459 table
+= row
.arg( Qt::escape( i18n( "Autodetected:" ) ),
460 Qt::escape( deviceType
== MediaDeviceCache::SolidPMPType
|| deviceType
== MediaDeviceCache::SolidVolumeType
? i18n("Yes") : i18n("No") ) );
461 table
+= row
.arg( Qt::escape( i18n( "Unique ID:" ) ),
462 Qt::escape( m_udi
) );
463 if( deviceType
== MediaDeviceCache::SolidPMPType
|| deviceType
== MediaDeviceCache::SolidVolumeType
)
465 Solid::Device
device( m_udi
);
466 if( device
.isValid() )
468 if( deviceType
== MediaDeviceCache::SolidPMPType
)
470 if( !device
.vendor().isEmpty() )
471 table
+= row
.arg( Qt::escape( i18n( "Vendor:" ) ),
472 Qt::escape( device
.vendor() ) );
473 if( !device
.product().isEmpty() )
474 table
+= row
.arg( Qt::escape( i18n( "Product:" ) ),
475 Qt::escape( device
.product() ) );
477 else if( deviceType
== MediaDeviceCache::SolidVolumeType
)
479 if( !device
.parent().vendor().isEmpty() )
480 table
+= row
.arg( Qt::escape( i18n( "Vendor:" ) ),
481 Qt::escape( device
.parent().vendor() ) );
482 if( !device
.parent().product().isEmpty() )
483 table
+= row
.arg( Qt::escape( i18n( "Product:" ) ),
484 Qt::escape( device
.parent().product() ) );
489 QString title
= Qt::escape( i18n( "Device information for " ) ) + "<b>" + m_udi
+ "</b>";
490 m_details
= QString( "<em>%1</em><br />" "<table>%2</table>" ).arg( title
, table
);
492 QLabel
* label_name
= new QLabel( i18n("Name: "), this );
493 Q_UNUSED( label_name
);
494 QLabel
* label_devicename
= new QLabel( m_name
, this );
495 Q_UNUSED( label_devicename
);
496 QLabel
* m_label_details
= new QLabel( "<qt>(<a href='details'>" + i18n( "Details" ) + "</a>)</qt>", this );
497 m_label_details
->setTextInteractionFlags( Qt::LinksAccessibleByMouse
| Qt::LinksAccessibleByKeyboard
);
498 connect( m_label_details
, SIGNAL( linkActivated( const QString
& ) ), this, SLOT( slotDetailsActivated( const QString
& ) ) );
500 QLabel
* label_plugin
= new QLabel( i18n("Plugin:"), this );
501 Q_UNUSED( label_plugin
);
502 m_pluginCombo
= new KComboBox( false, this );
504 if( deviceType
== MediaDeviceCache::SolidPMPType
)
506 debug() << "sending to getDisplayPluginName: " << MediaBrowser::instance()->deviceFromId( m_udi
)->type();
507 QString name
= MediaBrowser::instance()->getDisplayPluginName( MediaBrowser::instance()->deviceFromId( m_udi
)->type() );
508 debug() << "name of protocol from Solid is: " << name
;
511 m_pluginCombo
->addItem( i18n( "Unknown" ) );
515 debug() << "Adding " << name
<< " to pluginCombo";
516 m_pluginCombo
->addItem( name
);
519 else if( deviceType
== MediaDeviceCache::SolidVolumeType
)
521 m_pluginCombo
->addItem( i18n( "Generic Audio Player" ) );
525 m_pluginCombo
->addItem( i18n( "Do not handle" ) );
526 for( KService::List::ConstIterator it
= MediaBrowser::instance()->getPlugins().begin();
527 it
!= MediaBrowser::instance()->getPlugins().end();
529 m_pluginCombo
->addItem( (*it
)->name() );
530 if ( (*it
)->property( "X-KDE-Amarok-name" ).toString() == config
.readEntry( m_udi
, QString() ) )
531 m_pluginCombo
->setCurrentItem( (*it
)->name() );
534 m_pluginCombo
->setEnabled( deviceType
== MediaDeviceCache::ManualType
);
536 m_removeButton
= new KPushButton( i18n( "Remove" ), this );
537 connect( m_removeButton
, SIGNAL(clicked()), this, SLOT(slotDeleteDevice()) );
538 m_removeButton
->setToolTip( i18n( "Remove entries corresponding to this device from configuration file" ) );
539 m_removeButton
->setEnabled( deviceType
== MediaDeviceCache::ManualType
);
542 MediaDeviceConfig::~MediaDeviceConfig()
544 disconnect( m_label_details
, SIGNAL( linkActivated( const QString
& ) ), this, SLOT( slotDetailsActivated( const QString
& ) ) );
545 disconnect( m_removeButton
, SIGNAL(clicked()), this, SLOT(slotDeleteDevice()) );
549 MediaDeviceConfig::slotConfigureDevice() //slot
551 MediaDevice
*device
= MediaBrowser::instance()->deviceFromId( m_udi
);
554 DeviceConfigureDialog
* dcd
= new DeviceConfigureDialog( device
);
559 debug() << "Could not show the configuration dialog because the device could not be found.";
563 MediaDeviceConfig::slotDeleteDevice() //slot
566 emit
deleteDevice( m_udi
);
571 MediaDeviceConfig::slotDetailsActivated( const QString
&link
) //slot
574 QWhatsThis::showText( QCursor::pos(), "<qt>" + m_details
+ "</qt>", Amarok::mainWindow() );
578 MediaDeviceConfig::plugin()
580 return MediaBrowser::instance()->getInternalPluginName( m_pluginCombo
->currentText() );
583 MediaDeviceVolumeMarkerDialog::MediaDeviceVolumeMarkerDialog()
584 : KDialog( Amarok::mainWindow() )
585 , m_mountPointBox( 0 )
588 setObjectName( "mediadevicevolumemarkerdialog" );
590 setButtons( Ok
| Cancel
);
591 setDefaultButton( Ok
);
593 kapp
->setTopWidget( this );
594 setCaption( KDialog::makeStandardCaption( i18n( "Mark Volumes as Media Devices" ) ) );
596 m_mountPointBox
= new KVBox( this );
597 m_mountPointBox
->setSizePolicy( QSizePolicy( QSizePolicy::Expanding
, QSizePolicy::Expanding
) );
598 setMainWidget( m_mountPointBox
);
600 KHBox
*hbox
= new KHBox( m_mountPointBox
);
601 m_table
= new QTableWidget( 0, 2, hbox
);
602 QStringList headerlabels
;
603 headerlabels
<< i18n( "Mount Point:" ) << i18n( "Mark?" );
604 m_table
->setHorizontalHeaderLabels( headerlabels
);
605 m_table
->verticalHeader()->hide();
606 m_table
->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch
);
607 m_table
->setShowGrid( false );
609 connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
611 MediaDeviceCache::instance()->refreshCache();
612 QStringList udiList
= MediaDeviceCache::instance()->getAll();
613 foreach( const QString
&udi
, udiList
)
615 if( !MediaDeviceCache::instance()->deviceType( udi
) == MediaDeviceCache::SolidVolumeType
||
616 MediaDeviceCache::instance()->volumeMountPoint( udi
).isEmpty() )
618 debug() << "udi " << udi
<< " is not a volume, or mount point detected as empty";
621 int row
= m_table
->rowCount();
622 m_table
->insertRow( row
);
623 QString mountPoint
= MediaDeviceCache::instance()->volumeMountPoint( udi
);
624 QTableWidgetItem
*item
= new QTableWidgetItem( mountPoint
);
625 m_table
->setItem( row
, 0, item
);
626 item
= new QTableWidgetItem();
627 item
->setFlags( Qt::ItemIsEnabled
| Qt::ItemIsUserCheckable
);
628 if( QFile::exists( mountPoint
+ "/.is_audio_player" ) )
629 item
->setCheckState( Qt::Checked
);
631 item
->setCheckState( Qt::Unchecked
);
632 m_table
->setItem( row
, 1, item
);
634 m_table
->setSortingEnabled( true );
637 MediaDeviceVolumeMarkerDialog::~MediaDeviceVolumeMarkerDialog()
642 MediaDeviceVolumeMarkerDialog::slotOk()
644 for( int row
= 0; row
< m_table
->rowCount(); row
++ )
646 QString mountPoint
= m_table
->item( row
, 0 )->text();
647 bool checkedState
= m_table
->item( row
, 1 )->checkState() == Qt::Checked
? true : false;
648 bool initialState
= QFile::exists( mountPoint
+ "/.is_audio_player" );
649 if( initialState
== checkedState
)
651 if( initialState
== false )
653 //attempt to write the file
658 //attempt to delete the file
659 bool success
= QFile::remove( mountPoint
+ "/.is_audio_player" );
662 QMessageBox::critical( this, i18n( "Well, we tried..." ),
663 i18n( "Could not remove the marking file at %1.\n"
664 "Ensure that you have the correct permissions\n"
665 "to remove that file." ) );
670 disconnect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
673 #include "MediaDevicePluginManager.moc"