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(); }
void DictApplet::sendCommand(const QCString &fun, const QString &data) { if (waiting > 0) { waiting = 1; delayedFunc = fun.copy(); delayedData = data; return; } DCOPClient *client = kapp->dcopClient(); if (!client->isApplicationRegistered("kdict")) { KApplication::startServiceByDesktopName("kdict"); waiting = 1; delayedFunc = fun.copy(); delayedData = data; QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); return; } else { QCStringList list = client->remoteObjects("kdict"); if (list.findIndex("KDictIface")==-1) { waiting = 1; delayedFunc = fun.copy(); delayedData = data; QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); return; } } client->send("kdict","default",fun,data); }
void EditAction::updateDCOPObjects() { theDCOPObjects->clear(); DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; QCStringList theObjects = theClient->remoteObjects(nameProgramMap[theDCOPApplications->currentText()].utf8()); if(!theObjects.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPObjects->insertItem((*theAction).object()); for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) if(*j != "tdesycoca" && *j != "qt" && AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], *j).count()) theDCOPObjects->insertItem(TQString::fromUtf8(*j)); updateDCOPFunctions(); }
void DictApplet::sendDelayedCommand() { if (waiting > 100) { // timeout after ten seconds waiting = 0; return; } DCOPClient *client = kapp->dcopClient(); if (!client->isApplicationRegistered("kdict")) { waiting++; QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); return; } else { QCStringList list = client->remoteObjects("kdict"); if (list.findIndex("KDictIface")==-1) { waiting++; QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); return; } } client->send("kdict","default",delayedFunc,delayedData); waiting = 0; }