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

svn at pcbsd.org svn at pcbsd.org
Wed Feb 10 09:34:43 PST 2010


Author: kris
Date: 2010-02-10 09:34:43 -0800 (Wed, 10 Feb 2010)
New Revision: 6218

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

Fixed up the downloading / installs of PBIs when compiled on QT 4.6.x and
their annoying QUrl reformatting :(



Modified: pcbsd/trunk/SoftwareManager/softmanager-main.h
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.h	2010-02-10 16:52:30 UTC (rev 6217)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.h	2010-02-10 17:34:43 UTC (rev 6218)
@@ -167,6 +167,7 @@
     KMenu *popup;
     QString PBIDIRSID;
     QString PBISIDBuffer;
+    QString PBIUrl;
 
     KJob *copyJob;
     KJob *sysFetchJob;

Modified: pcbsd/trunk/SoftwareManager/softmanager-webview.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2010-02-10 16:52:30 UTC (rev 6217)
+++ pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2010-02-10 17:34:43 UTC (rev 6218)
@@ -185,25 +185,23 @@
    if ( rawHTML.indexOf("<!-- SM -->") == -1 )
      startPBIDirLoad(); // Need to re-auth and get a SID
 
-   return;
 
-   // This is just a stub for now
-   // Later we may setup a built-in PBI download button, and this code
-   // will detect if a pbi:// link is present
+  // Detect if we have a PBI download link
+  // KPM Eventually do away with download link on page, add nice button
 
-  // QString rawHTML = webPBIView->page()->mainFrame()->toHtml();
-  // qDebug(rawHTML.toLatin1());
-  // if ( rawHTML.indexOf("pbi://") != -1 )
-  // {
-  //   QString pbiURL = rawHTML.remove(0, rawHTML.indexOf("pbi://") );
-  //   pbiURL.truncate(pbiURL.indexOf('"'));
-  //   //QMessageBox::critical( 0, tr("Update Manager"), pbiURL, QMessageBox::Ok );        
-  // }
+  //qDebug(rawHTML.toLatin1());
+  if ( rawHTML.indexOf("pbi://") != -1 )
+  {
+    PBIUrl = rawHTML.remove(0, rawHTML.indexOf("pbi://") );
+    PBIUrl.truncate(PBIUrl.indexOf('"'));
+    //QMessageBox::critical( 0, tr("Update Manager"), pbiURL, QMessageBox::Ok );        
+  }
+  return;
 }
 
 void PBM::slotPBIWebLinkUrlChanged( const QUrl &url)
 {
-  if ( url.toString().indexOf("pbi://") != 0 && url.toString().indexOf("http://www.pbidir.com") != 0 )
+  if ( url.toString().indexOf("pbi:") != 0 && url.toString().indexOf("http://www.pbidir.com") != 0 )
   {
     webPBIView->stop();
     webPBIView->back();
@@ -213,35 +211,39 @@
 
 void PBM::slotPBIWebLinkClicked( const QUrl &url)
 {
+   
+  //QMessageBox::critical( 0, tr("Update Manager"), url.toString(), QMessageBox::Ok );        
+
+
   // Trigger a download of a new PBI
-  if ( url.toString().indexOf("pbi://") == 0 )
+  if ( url.toString().indexOf("pbi:") == 0 )
   {
-
+    //QMessageBox::critical( 0, tr("Update Manager"), PBIUrl, QMessageBox::Ok );        
     // Get the name of this PBI
-    QString tmpurl = url.toString();
+    QString tmpurl = PBIUrl;
     QString name = tmpurl.remove(0, tmpurl.indexOf("name=") + 5);
     if ( name.indexOf('&') != -1 )
       name.truncate(name.indexOf("&"));
 
     // Get the version
-    tmpurl = url.toString();
+    tmpurl = PBIUrl;
     QString version = tmpurl.remove(0, tmpurl.indexOf("ver=") + 4);
     if ( version.indexOf('&') != -1 )
       version.truncate(version.indexOf("&"));
 
     // Get the URL
-    tmpurl = url.toString();
+    tmpurl = PBIUrl;
     QString pbiurl = tmpurl.remove(0, tmpurl.indexOf("url=") + 4);
     if ( pbiurl.indexOf('&') != -1 )
       pbiurl.truncate(pbiurl.indexOf("&"));
 
-    tmpurl = url.toString();
+    tmpurl = PBIUrl;
     QString mirror = tmpurl.remove(0, tmpurl.indexOf("mirror=") + 7);
     if ( mirror.indexOf('&') != -1 )
       mirror.truncate(mirror.indexOf("&"));
     
     // Show the URL we are working on
-    qDebug(url.toString().toLatin1());        
+    qDebug() << PBIUrl;        
 
     switch( QMessageBox::warning( this, tr("Install Software?"), tr("Do you want to install") + " " + name + " " + version + "?", tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {
             case 0: // The user clicked the OK again button or pressed Enter



More information about the Commits mailing list