void EditAction::updateOptions() { if (theUseProfile->isChecked()) { ProfileServer *theServer = ProfileServer::profileServer(); if(!theApplications->currentItem()) return; const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; isUnique = p->unique(); } else if (theUseDCOP->isChecked()) { if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; program = theDCOPApplications->currentText(); isUnique = uniqueProgramMap[theDCOPApplications->currentText()]; } else isUnique = true; theIMLabel->setEnabled(!isUnique); theIMGroup->setEnabled(!isUnique); theDontSend->setEnabled(!isUnique); theSendToTop->setEnabled(!isUnique); theSendToBottom->setEnabled(!isUnique); theSendToAll->setEnabled(!isUnique); }
void AddAction::updateProfiles() { ProfileServer *theServer = ProfileServer::profileServer(); theProfiles->clear(); profileMap.clear(); QDict<Profile> dict = theServer->profiles(); QDictIterator<Profile> i(dict); for(; i.current(); ++i) profileMap[new QListViewItem(theProfiles, i.current()->name())] = i.currentKey(); }
void AddAction::updateProfileFunctions() { ProfileServer *theServer = ProfileServer::profileServer(); theProfileFunctions->clear(); profileFunctionMap.clear(); if(!theProfiles->currentItem()) return; const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; QDict<ProfileAction> dict = p->actions(); for(QDictIterator<ProfileAction> i(dict); i.current(); ++i) profileFunctionMap[new QListViewItem(theProfileFunctions, i.current()->name(), QString().setNum(i.current()->arguments().count()), i.current()->comment())] = i.currentKey(); updateParameters(); updateOptions(); }
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(); }
void EditAction::updateFunctions() { ProfileServer *theServer = ProfileServer::profileServer(); theFunctions->clear(); functionMap.clear(); if(theApplications->currentText().isNull() || theApplications->currentText().isEmpty()) return; const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; TQDict<ProfileAction> dict = p->actions(); for(TQDictIterator<ProfileAction> i(dict); i.current(); ++i) { theFunctions->insertItem(i.current()->name()); functionMap[i.current()->name()] = i.currentKey(); } updateArguments(); }
void AddAction::updateOptions() { IfMulti im; if(theUseProfile->isChecked()) { ProfileServer *theServer = ProfileServer::profileServer(); if(!theProfiles->currentItem()) return; const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; im = p->ifMulti(); isUnique = p->unique(); } else if(theUseDCOP->isChecked()) { if(!theObjects->selectedItem()) return; QListViewItem* i = theObjects->selectedItem()->parent(); if(!i) return; isUnique = uniqueProgramMap[i]; QRegExp r("(.*)-[0-9]+"); program = r.exactMatch(nameProgramMap[i]) ? r.cap(1) : nameProgramMap[i]; im = IM_DONTSEND; } else return; theIMLabel->setEnabled(!isUnique); theIMGroup->setEnabled(!isUnique); theIMLine->setEnabled(!isUnique); theIMTop->setEnabled(!isUnique); theDontSend->setEnabled(!isUnique); theSendToBottom->setEnabled(!isUnique); theSendToTop->setEnabled(!isUnique); theSendToAll->setEnabled(!isUnique); switch(im) { case IM_DONTSEND: theDontSend->setChecked(true); break; case IM_SENDTOTOP: theSendToTop->setChecked(true); break; case IM_SENDTOBOTTOM: theSendToBottom->setChecked(true); break; case IM_SENDTOALL: theSendToAll->setChecked(true); break; } }
void AddAction::updateParameters() { theParameters->clear(); theArguments.clear(); if(theUseDCOP->isChecked() && theFunctions->currentItem()) { Prototype p(theFunctions->currentItem()->text(2)); for(unsigned k = 0; k < p.count(); k++) { new KListViewItem(theParameters, p.name(k).isEmpty() ? i18n( "<anonymous>" ) : p.name(k), "", p.type(k), QString().setNum(k + 1)); theArguments.append(QVariant("")); theArguments.back().cast(QVariant::nameToType(p.type(k).utf8())); } } else if(theUseProfile->isChecked() && theProfiles->currentItem()) { ProfileServer *theServer = ProfileServer::profileServer(); if(!theProfiles->currentItem()) return; if(!theProfileFunctions->currentItem()) return; const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; const ProfileAction *pa = p->actions()[profileFunctionMap[theProfileFunctions->currentItem()]]; int index = 1; for(QValueList<ProfileActionArgument>::const_iterator i = pa->arguments().begin(); i != pa->arguments().end(); ++i, index++) { theArguments.append(QVariant((*i).getDefault())); theArguments.back().cast(QVariant::nameToType((*i).type().utf8())); new QListViewItem(theParameters, (*i).comment(), theArguments.back().toString(), (*i).type(), QString().setNum(index)); } // quicky update options too... theRepeat->setChecked(pa->repeat()); theAutoStart->setChecked(pa->autoStart()); } updateParameter(); }