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

svn at pcbsd.org svn at pcbsd.org
Mon Dec 28 10:23:28 PST 2009


Author: kris
Date: 2009-12-28 10:23:28 -0800 (Mon, 28 Dec 2009)
New Revision: 5699

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

Fixed some bugs in trac, use konq for external links, re-auth if software manager times out with pbidir



Modified: pcbsd/trunk/SoftwareManager/softmanager-main.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.cpp	2009-12-28 17:22:42 UTC (rev 5698)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.cpp	2009-12-28 18:23:28 UTC (rev 5699)
@@ -74,6 +74,7 @@
    connect(webPBIView, SIGNAL( loadFinished(bool) ), this, SLOT(slotPBIWebLoadFinished(bool) ) );
    connect(webPBIView, SIGNAL( loadProgress(int) ), this, SLOT(slotPBIWebLoadProgress(int) ) );
    connect(webPBIView, SIGNAL( linkClicked(const QUrl &) ), this, SLOT(slotPBIWebLinkClicked(const QUrl &) ) );
+   connect(webPBIView, SIGNAL( urlChanged(const QUrl &) ), this, SLOT(slotPBIWebLinkUrlChanged(const QUrl &) ) );
 
    // Connect the SoftwareListBox with right-click menu
    SoftwareListBox->setContextMenuPolicy( Qt::CustomContextMenu);

Modified: pcbsd/trunk/SoftwareManager/softmanager-main.h
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.h	2009-12-28 17:22:42 UTC (rev 5698)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.h	2009-12-28 18:23:28 UTC (rev 5699)
@@ -125,6 +125,7 @@
     void slotPBIWebLoadFinished(bool ok);
     void slotPBIWebLoadProgress(int progress);
     void slotPBIWebLinkClicked(const QUrl &url);
+    void slotPBIWebLinkUrlChanged(const QUrl &url);
     void slotQuitButtonClicked();
     void slotRefreshButtonClicked();
     void slotStopButtonClicked();

Modified: pcbsd/trunk/SoftwareManager/softmanager-webview.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2009-12-28 17:22:42 UTC (rev 5698)
+++ pcbsd/trunk/SoftwareManager/softmanager-webview.cpp	2009-12-28 18:23:28 UTC (rev 5699)
@@ -83,8 +83,8 @@
      else
        bits = "32";
 
-     QString url = "http://www.pbidir.com/bt/set/lang/" + Lang + "/bits/" + bits + "/ver/" + Version +  \
-                   "/is_client/true?PDirSID=" + PBIDIRSID;
+     QString url = "http://www.pbidir.com/bt/set/lang/" + Lang + "/bits/" + bits + "/ver/" + Version + "/is_client/true?PDirSID=" + PBIDIRSID;
+     //QMessageBox::critical( 0, tr("Update Manager"), url, QMessageBox::Ok );        
      setPBISIDJob = KIO::http_post( url, postData.toUtf8(), KIO::HideProgressInfo);
      connect(setPBISIDJob, SIGNAL(result(KJob *)), this, SLOT(slotPBIsetSIDDone(KJob *)) );
      progressPBIWeb->setValue(5);
@@ -179,22 +179,37 @@
 
 void PBM::slotParseHtmlForDownloadURL()
 {
+   // Check if we have a SM tag, and if not re-auth
+   QString rawHTML = webPBIView->page()->mainFrame()->toHtml();
+   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
 
-   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 );        
-   }
+  // 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 );        
+  // }
 }
 
+void PBM::slotPBIWebLinkUrlChanged( const QUrl &url)
+{
+  if ( url.toString().indexOf("pbi://") != 0 && url.toString().indexOf("http://www.pbidir.com") != 0 )
+  {
+    webPBIView->stop();
+    webPBIView->back();
+    system("konqueror " + url.toString().toLatin1() + " &");
+  }
+}
+
 void PBM::slotPBIWebLinkClicked( const QUrl &url)
 {
   // Trigger a download of a new PBI



More information about the Commits mailing list