Index: amarok.kdevelop
===================================================================
--- amarok.kdevelop	(revision 554563)
+++ amarok.kdevelop	(working copy)
@@ -15,7 +15,7 @@
     <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/>
+      <mainprogram>src/amarokapp</mainprogram>
       <programargs/>
       <terminal>false</terminal>
       <autocompile>false</autocompile>
       <envvars/>
-      <directoryradio>build</directoryradio>
+      <directoryradio>executable</directoryradio>
       <customdirectory>/usr/kde/cvs/bin/</customdirectory>
       <runarguments>
         <amarok/>
@@ -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,7 +155,10 @@
       <automaticHeaderCompletion>true</automaticHeaderCompletion>
       <headerCompletionDelay>250</headerCompletionDelay>
     </codecompletion>
-    <references/>
+    <references>
+      <pcs>KDElibs</pcs>
+      <pcs>Qt</pcs>
+    </references>
     <creategettersetter>
       <prefixGet/>
       <prefixSet>set</prefixSet>
Index: src/mediadevice/generic/genericmediadevice.h
===================================================================
--- src/mediadevice/generic/genericmediadevice.h	(revision 554563)
+++ src/mediadevice/generic/genericmediadevice.h	(working copy)
@@ -29,7 +29,10 @@
 
 class GenericMediaItem;
 class GenericMediaFile;
+class GenericMediaDeviceConfigDialog;
 
+class QStringList;
+
 typedef QMap<QString, GenericMediaFile*> MediaFileMap;
 typedef QMap<GenericMediaItem*, GenericMediaFile*> MediaItemMap;
 
@@ -46,11 +49,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 +104,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 +122,7 @@
         int               addTrackToList( int type, KURL name, int size=0 );
 
         QString           cleanPath( const QString &component );
+        void              updateConfigDialogLists();
 
         GenericMediaFile     *m_initialFile;
 
@@ -122,6 +138,10 @@
         KURL::List        m_downloadList;
         MediaFileMap      m_mfm;
         MediaItemMap      m_mim;
+
+        QStringList       m_supportedFileTypes;
+        GenericMediaDeviceConfigDialog *m_configDialog;
+
 };
 
 #endif /*AMAROK_GENERICMEDIADEVICE_H*/
Index: src/mediadevice/generic/Makefile.am
===================================================================
--- src/mediadevice/generic/Makefile.am	(revision 554563)
+++ src/mediadevice/generic/Makefile.am	(working copy)
@@ -23,7 +23,8 @@
     $(all_libraries)
 
 libamarok_generic_mediadevice_la_SOURCES = \
-    genericmediadevice.cpp
+    genericmediadevice.cpp\
+    genericmediadeviceconfigdialog.ui
 
 noinst_HEADERS = \
     genericmediadevice.h
Index: src/mediadevice/generic/genericmediadevice.cpp
===================================================================
--- src/mediadevice/generic/genericmediadevice.cpp	(revision 554563)
+++ src/mediadevice/generic/genericmediadevice.cpp	(working copy)
@@ -31,6 +31,7 @@
 #include "playlist.h"
 #include "statusbar/statusbar.h"
 #include "transferdialog.h"
+#include "genericmediadeviceconfigdialog.h"
 
 #include <kapplication.h>
 #include <kconfig.h>           //download saveLocation
@@ -51,7 +52,19 @@
 #include <qcstring.h>
 #include <qfile.h>
 #include <qstringx.h>
+#include <qstringlist.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;
 
@@ -306,12 +319,17 @@
     m_name = "Generic Audio Player";
     m_td = 0;
     m_dirLister = new KDirLister();
-    m_dirLister->setNameFilter( "*.mp3 *.wav *.asf *.flac *.wma *.ogg *.aac *.m4a" );
+    m_dirLister->setNameFilter( "*.mp3 *.wav *.asf *.flac *.wma *.ogg *.aac *.m4a *.mp4 *.mp2 *.ac3" );
     m_dirLister->setAutoUpdate( false );
     m_spacesToUnderscores = false;
     m_firstSort = "None";
     m_secondSort = "None";
     m_thirdSort = "None";
+    m_supportedFileTypes.empty();
+
+    m_configDialog = 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 +345,41 @@
 
 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_configDialog != 0)
+    {
+        QComboBox *convert     = m_configDialog->m_convertComboBox;
+        QListBox  *supported   = m_configDialog->m_supportedListBox;
+
+        m_supportedFileTypes.clear();
+        for( uint i = 0; i < supported->count(); i++ )
+        {
+            QString currentText = supported->item( i )->text();
+
+            if( currentText == convert->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 +388,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 +992,155 @@
     return result;
 }
 
+/// File Information functions
+
+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();
+}
+
+/// Configuration Dialog Extension
+
+void GenericMediaDevice::addConfigElements( QWidget * parent )
+{
+    m_configDialog = new GenericMediaDeviceConfigDialog( parent );
+
+    updateConfigDialogLists();
+
+    connect( m_configDialog->m_addSupportedButton,    SIGNAL( clicked() ),                      this, SLOT( addSupportedButtonClicked() ) );
+    connect( m_configDialog->m_removeSupportedButton, SIGNAL( clicked() ),                      this, SLOT( removeSupportedButtonClicked() ) );
+    connect( m_configDialog->m_supportedListBox,      SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( supportedListBoxDoubleClicked( QListBoxItem* ) ) );
+}
+
+
+void GenericMediaDevice::removeConfigElements( QWidget * /* parent */ )
+{
+    if( m_configDialog != 0 )
+        delete m_configDialog;
+
+    m_configDialog = 0;
+
+}
+
+/// Configuration Dialog Extension slots
+
+void
+GenericMediaDevice::addSupportedButtonClicked()
+{
+    if( m_configDialog->m_unsupportedComboBox->currentItem() < 0 )
+        return;
+
+    QComboBox *unsupported = m_configDialog->m_unsupportedComboBox;
+    QComboBox *convert     = m_configDialog->m_convertComboBox;
+    QListBox  *supported   = m_configDialog->m_supportedListBox;
+
+    supported->insertItem( unsupported->currentText() );
+
+    QString temp = convert->currentText();
+    convert->insertItem( unsupported->currentText() );
+
+    unsupported->removeItem( unsupported->currentItem() );
+
+    supported->sort();
+    convert->listBox()->sort();
+
+    convert->setCurrentText( temp );
+}
+
+
+void
+GenericMediaDevice::removeSupportedButtonClicked()
+{
+    QComboBox *unsupported = m_configDialog->m_unsupportedComboBox;
+    QComboBox *convert     = m_configDialog->m_convertComboBox;
+    QListBox  *supported   = m_configDialog->m_supportedListBox;
+
+    for( uint i = 0; i < supported->count() ; /* nothing */)
+    {
+        QListBoxItem *item = supported->item( i );
+
+        if( item->isSelected() )
+        {
+            QString temp;
+
+            unsupported->insertItem( item->text() );
+
+            temp = convert->currentText();
+            convert->setCurrentText( item->text() );
+            convert->removeItem( convert->currentItem() );
+            convert->setCurrentText( temp );
+
+            item = 0;
+            supported->removeItem( i );
+
+            continue;
+        }
+
+        i++;
+    }
+
+    // at least support mp3 format.
+    if( supported->count() <= 0 )
+    {
+        supported->insertItem( "mp3" );
+        unsupported->setCurrentText( "mp3" );
+        unsupported->removeItem( convert->currentItem() );
+    }
+
+    unsupported->listBox()->sort();
+}
+
+
+void
+GenericMediaDevice::supportedListBoxDoubleClicked( QListBoxItem* item )
+{
+    m_configDialog->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";
+
+    QComboBox *unsupported = m_configDialog->m_unsupportedComboBox;
+    QComboBox *convert     = m_configDialog->m_convertComboBox;
+    QListBox  *supported   = m_configDialog->m_supportedListBox;
+
+
+    for( QStringList::Iterator it = allTypes.begin(); it != allTypes.end(); it++ )
+    {
+        if( m_supportedFileTypes.contains( *it ) )
+        {
+            supported->insertItem( *it );
+            convert->insertItem( *it );
+        }
+        else
+        {
+            unsupported->insertItem( *it );
+        }
+    }
+
+    supported->sort();
+    unsupported->listBox()->sort();
+    convert->listBox()->sort();
+    convert->setCurrentText( m_supportedFileTypes.first() );
+}
+
+
 #include "genericmediadevice.moc"
Index: src/mediadevice/generic/genericmediadeviceconfigdialog.ui
===================================================================
--- src/mediadevice/generic/genericmediadeviceconfigdialog.ui	(revision 0)
+++ src/mediadevice/generic/genericmediadeviceconfigdialog.ui	(revision 0)
@@ -0,0 +1,176 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GenericMediaDeviceConfigDialog</class>
+<widget class="QWidget">
+    <property name="name">
+        <cstring>GenericMediaDeviceConfigDialog</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>409</width>
+            <height>296</height>
+        </rect>
+    </property>
+    <property name="sizePolicy">
+        <sizepolicy>
+            <hsizetype>7</hsizetype>
+            <vsizetype>7</vsizetype>
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+        </sizepolicy>
+    </property>
+    <property name="caption">
+        <string>Form1</string>
+    </property>
+    <grid>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <property name="margin">
+            <number>0</number>
+        </property>
+        <property name="spacing">
+            <number>0</number>
+        </property>
+        <widget class="QGroupBox" row="0" column="0">
+            <property name="name">
+                <cstring>groupBox1</cstring>
+            </property>
+            <property name="sizePolicy">
+                <sizepolicy>
+                    <hsizetype>7</hsizetype>
+                    <vsizetype>7</vsizetype>
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                </sizepolicy>
+            </property>
+            <property name="title">
+                <string>File formats when transferring to media devices</string>
+            </property>
+            <property name="flat">
+                <bool>false</bool>
+            </property>
+            <vbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QLabel">
+                    <property name="name">
+                        <cstring>textLabel2</cstring>
+                    </property>
+                    <property name="text">
+                        <string>The following formats will be transferred directly:</string>
+                    </property>
+                </widget>
+                <widget class="QLayoutWidget">
+                    <property name="name">
+                        <cstring>layout24</cstring>
+                    </property>
+                    <hbox>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <widget class="QLayoutWidget">
+                            <property name="name">
+                                <cstring>layout23</cstring>
+                            </property>
+                            <vbox>
+                                <property name="name">
+                                    <cstring>unnamed</cstring>
+                                </property>
+                                <widget class="QListBox">
+                                    <property name="name">
+                                        <cstring>m_supportedListBox</cstring>
+                                    </property>
+                                </widget>
+                                <widget class="QLabel">
+                                    <property name="name">
+                                        <cstring>textLabel1</cstring>
+                                    </property>
+                                    <property name="sizePolicy">
+                                        <sizepolicy>
+                                            <hsizetype>7</hsizetype>
+                                            <vsizetype>0</vsizetype>
+                                            <horstretch>0</horstretch>
+                                            <verstretch>0</verstretch>
+                                        </sizepolicy>
+                                    </property>
+                                    <property name="text">
+                                        <string>Other formats will be converted to:</string>
+                                    </property>
+                                </widget>
+                            </vbox>
+                        </widget>
+                        <widget class="QLayoutWidget">
+                            <property name="name">
+                                <cstring>layout19</cstring>
+                            </property>
+                            <vbox>
+                                <property name="name">
+                                    <cstring>unnamed</cstring>
+                                </property>
+                                <widget class="QComboBox">
+                                    <property name="name">
+                                        <cstring>m_unsupportedComboBox</cstring>
+                                    </property>
+                                </widget>
+                                <widget class="QPushButton">
+                                    <property name="name">
+                                        <cstring>m_addSupportedButton</cstring>
+                                    </property>
+                                    <property name="text">
+                                        <string>&amp;Add format...</string>
+                                    </property>
+                                    <property name="accel">
+                                        <string>Alt+A</string>
+                                    </property>
+                                </widget>
+                                <widget class="QPushButton">
+                                    <property name="name">
+                                        <cstring>m_removeSupportedButton</cstring>
+                                    </property>
+                                    <property name="text">
+                                        <string>Remove selected</string>
+                                    </property>
+                                </widget>
+                                <spacer>
+                                    <property name="name">
+                                        <cstring>spacer1</cstring>
+                                    </property>
+                                    <property name="orientation">
+                                        <enum>Vertical</enum>
+                                    </property>
+                                    <property name="sizeType">
+                                        <enum>Expanding</enum>
+                                    </property>
+                                    <property name="sizeHint">
+                                        <size>
+                                            <width>20</width>
+                                            <height>93</height>
+                                        </size>
+                                    </property>
+                                </spacer>
+                                <widget class="QComboBox">
+                                    <property name="name">
+                                        <cstring>m_convertComboBox</cstring>
+                                    </property>
+                                    <property name="sizePolicy">
+                                        <sizepolicy>
+                                            <hsizetype>1</hsizetype>
+                                            <vsizetype>0</vsizetype>
+                                            <horstretch>0</horstretch>
+                                            <verstretch>0</verstretch>
+                                        </sizepolicy>
+                                    </property>
+                                </widget>
+                            </vbox>
+                        </widget>
+                    </hbox>
+                </widget>
+            </vbox>
+        </widget>
+    </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
