Index: amarok.kdevelop
===================================================================
--- amarok.kdevelop	(revision 554350)
+++ amarok.kdevelop	(working copy)
@@ -11,11 +11,11 @@
     </keywords>
     <projectdirectory>.</projectdirectory>
     <absoluteprojectpath>false</absoluteprojectpath>
-    <version/>
-    <description/>
+    <version></version>
+    <description></description>
     <ignoreparts/>
     <secondaryLanguages/>
-    <versioncontrol/>
+    <versioncontrol>kdevsubversion</versioncontrol>
   </general>
   <kdevautoproject>
     <general>
@@ -31,7 +31,7 @@
       <abortonerror>false</abortonerror>
       <numberofjobs>1</numberofjobs>
       <dontact>false</dontact>
-      <makebin>unsermake</makebin>
+      <makebin>make</makebin>
       <envvars>
         <envvar value="1" name="WANT_AUTOCONF_2_5" />
         <envvar value="1" name="WANT_AUTOMAKE_1_6" />
@@ -44,12 +44,12 @@
       <cxxflags>\s-O0 -g3 -Wall</cxxflags>
     </compiler>
     <run>
-      <mainprogram/>
-      <programargs/>
+      <mainprogram>src/amarokapp</mainprogram>
+      <programargs></programargs>
       <terminal>false</terminal>
       <autocompile>false</autocompile>
       <envvars/>
-      <directoryradio>build</directoryradio>
+      <directoryradio>executable</directoryradio>
       <customdirectory>/usr/kde/cvs/bin/</customdirectory>
       <runarguments>
         <amarok/>
@@ -112,15 +112,15 @@
   <kdevdebugger>
     <general>
       <dbgshell>/usr/bin/libtool</dbgshell>
-      <programargs/>
-      <gdbpath/>
+      <programargs></programargs>
+      <gdbpath></gdbpath>
       <breakonloadinglibs>true</breakonloadinglibs>
       <separatetty>false</separatetty>
       <floatingtoolbar>false</floatingtoolbar>
       <runappinappdirectory>true</runappinappdirectory>
-      <configGdbScript/>
-      <runShellScript/>
-      <runGdbScript/>
+      <configGdbScript></configGdbScript>
+      <runShellScript></runShellScript>
+      <runGdbScript></runGdbScript>
     </general>
     <display>
       <staticmembers>false</staticmembers>
@@ -147,7 +147,7 @@
       <includeGlobalFunctions>true</includeGlobalFunctions>
       <includeTypes>true</includeTypes>
       <includeEnums>true</includeEnums>
-      <includeTypedefs>false</includeTypedefs>
+      <includeTypedefs>true</includeTypedefs>
       <automaticCodeCompletion>true</automaticCodeCompletion>
       <automaticArgumentsHint>true</automaticArgumentsHint>
       <codeCompletionDelay>250</codeCompletionDelay>
@@ -155,9 +155,12 @@
       <automaticHeaderCompletion>true</automaticHeaderCompletion>
       <headerCompletionDelay>250</headerCompletionDelay>
     </codecompletion>
-    <references/>
+    <references>
+      <pcs>KDElibs</pcs>
+      <pcs>Qt</pcs>
+    </references>
     <creategettersetter>
-      <prefixGet/>
+      <prefixGet></prefixGet>
       <prefixSet>set</prefixSet>
       <prefixVariable>m_,_</prefixVariable>
       <parameterName>theValue</parameterName>
Index: src/mediadevice/generic/genericmediadevice.h
===================================================================
--- src/mediadevice/generic/genericmediadevice.h	(revision 554350)
+++ src/mediadevice/generic/genericmediadevice.h	(working copy)
@@ -26,10 +26,22 @@
 #include <kurl.h>
 
 #include <qptrlist.h>
+#include <qstringlist.h>
 
 class GenericMediaItem;
 class GenericMediaFile;
 
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QSpacerItem;
+class QGroupBox;
+class QLabel;
+class QListBox;
+class QListBoxItem;
+class QPushButton;
+class QComboBox;
+
 typedef QMap<QString, GenericMediaFile*> MediaFileMap;
 typedef QMap<GenericMediaItem*, GenericMediaFile*> MediaItemMap;
 
@@ -46,11 +58,19 @@
 
         void              rmbPressed( QListViewItem* qitem, const QPoint& point, int );
 
+        QStringList       supportedFiletypes() { return m_supportedFileTypes; }
+        bool              isPlayable( const MetaBundle& bundle );
+        bool              isPreferredFormat( const MetaBundle &bundle );
+
         bool              hasTransferDialog() { return true; }
         void              runTransferDialog();
         TransferDialog   *getTransferDialog() { return m_td; }
 
         bool              needsManualConfig() { return false; }
+        void              addConfigElements( QWidget * parent );
+        void              removeConfigElements( QWidget * /* parent */);
+
+        void              applyConfig();
         void              loadConfig();
 
         MediaFileMap     &getFileMap() { return m_mfm; }
@@ -93,7 +113,11 @@
         void              dirListerClear( const KURL &url );
         void              dirListerDeleteItem( KFileItem *fileitem );
 
+        void              addSupportedButtonClicked();
+        void              removeSupportedButtonClicked();
+        void              supportedListBoxDoubleClicked( QListBoxItem* );
 
+
     private:
         enum              Error { ERR_ACCESS_DENIED, ERR_CANNOT_RENAME, ERR_DISK_FULL, ERR_COULD_NOT_WRITE };
 
@@ -107,6 +131,7 @@
         int               addTrackToList( int type, KURL name, int size=0 );
 
         QString           cleanPath( const QString &component );
+        void              updateConfigDialogLists();
 
         GenericMediaFile     *m_initialFile;
 
@@ -122,6 +147,22 @@
         KURL::List        m_downloadList;
         MediaFileMap      m_mfm;
         MediaItemMap      m_mim;
+
+        QStringList       m_supportedFileTypes;
+        QGroupBox        *m_configGroupBox;
+        QVBoxLayout      *m_configGroupBoxLayout;
+        QLabel           *m_supportedListLabel;
+        QHBoxLayout      *m_configGroupBoxLayout2;
+        QListBox         *m_supportedListBox;
+        QVBoxLayout      *m_configGroupBoxLayout3;
+        QComboBox        *m_unsupportedComboBox;
+        QPushButton      *m_addSupportedButton;
+        QPushButton      *m_removeSupportedButton;
+        QSpacerItem      *m_configGroupBoxSpacer;
+        QHBoxLayout      *m_configGroupBoxLayout4;
+        QLabel           *m_convertLabel;
+        QComboBox        *m_convertComboBox;
+
 };
 
 #endif /*AMAROK_GENERICMEDIADEVICE_H*/
Index: src/mediadevice/generic/genericmediadevice.cpp
===================================================================
--- src/mediadevice/generic/genericmediadevice.cpp	(revision 554350)
+++ src/mediadevice/generic/genericmediadevice.cpp	(working copy)
@@ -52,6 +52,17 @@
 #include <qfile.h>
 #include <qstringx.h>
 
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+
 typedef QPtrList<GenericMediaFile> MediaFileList;
 typedef QPtrListIterator<GenericMediaFile> MediaFileListIterator;
 
@@ -312,6 +323,23 @@
     m_firstSort = "None";
     m_secondSort = "None";
     m_thirdSort = "None";
+    m_supportedFileTypes.empty();
+
+    m_configGroupBox        = 0;
+    m_configGroupBoxLayout  = 0;
+    m_supportedListLabel    = 0;
+    m_configGroupBoxLayout2 = 0;
+    m_supportedListBox      = 0;
+    m_configGroupBoxLayout3 = 0;
+    m_addSupportedButton    = 0;
+    m_removeSupportedButton = 0;
+    m_configGroupBoxSpacer  = 0;
+    m_configGroupBoxLayout4 = 0;
+    m_convertLabel          = 0;
+    m_convertComboBox       = 0;
+
+
+
     connect( m_dirLister, SIGNAL( newItems(const KFileItemList &) ), this, SLOT( newItems(const KFileItemList &) ) );
     connect( m_dirLister, SIGNAL( completed() ), this, SLOT( dirListerCompleted() ) );
     connect( m_dirLister, SIGNAL( clear() ), this, SLOT( dirListerClear() ) );
@@ -327,15 +355,38 @@
 
 GenericMediaDevice::~GenericMediaDevice()
 {
-    setConfigString( "firstGrouping"    , m_firstSort );
-    setConfigString( "secondGrouping"   , m_secondSort );
-    setConfigString( "thirdGrouping"    , m_thirdSort );
-    setConfigBool( "spacesToUnderscores", m_spacesToUnderscores );
+    applyConfig();
 
     closeDevice();
 }
 
 void
+GenericMediaDevice::applyConfig()
+{
+    if( m_supportedListBox != 0 && m_convertComboBox != 0)
+    {
+        m_supportedFileTypes.clear();
+        for( uint i = 0; i < m_supportedListBox->count(); i++ )
+        {
+            QString currentText = m_supportedListBox->item( i )->text();
+
+            if( currentText == m_convertComboBox->currentText() )
+                m_supportedFileTypes.prepend( currentText );
+            else
+                m_supportedFileTypes.append( currentText );
+        }
+    }
+
+
+    setConfigString( "firstGrouping"     , m_firstSort );
+    setConfigString( "secondGrouping"    , m_secondSort );
+    setConfigString( "thirdGrouping"     , m_thirdSort );
+    setConfigBool( "spacesToUnderscores" , m_spacesToUnderscores );
+    setConfigString( "supportedFiletypes", m_supportedFileTypes.join( ", " ) );
+}
+
+
+void
 GenericMediaDevice::loadConfig()
 {
     MediaDevice::loadConfig();
@@ -344,6 +395,7 @@
     m_firstSort           = configString( "firstGrouping", "None" );
     m_secondSort          = configString( "secondGrouping", "None" );
     m_thirdSort           = configString( "thirdGrouping", "None" );
+    m_supportedFileTypes      = QStringList::split( ", ", configString( "supportedFiletypes", "mp3"), true);
 }
 
 bool
@@ -947,4 +999,203 @@
     return result;
 }
 
+
+bool GenericMediaDevice::isPlayable( const MetaBundle& bundle )
+{
+    for( QStringList::Iterator it = m_supportedFileTypes.begin(); it != m_supportedFileTypes.end() ; it++ )
+    {
+        if( bundle.type() == *it )
+            return true;
+    }
+
+    return false;
+}
+
+
+bool GenericMediaDevice::isPreferredFormat( const MetaBundle &bundle )
+{
+    return m_supportedFileTypes.first() == bundle.type();
+}
+
+
+void GenericMediaDevice::addConfigElements( QWidget * parent )
+{
+    m_configGroupBox = new QGroupBox( parent );
+    m_configGroupBox->setColumnLayout(0, Qt::Vertical );
+    m_configGroupBox->layout()->setSpacing( 6 );
+    m_configGroupBox->layout()->setMargin( 11 );
+    m_configGroupBoxLayout = new QVBoxLayout( m_configGroupBox->layout() );
+    m_configGroupBoxLayout->setAlignment( Qt::AlignTop );
+    m_configGroupBox->setTitle( i18n( "File formats when transferring to media devices" ) );
+
+    m_supportedListLabel = new QLabel( m_configGroupBox, "m_supportedListLabel" );
+    m_supportedListLabel->setText( i18n( "The following formats will be transferred directly:" ) );
+    m_configGroupBoxLayout->addWidget( m_supportedListLabel );
+
+    m_configGroupBoxLayout2 = new QHBoxLayout( 0, 0, 6, "m_configGroupBoxLayout2");
+
+    m_supportedListBox = new QListBox( m_configGroupBox, "m_supportedListBox" );
+    m_supportedListBox->setMultiSelection( true );
+
+    m_supportedListBox->clear();
+
+    m_configGroupBoxLayout2->addWidget( m_supportedListBox );
+
+    m_configGroupBoxLayout3 = new QVBoxLayout( 0, 0, 6, "m_configGroupBoxLayout3");
+
+    m_unsupportedComboBox = new QComboBox( false, m_configGroupBox, "m_unsupportedComboBox" );
+    m_configGroupBoxLayout3->addWidget( m_unsupportedComboBox );
+
+    m_addSupportedButton = new QPushButton( m_configGroupBox, "m_addSupportedButton" );
+    m_addSupportedButton->setText( i18n( "Add format..." ) );
+    m_configGroupBoxLayout3->addWidget( m_addSupportedButton );
+
+    m_removeSupportedButton = new QPushButton( m_configGroupBox, "m_removeSupportedButton" );
+    m_removeSupportedButton->setText( i18n( "Remove selected" ) );
+    m_configGroupBoxLayout3->addWidget( m_removeSupportedButton );
+
+    m_configGroupBoxSpacer = new QSpacerItem( 20, 71, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    m_configGroupBoxLayout3->addItem( m_configGroupBoxSpacer );
+    m_configGroupBoxLayout2->addLayout( m_configGroupBoxLayout3 );
+    m_configGroupBoxLayout->addLayout( m_configGroupBoxLayout2 );
+
+    m_configGroupBoxLayout4 = new QHBoxLayout( 0, 0, 6, "m_configGroupBoxLayout4");
+
+    m_convertLabel = new QLabel( m_configGroupBox, "m_convertLabel" );
+    m_convertLabel->setText( i18n( "Other formats will be converted to:" ) );
+    m_configGroupBoxLayout4->addWidget( m_convertLabel );
+
+    m_convertComboBox = new QComboBox( false, m_configGroupBox, "m_convertComboBox" );
+    m_configGroupBoxLayout4->addWidget( m_convertComboBox );
+    m_configGroupBoxLayout->addLayout( m_configGroupBoxLayout4 );
+
+    updateConfigDialogLists();
+
+    connect( m_addSupportedButton,    SIGNAL( clicked() ),                      this, SLOT( addSupportedButtonClicked() ) );
+    connect( m_removeSupportedButton, SIGNAL( clicked() ),                      this, SLOT( removeSupportedButtonClicked() ) );
+    connect( m_supportedListBox,      SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( supportedListBoxDoubleClicked( QListBoxItem* ) ) );
+}
+
+
+void GenericMediaDevice::removeConfigElements( QWidget * /* parent */ )
+{
+    delete m_configGroupBox;
+    delete m_configGroupBoxLayout;
+    delete m_supportedListLabel;
+    delete m_configGroupBoxLayout2;
+    delete m_supportedListBox;
+    delete m_configGroupBoxLayout3;
+    delete m_addSupportedButton;
+    delete m_removeSupportedButton;
+    delete m_configGroupBoxSpacer;
+    delete m_configGroupBoxLayout4;
+    delete m_convertLabel;
+    delete m_convertComboBox;
+
+    m_configGroupBox        = 0;
+    m_configGroupBoxLayout  = 0;
+    m_supportedListLabel    = 0;
+    m_configGroupBoxLayout2 = 0;
+    m_supportedListBox      = 0;
+    m_configGroupBoxLayout3 = 0;
+    m_addSupportedButton    = 0;
+    m_removeSupportedButton = 0;
+    m_configGroupBoxSpacer  = 0;
+    m_configGroupBoxLayout4 = 0;
+    m_convertLabel          = 0;
+    m_convertComboBox       = 0;
+}
+
+
+void
+GenericMediaDevice::addSupportedButtonClicked()
+{
+    if( m_unsupportedComboBox->currentItem() < 0 )
+        return;
+
+    m_supportedListBox->insertItem( m_unsupportedComboBox->currentText() );
+
+    QString temp = m_convertComboBox->currentText();
+    m_convertComboBox->insertItem( m_unsupportedComboBox->currentText() );
+
+    m_unsupportedComboBox->removeItem( m_unsupportedComboBox->currentItem() );
+
+    m_supportedListBox->sort();
+    m_convertComboBox->listBox()->sort();
+
+    m_convertComboBox->setCurrentText( temp );
+}
+
+
+void
+GenericMediaDevice::removeSupportedButtonClicked()
+{
+    for( uint i = 0; i < m_supportedListBox->count() ; /* nothing */)
+    {
+        if( m_supportedListBox->item( i )->isSelected() )
+        {
+            QString temp;
+
+            m_unsupportedComboBox->insertItem( m_supportedListBox->item( i )->text() );
+
+            temp = m_convertComboBox->currentText();
+            m_convertComboBox->setCurrentText( m_supportedListBox->item( i )->text() );
+            m_convertComboBox->removeItem( m_convertComboBox->currentItem() );
+            m_convertComboBox->setCurrentText( temp );
+
+            m_supportedListBox->removeItem( i );
+
+            continue;
+        }
+
+        i++;
+    }
+
+    // at least support mp3 format.
+    if( m_supportedListBox->count() <= 0 )
+    {
+        m_supportedListBox->insertItem( "mp3" );
+        m_unsupportedComboBox->setCurrentText( "mp3" );
+        m_unsupportedComboBox->removeItem( m_convertComboBox->currentItem() );
+    }
+
+    m_unsupportedComboBox->listBox()->sort();
+}
+
+
+void
+GenericMediaDevice::supportedListBoxDoubleClicked( QListBoxItem* item )
+{
+    m_convertComboBox->setCurrentText( item->text() );
+}
+
+
+void
+GenericMediaDevice::updateConfigDialogLists()
+{
+    QStringList allTypes;
+    allTypes << "mp3" << "ogg" << "wma" << "mp4" << "aac" << "m4a" << "ac3";
+    allTypes << "wav" << "flac" << "asf" << "asx" << "mpg" << "mp4v" << "mpeg";
+    allTypes << "aa" << "3gp" << "mp2";
+
+    for( QStringList::Iterator it = allTypes.begin(); it != allTypes.end(); it++ )
+    {
+        if( m_supportedFileTypes.contains( *it ) )
+        {
+            m_supportedListBox->insertItem( *it );
+            m_convertComboBox->insertItem( *it );
+        }
+        else
+        {
+            m_unsupportedComboBox->insertItem( *it );
+        }
+    }
+
+    m_supportedListBox->sort();
+    m_unsupportedComboBox->listBox()->sort();
+    m_convertComboBox->listBox()->sort();
+    m_convertComboBox->setCurrentText( m_supportedFileTypes.first() );
+}
+
+
 #include "genericmediadevice.moc"
