summaryrefslogtreecommitdiffstats
path: root/buildtools/qmake/newwidgetdlg.cpp
blob: 44dd758848f0e57a61dc9a1536d13b5d79cdf4c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/***************************************************************************
 *   Copyright (C) 2002 by Jakob Simon-Gaarde                              *
 *   jsgaarde@tdcspace.dk                                                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "newwidgetdlg.h"
#include <tqradiobutton.h>
#include <tqstringlist.h>
#include <tqcheckbox.h>
#include <tqmessagebox.h>
#include <kfiledialog.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <domutil.h>
#include <tqdom.h>
#include <kstdguiitem.h>

#define WIDGET_CAPTION_NAME "widget/property|name=caption/string"
#define WIDGET_CLASS_NAME   "class"
#define WIDGET_SLOTS        "slots"

NewWidgetDlg::NewWidgetDlg(TQStringList &newFileNames,TQWidget* parent, const char* name, bool modal, WFlags fl)
: NewWidgetDlgBase(parent,name,modal,fl),
m_newFileNames(newFileNames)
//=================================================
{
// Remove in kde 3.4 support
	okayButton->setGuiItem(KStdGuiItem::ok());
	cancelButton->setGuiItem(KStdGuiItem::cancel());
}


NewWidgetDlg::~NewWidgetDlg()
//==============================================
{
}


void NewWidgetDlg::subclassingPressed()
//=====================================
{
  TQMessageBox::information(0,"subclassing","");
}


void NewWidgetDlg::templateSelChanged()
//=====================================
{
  TQMessageBox::information(0,"template","");
}

void NewWidgetDlg::accept()
//=========================
{
  TQDomDocument doc;
  DomUtil::openDOMFile(doc,"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog.ui");
  DomUtil::replaceText(doc,WIDGET_CLASS_NAME,"TestClass");
  DomUtil::replaceText(doc,WIDGET_CAPTION_NAME,"Test Dialog");
  TQDomElement slotsElem = DomUtil::elementByPathExt(doc,WIDGET_SLOTS);
  TQDomNodeList slotnodes = slotsElem.childNodes();
  for (unsigned int i=0; i<slotnodes.count();i++)
  {
    TQString msg;
    TQDomElement slotelem = slotnodes.item(i).toElement();
    msg.sprintf("Slotname: %s\nReturns: %s\nAccess: %s",
                    slotelem.text().ascii(),
                    slotelem.attributeNode("returnType").value().ascii(),
                    slotelem.attributeNode("access").value().ascii());
    TQMessageBox::information(0,"Slots",msg);
  }
  DomUtil::saveDOMFile(doc,"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog2.ui");
  NewWidgetDlgBase::accept();
}