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

svn at pcbsd.org svn at pcbsd.org
Mon Apr 2 09:46:10 PDT 2012


Author: kris
Date: 2012-04-02 16:46:10 +0000 (Mon, 02 Apr 2012)
New Revision: 16133

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
Log:

Add text indicator if jail is set to start at bootup
Add code to display warden metapkgsets available, and choose between them



Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.cpp	2012-04-02 16:12:00 UTC (rev 16132)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.cpp	2012-04-02 16:46:10 UTC (rev 16133)
@@ -82,12 +82,13 @@
    connect( pushUserAdmin, SIGNAL(clicked()), this, SLOT(slotUserAdmin() ) );
    connect( pushEditIP, SIGNAL(clicked()), this, SLOT(slotPushEditIP() ) );
    connect( pushUpdate, SIGNAL(clicked()), this, SLOT(slotUpdate() ) );
+   connect( comboPackageSet, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeMetaDefault() ) );
 }
 
 
 void dialogWarden::refreshJails()
 {
-   QString AutoStart, jType, jIPs;
+   QString jType, jIPs;
    QStringList jD;
  
    if ( widgetPackages->layout() == 0 )
@@ -123,12 +124,6 @@
           host = stream.readLine(); // line of text excluding '\n'
        file.close();
 	    
-       // Check if this jail is set to autostart
-       AutoStart = "Disabled";
-       QFile file2(JailDir + "/" + d[i] + "/etc/warden/autostart" );
-       if ( file2.exists() )
-          AutoStart = "Enabled";  
-
        // Check for additional IPs in this jail
        jIPs = "";
        QFile fileip(JailDir + "/" + d[i] + "/etc/warden/ip-extra" );
@@ -953,6 +948,22 @@
    if ( ! listJails->currentItem() )
      return;
 
+   // Load the meta-pkg set
+   QString dMeta = Utils::getValFromPCConf(JailDir + listJails->currentItem()->text(0) + "/usr/local/etc/warden.conf", "PCBSD_METAPKGSET");
+
+   comboPackageSet->clear();
+   QDir dir("/var/db/pc-metapkgmanager/pkgsets");
+   dir.setFilter(QDir::Dirs);
+   dir.setSorting(QDir::Name);
+   dir.setNameFilters(QStringList() << "ward*" );
+
+   QStringList list = dir.entryList();
+   for (int i = 0; i < list.size(); ++i) {
+       comboPackageSet->addItem(list.at(i));
+       if (list.at(i) == dMeta)
+          comboPackageSet->setCurrentIndex(i);
+   }
+
    // Load the details for this jail
    for (int i=0; i < jailDetails.count(); ++i) {
      if ( jailDetails.at(i).at(0) != listJails->currentItem()->text(0) )
@@ -990,12 +1001,19 @@
      labelConnections->setText("");
      labelType->setText("");
      labelIPs->setText("");
+     labelStartAtBoot->setText("");
      return;
    }
 
    groupJailTab->setTitle(tr("Working on jail:") + " " + listJails->currentItem()->text(0));
    groupJailTab->setEnabled(true);
 
+   QString AutoStart = "Disabled";
+   QFile file2(JailDir + "/" + listJails->currentItem()->text(0) + "/etc/warden/autostart" );
+   if ( file2.exists() )
+      AutoStart = "Enabled";
+   labelStartAtBoot->setText(AutoStart);
+
    refreshJailDetailsView();
 
    // Stop any metaWidget activity
@@ -1066,3 +1084,26 @@
    QString cmd = "pc-updategui -warden /usr/jails/" + listJails->currentItem()->text(0) + " " + listJails->currentItem()->text(0) + " &"; 
    system(cmd.toLatin1());
 }
+
+void dialogWarden::slotChangeMetaDefault()
+{
+   if ( ! listJails->currentItem() )
+      return;
+   if ( ! listJails->currentItem()->text(0).isEmpty() )
+      return;
+   if ( comboPackageSet->currentIndex() == -1 )
+      return;   
+   if ( comboPackageSet->currentText().isEmpty())
+      return;   
+
+   // We can return if we just changed to what is already set
+   QString dMeta = Utils::getValFromPCConf(JailDir + listJails->currentItem()->text(0) + "/usr/local/etc/warden.conf", "PCBSD_METAPKGSET");
+   if ( dMeta == comboPackageSet->currentText() )
+      return;
+
+   // Update now
+   Utils::setValPCConf(JailDir + listJails->currentItem()->text(0) + "/usr/local/etc/warden.conf", "PCBSD_METAPKGSET", comboPackageSet->currentText());
+
+   // Update the meta-widget
+   slotCurrentJailChanged();
+}

Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.h
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.h	2012-04-02 16:12:00 UTC (rev 16132)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.h	2012-04-02 16:46:10 UTC (rev 16133)
@@ -70,6 +70,7 @@
     void slotUserAdmin();
     void slotPushEditIP();
     void slotUpdate();
+    void slotChangeMetaDefault();
 
 private:
     void refreshJailDetailsView();

Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.ui	2012-04-02 16:12:00 UTC (rev 16132)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.ui	2012-04-02 16:46:10 UTC (rev 16133)
@@ -231,6 +231,20 @@
                   </property>
                  </widget>
                 </item>
+                <item row="2" column="0">
+                 <widget class="QLabel" name="label_4">
+                  <property name="text">
+                   <string>Start at boot:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item row="2" column="1">
+                 <widget class="QLabel" name="labelStartAtBoot">
+                  <property name="text">
+                   <string/>
+                  </property>
+                 </widget>
+                </item>
                </layout>
               </item>
               <item row="0" column="1">



More information about the Commits mailing list