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

List:       kde-commits
Subject:    playground/network/smb4k/core
From:       Alexander Reinholdt <alexander.reinholdt () kdemail ! net>
Date:       2013-06-09 18:53:40
Message-ID: 20130609185340.E46BDAC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1357415 by areinholdt:

Improved searching for known shares. Now the list of mounted 
shares is also taken into account.


 M  +36 -2     smb4kbookmarkhandler.cpp  


--- trunk/playground/network/smb4k/core/smb4kbookmarkhandler.cpp #1357414:1357415
@@ -113,13 +113,15 @@
 
 void Smb4KBookmarkHandler::addBookmark( const QUrl & url )
 {
+  QList<Smb4KShare *> shares; 
+  
+  // First, search the list of shares gathered by 
+  // the scanner.
   for ( int i = 0; i < sharesList().size(); ++i )
   {
     if ( sharesList().at( i )->url() == url )
     {
-      QList<Smb4KShare *> shares;
       shares << sharesList().at( i );
-      addBookmarks( shares, 0 );
       break;
     }
     else
@@ -127,9 +129,41 @@
       continue;
     }
   }
+  
+  // Second, if the list is still empty, try the list 
+  // of mounted shares.
+  if ( shares.isEmpty() )
+  {
+    for ( int i = 0; i < mountedSharesList().size(); ++i )
+    {
+      if ( mountedSharesList().at( i )->url() == url )
+      {
+        shares << mountedSharesList().at( i );
+        break;
 }
+      else
+      {
+        continue;
+      }
+    }
+  }
+  else
+  {
+    // Do nothing
+  }
 
+  // Now add the share.
+  if ( !shares.isEmpty() )
+  {
+    addBookmarks( shares, 0 );
+  }
+  else
+  {
+    // Do nothing
+  }
+}
 
+
 void Smb4KBookmarkHandler::addBookmarks( const QList<Smb4KShare *> &list, QWidget *parent )
 {
   // Prepare the list of bookmarks and show the save dialog.
[prev in list] [next in list] [prev in thread] [next in thread] 

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