From owner-p4-projects@FreeBSD.ORG Fri Apr 18 14:42:52 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4549037B404; Fri, 18 Apr 2003 14:42:52 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D456837B401 for ; Fri, 18 Apr 2003 14:42:51 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64A5B43F93 for ; Fri, 18 Apr 2003 14:42:51 -0700 (PDT) (envelope-from cvance@tislabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3ILgp0U043314 for ; Fri, 18 Apr 2003 14:42:51 -0700 (PDT) (envelope-from cvance@tislabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3ILgodx043311 for perforce@freebsd.org; Fri, 18 Apr 2003 14:42:50 -0700 (PDT) Date: Fri, 18 Apr 2003 14:42:50 -0700 (PDT) Message-Id: <200304182142.h3ILgodx043311@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cvance@tislabs.com using -f From: Chris Vance To: Perforce Change Reviews Subject: PERFORCE change 29229 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 21:42:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=29229 Change 29229 by cvance@cvance_demo on 2003/04/18 14:41:53 * Add new rule editor windows to the application, fixup Makefile so it is included in the build. Yuck, this was based on auto-generated code from an IDE, so it's UGLY. This is also for a demo, nothing more, so don't poke beyond the surface :) * Update KUDIDFW class to use a buttonbar, fix the main-window splitter so everything fills in the window better, fill the last column of the viewer table all the way to the window border * Update the action for the newRule button to use the new dialog class. Affected files ... .. //depot/projects/trustedbsd/misc/kugidfw/Makefile#3 edit .. //depot/projects/trustedbsd/misc/kugidfw/kugidfw.cc#4 edit .. //depot/projects/trustedbsd/misc/kugidfw/kugidfw.h#3 edit .. //depot/projects/trustedbsd/misc/kugidfw/ruleeditor.cc#1 add .. //depot/projects/trustedbsd/misc/kugidfw/ruleeditor.h#1 add Differences ... ==== //depot/projects/trustedbsd/misc/kugidfw/Makefile#3 (text+ko) ==== @@ -41,10 +41,13 @@ all: kugidfw main.o: main.cc kugidfw.h +ruleeditor.moc: ruleeditor.h + ${MOC} ruleeditor.h -o ruleeditor.moc kugidfw.moc: kugidfw.h ${MOC} kugidfw.h -o kugidfw.moc -kugidfw.o: kugidfw.cc kugidfw.h kugidfw.moc -kugidfw: main.o kugidfw.o +kugidfw.o: kugidfw.cc kugidfw.h kugidfw.moc ruleeditor.h ruleeditor.moc +ruleeditor.o: ruleeditor.cc ruleeditor.h ruleeditor.moc +kugidfw: main.o kugidfw.o ruleeditor.o g++ -o ${.TARGET} ${.ALLSRC} ${LDFLAGS} clean: ==== //depot/projects/trustedbsd/misc/kugidfw/kugidfw.cc#4 (text+ko) ==== @@ -52,43 +52,37 @@ #include +#include "ruleeditor.h" + #include "../kmacmanager/konqueror.h" KUGIDFW::KUGIDFW() : KMainWindow() { - file = new QPopupMenu(); + QPopupMenu *file = new QPopupMenu(); file->insertItem("&About", this, SLOT(slotAbout())); file->insertItem("&Refresh", this, SLOT(slotRefresh())); file->insertSeparator(); file->insertItem("&Exit", this, SLOT(slotExit())); - menu = menuBar(); + KMenuBar *menu = menuBar(); menu->insertItem("&File", file); - bar = statusBar(); - QSplitter *splitter = new QSplitter(this); splitter->setOrientation(Vertical); - QHBox *hbox = new QHBox(splitter); - pushbutton_edit = new QPushButton("Edit", hbox); - pushbutton_new = new QPushButton("New", hbox); - pushbutton_remove = new QPushButton("Remove", hbox); + KButtonBox *buttonBar = new KButtonBox(splitter); + buttonBar->addButton("New", this, SLOT(slotNew())); + buttonBar->addButton("Edit", this, SLOT(slotEdit())); + buttonBar->addButton("Remove", this, SLOT(slotRemove())); - listview = new QListView(splitter, ""); - listview->setAllColumnsShowFocus(true); - + listview = new KListView(splitter, ""); + listview->setFullWidth(); listview->addColumn("#"); listview->addColumn("rule"); connect(listview, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(slotDoubleClick(QListViewItem *))); - connect(pushbutton_edit, SIGNAL(clicked()), this, SLOT(slotEdit())); - connect(pushbutton_new, SIGNAL(clicked()), this, SLOT(slotNew())); - connect(pushbutton_remove, SIGNAL(clicked()), this, - SLOT(slotRemove())); - setCentralWidget(splitter); refresh(); @@ -113,48 +107,9 @@ void KUGIDFW::slotNew() { - struct mac_bsdextended_rule rule; - char errstr[BUFSIZ]; - char *string, *stringp; - const char *rulenum; - bool ok = FALSE; - int error, ruleint; - - QString returned_string = QInputDialog::getText("New rule", - "Enter rule number and rule", QLineEdit::Normal, - "", &ok, this, ""); - if (!ok) - return; - - stringp = string = strdup(returned_string.latin1()); - - while (*stringp == ' ' || *stringp == '\t') - stringp++; - - rulenum = strsep(&stringp, " \t"); - ruleint = atoi(rulenum); - - if (stringp == NULL) { - QMessageBox::information(this, "Invalid string", - "Short string"); - free(string); - return; - } - - error = bsde_parse_rule_string(stringp, &rule, BUFSIZ, errstr); - if (error) - QMessageBox::information(this, errstr, errstr); - else { - error = bsde_set_rule(ruleint, &rule, BUFSIZ, errstr); - if (error) - QMessageBox::information(this, errstr, errstr); - else { - refresh(); - KONQUEROR_REFRESH(); - } - } - - free(string); + RuleEditor *editor = new RuleEditor(); + editor->exec(); + refresh(); } void KUGIDFW::slotRemove() ==== //depot/projects/trustedbsd/misc/kugidfw/kugidfw.h#3 (text+ko) ==== @@ -43,12 +43,12 @@ #include #include +#include #include #include #include #include -#include -#include +#include #include #include #include @@ -67,22 +67,16 @@ void slotRefresh(); void slotRemove(); void slotExit(); + void refresh(); private: - void refresh(); int pause; + /* KMenuBar *menu; KStatusBar *bar; QPopupMenu *file; - QListView *listview; + */ + KListView *listview; kvm_t *kvm_handle; - - /* Display toggles */ - QCheckBox *checkbox_kernel; - QCheckBox *checkbox_user; - QCheckBox *checkbox_other_user; - QPushButton *pushbutton_edit; - QPushButton *pushbutton_new; - QPushButton *pushbutton_remove; }; #endif