void KonqSidebarTree::contentsDropEvent( QDropEvent *ev ) { if (d->m_dropMode == SidebarTreeMode) { m_autoOpenTimer->stop(); if ( !selectedItem() ) { // KonqOperations::doDrop( 0L, m_dirtreeDir.dir, ev, this ); KURL::List urls; if ( KURLDrag::decode( ev, urls ) ) { for(KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it) { addURL(0, *it); } } } else { KonqSidebarTreeItem *selection = static_cast<KonqSidebarTreeItem *>( selectedItem() ); selection->drop( ev ); } } else { KListView::contentsDropEvent(ev); } }
void VolumeURLListProperty::addVolume_(VolumeBase* handle, bool owner /*= false*/, bool selected /*= false*/) { tgtAssert(handle, "null pointer passed"); std::string url = handle->getOrigin().getURL(); if (!containsURL(url)) addURL(url, selected, false); else removeVolume(handle, false); handleMap_[url] = handle; ownerMap_[url] = owner; }
void MoleculeURLListProperty::addMolecule(Molecule* handle, bool owner /*= false*/, bool selected /*= false*/) { tgtAssert(handle, "null pointer passed"); std::string url = handle->getOrigin().getURL(); if (!containsURL(url)) addURL(url, selected); else removeMolecule(handle); handleMap_[url] = handle; ownerMap_[url] = owner; invalidate(); }
/** * 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(); }
int main (int argc, char * argv[]) { int i; int changedCount = 0; files = tr_new0 (const char*, argc); tr_setMessageLevel (TR_MSG_ERR); if (parseCommandLine (argc, (const char**)argv)) return EXIT_FAILURE; if (showVersion) { fprintf (stderr, MY_NAME" "LONG_VERSION_STRING"\n"); return EXIT_SUCCESS; } if (fileCount < 1) { fprintf (stderr, "ERROR: No torrent files specified.\n"); tr_getopt_usage (MY_NAME, getUsage (), options); fprintf (stderr, "\n"); return EXIT_FAILURE; } if (!add && !deleteme && !replace[0]) { fprintf (stderr, "ERROR: Must specify -a, -d or -r\n"); tr_getopt_usage (MY_NAME, getUsage (), options); fprintf (stderr, "\n"); return EXIT_FAILURE; } for (i=0; i<fileCount; ++i) { tr_benc top; bool changed = false; const char * filename = files[i]; printf ("%s\n", filename); if (tr_bencLoadFile (&top, TR_FMT_BENC, filename)) { printf ("\tError reading file\n"); continue; } if (deleteme != NULL) changed |= removeURL (&top, deleteme); if (add != NULL) changed = addURL (&top, add); if (replace[0] && replace[1]) changed |= replaceURL (&top, replace[0], replace[1]); if (changed) { ++changedCount; tr_bencToFile (&top, TR_FMT_BENC, filename); } tr_bencFree (&top); } printf ("Changed %d files\n", changedCount); tr_free (files); return EXIT_SUCCESS; }
int main (int argc, char * argv[]) { int i; int changedCount = 0; #ifdef _WIN32 tr_win32_make_args_utf8 (&argc, &argv); #endif files = tr_new0 (const char*, argc); tr_logSetLevel (TR_LOG_ERROR); if (parseCommandLine (argc, (const char**)argv)) return EXIT_FAILURE; if (showVersion) { fprintf (stderr, MY_NAME" "LONG_VERSION_STRING"\n"); return EXIT_SUCCESS; } if (fileCount < 1) { fprintf (stderr, "ERROR: No torrent files specified.\n"); tr_getopt_usage (MY_NAME, getUsage (), options); fprintf (stderr, "\n"); return EXIT_FAILURE; } if (!add && !deleteme && !replace[0]) { fprintf (stderr, "ERROR: Must specify -a, -d or -r\n"); tr_getopt_usage (MY_NAME, getUsage (), options); fprintf (stderr, "\n"); return EXIT_FAILURE; } for (i=0; i<fileCount; ++i) { tr_variant top; bool changed = false; const char * filename = files[i]; tr_error * error = NULL; printf ("%s\n", filename); if (!tr_variantFromFile (&top, TR_VARIANT_FMT_BENC, filename, &error)) { printf ("\tError reading file: %s\n", error->message); tr_error_free (error); continue; } if (deleteme != NULL) changed |= removeURL (&top, deleteme); if (add != NULL) changed = addURL (&top, add); if (replace[0] && replace[1]) changed |= replaceURL (&top, replace[0], replace[1]); if (changed) { ++changedCount; tr_variantToFile (&top, TR_VARIANT_FMT_BENC, filename); } tr_variantFree (&top); } printf ("Changed %d files\n", changedCount); tr_free (files); return EXIT_SUCCESS; }
/* * This adds routes to the RestAPI hashmap */ void initializeRouter() { addURL("/api/register/user", ®isterUser); // These are just examples. registerUser() and authenticateHTTPClient() needs to be declared somewhere addURL("/api/auth/user", &authenticateHTTPClient); }
static unsigned short httpReadHeaders(HTTP *http, App *app, Buf *buf, unsigned char *url, unsigned char **ct, int *chunked) { unsigned short c; unsigned char *charset; unsigned char *contentType; int locationFound; unsigned char *name; URL *rel; ContentType *type; unsigned char *value; char *version; app->printHTML(app, "<h4>Response</h4>"); app->printHTML(app, "<pre>"); contentType = NULL; locationFound = 0; bufMark(buf, 0); c = bufGetByte(buf); if (c == 256) { *ct = emptyHTTPResponse; return c; } nonEmptyHTTPResponseCount++; c = readNonWhiteSpace(buf, c); bufMark(buf, -1); app->httpResponse(app, buf); version = (char *) bufCopy(buf); if (!strcmp(version, "HTTP/1.0")) { } else if (!strcmp(version, "HTTP/1.1")) { } else if (!strncmp(version, "HTTP/", 5)) { } else { /* XXX deal with HTTP/0.9? */ *ct = http09Response; return c; } free(version); http10OrGreaterCount++; c = readSpaceTab(buf, c); c = readNumber(buf, c, &http->status); c = readLine(buf, c); while (1) { if (c == 256) { bufMark(buf, 0); app->httpResponse(app, buf); break; } bufMark(buf, -1); app->httpResponse(app, buf); if ((c == '\r') || (c == '\n')) { readLine(buf, c); bufUnGetByte(buf); bufMark(buf, 0); app->httpResponse(app, buf); break; } while ( (c != 256) && (c != '\r') && (c != '\n') && (c != ':') ) { c = bufGetByte(buf); } if (c != ':') { bufMark(buf, -1); fprintf(stderr, "no colon in HTTP header \"%s\": %s\n", bufCopy(buf), url); *ct = NULL; return c; } bufMark(buf, -1); app->httpResponseHeaderName(app, buf); name = bufCopyLower(buf); c = readSpaceTab(buf, bufGetByte(buf)); bufMark(buf, -1); app->httpResponse(app, buf); c = readLine(buf, c); if ((c == ' ') || (c == '\t')) { do { c = readLine(buf, c); } while ((c == ' ') || (c == '\t')); } c = bufTrimTrailingWhiteSpace(buf); bufMark(buf, -1); value = bufCopy(buf); if (!strcasecmp((char *) name, "content-type")) { app->httpResponseHeaderValue(app, buf, NULL); type = mimeParseContentType(value); contentType = mimeGetContentType(type); charset = mimeGetContentTypeParameter(type, "charset"); if (charset) { app->httpResponseCharSet(app, charset); free(charset); } mimeFreeContentType(type); } else if (!strcasecmp((char *) name, "location")) { /* XXX supposed to be absolute URL? */ rel = urlRelative(url, value); addURL(app, rel->url); app->httpResponseHeaderValue(app, buf, rel->url); urlFree(rel); locationFound = 1; } else if (!strcasecmp((char *) name, "transfer-encoding")) { app->httpResponseHeaderValue(app, buf, NULL); if (!strcasecmp((char *) value, "chunked")) { *chunked = 1; } } else { app->httpResponseHeaderValue(app, buf, NULL); } free(name); free(value); c = readLine(buf, c); bufMark(buf, -1); app->httpResponse(app, buf); } if (!contentType) { if (locationFound) { *ct = locationURLWasAdded; return c; } } *ct = contentType; return c; }