void EditAction::updateArguments() { kdDebug() << k_funcinfo << endl; if(theUseProfile->isChecked()) { theArguments->clear(); const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); if(!a) { arguments.clear(); return; } const TQValueList<ProfileActionArgument> &p = a->arguments(); if(p.count() != arguments.count()) { arguments.clear(); for(unsigned i = 0; i < p.count(); i++) arguments.append(TQVariant("")); } theArguments->setEnabled(p.count()); for(unsigned i = 0; i < p.count(); i++) { theArguments->insertItem(p[i].comment() + " (" + p[i].type() + ")"); arguments[i].cast(TQVariant::nameToType(p[i].type().utf8())); } if(p.count()) updateArgument(0); else updateArgument(-1); } else if(theUseDCOP->isChecked()) { theArguments->clear(); Prototype p(theDCOPFunctions->currentText()); if(p.count() != arguments.count()) { arguments.clear(); for(unsigned i = 0; i < p.count(); i++) arguments.append(TQVariant("")); } theArguments->setEnabled(p.count()); for(unsigned i = 0; i < p.count(); i++) { theArguments->insertItem(TQString(TQString().setNum(i + 1) + ": " + (p.name(i).isEmpty() ? p.type(i) : p.name(i) + " (" + p.type(i) + ")"))); arguments[i].cast(TQVariant::nameToType(p.type(i).utf8())); } if(p.count()) updateArgument(0); else updateArgument(-1); } }
// called when the textbox/checkbox/whatever changes value void AddAction::slotParameterChanged() { if(!theParameters->currentItem()) return; int index = theParameters->currentItem()->text(3).toInt() - 1; QString type = theParameters->currentItem()->text(2); if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) theArguments[index].asInt() = theValueIntNumInput->value(); else if(type.find("double") != -1 || type.find("float") != -1) theArguments[index].asDouble() = theValueDoubleNumInput->value(); else if(type.find("bool") != -1) theArguments[index].asBool() = theValueCheckBox->isChecked(); else if(type.find("QStringList") != -1) theArguments[index].asStringList() = theValueEditListBox->items(); else theArguments[index].asString() = theValueLineEdit->text(); theArguments[theParameters->currentItem()->text(3).toInt() - 1].cast(QVariant::nameToType(theParameters->currentItem()->text(2).utf8())); updateArgument(theParameters->currentItem()); }