[PC-BSD Commits] r7389 - pcbsd/current/src-qt4/pc-softwaremanager

svn at pcbsd.org svn at pcbsd.org
Tue Aug 17 13:23:47 PDT 2010


Author: kris
Date: 2010-08-17 13:23:47 -0700 (Tue, 17 Aug 2010)
New Revision: 7389

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp
   pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h
   pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.ui
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
Log:

Large update tp pc-softwaremanager, added support to configuring mirrors for pbi_add -r, and created support for enabing proxy server communication for both pbi_add -r and the QT portition of the tool as well.



Modified: pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp	2010-08-17 20:23:47 UTC (rev 7389)
@@ -20,16 +20,19 @@
 #include "softmanager-main.h"
 #include "ui_softconfigwidget.h"
 
+
+
+
 void softwareConfigWidget::programInit()
 {
   // Our buttons / slots
-  connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) );
   connect( pushSave, SIGNAL( clicked() ), this, SLOT( slotSaveClicked() ) );
   connect( pushCancel, SIGNAL( clicked() ), this, SLOT( slotCancelClicked() ) );
   connect( pushRefreshList, SIGNAL( clicked() ), this, SLOT( slotUpdateMirrorList() ) );
+  connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyChecked() ) );
+  connect( checkProxyUser, SIGNAL( clicked() ), this, SLOT( slotProxyUserChecked() ) );
 
   // Connect the mirror radio buttons, so we can enable / disable objects based on status
-  connect( radioAutoMirror, SIGNAL( clicked() ), this, SLOT( slotCheckMirrorRadio() ) );
   connect( radioSelectMirror, SIGNAL( clicked() ), this, SLOT( slotCheckMirrorRadio() ) );
   connect( radioCustomMirror, SIGNAL( clicked() ), this, SLOT( slotCheckMirrorRadio() ) );
 
@@ -70,19 +73,13 @@
 {
   // Save the user preferences for the System Updater
   QSettings settings("PCBSD");
+  QString curMirror;
 
-  // Load the custom tmpdir string
-  QString tmpDir = lineTMPDIR->text();
-  settings.setValue( "/PC-BSD/SoftwareManager/tmpDir", tmpDir );
-
-  if (radioAutoMirror->isChecked() )
-     settings.setValue("/PC-BSD/SoftwareManager/mirrorType", AUTOMIRROR);
   if (radioCustomMirror->isChecked() ) {
      settings.setValue("/PC-BSD/SoftwareManager/mirrorType", CUSTOMMIRROR);
-     settings.setValue("/PC-BSD/SoftwareManager/currentMirror", lineCustomMirror->text() );
+     curMirror = lineCustomMirror->text();
   }
 
-  // Save the update frequency
   qlonglong frequency = spinBoxUpdateFrequency->value() * 1000 * 60 * 60;
   settings.setValue("/PC-BSD/SystemUpdater/checkUpdateFrequency", frequency);
 
@@ -92,12 +89,6 @@
   // Save if we are set to automatically download / install updates as system shutdown
   settings.setValue("/PC-BSD/SoftwareManager/autoDownloadUpdates", checkAutoDownloadSysUpdates->isChecked());
 
-  // Save if we are set to automatically download / install updates as system shutdown
-  settings.setValue("/PC-BSD/SoftwareManager/autoDesktopIcons", checkAutoDesktopIcons->isChecked());
-
-  // Save if we are going to keep downloaded .PBI files in the temp dir
-  settings.setValue("/PC-BSD/SoftwareManager/keepDownloadedSoftware", checkKeepDownloadedSoftware->isChecked());
-
   // Check if we have a mirror selected and save it
   if ( radioSelectMirror->isChecked() )
   {
@@ -106,13 +97,102 @@
      int i = 0;
      while ( !mirrorNames[i].isEmpty() )
      {
-       if ( comboMirrorList->currentText() == mirrorNames[i]) {
-         settings.setValue("/PC-BSD/SoftwareManager/currentMirror", mirrorURLs[i] );
-       }
+       if ( comboMirrorList->currentText() == mirrorNames[i])
+         curMirror = mirrorURLs[i];
        i++;
      }
   }
 
+  QStringList pbiConf;
+
+  // Read PBI_ETCCONF into memory
+  bool wroteMirror = false, wroteProxy = false, wroteProxyPort = false, savedLine = false;
+  bool wroteProxyUser = false, wroteProxyPass = false, wroteProxyType = false;
+  QFile confFile(PBI_ETCCONF);
+  if ( confFile.open( QIODevice::ReadOnly ) ) {
+        QTextStream stream( &confFile );
+        QString line;
+        while ( !stream.atEnd() ) {
+	    savedLine = false;
+            line = stream.readLine();
+
+	    // Check Mirror Tag
+	    if ( line.indexOf("PBI_MIRROR: ") == 0 ) {
+	      pbiConf << "PBI_MIRROR: " + curMirror;
+	      wroteMirror = true;
+	      savedLine = true;
+	    }
+
+	    if ( line.indexOf("PBI_PROXYURL: ") == 0 ) {
+	      if ( checkProxy->isChecked() ) {
+	        pbiConf << "PBI_PROXYURL: " + lineProxyAddress->text();
+	        wroteProxy = true;
+              }
+	      savedLine = true;
+	    }
+	    if ( line.indexOf("PBI_PROXYTYPE: ") == 0 ) {
+	      if ( checkProxy->isChecked() ) {
+	        if ( radioHTTPProxy->isChecked()) 
+	          pbiConf << "PBI_PROXYTYPE: HTTP";
+		else
+	          pbiConf << "PBI_PROXYTYPE: SOCKS5";
+	        wroteProxyType = true;
+              }
+	      savedLine = true;
+	    }
+	    if ( line.indexOf("PBI_PROXYUSER: ") == 0 ) {
+	      if ( checkProxy->isChecked() && checkProxyUser->isChecked() ) {
+	          pbiConf << "PBI_PROXYUSER: " + lineProxyUser->text();
+	        wroteProxyType = true;
+              }
+	      savedLine = true;
+	    }
+	    if ( line.indexOf("PBI_PROXYPASS: ") == 0 ) {
+	      if ( checkProxy->isChecked() && checkProxyUser->isChecked() ) {
+	          pbiConf << "PBI_PROXYPASS: " + lineProxyPass->text();
+	        wroteProxyType = true;
+              }
+	      savedLine = true;
+	    }
+	    if ( line.indexOf("PBI_PROXYPORT: ") == 0 ) {
+	      if ( checkProxy->isChecked() ) {
+	        pbiConf << "PBI_PROXYPORT: " + QString::number(spinProxyPort->value());
+	        wroteProxyPort = true;
+              }
+	      savedLine = true;
+	    }
+
+
+	    if (!savedLine )
+	      pbiConf << line;
+	   
+        }
+	if ( !wroteMirror)
+  	  pbiConf << "PBI_MIRROR: " + curMirror;
+	if ( !wroteProxy && checkProxy->isChecked())
+  	  pbiConf << "PBI_PROXYURL: " + lineProxyAddress->text();
+	if ( !wroteProxyPort && checkProxy->isChecked())
+	  pbiConf << "PBI_PROXYPORT: " + QString::number(spinProxyPort->value());
+	if ( !wroteProxyUser && checkProxy->isChecked() && checkProxyUser->isChecked())
+  	  pbiConf << "PBI_PROXYUSER: " + lineProxyUser->text();
+	if ( !wroteProxyPass && checkProxy->isChecked() && checkProxyUser->isChecked())
+  	  pbiConf << "PBI_PROXYPASS: " + lineProxyPass->text();
+	if ( !wroteProxyType && checkProxy->isChecked() ) {
+	  if ( radioHTTPProxy->isChecked()) 
+	     pbiConf << "PBI_PROXYTYPE: HTTP";
+	  else
+	     pbiConf << "PBI_PROXYTYPE: SOCKS5";
+        }
+   confFile.close();
+  }
+
+  if ( confFile.open( QIODevice::WriteOnly ) ) {
+        QTextStream stream( &confFile );
+	for (int i = 0; i < pbiConf.count(); ++i)
+		stream << pbiConf.at(i) << "\n";
+  }
+
+  // Save the update frequency
   // Write our Mirrors array
   settings.beginWriteArray("/PC-BSD/SoftwareManager/mirrorList");
   int i = 0;
@@ -131,13 +211,9 @@
 void softwareConfigWidget::loadSettings() {
   // Load the user preferences for the System Updater
   QSettings settings("PCBSD");
+  QString tmp;
   
-  // Load a custom tmpdir
-  QString customTmpDir= PATCHTMPDIR_DEFAULT;
-  customTmpDir = settings.value("/PC-BSD/SoftwareManager/tmpDir", customTmpDir).toString();
-  lineTMPDIR->setText( customTmpDir );
-
-    // Save the update frequency
+  // Save the update frequency
   qlonglong frequency = settings.value("/PC-BSD/SystemUpdater/checkUpdateFrequency", (12 * 1000 * 60 * 60)).toLongLong();
   frequency = (((frequency / 1000) / 60 ) / 60);
   spinBoxUpdateFrequency->setValue(frequency);
@@ -146,30 +222,57 @@
   // Load our settings for auto-updating sys and PBI
   checkAutoUpdateSoftware->setChecked(settings.value("/PC-BSD/SoftwareManager/autoUpdateSoftware", false).toBool());
   checkAutoDownloadSysUpdates->setChecked(settings.value("/PC-BSD/SoftwareManager/autoDownloadUpdates", false).toBool());
-  checkKeepDownloadedSoftware->setChecked(settings.value("/PC-BSD/SoftwareManager/keepDownloadedSoftware", false).toBool());
-  checkAutoDesktopIcons->setChecked(settings.value("/PC-BSD/SoftwareManager/autoDesktopIcons", true).toBool());
-
+  
   // Get the currently selected mirror
-  currentMirror = settings.value("/PC-BSD/SoftwareManager/currentMirror", "").toString();
+  //currentMirror = settings.value("/PC-BSD/SoftwareManager/currentMirror", "").toString();
 
-  // Load the current mirror selection type
-  switch (settings.value("/PC-BSD/SoftwareManager/mirrorType", AUTOMIRROR ).toInt() ) {
-   case AUTOMIRROR:
-      radioAutoMirror->setChecked(true);
-   break;
-   case SELECTMIRROR:
-      radioSelectMirror->setChecked(true);
-   break;
-   case CUSTOMMIRROR:
-      radioCustomMirror->setChecked(true);
-      lineCustomMirror->setText(currentMirror);
-   break;
+  // Load from PBI_ETCCONF the default mirror
+  QFile confFile(PBI_ETCCONF);
+  if ( confFile.open( QIODevice::ReadOnly ) ) {
+        QTextStream stream( &confFile );
+        stream.setCodec("UTF-8");
+        QString line;
+        while ( !stream.atEnd() ) {
+            line = stream.readLine();
+	    if ( line.indexOf("PBI_MIRROR: ") == 0 ) {
+		currentMirror = line.replace("PBI_MIRROR: ", "");
+	    }
+
+	    if ( line.indexOf("PBI_PROXYURL: ") == 0 ) {
+		lineProxyAddress->setText(line.replace("PBI_PROXYURL: ", ""));
+		checkProxy->setChecked(true);
+	    }
+
+	    if ( line.indexOf("PBI_PROXYUSER: ") == 0 ) {
+		lineProxyUser->setText(line.replace("PBI_PROXYUSER: ", ""));
+		checkProxyUser->setChecked(true);
+	    }
+
+	    if ( line.indexOf("PBI_PROXYPASS: ") == 0 )
+		lineProxyPass->setText(line.replace("PBI_PROXYPASS: ", ""));
+
+	    if ( line.indexOf("PBI_PROXYTYPE: ") == 0 ) {
+		tmp = line.replace("PBI_PROXYTYPE: ", "");
+		if ( tmp == "SOCKS5" )
+		  radioSOCKSProxy->setChecked(true);
+		else
+		  radioHTTPProxy->setChecked(true);
+            }
+
+	    if ( line.indexOf("PBI_PROXYPORT: ") == 0 ) {
+		bool ok;
+		int pPort = line.replace("PBI_PROXYPORT: ", "").toInt(&ok);
+		if (ok)
+	          spinProxyPort->setValue(pPort);
+	    }
+        }
+   confFile.close();
   }
 
-
   // Load our array of mirrors
   comboMirrorList->clear();
   bool foundMirror = false;
+  bool usingMirrorList = false;
   QString MirrorName, MirrorURL;
   int size = settings.beginReadArray("/PC-BSD/SoftwareManager/mirrorList");
   for (int i = 0; i < size; ++i) {
@@ -180,10 +283,12 @@
      comboMirrorList->addItem( MirrorName );
      mirrorNames[i] = MirrorName;
      mirrorURLs[i] = MirrorURL;
-     if ( currentMirror == MirrorURL )
-     {
+     if ( currentMirror == MirrorURL ) {
        comboMirrorList->setCurrentIndex(i);
+       radioSelectMirror->setChecked(true);
+       usingMirrorList = true;
      }
+     
   }
 
   settings.endArray();  
@@ -193,9 +298,16 @@
 
   // If our mirror list is empty, start a refresh of it now
   if ( !foundMirror)
-  {
     slotUpdateMirrorList();
+
+  // Check if we found a mirror in the PC-BSD list, otherwise default to custom mirror
+  if (!usingMirrorList) {
+      radioCustomMirror->setChecked(true);
+      lineCustomMirror->setText(currentMirror);
   }
+
+  // Enable / disable proxy settings
+  slotProxyChecked();
 }
 
 void softwareConfigWidget::slotUpdateMirrorList() {
@@ -271,12 +383,6 @@
 
 void softwareConfigWidget::slotCheckMirrorRadio() {
 
-    if( radioAutoMirror->isChecked() )
-    {
-      comboMirrorList->setEnabled(false);
-      pushRefreshList->setEnabled(false);
-      lineCustomMirror->setEnabled(false);
-    }
     if( radioSelectMirror->isChecked() )
     {
       comboMirrorList->setEnabled(true);
@@ -291,17 +397,21 @@
     }
 }
 
-void softwareConfigWidget::slotSelectCustomTmp()
-{
-   QString newDir = QFileDialog::getExistingDirectory( this,
-                    tr("Select Temp directory"),
-                    "/");
-     
-   // Check if the user just hit cancel
-   if ( newDir.isEmpty() )
-   {
-      return; 
-   }
+void softwareConfigWidget::slotProxyChecked() {
+  if ( checkProxy->isChecked() )
+    groupProxySettings->setEnabled(true);
+  else
+    groupProxySettings->setEnabled(false);
 
-   lineTMPDIR->setText(newDir);
+  slotProxyUserChecked();
 }
+
+void softwareConfigWidget::slotProxyUserChecked() {
+  if ( checkProxyUser->isChecked() ) {
+    lineProxyUser->setEnabled(true);
+    lineProxyPass->setEnabled(true);
+  } else {
+    lineProxyUser->setEnabled(false);
+    lineProxyPass->setEnabled(false);
+  }
+}

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h	2010-08-17 20:23:47 UTC (rev 7389)
@@ -7,6 +7,8 @@
 
 #include "ui_softconfigwidget.h"
 
+#define PBI_ETCCONF "/usr/local/etc/pbi.conf"
+
 class softwareConfigWidget : public QDialog, private Ui::softwareConfigWidget
 {
 	Q_OBJECT
@@ -27,11 +29,12 @@
         void slotSaveClicked();
         bool sanityCheckSettings();
         void slotCancelClicked();
-        void slotSelectCustomTmp();
         void slotUpdateMirrorList();
         void slotRefreshMirrorDone();
         void slotCheckMirrorRadio();
 	void slotGetMirrorData();
+	void slotProxyChecked();
+	void slotProxyUserChecked();
 private:
         void saveSettings();
         void loadSettings();

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.ui
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.ui	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.ui	2010-08-17 20:23:47 UTC (rev 7389)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>434</width>
-    <height>307</height>
+    <width>376</width>
+    <height>451</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -35,23 +35,13 @@
          </property>
          <layout class="QGridLayout" name="gridLayout_4">
           <item row="0" column="0">
-           <widget class="QRadioButton" name="radioAutoMirror">
-            <property name="text">
-             <string>Automatic Mirror Selection</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="0">
            <widget class="QRadioButton" name="radioSelectMirror">
             <property name="text">
              <string>Select Mirror from list</string>
             </property>
            </widget>
           </item>
-          <item row="2" column="0">
+          <item row="1" column="0">
            <layout class="QHBoxLayout" name="horizontalLayout_3">
             <item>
              <spacer name="horizontalSpacer_2">
@@ -94,14 +84,14 @@
             </item>
            </layout>
           </item>
-          <item row="3" column="0">
+          <item row="2" column="0">
            <widget class="QRadioButton" name="radioCustomMirror">
             <property name="text">
              <string>Specify a custom Mirror</string>
             </property>
            </widget>
           </item>
-          <item row="4" column="0">
+          <item row="3" column="0">
            <layout class="QHBoxLayout" name="horizontalLayout_4">
             <item>
              <spacer name="horizontalSpacer_3">
@@ -127,6 +117,19 @@
          </layout>
         </widget>
        </item>
+       <item row="1" column="0">
+        <spacer name="verticalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_2">
@@ -140,56 +143,22 @@
           <string>Download and install software updates automatically.</string>
          </property>
          <property name="text">
-          <string>Automatically update software</string>
+          <string>Automatically update applications</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="0">
-        <spacer name="verticalSpacer_2">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>195</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="2" column="0">
-        <widget class="QCheckBox" name="checkKeepDownloadedSoftware">
-         <property name="text">
-          <string>Keep downloaded software in temporary directory</string>
-         </property>
-        </widget>
-       </item>
        <item row="1" column="0">
-        <widget class="QCheckBox" name="checkAutoDesktopIcons">
-         <property name="text">
-          <string>Automatically create desktop icons</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="tab_3">
-      <attribute name="title">
-       <string>System</string>
-      </attribute>
-      <layout class="QGridLayout" name="gridLayout_6">
-       <item row="1" column="0">
         <widget class="QCheckBox" name="checkAutoDownloadSysUpdates">
          <property name="toolTip">
           <string>This will download updates in the background, and install them at shutdown.</string>
          </property>
          <property name="text">
-          <string>Automatically install available updates</string>
+          <string>Automatically install system updates</string>
          </property>
         </widget>
        </item>
        <item row="2" column="0">
-        <spacer name="verticalSpacer_3">
+        <spacer name="verticalSpacer_2">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
@@ -205,113 +174,215 @@
      </widget>
      <widget class="QWidget" name="tab_4">
       <attribute name="title">
-       <string>Misc</string>
+       <string>Network</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_2">
+      <layout class="QGridLayout" name="gridLayout_8">
        <item row="0" column="0">
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QLabel" name="label">
-           <property name="text">
-            <string>Temporary file directory:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLineEdit" name="lineTMPDIR">
-           <property name="readOnly">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="pushTMPDIR">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>28</width>
-             <height>28</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>28</width>
-             <height>28</height>
-            </size>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="icon">
-            <iconset resource="SoftwareManager.qrc">
-             <normaloff>:/folder.png</normaloff>:/folder.png</iconset>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>20</width>
-             <height>20</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-        </layout>
+        <widget class="QCheckBox" name="checkProxy">
+         <property name="text">
+          <string>Use Proxy Server</string>
+         </property>
+        </widget>
        </item>
        <item row="1" column="0">
-        <layout class="QHBoxLayout" name="horizontalLayout_5">
-         <item>
-          <widget class="QLabel" name="label_2">
-           <property name="text">
-            <string>Check for updates every</string>
-           </property>
-           <property name="alignment">
-            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="spinBoxUpdateFrequency">
-           <property name="minimum">
-            <number>1</number>
-           </property>
-           <property name="maximum">
-            <number>48</number>
-           </property>
-           <property name="singleStep">
-            <number>1</number>
-           </property>
-           <property name="value">
-            <number>12</number>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>hours</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_4">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
+        <widget class="QGroupBox" name="groupProxySettings">
+         <property name="title">
+          <string>Proxy Configuration</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_7">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label">
+            <property name="text">
+             <string>Server Address</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLineEdit" name="lineProxyAddress"/>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_4">
+            <property name="text">
+             <string>Port Number</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QSpinBox" name="spinProxyPort">
+              <property name="maximum">
+               <number>99999</number>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_5">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+          <item row="4" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Proxy Type</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout_6">
+            <item>
+             <widget class="QRadioButton" name="radioHTTPProxy">
+              <property name="text">
+               <string>HTTP</string>
+              </property>
+              <property name="checked">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QRadioButton" name="radioSOCKSProxy">
+              <property name="text">
+               <string>SOCKS5</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_6">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+          <item row="6" column="0">
+           <widget class="QCheckBox" name="checkProxyUser">
+            <property name="text">
+             <string>Specify a Username / Password</string>
+            </property>
+           </widget>
+          </item>
+          <item row="7" column="0">
+           <layout class="QGridLayout" name="gridLayout_6">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_6">
+              <property name="text">
+               <string>Username</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1" rowspan="2">
+             <spacer name="horizontalSpacer_7">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>13</width>
+                <height>38</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item row="0" column="2">
+             <widget class="QLabel" name="label_7">
+              <property name="text">
+               <string>Password</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QLineEdit" name="lineProxyUser"/>
+            </item>
+            <item row="1" column="2">
+             <widget class="QLineEdit" name="lineProxyPass">
+              <property name="echoMode">
+               <enum>QLineEdit::Password</enum>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
        </item>
        <item row="2" column="0">
+        <widget class="QGroupBox" name="groupBox_3">
+         <property name="title">
+          <string>Checker Frequency</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_2">
+          <item row="0" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout_5">
+            <item>
+             <widget class="QLabel" name="label_2">
+              <property name="text">
+               <string>Check for updates every</string>
+              </property>
+              <property name="alignment">
+               <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="spinBoxUpdateFrequency">
+              <property name="minimum">
+               <number>1</number>
+              </property>
+              <property name="maximum">
+               <number>48</number>
+              </property>
+              <property name="singleStep">
+               <number>1</number>
+              </property>
+              <property name="value">
+               <number>12</number>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_3">
+              <property name="text">
+               <string>hours</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_4">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="3" column="0">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2010-08-17 20:23:47 UTC (rev 7389)
@@ -51,7 +51,6 @@
    pbistatus = PBI_UPDATED;
    isWorkingOnPBI = false;
    autoUpdateSoftware = false;
-   keepDownloadedSoftware = false;
 
    // Load the program preferences
    slotLoadSettings();
@@ -544,32 +543,71 @@
   if ( Lang == "C" )
     Lang = "en";
 
-  
   // Load a custom tmpdir
   customTmpDir= PATCHTMPDIR_DEFAULT;
-  customTmpDir = settings.value("/PC-BSD/SoftwareManager/tmpDir", customTmpDir).toString();
 
+  QString ProxyUser, ProxyPass, ProxyType, ProxyAddress;
+  int ProxyPort = 0;
+
   // Get the currently selected mirror
-  mirrorURL = settings.value("/PC-BSD/SoftwareManager/currentMirror", "").toString();
+  QFile confFile(PBI_ETCCONF);
+  if ( confFile.open( QIODevice::ReadOnly ) ) {
+        QTextStream stream( &confFile );
+        stream.setCodec("UTF-8");
+        QString line;
+        while ( !stream.atEnd() ) {
+            line = stream.readLine();
+	    if ( line.indexOf("PBI_MIRROR: ") == 0 )
+		mirrorURL = line.replace("PBI_MIRROR: ", "");
 
-  // Load the current mirror selection type
-  mirrorType = settings.value("/PC-BSD/SoftwareManager/mirrorType", AUTOMIRROR).toInt();
+	    if ( line.indexOf("PBI_PROXYURL: ") == 0 )
+		ProxyAddress = line.replace("PBI_PROXYURL: ", "");
 
+	    if ( line.indexOf("PBI_PROXYTYPE: ") == 0 )
+		ProxyType = line.replace("PBI_PROXYTYPE: ", "");
+
+	    if ( line.indexOf("PBI_PROXYUSER: ") == 0 )
+		ProxyUser = line.replace("PBI_PROXYUSER: ", "");
+
+	    if ( line.indexOf("PBI_PROXYPASS: ") == 0 )
+		ProxyPass = line.replace("PBI_PROXYPASS: ", "");
+
+	    if ( line.indexOf("PBI_PROXYPORT: ") == 0 ) {
+		bool ok;
+		int pPort = line.replace("PBI_PROXYPORT: ", "").toInt(&ok);
+		if (ok)
+	          ProxyPort = pPort;
+	    }
+        }
+   confFile.close();
+  }
+
+  // Enable / disable the proxy
+  if (! ProxyAddress.isEmpty() ) 
+  {
+     QNetworkProxy proxy;
+     if ( ProxyType == "SOCKS5" )
+       proxy.setType(QNetworkProxy::Socks5Proxy);
+     else
+       proxy.setType(QNetworkProxy::HttpProxy);
+
+     proxy.setHostName(ProxyAddress);
+     proxy.setPort(ProxyPort);
+
+     if ( ! ProxyUser.isEmpty() )
+       proxy.setUser(ProxyUser);
+     if ( ! ProxyPass.isEmpty() )
+       proxy.setPassword(ProxyPass);
+
+     QNetworkProxy::setApplicationProxy(proxy);
+  } else {
+     QNetworkProxy proxy;
+     proxy.setType(QNetworkProxy::NoProxy);
+     QNetworkProxy::setApplicationProxy(proxy);
+  }
+
   // Auto Update Software
   autoUpdateSoftware = settings.value("/PC-BSD/SoftwareManager/autoUpdateSoftware", false).toBool();
 
-  // Auto-create desktop icons
-  autoDesktopIcons = settings.value("/PC-BSD/SoftwareManager/autoDesktopIcons", true).toBool();
-
-  // Keep downloaded PBIs in the tmpdir
-  keepDownloadedSoftware = settings.value("/PC-BSD/SoftwareManager/keepDownloadedSoftware", false).toBool();
-
 }
 
-void PBM::slotLaunchKDEProxyConfig()
-{
-   QString command;
-   command = "su " + RealUserName + " -c 'kcmshell4 proxy' &";
-   system(command.toLatin1()); 
-   QMessageBox::information( 0, tr("Proxy Configuration!"), tr("You will need to restart the system updater for any proxy changes to take effect!"), QMessageBox::Ok );
-}

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2010-08-17 20:23:47 UTC (rev 7389)
@@ -16,6 +16,7 @@
 #include <QNetworkAccessManager>
 #include <QNetworkRequest>
 #include <QNetworkReply>
+#include <QNetworkProxy>
 #include <QDebug>
 
 /* Local Includes */
@@ -27,8 +28,11 @@
 #include "ui_softconfigwidget.h"
 
 /* Change this to switch the default patch tmpdir */
-#define  PATCHTMPDIR_DEFAULT "/usr/local/tmp"
+#define PATCHTMPDIR_DEFAULT "/usr/local/tmp"
 
+// The default pbi.conf file
+#define PBI_ETCCONF "/usr/local/etc/pbi.conf"
+
 // Set our defines for the type of mirror the user is running
 #define AUTOMIRROR      0
 #define SELECTMIRROR    1
@@ -83,7 +87,6 @@
     void slotReadInstallScriptOutput();
     void slotStartCheckAvailSysSpace();
     void slotStartPBIUpgrades();
-    void slotLaunchKDEProxyConfig();
     void slotRescanForUpdates();
     void slotViewDetailsClicked();
     void slotSelectAllSys();
@@ -227,8 +230,6 @@
     QTreeWidgetItemIterator *currentWorkingPBI;
     bool isWorkingOnPBI;
     bool autoUpdateSoftware;
-    bool autoDesktopIcons;
-    bool keepDownloadedSoftware;
 
 signals:
 

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2010-08-17 19:53:44 UTC (rev 7388)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2010-08-17 20:23:47 UTC (rev 7389)
@@ -52,6 +52,7 @@
 
   // If we've gotten this far, we have a new PBI to check for updates to!
   item->setText(1, tr("Checking for Updates..."));
+  qDebug() << "Starting update check for:" << item->getProgIndexName();
 
   checkPBIProc = new QProcess();
   checkPBIProc->setProcessChannelMode(QProcess::MergedChannels);
@@ -67,8 +68,9 @@
     QString output, tmp;
 
     // Read in the output from the update service
-    output = checkPBIProc->readAll().simplified();
+    output = checkPBIProc->readAll();
 
+    qDebug() << "Update Return:" << output;
 
     if ( output.indexOf("Available:") == -1  && ! output.isEmpty())
     {



More information about the Commits mailing list