[prelude-cvslog] r10582 - lmledit/trunk

noreply at prelude-ids.org noreply at prelude-ids.org
Thu May 8 20:38:50 CEST 2008


Author: pollux
Date: 2008-05-08 20:38:50 +0200 (Thu, 08 May 2008)
New Revision: 10582

Modified:
   lmledit/trunk/mainwindow.cpp
   lmledit/trunk/mainwindow.h
Log:
Close rule edition window when closing main window


Modified: lmledit/trunk/mainwindow.cpp
===================================================================
--- lmledit/trunk/mainwindow.cpp	2008-05-08 18:37:45 UTC (rev 10581)
+++ lmledit/trunk/mainwindow.cpp	2008-05-08 18:38:50 UTC (rev 10582)
@@ -55,9 +55,11 @@
 
 void LMLEditMainWindow::editRule(QListWidgetItem * item)
 {
+	Rule * rule;
+
 	ruleEdit->clear();
 	ruleEdit->setId( ui->rulesView->row(item) );
-	Rule * rule = rulesList.at(ui->rulesView->row(item));
+	rule = rulesList.at(ui->rulesView->row(item));
 	Q_ASSERT(rule != NULL);
 	ruleEdit->setRule( rule );
 
@@ -91,10 +93,13 @@
 	QString str = ruleEdit->regex();
 
 	if (! str.isEmpty()) {
+		// XXX this code is wrong: the rule should be re-built
+		// from ruleEdit contents
 		if (ruleEdit->id() == -1) {
 			it = new QListWidgetItem(str,ui->rulesView);
 			// create and add new Rule object to list
 			rule = new Rule(str,str);
+			rule->setRegex(ruleEdit->regex());
 			rulesList.append(rule);
 			Q_ASSERT(rulesList.size() == ui->rulesView->count());
 			it->setToolTip("tooltip");
@@ -125,6 +130,11 @@
 				"(C) 2007,2008 Pierre Chifflier (chifflier AT inl.fr)"));
 }
 
+void LMLEditMainWindow::closeEvent (QCloseEvent * event)
+{
+	ruleEdit->close();
+}
+
 void LMLEditMainWindow::openRulesetFile(const QString &fileName)
 {
 	QApplication::setOverrideCursor(Qt::WaitCursor);

Modified: lmledit/trunk/mainwindow.h
===================================================================
--- lmledit/trunk/mainwindow.h	2008-05-08 18:37:45 UTC (rev 10581)
+++ lmledit/trunk/mainwindow.h	2008-05-08 18:38:50 UTC (rev 10582)
@@ -23,6 +23,9 @@
 
 	void openRulesetFile(const QString &fileName);
 
+protected:
+	void closeEvent (QCloseEvent * event);
+
 private slots:
 	void addRule();
 	void editRule(QListWidgetItem * item);




More information about the Prelude-cvslog mailing list