- Bug #156176: Added downloads() function.
authorMarius Tomaschewski <mt@suse.de>
Thu, 9 Mar 2006 02:45:19 +0000 (02:45 +0000)
committerMarius Tomaschewski <mt@suse.de>
Thu, 9 Mar 2006 02:45:19 +0000 (02:45 +0000)
zypp/media/MediaAccess.cc
zypp/media/MediaAccess.h
zypp/media/MediaHandler.h
zypp/media/MediaManager.cc
zypp/media/MediaManager.h

index 389dd1d..1a7fc2b 100644 (file)
@@ -135,6 +135,12 @@ MediaAccess::protocol() const
   return _handler->protocol();
 }
 
+bool
+MediaAccess::downloads() const
+{
+       return _handler ? _handler->downloads() : false;
+}
+
 ///////////////////////////////////////////////////////////////////
 //
 //
index 40c1250..f2103eb 100644 (file)
@@ -97,6 +97,11 @@ namespace zypp {
        bool isOpen() const { return( _handler != 0 ); }
 
        /**
+        * Hint if files are downloaded or not.
+        */
+       bool        downloads() const;
+
+       /**
         * Used Protocol if media is opened, otherwise 'unknown'.
         **/
         std::string protocol() const;
index fc748c8..12218d7 100644 (file)
@@ -382,6 +382,11 @@ class MediaHandler {
         //
         ///////////////////////////////////////////////////////////////////
 
+       /**
+        * Hint if files are downloaded or not.
+        */
+       bool        downloads() const { return _does_download; }
+
         /**
         * Protocol hint for MediaAccess.
         **/
index d64e7ed..2b46dcc 100644 (file)
@@ -264,6 +264,17 @@ namespace zypp
     }
 
     // ---------------------------------------------------------------
+         bool
+    MediaManager::downloads(MediaAccessId accessId) const
+    {
+      MutexLock glock(g_Mutex);
+
+      ManagedMedia &ref( m_impl->findMM(accessId));
+
+      return ref.handler->downloads();
+    }
+
+    // ---------------------------------------------------------------
     Url
     MediaManager::url(MediaAccessId accessId) const
     {
index e2096ea..9c9cde8 100644 (file)
@@ -199,6 +199,12 @@ namespace zypp
       protocol(MediaAccessId accessId) const;
 
       /**
+            * Hint if files are downloaded or not.
+            */
+           bool
+      downloads(MediaAccessId accessId) const;
+
+      /**
        * Url of the media access id, otherwise empty Url.
        *
        * \throws MediaNotOpenException for invalid access id.