00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "newwidgetdlg.h"
00013
#include <qradiobutton.h>
00014
#include <qstringlist.h>
00015
#include <qcheckbox.h>
00016
#include <qmessagebox.h>
00017
#include <kfiledialog.h>
00018
#include <klineedit.h>
00019
#include <qpushbutton.h>
00020
#include <domutil.h>
00021
#include <qdom.h>
00022
00023 #define WIDGET_CAPTION_NAME "widget/property|name=caption/string"
00024 #define WIDGET_CLASS_NAME "class"
00025 #define WIDGET_SLOTS "slots"
00026
00027 NewWidgetDlg::NewWidgetDlg(
QStringList &newFileNames,
QWidget* parent,
const char* name,
bool modal, WFlags fl)
00028 :
NewWidgetDlgBase(parent,name,modal,fl),
00029 m_newFileNames(newFileNames)
00030
00031 {
00032 }
00033
00034
00035 NewWidgetDlg::~NewWidgetDlg()
00036
00037 {
00038 }
00039
00040
00041 void NewWidgetDlg::subclassingPressed()
00042
00043 {
00044 QMessageBox::information(0,
"subclassing",
"");
00045 }
00046
00047
00048 void NewWidgetDlg::templateSelChanged()
00049
00050 {
00051 QMessageBox::information(0,
"template",
"");
00052 }
00053
00054 void NewWidgetDlg::accept()
00055
00056 {
00057
QDomDocument doc;
00058 DomUtil::openDOMFile(doc,
"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog.ui");
00059 DomUtil::replaceText(doc,
WIDGET_CLASS_NAME,
"TestClass");
00060 DomUtil::replaceText(doc,
WIDGET_CAPTION_NAME,
"Test Dialog");
00061
QDomElement slotsElem = DomUtil::elementByPathExt(doc,
WIDGET_SLOTS);
00062
QDomNodeList slotnodes = slotsElem.childNodes();
00063
for (
unsigned int i=0; i<slotnodes.count();i++)
00064 {
00065
QString msg;
00066
QDomElement slotelem = slotnodes.item(i).toElement();
00067 msg.sprintf(
"Slotname: %s\nReturns: %s\nAccess: %s",
00068 slotelem.text().ascii(),
00069 slotelem.attributeNode(
"returnType").value().ascii(),
00070 slotelem.attributeNode(
"access").value().ascii());
00071 QMessageBox::information(0,
"Slots",msg);
00072 }
00073 DomUtil::saveDOMFile(doc,
"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog2.ui");
00074 NewWidgetDlgBase::accept();
00075 }
00076