void FileShareProtocol::list() { // Read out directory, display by date (latest first) QDir dir(m_settings->path, QLatin1String(tempGlobPatternC), QDir::Time, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable); QStringList entries; QString user; QString description; QString errorMessage; const QChar blank = QLatin1Char(' '); const QFileInfoList entryInfoList = dir.entryInfoList(); const int count = qMin(m_settings->displayCount, entryInfoList.size()); for (int i = 0; i < count; i++) { const QFileInfo& entryFi = entryInfoList.at(i); if (parse(entryFi.absoluteFilePath(), &errorMessage, &user, &description)) { QString entry = entryFi.fileName(); entry += blank; entry += user; entry += blank; entry += description; entries.push_back(entry); } if (debug) qDebug() << entryFi.absoluteFilePath() << errorMessage; } emit listDone(name(), entries); }
void SlideShare::parseList() { qDebug() << ">>>>>>>>> SlideShare::parseList()" ; QDomDocument doc; QByteArray data = reply->readAll(); doc.setContent(data); QDomElement root = doc.documentElement(); QDomElement child = root.firstChildElement("Slideshow"); textDocList.clear(); presentationList.clear(); spreadsheetList.clear(); while(!child.isNull()) { SlideShareDocument *p = new SlideShareDocument; p->title = child.firstChildElement("Title").text(); p->url = child.firstChildElement("URL").text(); p->format = child.firstChildElement("Format").text(); p->slideID = child.firstChildElement("ID").text(); p->thumbnailBig = child.firstChildElement("ThumbnailUrl").text(); p->thumbnailSmall = child.firstChildElement("ThumbnailSmallURL").text(); p->downloadUrl = p->url.append("/download"); QString download = child.firstChildElement("Download").text(); if(download == "1") { if(p->format == "odt" || p->format == "doc") this->textDocList.append(*p); if(p->format == "odp" || p->format == "ppt") this->presentationList.append(*p); if(p->format == "ods" || p->format == "xls") this->spreadsheetList.append(*p); } child = child.nextSiblingElement("Slideshow"); } emit listDone(); }