[PC-BSD Commits] r16061 - pcbsd/current/src-qt4/warden/src

svn at pcbsd.org svn at pcbsd.org
Wed Mar 28 10:31:42 PDT 2012


Author: kris
Date: 2012-03-28 17:31:42 +0000 (Wed, 28 Mar 2012)
New Revision: 16061

Added:
   pcbsd/current/src-qt4/warden/src/dialogEditIP.cpp
   pcbsd/current/src-qt4/warden/src/dialogEditIP.h
   pcbsd/current/src-qt4/warden/src/dialogEditIP.ui
Modified:
   pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
   pcbsd/current/src-qt4/warden/src/dialogwarden.h
   pcbsd/current/src-qt4/warden/src/dialogwarden.ui
   pcbsd/current/src-qt4/warden/src/src.pro
Log:

Update warden, add dialog for editing additional IPs, cleanup tool buttons with ones
that will be functional for 9.1



Index: pcbsd/current/src-qt4/warden/src/dialogEditIP.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogEditIP.ui	2012-03-28 17:30:59 UTC (rev 16060)
+++ pcbsd/current/src-qt4/warden/src/dialogEditIP.ui	2012-03-28 17:31:42 UTC (rev 16061)

Property changes on: pcbsd/current/src-qt4/warden/src/dialogEditIP.ui
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/xml
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.cpp	2012-03-28 17:30:59 UTC (rev 16060)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.cpp	2012-03-28 17:31:42 UTC (rev 16061)
@@ -8,7 +8,7 @@
 ** Instead, write your code in functions called init() and destroy().
 ** These will automatically be called by the form's constructor and
 ** destructor.
-*****************************************************************************/
+****************************************************************************/
 #include "dialogwarden.h"
 #include <qmessagebox.h>
 #include <qfiledialog.h>
@@ -77,6 +77,11 @@
    connect( radioHostSort, SIGNAL(clicked()), this, SLOT(slotJailViewChanged() ) );
    connect( pushAdd, SIGNAL(clicked()), this, SLOT(slotClickedNewJail() ) );
    connect( pushRemove, SIGNAL(clicked()), this, SLOT(slotDeleteJail() ) );
+   connect( pushExportJail, SIGNAL(clicked()), this, SLOT(slotExportJail() ) );
+   connect( pushTerminal, SIGNAL(clicked()), this, SLOT(slotTerminal() ) );
+   connect( pushUserAdmin, SIGNAL(clicked()), this, SLOT(slotUserAdmin() ) );
+   connect( pushEditIP, SIGNAL(clicked()), this, SLOT(slotPushEditIP() ) );
+   connect( pushUpdate, SIGNAL(clicked()), this, SLOT(slotUpdate() ) );
 }
 
 
@@ -131,7 +136,7 @@
          if (fileip.open( QIODevice::ReadOnly ) ) {
             QTextStream stream2( &fileip );
             while ( !stream2.atEnd() )
-              jIPs = jIPs + stream2.readLine() + " "; // line of text excluding '\n'
+              jIPs = jIPs + stream2.readLine().simplified() + " "; // line of text excluding '\n'
 	 }
          fileip.close();
        }
@@ -227,6 +232,28 @@
 	return;
     }
 
+    // Check for additional IPs in this jail
+    QString jIPs;
+    QFile fileip(JailDir + "/" + currentDetailsWorkingJail + "/etc/warden/ip-extra" );
+    if ( fileip.exists() ) {
+      if (fileip.open( QIODevice::ReadOnly ) ) {
+         QTextStream stream2( &fileip );
+         while ( !stream2.atEnd() )
+           jIPs = jIPs + stream2.readLine().simplified() + " "; // line of text excluding '\n'
+         fileip.close();
+      }
+    }
+
+    // Save the new jail IPs
+    for (int i=0; i < jailDetails.count(); ++i) {
+      if ( jailDetails.at(i).at(0) != currentDetailsWorkingJail )
+         continue;     
+      QStringList tmpList = jailDetails.at(i);
+      tmpList.replace(3, jIPs);
+      jailDetails.replace(i, tmpList);
+    }
+
+
     // Run the getUpdatesDir.sh script to rsync with master server
     detailsProc = new QProcess( this );
     QString program = ProgDir + "/scripts/backend/details.sh";
@@ -259,7 +286,7 @@
 {
     QString line, size, ports, connections;
 
-    // Read the output and parse KPM
+    // Read the output and parse
     while ( detailsProc->canReadLine() )
     {
 	line = detailsProc->readLine().simplified();
@@ -976,3 +1003,49 @@
    widgetPackages->setLayout(mWLayout);
 
 }
+
+void dialogWarden::slotUserAdmin()
+{
+
+}
+
+void dialogWarden::slotTerminal()
+{
+   if ( ! listJails->currentItem() )
+     return;
+   QString cmd = "xterm -e warden chroot " + listJails->currentItem()->text(0) + " &"; 
+   system(cmd.toLatin1());
+}
+
+void dialogWarden::slotPushEditIP()
+{
+
+   if ( ! listJails->currentItem() )
+     return;
+
+   QString IPs;
+
+   for (int i=0; i < jailDetails.count(); ++i) {
+     if ( jailDetails.at(i).at(0) != listJails->currentItem()->text(0) )
+        continue;
+     IPs = jailDetails.at(i).at(3);
+     if ( jailDetails.at(i).at(1) == "Pending" )
+	return;
+     break;
+   }
+  
+
+   dIP = new dialogEditIP();
+   connect(dIP, SIGNAL(saved()),this, SLOT(slotMonitorJailDetails()) );
+   if ( IPs.isEmpty() )
+      dIP->programInit(listJails->currentItem()->text(0), QStringList() );
+   else
+      dIP->programInit(listJails->currentItem()->text(0), IPs.split(" ") );
+   dIP->exec();
+
+}
+
+void dialogWarden::slotUpdate()
+{
+   
+}

Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.h
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.h	2012-03-28 17:30:59 UTC (rev 16060)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.h	2012-03-28 17:31:42 UTC (rev 16061)
@@ -6,6 +6,7 @@
 
 #include "ui_dialogwarden.h"
 #include "dialogimport.h"
+#include "dialogEditIP.h"
 #include "wizardNewJail.h"
 #include <pcbsd-utils.h>
 #include <QMenu>
@@ -65,6 +66,10 @@
     void slotImportConfigDone(const QString &IP, const QString &Host);
     void slotJailViewChanged();
     void slotCurrentJailChanged();
+    void slotTerminal();
+    void slotUserAdmin();
+    void slotPushEditIP();
+    void slotUpdate();
 
 private:
     void refreshJailDetailsView();
@@ -112,6 +117,7 @@
     QProcess *toggleAutoProc;
     metaWidget *pkgWidget;
     QList<QStringList> jailDetails;
+    dialogEditIP *dIP;
 
 signals:
 } ;

Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.ui	2012-03-28 17:30:59 UTC (rev 16060)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.ui	2012-03-28 17:31:42 UTC (rev 16061)
@@ -279,17 +279,25 @@
                  </widget>
                 </item>
                 <item>
-                 <widget class="QLabel" name="labelIPEdit">
+                 <widget class="QPushButton" name="pushEditIP">
                   <property name="cursor">
-                   <cursorShape>PointingHandCursor</cursorShape>
+                   <cursorShape>OpenHandCursor</cursorShape>
                   </property>
+                  <property name="styleSheet">
+                   <string notr="true">color: rgb(0, 0, 255);</string>
+                  </property>
                   <property name="text">
-                   <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline; color:#0000ff;">(edit)</span></p></body></html></string>
+                   <string>(edit)</string>
                   </property>
+                  <property name="autoDefault">
+                   <bool>false</bool>
+                  </property>
+                  <property name="default">
+                   <bool>false</bool>
+                  </property>
+                  <property name="flat">
+                   <bool>true</bool>
+                  </property>
                  </widget>
                 </item>
                </layout>
@@ -388,12 +396,12 @@
                 </item>
                </layout>
               </item>
-              <item row="2" column="0">
+              <item row="1" column="0">
                <layout class="QHBoxLayout" name="horizontalLayout">
                 <item>
-                 <widget class="QPushButton" name="pushFetchPorts">
+                 <widget class="QPushButton" name="pushTerminal">
                   <property name="text">
-                   <string>Fetch Ports Tree</string>
+                   <string>Launch Terminal</string>
                   </property>
                  </widget>
                 </item>
@@ -412,17 +420,17 @@
                 </item>
                </layout>
               </item>
-              <item row="3" column="0">
+              <item row="2" column="0">
                <layout class="QHBoxLayout" name="horizontalLayout_2">
                 <item>
-                 <widget class="QPushButton" name="pushFetchSrc">
+                 <widget class="QPushButton" name="pushUpdate">
                   <property name="text">
-                   <string>Fetch System Source</string>
+                   <string>Check for Updates</string>
                   </property>
                  </widget>
                 </item>
                 <item>
-                 <spacer name="horizontalSpacer_3">
+                 <spacer name="horizontalSpacer_6">
                   <property name="orientation">
                    <enum>Qt::Horizontal</enum>
                   </property>
@@ -469,30 +477,6 @@
                 </item>
                </layout>
               </item>
-              <item row="1" column="0">
-               <layout class="QHBoxLayout" name="horizontalLayout_4">
-                <item>
-                 <widget class="QPushButton" name="pushFirewall">
-                  <property name="text">
-                   <string>Firewall Manager</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>
              </layout>
             </widget>
            </item>
@@ -511,11 +495,6 @@
            </item>
           </layout>
          </widget>
-         <widget class="QWidget" name="tab_3">
-          <attribute name="title">
-           <string>Logs</string>
-          </attribute>
-         </widget>
          <widget class="QWidget" name="tab_4">
           <attribute name="title">
            <string>Packages</string>
@@ -539,7 +518,7 @@
      <x>0</x>
      <y>0</y>
      <width>804</width>
-     <height>21</height>
+     <height>23</height>
     </rect>
    </property>
    <widget class="QMenu" name="fileMenu">

Modified: pcbsd/current/src-qt4/warden/src/src.pro
===================================================================
--- pcbsd/current/src-qt4/warden/src/src.pro	2012-03-28 17:30:59 UTC (rev 16060)
+++ pcbsd/current/src-qt4/warden/src/src.pro	2012-03-28 17:31:42 UTC (rev 16061)
@@ -6,12 +6,13 @@
 LIBS    += -lpcbsd
 INCLUDEPATH+= ../../../pcbsd/current/src-qt4/libpcbsd/
 
-HEADERS += dialogwarden.h dialogconfig.h dialogimport.h dialogworking.h dialogdisplayoutput.h wizardNewJail.h
+HEADERS += dialogwarden.h dialogconfig.h dialogimport.h dialogworking.h dialogdisplayoutput.h wizardNewJail.h dialogEditIP.h
 
-SOURCES	+= main.cpp dialogwarden.cpp dialogconfig.cpp dialogimport.cpp dialogworking.cpp dialogdisplayoutput.cpp wizardNewJail.cpp
+SOURCES	+= main.cpp dialogwarden.cpp dialogconfig.cpp dialogimport.cpp dialogworking.cpp dialogdisplayoutput.cpp wizardNewJail.cpp dialogEditIP.cpp
 
 FORMS	= dialogwarden.ui \
 	dialogconfig.ui \
+        dialogEditIP.ui \
 	dialogdisplayoutput.ui \
 	dialogimport.ui \
 	dialogworking.ui \



More information about the Commits mailing list