void SCNetworkEventPublisher::configure() { for (const auto& sub : subscriptions_) { auto sc = getSubscriptionContext(sub->context); if (sc->type == ADDRESS_TARGET) { auto existing_address = std::find( target_addresses_.begin(), target_addresses_.end(), sc->target); if (existing_address != target_addresses_.end()) { // Add the address target. addAddress(sc); } } else { auto existing_hostname = std::find(target_names_.begin(), target_names_.end(), sc->target); if (existing_hostname != target_names_.end()) { // Add the hostname target. addHostname(sc); } } } // Make sure at least one target exists. if (targets_.empty()) { auto sc = createSubscriptionContext(); sc->type = NAME_TARGET; sc->target = "localhost"; addHostname(sc); } restart(); }
MLPublishedParam::MLPublishedParam(const MLPath & procPath, const MLSymbol name, const MLSymbol alias, const MLSymbol type, int idx) : mPublishedAlias(alias), mIndex(idx), mAutomatable(true), mFlip(false) { setRange(0.f, 1.f, 0.01f, false, 0.f); mUnit = kJucePluginParam_Generic; mWarpMode = kJucePluginParam_Linear; mParamValue = 0.f; mDefault = 0.f; mZeroThreshold = 0.f - (MLParamValue)(2 << 16); mGroupIndex = -1; addAddress(procPath, name); // default type is float if(type == MLSymbol()) { mType = MLSymbol("float"); } else { mType = type; } }
bool metacall(Person* c, const QByteArray& key, const QByteArray& value) { const QStringList settings = QString(key).split(';'); if (settings.length() < 1) return false; if (!m_hHash[settings[0].toLatin1()]) { if(key.contains(VCardUtils::Property::PHOTO)) { //key must contain additional attributes, we don't need them right now (ENCODING, TYPE...) setPhoto(c, key, value); return true; } if(key.contains(VCardUtils::Property::ADDRESS)) { addAddress(c, key, value); return true; } if(key.contains(VCardUtils::Property::TELEPHONE)) { addContactMethod(c, key, value); return true; } return false; } (this->*(m_hHash[settings[0].toLatin1()]))(c,key,value); return true; }
bool DbManager::addPerson(const Person *person) { if(person && person->isSufficient()) { QSqlQuery query; QString query_string = "INSERT INTO people (first_name, last_name, personal_code, job, email, phone) " "VALUES (:first_name, :last_name, :personal_code, :job, :email, :phone)"; query.prepare(query_string); query.bindValue(":first_name", person->getFirst_name()); query.bindValue(":last_name", person->getLast_name()); query.bindValue(":personal_code", person->getPersonal_code()); query.bindValue(":job", person->getJob()); query.bindValue(":email", person->getEmail()); query.bindValue(":phone", person->getPhone()); if(query.exec()) { int id_person = query.lastInsertId().toInt(); addAddress(id_person, person->getAddress()); int id_license = getIdLicense(person->getLicense()); if(id_license > 0) { addLicenseToPerson(id_person, id_license, person->getDateOfIssue()); } return true; } } return false; }
static void down_to_transport(CnetEvent ev, CnetTimer timer, CnetData data) { /* our packet */ TR_PACKET p; /* destination address to pass to network layer */ CnetAddr temp; p.length = sizeof(p.msg); CHECK(CNET_read_application(&temp, p.msg, &p.length)); CNET_disable_application(temp); /* establish sequence number */ unsigned long seq = getSequence(temp); if( seq == -1) { addAddress(temp,0); p.sequence_number = 0; } else { unsigned long newseq = seq + p.length; setSequence(temp,newseq); p.sequence_number = newseq; } p.checksum = checksum_crc32( ((char*)&p)+sizeof(unsigned int) , TR_PACKET_SIZE(p) - sizeof(unsigned int)); down_to_network( (char*)&p , TR_PACKET_SIZE(p) , temp); /* enqueuePacket((char*)&p, TR_PACKET_SIZE(p), temp); */ CNET_start_timer(EV_TIMER1, 1000, (CnetData)1); }
void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const HostAddressPort& address) { static int hostid = 0; std::string hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid)); hostid++; addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, address.getPort(), 0, 0)); addAddress(hostname, address.getAddress()); }
bool Layer2::layer2_is_bus () { if (! addGroupAddress (0)) return false; if (! addAddress (0)) return false; return true; }
/* Format: 131.114.21.0/24,10.0.0.0/255.0.0.0 */ bool AddressTree::addAddresses(char *rule) { char *net = strtok(rule, ","); while(net != NULL) { int16_t rc; if((rc = addAddress(net)) < 0) return false; net = strtok(NULL, ","); } return true; }
void SymbolData::addLabel(int memoryAddress, const std::wstring& name) { if (!enabled) return; addAddress(memoryAddress); SymDataSymbol sym; sym.address = memoryAddress; sym.name = convertWStringToUtf8(name); modules[currentModule].symbols.push_back(sym); }
void SymbolData::addData(int address, int size, DataType type) { if (!enabled) return; addAddress(address); SymDataData data; data.address = address; data.size = size; data.type = type; modules[currentModule].data.push_back(data); }
bool ConnState::setup() { // Force queuing so that a bad or unreachable client can't disable the whole system if (!assureFilter("queue", true)) return false; if (! SubDriver::setup()) return false; if (type == CT_BUSMONITOR && ! dynamic_cast<Router *>(&server->router)->registerVBusmonitor(this)) return false; addAddress(addr); TRACEPRINTF (t, 8, "Start Conn %d", channel); return true; }
void DeviceInterface::addNode(const Device::Node& n) { auto full = Device::FullAddressSettings::make<Device::FullAddressSettings::as_parent>( n.get<Device::AddressSettings>(), Device::address(*n.parent())); // Add in the device implementation addAddress(full); for(const auto& child : n) { addNode(child); } }
/** * Add data to the contact. * All fields must be empty. */ void PIMContact::addDataToContact() { printf("\n==============Add data to contact==============\n"); printf(sFieldSeparator); addContactName(); waitForClick(); addAddress(); waitForClick(); addBirthday(); waitForClick(); addEmail(); waitForClick(); addNickname(); waitForClick(); addNote(); waitForClick(); addOrg(); waitForClick(); // If you want to set a photo URL call addPhotoURL method instead of // addPhoto method. addPhoto(); waitForClick(); addPhone(); waitForClick(); addTitle(); waitForClick(); addURL(); waitForClick(); addIM(); waitForClick(); addRelation(); waitForClick(); addOrgInfo(); waitForClick(); }
void NodeUpdateProxy::rec_addNode( Device::NodePath parentPath, const Device::Node& n, int row) { addAddress(parentPath, n.template get<Device::AddressSettings>(), row); parentPath.append(row); int r = 0; for(const auto& child : n.children()) { rec_addNode(parentPath, child, r++); } }
void SymbolData::startFunction(int address) { if (currentFunction != -1) { Logger::printError(Logger::Error,L"Opened a function inside another function"); return; } currentFunction = modules[currentModule].functions.size(); addAddress(address); SymDataFunction func; func.address = address; func.size = 0; modules[currentModule].functions.push_back(func); }
void Service::addAddress(iostream::XdrInputStream& istream, iostream::XdrOutputStream& ostream) { ostream.write(net::MessageProtocol::REPLY); ostream.flush(); // Extract the name and address std::string name; istream.read(name); // istream.flush(); std::string address; istream.read(address); // istream.flush(); addAddress(name, address); }
void PersonView::slotLinkClicked( const QUrl &url ) { qDebug() << "CLICKED" << url; if ( url.scheme() == "polka" ) { QStringList path = url.path().split("/"); QString action = path.first(); qDebug() << "ACTION" << action; if ( action == "editName" ) editName(); else if ( action == "addEmail" ) addEmail(); else if ( action == "editEmail" ) editEmail( path.value( 1 ) ); else if ( action == "removeEmail" ) removeEmail( path.value( 1 ) ); else if ( action == "commentEmail" ) commentEmail( path.value( 1 ) ); else if ( action == "addPhone" ) addPhone(); else if ( action == "editPhone" ) editPhone( path.value( 1 ) ); else if ( action == "removePhone" ) removePhone( path.value( 1 ) ); else if ( action == "commentPhone" ) commentPhone( path.value( 1 ) ); else if ( action == "addLink" ) addLink(); else if ( action == "editLink" ) editLink( path.value( 1 ) ); else if ( action == "removeLink" ) removeLink( path.value( 1 ) ); else if ( action == "commentLink" ) commentLink( path.value( 1 ) ); else if ( action == "addAddress" ) addAddress(); else if ( action == "editAddress" ) editAddress( path.value( 1 ) ); else if ( action == "removeAddress" ) removeAddress( path.value( 1 ) ); else if ( action == "commentAddress" ) commentAddress( path.value( 1 ) ); else if ( action == "addComment" ) addComment(); else if ( action == "editComment" ) editComment( path.value( 1 ) ); else if ( action == "removeComment" ) removeComment( path.value( 1 ) ); else if ( action == "close" ) requestClose(); else if ( action == "magic" ) debugHtml(); else qDebug() << "unknown action" << action; } else { new KRun( QUrl( url ), this ); } }
void Service::run() { _runFlag = true; _serviceSocket = new net::ServerSocket(_port); _serviceSocket->listen(); while(_runFlag) { net::Socket& socket = _serviceSocket->accept(); iostream::XdrInputStream& istream = socket.getXdrInputStream(); iostream::XdrOutputStream& ostream = socket.getXdrOutputStream(); int requestType = 0; ostream.flush(); ostream.write(net::MessageProtocol::REPLY); ostream.flush(); istream.read(requestType); // istream.flush(); if (requestType == net::MessageProtocol::ADDADDRESS) { addAddress(istream, ostream); } else if (requestType == net::MessageProtocol::REMOVEADDRESS) { removeAddress(istream, ostream); } else if (requestType == net::MessageProtocol::GETAVAILABLEADDRESS) { getNextAddress(istream, ostream); } else { handleError(istream, ostream); } socket.close(); } delete _serviceSocket; }
TPUARTLayer2Driver::TPUARTLayer2Driver (int version, const char *device, eibaddr_t a, Trace * tr) { t = tr; TRACEPRINTF (t, 2, this, "Open"); addr = a; ver = version; pth_sem_init (&in_signal); pth_sem_init (&out_signal); getwait = pth_event (PTH_EVENT_SEM, &out_signal); fd = open (device, O_RDWR); if (fd == -1) return; addAddress (a); Start (); mode = 0; vmode = 0; TRACEPRINTF (t, 2, this, "Opened"); }
void ChainScanner::processPartialData(const PartialScanResult &result) { TransactionStore & transactionStore = _database.getTransactions(); StealthPaymentStore & stealthPaymentStore = _database.getStealthPayments(); for(QJsonArray::const_iterator it = result.transactions.first; it!=result.transactions.second; ++it) { const QJsonValue & value = *it; QJsonObject object = value.toObject(); //ToDo : use const reference isntead transactionStore.insert(object); //ignore duplicates } for(QJsonArray::const_iterator it = result.stealthPayments.first; it!=result.stealthPayments.second; ++it) { const QJsonValue & val = *it; QJsonObject obj = val.toObject(); if(!stealthPaymentStore.replace(obj)) { return; } addAddress(obj["address"].toString().toStdString()); } }
void serial_to_wpcap(FILE *inslip) { uint16_t buf_aligned[BUF_SIZE/2 + 42]; //extra for possible eth_hdr and ip_process expansion uint8_t *buf = (uint8_t *)buf_aligned; static int inbufptr = 0, issensiblestring=1; int ret; unsigned char c; unsigned char * inpktbuf; if(tun){ inpktbuf = buf + sizeof(struct uip_eth_hdr); } else { inpktbuf = buf; } read_more: if(inbufptr >= BUF_SIZE) { inbufptr = 0; } ret = fread(&c, 1, 1, inslip); if(ret == -1) { err(1, "serial_to_tun: read"); } if(ret == 0) { clearerr(inslip); return; if (timestamp) stamptime(); fprintf(stderr, "serial_to_tun: EOF\n"); exit(1); } /* fprintf(stderr, ".");*/ switch(c) { case SLIP_END: if(inbufptr > 0) { if(inpktbuf[0] == '!') { if (inpktbuf[1] == 'M' && inbufptr == 18) { /* Read gateway MAC address and autoconfigure tap0 interface */ char macs64[24], macs48[18]; int addr_bytes[8]; int i, pos; for(i = 0, pos = 0; i < 16; i++) { macs64[pos++] = inpktbuf[2 + i]; if ((i & 1) == 1 && i < 14) { macs64[pos++] = '-'; } } macs64[pos] = '\0'; if (timestamp) stamptime(); fprintf(stderr, "*** Gateway's MAC address: %s\n", macs64); mac_received = true; sscanf(macs64, "%2X-%2X-%2X-%2X-%2X-%2X-%2X-%2X", &addr_bytes[0], &addr_bytes[1], &addr_bytes[2], &addr_bytes[3], &addr_bytes[4], &addr_bytes[5], &addr_bytes[6], &addr_bytes[7]); /* Form a fictitious MAC address for the attached device from its EUI-64 (2 middle bytes elided) */ addr_bytes[0] |= 0x02; for(i=0;i<3;i++){ dev_eth_addr.addr[i] = addr_bytes[i]; } for(i=3;i<6;i++){ dev_eth_addr.addr[i] = addr_bytes[i+2]; } sprintf(macs48,"%02X-%02X-%02X-%02X-%02X-%02X", dev_eth_addr.addr[0], dev_eth_addr.addr[1], dev_eth_addr.addr[2], dev_eth_addr.addr[3], dev_eth_addr.addr[4], dev_eth_addr.addr[5]); if (timestamp) stamptime(); fprintf(stderr,"Fictitious MAC-48: %s\n", macs48); if(autoconf){ if(IPAddrFromPrefix(autoconf_addr, ipprefix, macs64)!=0){ if (timestamp) stamptime(); fprintf(stderr, "Invalid IPv6 address.\n"); exit(1); } local_ipaddr = autoconf_addr; addAddress(if_name,local_ipaddr); } if(br_prefix != NULL){ /* RPL Border Router mode. Add route towards LoWPAN. */ if(IPAddrFromPrefix(rem_ipaddr, br_prefix, macs64)!=0){ if (timestamp) stamptime(); fprintf(stderr, "Invalid IPv6 address.\n"); exit(1); } addLoWPANRoute(if_name, br_prefix, rem_ipaddr); addNeighbor(if_name, rem_ipaddr, macs48); } } #define DEBUG_LINE_MARKER '\r' } else if(inpktbuf[0] == '?') { if (inpktbuf[1] == 'M') { /* Send our MAC address. */ send_mac = true; set_sniffer_mode = true; set_channel = true; } else if (inpktbuf[1] == 'P') { /* Send LoWPAN network prefix to the border router. */ send_prefix = true; } } else if(inpktbuf[0] == DEBUG_LINE_MARKER) { /* Dont insert timestamp on wireshark packet dumps starting with 0000 */ if (timestamp) { if (inpktbuf[0]!='0' || inpktbuf[1]!=0 || inpktbuf[2]!=0 || inpktbuf[3]!=0) stamptime(); } fwrite(inpktbuf + 1, inbufptr - 1, 1, stderr); issensiblestring=1; } #if 0 else if(is_sensible_string(inpktbuf, inbufptr)) { /* Dont insert timestamp on wireshark packet dumps starting with 0000 */ if (timestamp) { if (inpktbuf[0]!='0' || inpktbuf[1]!=0 || inpktbuf[2]!=0 || inpktbuf[3]!=0) stamptime(); } fwrite(inpktbuf, inbufptr, 1, stderr); } #else else if(issensiblestring) { /* Dont insert timestamp on wireshark packet dumps starting with 0000 */ if (timestamp) { if (inpktbuf[0]!='0' || inpktbuf[1]!=0 || inpktbuf[2]!=0 || inpktbuf[3]!=0) stamptime(); } fwrite(inpktbuf, inbufptr, 1, stderr); } #endif else { PRINTF("Sending to wpcap\n"); if(tun){ //Ethernet header to be inserted before IP packet struct uip_eth_hdr * eth_hdr = (struct uip_eth_hdr *)buf; memcpy(ð_hdr->dest, &adapter_eth_addr, sizeof(struct uip_eth_addr)); memcpy(ð_hdr->src, &dev_eth_addr, sizeof(struct uip_eth_addr)); eth_hdr->type = htons(UIP_ETHTYPE_IPV6); inbufptr += sizeof(struct uip_eth_hdr); // Process incoming packets to transform link layer addresses inside ICMP packets. // Try to do processing if we did not succeed to add the neighbor. if(clean_neighb == false){ inbufptr = ip_process(buf, inbufptr); } } //print_packet(inpktbuf, inbufptr); wpcap_send(buf, inbufptr); /* printf("After sending to wpcap\n");*/ } inbufptr = 0; issensiblestring=1; } break; case SLIP_ESC: if(fread(&c, 1, 1, inslip) != 1) { clearerr(inslip); /* Put ESC back and give up! */ ungetc(SLIP_ESC, inslip); return; } switch(c) { case SLIP_ESC_END: c = SLIP_END; break; case SLIP_ESC_ESC: c = SLIP_ESC; break; } /* FALLTHROUGH */ default: inpktbuf[inbufptr++] = c; if (issensiblestring) { if(c == '\n') { /* Dont insert timestamp on wireshark packet dumps starting with 0000 */ if (timestamp) { if (inpktbuf[0]!='0' || inpktbuf[1]!=0 || inpktbuf[2]!=0 || inpktbuf[3]!=0) stamptime(); } /* This could be a proper debug string starting with CR just a print to stdout */ /* Trap the CR which would cause overwriting of the timestamp */ //{int i;for (i=0;i<inbufptr;i++) fprintf(stderr,"%2x ",inpktbuf[i]);} if(inpktbuf[0] == DEBUG_LINE_MARKER) { fwrite(inpktbuf + 1, inbufptr - 1, 1, stderr); } else { fwrite(inpktbuf, inbufptr, 1, stderr); } inbufptr=0; } else if (c == 0 || c == '\t' || c == '\r') { } else if(c < ' ' || '~' < c) { issensiblestring=0; } } break; } goto read_more; }
int main(int argc, char **argv) { int c; int slipfd, maxfd; int ret; fd_set rset, wset; FILE *inslip; char siodev[10] = ""; int baudrate = -2; char buf[4000]; prog = argv[0]; setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ memset(&osVersionInfo,0,sizeof(OSVERSIONINFO)); osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osVersionInfo); while((c = getopt(argc, argv, "B:D:L:hs:c:ra:p:vtb:")) != -1) { switch (c) { case 'B': baudrate = atoi(optarg); break; case 'L': if(strncmp("0", optarg, 1) == 0) { timestamp = 0; } else { timestamp = atoi(optarg); if (timestamp==0) timestamp=1; } break; case 's': if(strncmp("/dev/", optarg, 5) == 0) { strncpy(siodev,optarg + 5,sizeof(siodev)-1); } else if(strncmp("COM", optarg, 3) == 0) { int portnum; portnum = atoi(optarg+3); if(portnum == 0){ err(1,"port number is invalid"); } sprintf(siodev,"ttyS%d",portnum-1); } else { strncpy(siodev,optarg,sizeof(siodev)-1); } break; case 'c': channel = atoi(optarg); set_channel = 1; break; case 'r': sniffer_mode = 1; break; case 'a': if(autoconf == true){ print_help(); } local_ipaddr = optarg; if (!validIPAddr(local_ipaddr, 0)){ if (timestamp) stamptime(); fprintf(stderr, "Invalid IPv6 address: %s", local_ipaddr); exit(1); } break; case 'p': if(local_ipaddr !=NULL){ print_help(); } autoconf = true; ipprefix = optarg; if (!validIPAddr(ipprefix, 0)){ if (timestamp) stamptime(); fprintf(stderr, "Invalid IPv6 prefix: %s", ipprefix); exit(1); } break; case 'v': verbose = true; break; case 't': tun = true; break; case 'b': br_prefix = optarg; send_prefix = true; send_mac = false; tun = true; if (!validIPAddr(br_prefix, 64)){ if (timestamp) stamptime(); fprintf(stderr, "Invalid IPv6 64-bit prefix: %s", br_prefix); exit(1); } strtok(br_prefix,"/"); // Remove prefix length if it is present. break; case '?': case 'h': default: print_help(); break; } } argc -= (optind - 1); argv += (optind - 1); if(argc != 2 || *siodev == '\0') { print_help(); } if(autoconf == true && br_prefix != NULL){ if (timestamp) stamptime(); fprintf(stderr, "-p and -b options cannot be used together.\r\n"); print_help(); } sscanf(argv[1],"%2X-%2X-%2X-%2X-%2X-%2X", (int *)&adapter_eth_addr.addr[0],(int *)&adapter_eth_addr.addr[1], (int *)&adapter_eth_addr.addr[2],(int *)&adapter_eth_addr.addr[3], (int *)&adapter_eth_addr.addr[4],(int *)&adapter_eth_addr.addr[5]); if_name = wpcap_start(&adapter_eth_addr, verbose); if(local_ipaddr!=NULL){ addAddress(if_name, local_ipaddr); } switch(baudrate) { case -2: break; /* Use default. */ case 9600: b_rate = B9600; break; case 19200: b_rate = B19200; break; case 38400: b_rate = B38400; break; case 57600: b_rate = B57600; break; case 115200: b_rate = B115200; break; case 230400: b_rate = B230400; break; case 460800: b_rate = B460800; break; case 921600: b_rate = B921600; break; default: err(1, "unknown baudrate %d", baudrate); break; } slipfd = devopen(siodev, O_RDWR | O_NONBLOCK | O_NOCTTY | O_NDELAY | O_DIRECT | O_SYNC ); if(slipfd == -1) { err(1, "can't open siodev ``/dev/%s''", siodev); } if (timestamp) stamptime(); fprintf(stderr, "wpcapslip6 started on ``/dev/%s''\n", siodev); stty_telos(slipfd); slip_send(SLIP_END); inslip = fdopen(slipfd, "r"); if(inslip == NULL) err(1, "main: fdopen"); atexit(cleanup); signal(SIGHUP, sigcleanup); signal(SIGTERM, sigcleanup); signal(SIGINT, sigcleanup); signal(SIGALRM, sigalarm); /* Request mac address from gateway. It may be useful for setting the best IPv6 address of the local interface. */ while(1) { maxfd = 0; FD_ZERO(&rset); FD_ZERO(&wset); send_commands(); if(!slip_empty()) { /* Anything to flush? */ FD_SET(slipfd, &wset); } FD_SET(slipfd, &rset); /* Read from slip ASAP! */ if(slipfd > maxfd) maxfd = slipfd; #ifdef WITH_STDIN FD_SET(STDIN_FILENO, &rset); /* Read from stdin too. */ if(STDIN_FILENO > maxfd) maxfd = STDIN_FILENO; /* This would not be necessary, since we know STDIN_FILENO is 0. */ #endif if(slip_empty()) { char *pbuf = buf; ret = wpcap_poll(pbuf); if( ret > 0 ){ struct uip_eth_hdr * eth_hdr = (struct uip_eth_hdr *)pbuf; if(eth_hdr->type == htons(UIP_ETHTYPE_IPV6)){ // We forward only IPv6 packet. if(tun){ // Cut away ethernet header. pbuf += sizeof(struct uip_eth_hdr); ret -= sizeof(struct uip_eth_hdr); } write_to_serial(pbuf, ret); /*print_packet(pbuf, ret);*/ slip_flushbuf(slipfd); } } } { struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 10; ret = select(maxfd + 1, &rset, &wset, NULL, &tv); } if(ret == -1 && errno != EINTR && errno != EAGAIN) { err(1, "select"); } else if(ret > 0) { if(FD_ISSET(slipfd, &rset)) { /* printf("serial_to_wpcap\n"); */ serial_to_wpcap(inslip); /* printf("End of serial_to_wpcap\n");*/ } if(FD_ISSET(slipfd, &wset)) { slip_flushbuf(slipfd); } #ifdef WITH_STDIN if(FD_ISSET(STDIN_FILENO, &rset)) { char inbuf; if(fread(&inbuf,1,1,stdin)){ if(inbuf=='q'){ exit(0); } } } #endif } } }
void ContactDialog::setData(const ContactItem& c) { setWindowTitle(tr("Edit contact")); // Names ui->leFullName->setText(c.fullName); for (int i=0; i<c.names.count(); i++) addName(c.names[i]); // Phones for (int i=0; i<c.phones.count(); i++) addPhone(c.phones[i]); // Emails for (int i=0; i<c.emails.count(); i++) addEmail(c.emails[i]); // Birthday and anniversaries ui->cbBirthday->setChecked(c.birthday.value.isValid()); ui->dteBirthday->setEnabled(c.birthday.value.isValid()); ui->btnBDayDetails->setEnabled(c.birthday.value.isValid()); if (c.birthday.value.isValid()) ui->dteBirthday->setDateTime(c.birthday.value); birthdayDetails = c.birthday; DateDetailsDialog::setDateFormat(ui->dteBirthday, birthdayDetails.hasTime); anniversaryDetails.clear(); for (int i=0; i<c.anniversaries.count(); i++) addAnniversary(c.anniversaries[i]); // Photo if (c.photoType=="URL") ui->lbPhotoContent->setText(c.photoUrl); else if (c.photoType.toUpper()=="JPEG" || c.photoType.toUpper()=="PNG") { photo = c.photo; QPixmap pixPhoto; pixPhoto.loadFromData(photo); ui->lbPhotoContent->setPixmap(pixPhoto); } else if (!c.photo.isEmpty()) ui->lbPhotoContent->setText(S_PH_UNKNOWN_FORMAT); updatePhotoMenu(); // Addresses addAddress(ui->gbAddrHome, c.addrHome); addAddress(ui->gbAddrWork, c.addrWork); //Internet ui->leNickName->setText(c.nickName); ui->leURL->setText(c.url); ui->leJabber->setText(c.jabberName); ui->leICQ->setText(c.icqName); ui->leSkype->setText(c.skypeName); // Work ui->leOrganization->setText(c.organization); ui->leTitle->setText(c.title); // Other ui->leSortString->setText(c.sortString); ui->edDescription->setPlainText(c.description); ui->lbOriginalFormatValue->setText(c.originalFormat); ui->lbFormatVersionValue->setText(c.version); ui->lbIDValue->setText(c.id); ui->twOtherTags->setRowCount(c.otherTags.count()); int index = 0; foreach (const TagValue& tag, c.otherTags) { ui->twOtherTags->setItem(index, 0, new QTableWidgetItem(tag.tag)); ui->twOtherTags->setItem(index, 1, new QTableWidgetItem(tag.value)); index++; } // Unknown tags ui->twUnknownTags->setRowCount(c.unknownTags.count()); index = 0; foreach (const TagValue& tag, c.unknownTags) { ui->twUnknownTags->setItem(index, 0, new QTableWidgetItem(tag.tag)); ui->twUnknownTags->setItem(index, 1, new QTableWidgetItem(tag.value)); index++; } }
void Contact::setPriority(AddressMap::iterator address, int priority) { Address addr = (*address).second; m_addresses.erase(address); addAddress(addr, priority); }
AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, int selected, QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "street/postal", "Edit Address" ), Ok | Cancel, Ok, parent, name, true, true ), mPreviousAddress( 0 ) { mAddressList = list; QWidget *page = plainPage(); QGridLayout *topLayout = new QGridLayout( page, 8, 2 ); topLayout->setSpacing( spacingHint() ); mTypeCombo = new AddressTypeCombo( mAddressList, page ); topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); QLabel *label = new QLabel( i18n( "<streetLabel>:", "%1:" ).arg( KABC::Address::streetLabel() ), page ); label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); topLayout->addWidget( label, 1, 0 ); mStreetTextEdit = new QTextEdit( page ); mStreetTextEdit->setTextFormat( Qt::PlainText ); label->setBuddy( mStreetTextEdit ); topLayout->addWidget( mStreetTextEdit, 1, 1 ); TabPressEater *eater = new TabPressEater( this ); mStreetTextEdit->installEventFilter( eater ); label = new QLabel( i18n( "<postOfficeBoxLabel>:", "%1:" ).arg( KABC::Address::postOfficeBoxLabel() ), page ); topLayout->addWidget( label, 2 , 0 ); mPOBoxEdit = new KLineEdit( page ); label->setBuddy( mPOBoxEdit ); topLayout->addWidget( mPOBoxEdit, 2, 1 ); label = new QLabel( i18n( "<localityLabel>:", "%1:" ).arg( KABC::Address::localityLabel() ), page ); topLayout->addWidget( label, 3, 0 ); mLocalityEdit = new KLineEdit( page ); label->setBuddy( mLocalityEdit ); topLayout->addWidget( mLocalityEdit, 3, 1 ); label = new QLabel( i18n( "<regionLabel>:", "%1:" ).arg( KABC::Address::regionLabel() ), page ); topLayout->addWidget( label, 4, 0 ); mRegionEdit = new KLineEdit( page ); label->setBuddy( mRegionEdit ); topLayout->addWidget( mRegionEdit, 4, 1 ); label = new QLabel( i18n( "<postalCodeLabel>:", "%1:" ).arg( KABC::Address::postalCodeLabel() ), page ); topLayout->addWidget( label, 5, 0 ); mPostalCodeEdit = new KLineEdit( page ); label->setBuddy( mPostalCodeEdit ); topLayout->addWidget( mPostalCodeEdit, 5, 1 ); label = new QLabel( i18n( "<countryLabel>:", "%1:" ).arg( KABC::Address::countryLabel() ), page ); topLayout->addWidget( label, 6, 0 ); mCountryCombo = new KComboBox( page ); mCountryCombo->setEditable( true ); mCountryCombo->setDuplicatesEnabled( false ); #if KDE_IS_VERSION(3,3,0) QPushButton *labelButton = new QPushButton( i18n( "Edit Label..." ), page ); topLayout->addMultiCellWidget( labelButton, 7, 7, 0, 1 ); connect( labelButton, SIGNAL( clicked() ), SLOT( editLabel() ) ); #endif fillCountryCombo(); label->setBuddy( mCountryCombo ); topLayout->addWidget( mCountryCombo, 6, 1 ); mPreferredCheckBox = new QCheckBox( i18n( "street/postal", "This is the preferred address" ), page ); topLayout->addMultiCellWidget( mPreferredCheckBox, 8, 8, 0, 1 ); KSeparator *sep = new KSeparator( KSeparator::HLine, page ); topLayout->addMultiCellWidget( sep, 9, 9, 0, 1 ); QHBox *buttonBox = new QHBox( page ); buttonBox->setSpacing( spacingHint() ); topLayout->addMultiCellWidget( buttonBox, 10, 10, 0, 1 ); QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); mChangeTypeButton = new QPushButton( i18n( "Change Type..." ), buttonBox ); connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); mTypeCombo->updateTypes(); mTypeCombo->setCurrentItem( selected ); updateAddressEdits(); connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( updateAddressEdits() ) ); connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) ); connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) ); KAcceleratorManager::manage( this ); mChanged = false; bool state = (mAddressList.count() > 0); mRemoveButton->setEnabled( state ); mChangeTypeButton->setEnabled( state ); }
void TMailMessage::addBcc(const QByteArray &address, const QString &friendlyName) { addAddress("Bcc", address, friendlyName); addRecipient(address); }
void TMailMessage::setFrom(const QByteArray &address, const QString &friendlyName) { removeAllRawHeaders("From"); addAddress("From", address, friendlyName); }
void CPreciseTime::setupAddresses() { addAddress(new CAddress("codefix", (BYTE*)"\xB8\x00\x00\x00\x00\xF7\xE7\x8B\x44\x24\x20\xC1\xEA\x03", "x????xxxxxxxxx", 0x005113B0)); addAddress(new CAddress("datafix", (BYTE*)"\x25\x73\x25\x64\x3A\x25\x2E\x32\x64\x2E\x25\x2E\x32\x64", "xxxxxxxxxxxxxx", 0x01674528)); }