void EditAction::readFrom() { theRepeat->setChecked((*theAction).repeat()); theAutoStart->setChecked((*theAction).autoStart()); theDoBefore->setChecked((*theAction).doBefore()); theDoAfter->setChecked((*theAction).doAfter()); theDontSend->setChecked((*theAction).ifMulti() == IM_DONTSEND); theSendToTop->setChecked((*theAction).ifMulti() == IM_SENDTOTOP); theSendToBottom->setChecked((*theAction).ifMulti() == IM_SENDTOBOTTOM); theSendToAll->setChecked((*theAction).ifMulti() == IM_SENDTOALL); if((*theAction).isModeChange()) { // change mode theChangeMode->setChecked(true); if((*theAction).object().isEmpty()) theModes->setCurrentText(i18n("[Exit current mode]")); else theModes->setCurrentText((*theAction).object()); } else if((*theAction).isJustStart()) { // profile action theUseProfile->setChecked(true); const Profile *p = ProfileServer::profileServer()->profiles()[(*theAction).program()]; theApplications->setCurrentText(p->name()); updateFunctions(); updateArguments(); theJustStart->setChecked(true); } else if(ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype())) { // profile action theUseProfile->setChecked(true); const ProfileAction *a = ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype()); theApplications->setCurrentText(a->profile()->name()); updateFunctions(); theFunctions->setCurrentText(a->name()); arguments = (*theAction).arguments(); updateArguments(); theNotJustStart->setChecked(true); } else { // dcop action theUseDCOP->setChecked(true); theDCOPApplications->setCurrentText((*theAction).program()); updateDCOPObjects(); theDCOPObjects->setCurrentText((*theAction).object()); updateDCOPFunctions(); theDCOPFunctions->setCurrentText((*theAction).method().prototype()); arguments = (*theAction).arguments(); updateArguments(); } updateOptions(); }
void AddAction::updateObjects() { QStringList names; theObjects->clear(); uniqueProgramMap.clear(); nameProgramMap.clear(); DCOPClient *theClient = KApplication::kApplication()->dcopClient(); QCStringList theApps = theClient->registeredApplications(); for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) { if(!QString(*i).find("anonymous")) continue; if(!QString(*i).find(i18n( "anonymous" ))) continue; QRegExp r("(.*)-[0-9]+"); QString name = r.exactMatch(QString(*i)) ? r.cap(1) : *i; if(names.contains(name)) continue; names += name; KListViewItem *a = new KListViewItem(theObjects, name); uniqueProgramMap[a] = name == QString(*i); nameProgramMap[a] = *i; QCStringList theObjects = theClient->remoteObjects(*i); for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) if(*j != "ksycoca" && *j != "qt")// && getFunctions(*i, *j).count()) new KListViewItem(a, *j); } updateFunctions(); }
KB5() : vmd::KnowledgeBase(), mNbUpdate(0), mNbAck(0), mNbOut(0) { std::cout << fmt("KB5 start\n"); vmd::Activity& a = addActivity("A", 0.0, vd::infinity); vmd::Activity& b = addActivity("B", 1.0, vd::infinity); vmd::Activity& c = addActivity("C", 1.0, vd::infinity); vmd::Activity& d = addActivity("D", 2.0, vd::infinity); vmd::Activity& e = addActivity("E", 3.0, vd::infinity); vmd::Activity& f = addActivity("F", 4.0, vd::infinity); addOutputFunctions(this) += O("out", &KB5::out); addUpdateFunctions(this) += U("update", &KB5::update); a.addOutputFunction(outputFunctions()["out"]); b.addOutputFunction(outputFunctions()["out"]); c.addOutputFunction(outputFunctions()["out"]); d.addOutputFunction(outputFunctions()["out"]); e.addOutputFunction(outputFunctions()["out"]); f.addOutputFunction(outputFunctions()["out"]); a.addUpdateFunction(updateFunctions()["update"]); b.addUpdateFunction(updateFunctions()["update"]); c.addUpdateFunction(updateFunctions()["update"]); d.addUpdateFunction(updateFunctions()["update"]); e.addUpdateFunction(updateFunctions()["update"]); f.addUpdateFunction(updateFunctions()["update"]); }
void EditAction::updateApplications() { ProfileServer *theServer = ProfileServer::profileServer(); theApplications->clear(); applicationMap.clear(); TQDict<Profile> dict = theServer->profiles(); TQDictIterator<Profile> i(dict); for(; i.current(); ++i) { theApplications->insertItem(i.current()->name()); applicationMap[i.current()->name()] = i.currentKey(); } updateFunctions(); }