[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Casey Link <unnamedrambler () gmail ! com>
Date:       2008-05-31 23:10:32
Message-ID: 1212275432.225645.21686.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815021 by link:

Expose the local collection path via dbus in a more elegant fashion. The \
CollectionLocation changes should prove useful in the future for other  \
implementations. 


 M  +6 -0      collection/CollectionLocation.cpp  
 M  +12 -0     collection/CollectionLocation.h  
 M  +5 -0      collection/sqlcollection/SqlCollectionLocation.cpp  
 M  +1 -0      collection/sqlcollection/SqlCollectionLocation.h  
 M  +3 -11     dbus/amarokdbushandler.cpp  
 M  +1 -1      dbus/amarokdbushandler.h  
 M  +2 -2      dbus/org.kde.amarok.collection.xml  


--- trunk/extragear/multimedia/amarok/src/collection/CollectionLocation.cpp \
#815020:815021 @@ -59,6 +59,12 @@
     return QString();
 }
 
+QStringList
+CollectionLocation::actualLocation() const
+{
+    return QStringList();
+}
+
 bool
 CollectionLocation::isWriteable() const
 {
--- trunk/extragear/multimedia/amarok/src/collection/CollectionLocation.h \
#815020:815021 @@ -54,6 +54,9 @@
 
     Implementations which are only readable can reimplement getKIOCopyableUrls( \
                Meta::TrackList )
     if it is necessary, but can use the default implementations if possible.
+
+    Implementations that have a string expressable location(s), such as a URL or \
path on disk +    should reimplement actualLocation(). 
  
     Implementations that need additional information provided by the user have to \
                implement
     showSourceDialog() and showDestinationDialog(), depending on whether the \
information is required @@ -96,6 +99,15 @@
         virtual QString prettyLocation() const;
 
         /**
+            Returns a list of machine usable strings representingthe collection \
location. For example, +            a local collection would return a list of paths \
where tracks are stored, while an Ampache  +            collection would return a \
list with one string containing the URL of an ampache server. +            An iPod \
collection and a MTP device collection are examples of collections that do +          \
not need to reimplement this method. +        */
+        virtual QStringList actualLocation() const;
+
+        /**
             Returns whether the collection location is writeable or not. For \
                example, a local collection or an ipod
             collection would return true, a daap collection or a service collection \
                false. The value returned by this
             method indicates if it is possible to copy tracks to the collection, and \
                if it is generally possible to
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/SqlCollectionLocation.cpp \
#815020:815021 @@ -62,6 +62,11 @@
     return i18n( "Local Collection" );
 }
 
+QStringList
+SqlCollectionLocation::actualLocation() const
+{
+    return MountPointManager::instance()->collectionFolders();
+}
 bool
 SqlCollectionLocation::isWriteable() const
 {
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/SqlCollectionLocation.h \
#815020:815021 @@ -36,6 +36,7 @@
         virtual ~SqlCollectionLocation();
 
         virtual QString prettyLocation() const;
+        virtual QStringList actualLocation() const;
         virtual bool isWriteable() const;
         virtual bool isOrganizable() const;
         virtual bool remove( const Meta::TrackPtr &track );
--- trunk/extragear/multimedia/amarok/src/dbus/amarokdbushandler.cpp #815020:815021
@@ -29,6 +29,7 @@
 #include "collection/CollectionManager.h"
 #include "collection/SqlStorage.h"
 #include "collection/sqlcollection/SqlCollection.h"
+#include "collection/sqlcollection/SqlCollectionLocation.h"
 #include "context/LyricsManager.h"
 #include "EngineController.h"
 #include "equalizersetup.h"
@@ -848,18 +849,9 @@
         Q_UNUSED( path );
         return false;
     }
-    QString DbusCollectionHandler::mainCollectionPath()
+    QStringList DbusCollectionHandler::collectionLocation()
     {
-        /*The main collection path is defined as the first path encountered*/
-        QStringList folders = MountPointManager::instance()->collectionFolders();
-
-        QString firstPath = "NONE";
-
-        if(!folders.isEmpty()) {
-            firstPath = folders[0];
-        }
-
-        return firstPath;
+        return CollectionManager::instance()->primaryCollection()->location()->actualLocation();
  }
     bool DbusCollectionHandler::moveFile( const QString &oldURL, const QString \
&newURL, bool overwrite )  {
--- trunk/extragear/multimedia/amarok/src/dbus/amarokdbushandler.h #815020:815021
@@ -183,7 +183,7 @@
       virtual int totalGenres();
       virtual int totalTracks();
       virtual bool isDirInCollection( const QString &path );
-      virtual QString mainCollectionPath();
+      virtual QStringList collectionLocation();
       virtual bool moveFile( const QString &oldURL, const QString &newURL, bool \
overwrite );  virtual QStringList query(const QString& sql);
       virtual QStringList similarArtists( int artists );
--- trunk/extragear/multimedia/amarok/src/dbus/org.kde.amarok.collection.xml \
#815020:815021 @@ -56,8 +56,8 @@
       <arg name="url" type="s" direction="in"/>
       <arg name="oldLabel" type="as" direction="in"/>
     </method>
-    <method name="mainCollectionPath" >
-        <arg type="s" direction="out"/>
+    <method name="collectionLocation" >
+        <arg type="as" direction="out"/>
     </method>
   </interface>
 </node>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic