bool SubmitEditorWidget::canSubmit() const { if (cleanupDescription(descriptionText()).trimmed().isEmpty()) return false; const unsigned checkedCount = checkedFilesCount(); return d->m_emptyFileListEnabled || checkedCount > 0; }
QString SubmitEditorWidget::descriptionText() const { QString rc = trimMessageText(lineWrap() ? wrappedText(m_d->m_ui.description) : m_d->m_ui.description->toPlainText()); // append field entries foreach(const SubmitFieldWidget *fw, m_d->m_fieldWidgets) rc += fw->fieldValues(); return cleanupDescription(rc); }
void SubmitEditorWidget::descriptionTextChanged() { d->m_description = cleanupDescription(d->m_ui.description->toPlainText()); wrapDescription(); trimDescription(); // append field entries foreach (const SubmitFieldWidget *fw, d->m_fieldWidgets) d->m_description += fw->fieldValues(); updateSubmitAction(); }
void PBIDBAccess::syncLargePkgRepoList(bool reload){ //Detailed list of packages available on the repo (can take a while) // - use PKGAVAIL as the base template for all the other info classes (save on "pkg" calls) //qDebug() << "Sync Remote PKG Repo"; if(PKGAVAIL.isEmpty() || reload){ PKGAVAIL.clear(); QStringList args; args << "rquery" << "-a" << "APP=%o::::%n::::%v::::%m::::%w::::%c::::%e::::%sh::::%q"; QStringList out = runCMD("pkg",args).split("APP="); for(int i=0; i<out.length(); i++){ QStringList info = out[i].split("::::"); //qDebug() << "PKG:" << info; //[ origin, name, version, maintainer, website, comment, description, size] if(info.length() < 9){ continue; } //invalid NGApp app; app.origin = info[0]; app.name = info[1]; app.version = info[2]; app.maintainer = info[3]; app.website = info[4]; app.shortdescription = cleanupDescription( info[5].split("\n") ); app.description = cleanupDescription( info[6].split("\n") ); app.size = info[7]; app.arch = info[8]; app.portcat = info[0].section("/",0,0).simplified(); //app = getRemotePkgDetails(app); PKGAVAIL.insert(info[0], app); } //Now get all the dependency information for the packages args.clear(); args << "rquery" << "-a" << "APP=%o::::%do"; out = runCMD("pkg",args).split("APP="); for(int i=0; i<out.length(); i++){ QStringList info = out[i].split("::::"); if(info.length() < 2){ continue; } if(PKGAVAIL.contains(info[0])){ NGApp app = PKGAVAIL[info[0]]; app.dependency.append(info[1].simplified()); PKGAVAIL.insert(info[0], app); } } } //qDebug() << " - end Remote PKG Repo Sync"; }
NGCat PBIDBAccess::parseNgCatLine(QString line){ //Cat= index line: [name, icon, description, freebsd category] QStringList lineInfo = line.split("::::"); NGCat cat; if(lineInfo.length() < 4){ return cat; } //invalid entry - skip it cat.name = lineInfo[0]; cat.icon = PBI_DBDIR+"PBI-cat-icons/"+lineInfo[1]; cat.description = cleanupDescription( lineInfo[2].split("<br>") ); cat.portcat = lineInfo[3].remove(":"); //qDebug() << "Found Cat:" << cat.name << cat.portcat; return cat; }
//------------------- // PARSERS //------------------- NGApp PBIDBAccess::parseNgIndexLine(QString line){ //PBI= index line: [port, name, +ports, author, website, license, app type, category, tags, maintainer, shortdesc, fulldesc, screenshots, related, plugins, conf dir] // screenshots = list of URL's for screenshots (empty space delimiter? Note "%20"->" " conversion within a single URL) // related = list of ports that are similar to this one QStringList lineInfo = line.split("::::"); if(lineInfo.length() < 18){ return NGApp(); } //invalid entry - skip it QString orig = lineInfo[0]; NGApp app; if(PKGINSTALLED.contains(orig)){ app = PKGINSTALLED[orig]; } //Try to start with the known info else if(PKGAVAIL.contains(orig)){ app = PKGAVAIL[orig]; } app.origin = orig; app.name = lineInfo[1]; app.needsPkgs = lineInfo[2].split(" ", QString::SkipEmptyParts); app.author = lineInfo[3]; app.website = lineInfo[4]; app.license = lineInfo[5]; app.type = lineInfo[6]; app.category = app.origin.section("/",0,0); app.tags = lineInfo[8].split(","); app.maintainer = lineInfo[9]; app.shortdescription = cleanupDescription( lineInfo[10].split("<br>") ); app.description = cleanupDescription( lineInfo[11].split("<br>") ); app.screenshots = lineInfo[12].split(" ", QString::SkipEmptyParts); app.screenshots = app.screenshots.replaceInStrings("%20"," "); app.similarApps = lineInfo[13].split(" ", QString::SkipEmptyParts); app.possiblePlugins = lineInfo[14].split(" ", QString::SkipEmptyParts); app.pbiorigin = lineInfo[15]; app.buildOptions = lineInfo[16].split(" ",QString::SkipEmptyParts); app.rating = lineInfo[17]; //all ratings out of 5 total //Now check for different types of shortcuts for this app app.hasDE = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-desktop" ); app.hasME = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-menu" ); app.hasMT = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-mime" ); app.hasWiki = true; //PBI-apps have wiki pages //Now create the path to the icon in the index app.icon = PBI_DBDIR+app.pbiorigin+"/icon.png"; //qDebug() << "Found App:" << app.name << app.origin; return app; }