25 #include <tqlistview.h>
26 #include <tqlineedit.h>
27 #include <tqcheckbox.h>
29 #include <kinputdialog.h>
30 #include <tdelocale.h>
32 #include "atcommand.h"
34 #include "cmdpropertiesdialog.h"
35 #include "cmdpropertiesdialog.moc"
37 class ParameterItem :
public TQCheckListItem {
39 ParameterItem(ATParameter *p,TQListView *parent) :
40 TQCheckListItem(parent,p->name(),CheckBox),mParameter(p)
42 setText(1,p->value());
43 setOn(p->userInput());
48 mParameter->setName(text(0));
49 mParameter->setValue(text(1));
50 mParameter->setUserInput(isOn());
54 ATParameter *mParameter;
65 CmdPropertiesDialog::CmdPropertiesDialog(
ATCommand *cmd, TQWidget* parent,
66 const char* name,
bool modal,
68 : CmdPropertiesDialog_base( parent, name, modal, fl )
75 CmdPropertiesDialog::~CmdPropertiesDialog()
79 void CmdPropertiesDialog::readCommand()
81 mNameEdit->setText(mCmd->cmdName());
82 mStringEdit->setText(mCmd->cmdString());
83 mHexCheck->setChecked(mCmd->hexOutput());
85 TQPtrList<ATParameter> parameters = mCmd->parameters();
86 for(
int i=(
int)parameters.count()-1;i>=0;--i) {
87 ATParameter *p = parameters.at(i);
88 new ParameterItem(p,mParameterList);
92 void CmdPropertiesDialog::writeCommand()
94 mCmd->setCmdName(mNameEdit->text());
95 mCmd->setCmdString(mStringEdit->text());
96 mCmd->setHexOutput(mHexCheck->isChecked());
97 ParameterItem *item = (ParameterItem *)mParameterList->firstChild();
99 item->writeParameter();
100 item = (ParameterItem *)item->nextSibling();
104 void CmdPropertiesDialog::editParameterName(TQListViewItem *item)
108 TQString newName = KInputDialog::getText(TQString(),
109 i18n(
"Enter parameter name:"),item->text(0),&ok,
this);
112 item->setText(0,newName);
116 void CmdPropertiesDialog::slotAccept()
This class provides an abstraction of an AT command.