[Openvas-commits] r9202 - in trunk/gsd: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 12 11:30:04 CEST 2010


Author: raimund
Date: 2010-10-12 11:30:03 +0200 (Tue, 12 Oct 2010)
New Revision: 9202

Modified:
   trunk/gsd/ChangeLog
   trunk/gsd/src/dock_details.cpp
Log:
* src/dock_details.cpp (dock_details_config::update): Enable edit button if
config not in use and table empty.
(dock_details_config::modify_config): Removed selection validation to open
dialog if table is empty.
(dock_details_family::load): Resize tool bar to adjust its width to nvt table.



Modified: trunk/gsd/ChangeLog
===================================================================
--- trunk/gsd/ChangeLog	2010-10-12 08:56:34 UTC (rev 9201)
+++ trunk/gsd/ChangeLog	2010-10-12 09:30:03 UTC (rev 9202)
@@ -1,5 +1,13 @@
 2010-10-12  Raimund Renkert <raimund.renkert at greenbone.net>
 
+	* src/dock_details.cpp (dock_details_config::update): Enable edit button if
+	config not in use and table empty.
+	(dock_details_config::modify_config): Removed selection validation to open
+	dialog if table is empty.
+	(dock_details_family::load): Resize tool bar to adjust its width to nvt table.
+
+2010-10-12  Raimund Renkert <raimund.renkert at greenbone.net>
+
 	* src/gsd_dlg.cpp (new_target_dlg): Init the dialog to avoid duplicate
 	entries.
 

Modified: trunk/gsd/src/dock_details.cpp
===================================================================
--- trunk/gsd/src/dock_details.cpp	2010-10-12 08:56:34 UTC (rev 9201)
+++ trunk/gsd/src/dock_details.cpp	2010-10-12 09:30:03 UTC (rev 9202)
@@ -675,59 +675,56 @@
 dock_details_config::modify_config ()
 {
   QModelIndex ndx = tv_nvt_fam->selectionModel ()->currentIndex ();
-  if (ndx.isValid ())
+  dlg_modify_config *modify_config_dlg = new dlg_modify_config ();
+  connect (modify_config_dlg,
+           SIGNAL (sig_modify (bool, bool)),
+           this,
+           SLOT (exec_modify_config (bool, bool)));
+  connect (modify_config_dlg,
+           SIGNAL (sig_add_family (QString)),
+           this,
+           SLOT (add_family (QString)));
+  QDomElement family = families->getEntity (ndx.row ());
+  QString name = families->getValue (family, "name");
+  modify_config_dlg->setName (name);
+  if (families->getValue (family, "growing").compare ("1") == 0)
     {
-      dlg_modify_config *modify_config_dlg = new dlg_modify_config ();
-      connect (modify_config_dlg,
-               SIGNAL (sig_modify (bool, bool)),
-               this,
-               SLOT (exec_modify_config (bool, bool)));
-      connect (modify_config_dlg,
-               SIGNAL (sig_add_family (QString)),
-               this,
-               SLOT (add_family (QString)));
-      QDomElement family = families->getEntity (ndx.row ());
-      QString name = families->getValue (family, "name");
-      modify_config_dlg->setName (name);
-      if (families->getValue (family, "growing").compare ("1") == 0)
-        {
-          modify_config_dlg->setTrend (true);
-        }
-      else
-        {
-          modify_config_dlg->setTrend (false);
-        }
-      bool *ok = false;
-      int count = families->getValue (family, "nvt_count").toInt (ok, 10);
-      int max_count = families->getValue (family, "max_nvt_count").toInt (ok,
-                                                                          10);
-      if (count == max_count)
-        modify_config_dlg->setSelected (true);
-      else
-        modify_config_dlg->setSelected (false);
+      modify_config_dlg->setTrend (true);
+    }
+  else
+    {
+      modify_config_dlg->setTrend (false);
+    }
+  bool *ok = false;
+  int count = families->getValue (family, "nvt_count").toInt (ok, 10);
+  int max_count = families->getValue (family, "max_nvt_count").toInt (ok,
+                                                                      10);
+  if (count == max_count)
+    modify_config_dlg->setSelected (true);
+  else
+    modify_config_dlg->setSelected (false);
 
-      if (families->rowCount () != this->control->getFamilyModel ()->rowCount ())
+  if (families->rowCount () != this->control->getFamilyModel ()->rowCount ())
+    {
+      int i = 0, j = 0;
+      while (i <= families->rowCount () &&
+             j < this->control->getFamilyModel ()->rowCount ())
         {
-          int i = 0, j = 0;
-          while (i <= families->rowCount () &&
-                 j < this->control->getFamilyModel ()->rowCount ())
-            {
-              QString name_used = families->getValue (families->getEntity (i),
-                                                      "name");
-              QString name_unused =
-                this->control->getFamilyModel ()
-                               ->getValue (this->control
-                                                 ->getFamilyModel ()
-                                                   ->getEntity (j), "name");
-              if (name_used.compare (name_unused) != 0)
-                modify_config_dlg->addFamily (name_unused);
-              else
-                i++;
-              j++;
-            }
+          QString name_used = families->getValue (families->getEntity (i),
+                                                  "name");
+          QString name_unused =
+            this->control->getFamilyModel ()
+                           ->getValue (this->control
+                                             ->getFamilyModel ()
+                                               ->getEntity (j), "name");
+          if (name_used.compare (name_unused) != 0)
+            modify_config_dlg->addFamily (name_unused);
+          else
+            i++;
+          j++;
         }
-      modify_config_dlg->show ();
     }
+  modify_config_dlg->show ();
 }
 
 
@@ -1066,6 +1063,8 @@
   if (configs->getValue (config, "in_use").compare ("0") == 0)
     {
       this->editable = true;
+      if (families->rowCount () == 0)
+        actionModify_Family->setEnabled (true);
     }
   else
     {
@@ -1154,7 +1153,7 @@
   toolBar->setFloatable (false);
   toolBar->setMovable (false);
   toolBar->toggleViewAction ()->setVisible (false);
-  this->gridLayout->addWidget (toolBar,3,0,1,6);
+  this->gridLayout->addWidget (toolBar,3,0,1,4);
   delegate_text *text = new delegate_text ();
   tv_table->setItemDelegateForColumn (1, text);
   tv_table->setItemDelegateForColumn (4, text);



More information about the Openvas-commits mailing list