Date: Fri, 18 Apr 2003 14:42:50 -0700 (PDT) From: Chris Vance <cvance@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 29229 for review Message-ID: <200304182142.h3ILgodx043311@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <ugidfw.h> +#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 <kvm.h> #include <kapp.h> +#include <kbuttonbox.h> #include <kmainwindow.h> #include <qpushbutton.h> #include <kmenubar.h> #include <kstatusbar.h> -#include <qcheckbox.h> -#include <qlistview.h> +#include <klistview.h> #include <qpopupmenu.h> #include <qsplitter.h> #include <qtextview.h> @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304182142.h3ILgodx043311>