//////////////////////////////////////////////////////////////////////// // initialize the adaptor using the preferences, return false to // cancel adaptor loading bool adaptor::init(saga::impl::session *session, saga::ini::ini const& glob_ini, saga::ini::ini const& adap_ini) { if (adap_ini.has_section("cli")) { saga::ini::section s = adap_ini.get_section("cli"); if (s.has_entry("binary_path")) { binary_path = s.get_entry("binary_path"); std::cout << "binary_path = " << binary_path << std::endl; } if (s.has_section("description")) { saga::ini::section ss = s.get_section("description"); std::string v = ss.get_entry(sja::description_job_contact); saga::url mailto(v); if (mailto.get_scheme() != "mailto" || mailto.get_path().empty() ) // TODO mail address format check. { return false; } job_contact = v; } } return true; }
// Ensures that both ASCII and UTF-8 canonical URLs are handled properly and we // get the correct string object out. TEST(KURLTest, DISABLED_UTF8) { const char asciiURL[] = "http://foo/bar#baz"; KURL asciiKURL(ParsedURLString, asciiURL); EXPECT_TRUE(asciiKURL.string() == String(asciiURL)); // When the result is ASCII, we should get an ASCII String. Some // code depends on being able to compare the result of the .string() // getter with another String, and the isASCIIness of the two // strings must match for these functions (like equalIgnoringCase). EXPECT_TRUE(equalIgnoringCase(asciiKURL, String(asciiURL))); // Reproduce code path in FrameLoader.cpp -- equalIgnoringCase implicitly // expects gkurl.protocol() to have been created as ascii. KURL mailto(ParsedURLString, "mailto:[email protected]"); EXPECT_TRUE(equalIgnoringCase(mailto.protocol(), "mailto")); const char utf8URL[] = "http://foo/bar#\xe4\xbd\xa0\xe5\xa5\xbd"; KURL utf8KURL(ParsedURLString, utf8URL); EXPECT_TRUE(utf8KURL.string() == String::fromUTF8(utf8URL)); }
QString XmlParser::textToHtml( QString newText ) { // URL_IDENTICA = http://identi.ca/api QString networkUrl = m_serviceUrl.replace( QRegExp( "/api$" ), "" ); newText.replace( "<", "<" ); newText.replace( ">", ">" ); // recognize web/ftp links QRegExp ahref( "((https?|ftp)://[^ ]+)( ?)", Qt::CaseInsensitive ); newText.replace( ahref, "<a href='\\1'>\\1</a>\\3" ); // recognize @mentions (letters, numbers are allowed in nicks) // for Twitter, also allow _ in nicks and @user/list; // the list name can only contain letters, numbers and dashes (-) newText.replace( m_serviceUrl == TwitterAPI::UrlTwitter ? QRegExp( "(^|[^a-zA-Z0-9])@([\\w\\d_]+(/[\\w\\d-]+)?)" ) : QRegExp( "(^|[^a-zA-Z0-9])@([\\w\\d]+)" ), QString( "\\1<a href='%1/\\2'>@\\2</a>").arg( networkUrl ) ); // recognize e-mail addresses QRegExp mailto( "([a-z0-9\\._%-]+@[a-z0-9\\.-]+\\.[a-z]{2,4})", Qt::CaseInsensitive ); newText.replace( mailto, "<a href='mailto:\\1'>\\1</a>" ); // recognize #hashtags QRegExp tag( "#([\\w\\d-]+)( ?)", Qt::CaseInsensitive ); newText.replace( tag, m_serviceUrl == TwitterAPI::UrlTwitter ? "<a href='http://search.twitter.com/search?q=\\1'>#\\1</a>\\2" : QString( "<a href='%1/tag/\\1'>#\\1</a>\\2" ).arg(networkUrl) ); // recognize !groups if ( m_serviceUrl != TwitterAPI::UrlTwitter ) { QRegExp group( "!([\\w\\d-]+)( ?)", Qt::CaseInsensitive ); newText.replace( group, QString( "<a href='%1/group/\\1'>!\\1</a>\\2" ).arg(networkUrl) ); } return newText; }
void sender::sendtic(){emit mailto();};
void sender::addconnect(Widget &w){ connect(this, SIGNAL(mailto()), &w, SLOT(getmail())); }
int main(int argc, char **argv) { mailto("root|12345678"); return 0; }