void KonqSideBarWebModule::loadFavicon() {
    QString icon = KMimeType::favIconForUrl(_url);
    if (icon.isEmpty()) {
        org::kde::FavIcon favicon("org.kde.kded", "/modules/favicons", QDBusConnection::sessionBus());
        favicon.downloadHostIcon(_url.url());
        icon = KMimeType::favIconForUrl(_url);
    }

    if (!icon.isEmpty()) {
        emit setIcon(icon);

        if (icon != configGroup().readEntry("Icon", QString())) {
            configGroup().writeEntry("Icon", icon);
        }
    }
}
Exemple #2
0
void WebServer::processConnection(char *buff, int *bufflen) {
	int urlPrefixLen = strlen(m_urlPrefix);

	m_client = m_server.available();

	if (m_client) {
		m_readingContent = false;
		buff[0] = 0;
		ConnectionType requestType = INVALID;
		getRequest(requestType, buff, bufflen);

		// don't even look further at invalid requests.
		// this is done to prevent Webduino from hanging
		// - when there are illegal requests,
		// - when someone contacts it through telnet rather than proper HTTP,
		// - etc.
		if (requestType != INVALID) {
			processHeaders();

			if (strcmp(buff, "/robots.txt") == 0) {
				noRobots(requestType);
			} else if (strcmp(buff, "/favicon.ico") == 0) {
				favicon(requestType);
			}
		}
		if (requestType == INVALID || strncmp(buff, m_urlPrefix, urlPrefixLen) != 0
				|| !dispatchCommand(requestType, buff + urlPrefixLen, (*bufflen) >= 0)) {
			m_failureCmd(*this, requestType, buff, (*bufflen) >= 0);
		}
		reset();
		if(this->finalCommand != NULL){
			this->finalCommand(requestType, this->currentCollection, this->currentModel);
			this->finalCommand = NULL;
		}

	}
}