[PC-BSD Commits] r6333 - pcbsd/trunk/SoftwareManager

svn at pcbsd.org svn at pcbsd.org
Wed Mar 3 07:32:16 PST 2010


Author: kris
Date: 2010-03-03 07:32:16 -0800 (Wed, 03 Mar 2010)
New Revision: 6333

Modified:
   pcbsd/trunk/SoftwareManager/softmanager-main.cpp
   pcbsd/trunk/SoftwareManager/softmanager-main.h
   pcbsd/trunk/SoftwareManager/softmanager-webview.cpp
Log:

Added option to check for PBI's being loaded with a fuzzy name, fixes problems with pbidir having different
spacing / capitalization in the DB and it not matching with whats installed local-side



Modified: pcbsd/trunk/SoftwareManager/softmanager-main.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.cpp	2010-03-03 14:56:53 UTC (rev 6332)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.cpp	2010-03-03 15:32:16 UTC (rev 6333)
@@ -272,6 +272,25 @@
   return tmp;
 }
 
+// Function which looks for PBI name matches with no spaces / case insensitve
+bool PBM::checkPBILoadedFuzzy(QString name)
+{
+  QString tmp, tmp2;
+  tmp = name.toUpper();
+  tmp = tmp.replace(" ", "");
+
+  QTreeWidgetItemIterator it(SoftwareListBox);
+  while (*it) {
+    PBI *item = dynamic_cast<PBI*>(*it);
+    tmp2 = item->getName().toUpper();
+    tmp2 = tmp2.replace(" ", "");
+    if ( tmp == tmp2 )
+       return true; 
+    ++it;
+  }
+  return false;
+}
+
 // Function which checks if we already have a PBI with this name in the Tree
 bool PBM::checkPBILoaded(QString name)
 {
@@ -282,7 +301,6 @@
        return true; 
     ++it;
   }
-
   return false;
 }
 

Modified: pcbsd/trunk/SoftwareManager/softmanager-main.h
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.h	2010-03-03 14:56:53 UTC (rev 6332)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.h	2010-03-03 15:32:16 UTC (rev 6333)
@@ -145,6 +145,7 @@
     void RemovePBI( PBI * pbi );
     void generateCopyLabel();
     bool checkPBILoaded(QString name);
+    bool checkPBILoadedFuzzy(QString name);
     PBI *getPBIFromName(QString name);
     void startPBIDirLoad();
     void scheduleNewPBIDownload(QString name, QString ver, QString url, QString mirror);

Modified: pcbsd/trunk/SoftwareManager/softmanager-webview.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2010-03-03 14:56:53 UTC (rev 6332)
+++ pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2010-03-03 15:32:16 UTC (rev 6333)
@@ -248,7 +248,7 @@
     qDebug() << PBIUrl;        
 
     // Add extra warning that we are replacing existing PBI
-    if ( checkPBILoaded(name))
+    if ( checkPBILoadedFuzzy(name))
       replaceStr = " (" + tr("Will replace existing version") + ")"; 
 
     switch( QMessageBox::warning( this, tr("Install Software?"), tr("Do you want to install") + " " + name + " " + version + "?" + replaceStr, tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {



More information about the Commits mailing list