QDomElement StyleNode::getElement(QStringList path) { if (path.size() < 1 || path.first() != elem.tagName() ) return QDomElement(); if ( path.size() == 1) return elem; // Try to find this element among the children QDomElement e; int index = 0; while ( e.isNull() && index < children.size() ) { e = children[index]->getElement(path.mid(1)); index++; } if (!e.isNull() ) return e; // Try to find this element among the prototypes index = 0; while ( e.isNull() && index < prototypes.size() ) { QStringList newPath = path.mid(1); newPath.prepend("style"); e = prototypes[index]->getElement(newPath); index++; } return e; }
void JourneySearchParser::splitWordList( const QStringList& wordList, int splitWordPos, QString* leftOfSplitWord, QString* rightOfSplitWord, int excludeWordsFromleft ) { *leftOfSplitWord = ((QStringList)wordList.mid(excludeWordsFromleft, splitWordPos - excludeWordsFromleft)).join(" "); *rightOfSplitWord = ((QStringList)wordList.mid(splitWordPos + 1, wordList.count() - splitWordPos)).join(" "); }
static QStringList mergeLists (const QStringList &labels, const QStringList &ids) { if (labels.size () < ids.size ()) { return labels + (ids.mid (labels.size ())); } else if (labels.size () > ids.size ()) { return (labels.mid (0, ids.size ())); } return labels; }
IrcCommand* CommandParser::parseCommand(const QString& receiver, const QString& text) { if (text.startsWith("//") || text.startsWith("/ ") || !text.startsWith('/')) { QString message = text; if (message.startsWith('/')) message.remove(0, 1); return IrcCommand::createMessage(receiver, message.trimmed()); } else { typedef IrcCommand*(*ParseFunc)(const QString&, const QStringList&); static QHash<QString, ParseFunc> parseFunctions; if (parseFunctions.isEmpty()) { parseFunctions.insert("ADMIN", &CommandParser::parseAdmin); parseFunctions.insert("AWAY", &CommandParser::parseAway); parseFunctions.insert("INFO", &CommandParser::parseInfo); parseFunctions.insert("INVITE", &CommandParser::parseInvite); parseFunctions.insert("KICK", &CommandParser::parseKick); parseFunctions.insert("KNOCK", &CommandParser::parseKnock); parseFunctions.insert("LIST", &CommandParser::parseList); parseFunctions.insert("ME", &CommandParser::parseMe); parseFunctions.insert("MODE", &CommandParser::parseMode); parseFunctions.insert("MOTD", &CommandParser::parseMotd); parseFunctions.insert("NAMES", &CommandParser::parseNames); parseFunctions.insert("NICK", &CommandParser::parseNick); parseFunctions.insert("NOTICE", &CommandParser::parseNotice); parseFunctions.insert("PART", &CommandParser::parsePart); parseFunctions.insert("PING", &CommandParser::parsePing); parseFunctions.insert("QUIT", &CommandParser::parseQuit); parseFunctions.insert("QUOTE", &CommandParser::parseQuote); parseFunctions.insert("STATS", &CommandParser::parseStats); parseFunctions.insert("TIME", &CommandParser::parseTime); parseFunctions.insert("TOPIC", &CommandParser::parseTopic); parseFunctions.insert("TRACE", &CommandParser::parseTrace); parseFunctions.insert("USERS", &CommandParser::parseUsers); parseFunctions.insert("VERSION", &CommandParser::parseVersion); parseFunctions.insert("WHO", &CommandParser::parseWho); parseFunctions.insert("WHOIS", &CommandParser::parseWhois); parseFunctions.insert("WHOWAS", &CommandParser::parseWhowas); } const QString expanded = expandAlias(receiver, text.mid(1)); const QStringList words = expanded.split(" ", QString::SkipEmptyParts); const QString command = words.value(0).toUpper(); ParseFunc parseFunc = parseFunctions.value(command); if (parseFunc) { IrcCommand* cmd = parseFunc(receiver, words.mid(1)); if (cmd) return cmd; } else if (command_syntaxes().contains(command.toUpper())) { return parseCustomCommand(command, words.mid(1), command_syntaxes().value(command.toUpper())); } } // unknown command return 0; }
static QGpgMEKeyListJob::result_type list_keys(Context *ctx, QStringList pats, bool secretOnly) { if (pats.size() < 2) { std::vector<Key> keys; const KeyListResult r = do_list_keys(ctx, pats, keys, secretOnly); return std::make_tuple(r, keys, QString(), Error()); } // The communication channel between gpgme and gpgsm is limited in // the number of patterns that can be transported, but they won't // say to how much, so we need to find out ourselves if we get a // LINE_TOO_LONG error back... // We could of course just feed them single patterns, and that would // probably be easier, but the performance penalty would currently // be noticeable. unsigned int chunkSize = pats.size(); retry: std::vector<Key> keys; keys.reserve(pats.size()); KeyListResult result; do { const KeyListResult this_result = do_list_keys(ctx, pats.mid(0, chunkSize), keys, secretOnly); if (this_result.error().code() == GPG_ERR_LINE_TOO_LONG) { // got LINE_TOO_LONG, try a smaller chunksize: chunkSize /= 2; if (chunkSize < 1) // chunks smaller than one can't be -> return the error. { return std::make_tuple(this_result, keys, QString(), Error()); } else { goto retry; } } else if (this_result.error().code() == GPG_ERR_EOF) { // early end of keylisting (can happen when ~/.gnupg doesn't // exist). Fakeing an empty result: return std::make_tuple(KeyListResult(), std::vector<Key>(), QString(), Error()); } // ok, that seemed to work... result.mergeWith(this_result); if (result.error().code()) { break; } pats = pats.mid(chunkSize); } while (!pats.empty()); return std::make_tuple(result, keys, QString(), Error()); }
QModelIndex QFileSystemModelEx::index(const QString &path, int column) const { QFileInfo info(path); if(info.exists() && info.isDir()) { QString fullPath = QDir::fromNativeSeparators(info.canonicalFilePath()); QStringList parts = fullPath.split('/', QString::SkipEmptyParts); for(int i = 2; i <= parts.count(); i++) { QFileInfo currentPath(((QStringList) parts.mid(0, i)).join("/")); if((!currentPath.exists()) || (!currentPath.isDir()) || currentPath.isHidden()) { return QModelIndex(); } } QModelIndex index = QFileSystemModel::index(fullPath, column); if(index.isValid()) { QModelIndex temp = index; while(temp.isValid()) { removeFromCache(filePath(temp).toLower()); temp = temp.parent(); } return index; } } return QModelIndex(); }
void MainWindow::ShowConnectDialog() { const QUrl url("http://autosong.ninjam.com/serverlist.php"); ConnectDialog connectDialog; QSettings settings; QStringList hosts = settings.value("connect/hosts").toStringList(); connectDialog.resize(600, 500); connectDialog.loadServerList(url); connectDialog.setRecentHostsList(hosts); connectDialog.setUser(settings.value("connect/user").toString()); connectDialog.setIsPublicServer(settings.value("connect/public", true).toBool()); if (connectDialog.exec() != QDialog::Accepted) { return; } hosts.prepend(connectDialog.host()); hosts.removeDuplicates(); hosts = hosts.mid(0, 16); /* limit maximum number of elements */ settings.setValue("connect/hosts", hosts); settings.setValue("connect/user", connectDialog.user()); settings.setValue("connect/public", connectDialog.isPublicServer()); QString user = connectDialog.user(); if (connectDialog.isPublicServer()) { user.prepend("anonymous:"); } Connect(connectDialog.host(), user, connectDialog.pass()); }
PortInfo Firewall::LookUpPort(int port, QString type) { //Make sure that the port is valid if (port < 0 || port > 65535) { PortInfo returnValue; returnValue.Port = -1; returnValue.Description = "Port out of bounds"; return returnValue; } if(portStrings.isEmpty()){ readServicesFile(); } PortInfo returnValue; //the port number is valid so set it returnValue.Port = port; //make sure that the portType is cased in lower to match the service file and //then store it in the returnValue, since there isn't a huge point in checking //the validitiy of the type since /etc/services lists more than udp/tcp type = type.toLower(); returnValue.Type = type; //Check to see if it's a recommended port returnValue.Recommended = false; for(int recommendedPort : recommendedPorts) { if (port == recommendedPort) { returnValue.Recommended = true; } } //Check to see if the port number is listed. The format in the file // is portname/portType. ex.: 22/tcp QStringList portList = portStrings.filter( QRegExp("\\s"+QString::number(port)+"/"+type+"\\s") ); if(portList.size() > 0) { //grab the first one, there may be duplicates due to colliding ports in the /etc/services file //but those are listed after the declaration for what the port officially should be used for QString line = portList.at(0); //Split across spaces since it's whitespace delimited QStringList lineList = line.split(' '); //the keyword associated with the port is the first element in a line returnValue.Keyword = lineList.at(0); //if the size of the list is less than 3 then there is no description if(lineList.size() > 2){ returnValue.Description = lineList.mid(2,-1).join(" "); } } return returnValue; }
bool Nuria::RestfulHttpNode::invokePath (const QString &path, const QStringList &parts, int index, Nuria::HttpClient *client) { delayedRegisterMetaObject (); // if (client->verb () == HttpClient::InvalidVerb || !allowAccessToClient (path, parts, index, client)) { client->killConnection (403); return false; } // QString interestingPart = QStringList (parts.mid (index)).join (QLatin1Char ('/')); // Reverse walk over the QMap, so we first check longer paths. auto it = this->d_ptr->methods.end (); auto end = this->d_ptr->methods.begin (); do { it--; Internal::RestfulHttpNodeSlotData &cur = *it; QRegularExpressionMatch match = cur.path.match (interestingPart); if (match.hasMatch ()) { return invokeMatch (cur, match, client); } } while (it != end); // return HttpNode::invokePath (path, parts, index, client); }
static IceOffer iceblock_parse(const QStringList &in) { IceOffer out; if(in.count() < 3 || in[0] != "-----BEGIN ICE-----" || in[in.count()-1] != "-----END ICE-----") return IceOffer(); QStringList body = lines_unwrap(in.mid(1, in.count() - 2)).split(';'); if(body.count() < 2) return IceOffer(); QStringList parts = body[0].split(','); if(parts.count() != 2) return IceOffer(); bool ok; out.user = urlishDecode(parts[0], &ok); if(!ok || out.user.isEmpty()) return IceOffer(); out.pass = urlishDecode(parts[1], &ok); if(!ok || out.pass.isEmpty()) return IceOffer(); for(int n = 1; n < body.count(); ++n) { XMPP::Ice176::Candidate c = line_to_candidate(body[n]); if(c.type.isEmpty()) return IceOffer(); out.candidates += c; } return out; }
void SqlPlaylist::loadTracks() { QString query = "SELECT playlist_id, track_num, url, title, album, artist, length FROM " "playlist_tracks WHERE playlist_id=%1 ORDER BY track_num"; query = query.arg( QString::number( m_dbId ) ); QStringList result = CollectionManager::instance()->sqlStorage()->query( query ); int resultRows = result.count() / 7; for( int i = 0; i < resultRows; i++ ) { QStringList row = result.mid( i*7, 7 ); KUrl url = KUrl( row[2] ); MetaProxy::Track *proxyTrack = new MetaProxy::Track( url ); proxyTrack->setName( row[3] ); proxyTrack->setAlbum( row[4] ); proxyTrack->setArtist( row[5] ); Meta::TrackPtr trackPtr = Meta::TrackPtr( proxyTrack ); //subscribed to force a save to db on any change (such as AFT file move) subscribeTo( trackPtr ); m_tracks << trackPtr; } m_tracksLoaded = true; }
void GwtCallback::paintPrintText(QPrinter* printer) { QPainter painter; painter.begin(printer); // look up the system fixed font QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); fixedFont.setPointSize(10); painter.setFont(fixedFont); // break up the text into pages and draw each page QStringList lines = printText_.split(QString::fromUtf8("\n")); int i = 0; while (i < lines.size()) { // split off next chunk of lines and draw them int end = std::min(i + 60, lines.size()); QStringList pageLines(lines.mid(i, 60)); painter.drawText(50, 50, 650, 900, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, pageLines.join(QString::fromUtf8("\n"))); // start a new page if there are more lines if (end < lines.size()) printer->newPage(); // move to next line group i += 60; } painter.end(); }
Status StatusParser::parse(QString data) { data = stripResponseHeader(data); QStringList playerList = data.split("\n"); QString variableData = playerList.first(); playerList.removeFirst(); QStringList variableList = variableData.split("\\", QString::SkipEmptyParts); QStringListIterator it(variableList); Status status; while (it.hasNext()) { QString key = it.next(); if(it.hasNext()) { QString value = it.next(); status.variables.insert(key, value); } } QStringListIterator itP(playerList); while (itP.hasNext()) { QString line = itP.next(); QStringList playerData = line.split(" "); if(playerData.size() >= 3) { QString playerName = QStringList(playerData.mid(2)).join(" "); playerName.chop(1); // remove first " playerName.remove(0, 1); // remove last " status.players.append(std::move(Player(playerName, playerData[0].toInt(), playerData[1].toInt()))); } } return status; }
QString HandlerChoiceDialog::GetFilename () const { QString name = Buttons_->checkedButton ()-> property ("PluginName").toString (); QString result; if (Ui_.LocationsBox_->currentIndex () == 0) { if (Suggestion_.isEmpty ()) Suggestion_ = GetPluginSavePaths (name).value (0, QDir::homePath ()); result = QFileDialog::getExistingDirectory (0, tr ("Select save location"), Suggestion_, QFileDialog::Option (~QFileDialog::ShowDirsOnly)); if (result.isEmpty ()) return QString (); } else result = Ui_.LocationsBox_->currentText (); QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName ()); settings.setValue ("PreviousEntitySavePath", result); settings.beginGroup ("SavePaths"); QStringList pluginTexts = settings.value (name).toStringList (); pluginTexts.removeAll (result); pluginTexts.prepend (result); pluginTexts = pluginTexts.mid (0, 20); settings.setValue (name, pluginTexts); settings.endGroup (); return result; }
bool WebSocketMythEvent::HandleTextFrame(const WebSocketFrame &frame) { QString message = QString(frame.payload); if (message.isEmpty()) return false; QStringList tokens = message.split(" ", QString::SkipEmptyParts); if (tokens[0] == "WS_EVENT_ENABLE") // Only send events if asked { m_sendEvents = true; LOG(VB_HTTP, LOG_NOTICE, "WebSocketMythEvent: Enabled"); } else if (tokens[0] == "WS_EVENT_DISABLE") { m_sendEvents = false; LOG(VB_HTTP, LOG_NOTICE, "WebSocketMythEvent: Disabled"); } else if (tokens[0] == "WS_EVENT_SET_FILTER") { m_filters.clear(); if (tokens.length() == 1) return true; m_filters = tokens.mid(1); QString filterString = m_filters.join(", "); LOG(VB_HTTP, LOG_NOTICE, QString("WebSocketMythEvent: Updated filters (%1)").arg(filterString)); } return false; }
BookmarkGroupList BookmarkGroup::childGroups() const { //DEBUG_BLOCK if ( !m_hasFetchedChildGroups ) { QString query = "SELECT id, parent_id, name, description FROM bookmark_groups where parent_id=%1 ORDER BY name;"; query = query.arg( QString::number( m_dbId ) ); QStringList result = CollectionManager::instance()->sqlStorage()->query( query ); int resultRows = result.count() / 4; for( int i = 0; i < resultRows; i++ ) { QStringList row = result.mid( i*4, 4 ); BookmarkGroup* mutableThis = const_cast<BookmarkGroup*>( this ); m_childGroups << BookmarkGroupPtr( new BookmarkGroup( row, BookmarkGroupPtr( mutableThis ) ) ); } m_hasFetchedChildGroups = true; } return m_childGroups; }
void Botanna::processPublicMessage(QString &message, const QString &userName) { if (userName == name) { // skip my messages return; } // replace the message with the alias, if exists QString aliasMessage = memory->alias(message); if (!aliasMessage.isEmpty()) { message = aliasMessage; } if (message.startsWith("!")) { // special message QStringList messageParts = message.split(" "); if (messageParts.length() < 2) { // too few parts return; } const QString &commandType = messageParts.at(0); const QString &command = messageParts.at(1); QStringList parameters = messageParts.mid(2, -1); // from third element to end of list if (commandType == "!gdf") { gdfExecuteCommand(command, parameters, userName); } } else { // normal message } }
QString HandlerChoiceDialog::GetFilename () { const QString& name = Buttons_->checkedButton ()-> property ("PluginID").toString (); QString result; if (Ui_.LocationsBox_->currentIndex () == 0 && Ui_.LocationsBox_->currentText ().isEmpty ()) on_BrowseButton__released (); result = Ui_.LocationsBox_->currentText (); if (result.isEmpty ()) return QString (); QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName ()); settings.setValue ("PreviousEntitySavePath", result); settings.beginGroup ("SavePaths"); QStringList pluginTexts = settings.value (name).toStringList (); pluginTexts.removeAll (result); pluginTexts.prepend (result); pluginTexts = pluginTexts.mid (0, 20); settings.setValue (name, pluginTexts); settings.endGroup (); return result; }
int Pty::start(const QString& programName, const QStringList& programArguments, const QStringList& environmentList) { clearProgram(); // For historical reasons, the first argument in programArguments is the // name of the program to execute, so create a list consisting of all // but the first argument to pass to setProgram() Q_ASSERT(programArguments.count() >= 1); setProgram(programName, programArguments.mid(1)); addEnvironmentVariables(environmentList); // unless the LANGUAGE environment variable has been set explicitly // set it to a null string // this fixes the problem where KCatalog sets the LANGUAGE environment // variable during the application's startup to something which // differs from LANG,LC_* etc. and causes programs run from // the terminal to display messages in the wrong language // // this can happen if LANG contains a language which KDE // does not have a translation for // // BR:149300 setEnv("LANGUAGE", QString(), false /* do not overwrite existing value if any */); KProcess::start(); if (waitForStarted()) { return 0; } else { return -1; } }
QVariant RKMatrixInput::value (const QString& modifier) { if (modifier.isEmpty () || (modifier == "cbind")) { QStringList ret; for (int i = 0; i < column_count->intValue (); ++i) { ret.append ("\tc (" + makeColumnString (i, ", ") + ')'); } return QString ("cbind (\n" + ret.join (",\n") + "\n)"); } else if (modifier.startsWith ("row.")) { bool ok; int row = modifier.mid (4).toInt (&ok); if ((row >= 0) && ok) { return (rowStrings (row)); } } bool ok; int col = modifier.toInt (&ok); if ((col >= 0) && ok) { QStringList l; if (col < columns.size ()) l = columns[col].storage; while (l.size () < row_count->intValue ()) { l.append (QString ()); } if (l.size () > row_count->intValue ()) l = l.mid (0, row_count->intValue ()); return l; } return ("Modifier '" + modifier + "' not recognized\n"); }
QHash<QString, QString> AirportsData::getAirportNameMap(MainObject *mainObject) { QHash<QString, QString> airportMap; QString path(mainObject->X->fgroot() + QString("/Airports/apt.dat.gz")); fgx_gzHandle apt_dat_file = fgx_gzOpen(path); while( !fgx_gzEof( apt_dat_file ) ) { QString line = fgx_gzReadline( apt_dat_file ); if(line.trimmed().isEmpty()) continue; QStringList ls = line.split(" ", QString::SkipEmptyParts); // 1 is the row code for airports, 16 for seaplane bases (not in FlightGear!) and 17 for heliports // see http://data.x-plane.com/file_specs/XP%20APT850%20Spec.pdf for details if(ls[0].compare("1") == 0 || ls[0].compare("16") == 0 || ls[0].compare("17") == 0) { QString airport_name = QStringList(ls.mid(5)).join(" "); QString airport_code = ls[4]; airportMap.insert(airport_code, airport_name); } } fgx_gzClose( apt_dat_file ); return airportMap; }
void Syncer::CreateRemotePath (const QStringList& path) { if (Id2Path_.right.count (path.join ("/"))) return; QStringList nonExistingPath; QStringList existingPath; for (int i = path.length () - 1; i >= 0; --i) { QStringList temp = path.mid (0, i + 1); if (Id2Path_.right.count (temp.join ("/"))) { existingPath = temp; break; } else if (nonExistingPath.isEmpty ()) nonExistingPath = temp; } if (nonExistingPath.isEmpty ()) return; int lastPos = 0; for ( ; lastPos < std::min (existingPath .size (), nonExistingPath.size ()); ++lastPos) if (existingPath.at (lastPos) != nonExistingPath.at (lastPos)) break; SFLAccount_->CreateDirectory (nonExistingPath.at (lastPos), existingPath.isEmpty () ? QByteArray () : Id2Path_.right.at (existingPath.join ("/"))); if (lastPos != nonExistingPath.length () - 1) CallsQueue_.append ([this, nonExistingPath] () { CreateRemotePath (nonExistingPath); }); }
void ViewPrivate::addActionsToContextMenu(QMenu *menu) { Q_Q(View); QString s = selection(); QString shortUrl = shortUrlFromString(s); QString longUrl = longUrlFromString(s); // A. Treat long URL if (isUrlLike(longUrl)) { // Split the selected text into blocks seperated by one of the // characters in seps QStringList blocks = longUrl.split(QRegExp("\\s+")); // Parse the blocks into two types: // 1. Only the first component has a protocol prefix // 2. Either the first one does not have a protocol prefix, or there // are multiple entries in the list that has a prefix. bool firstOnlyProtocol = false; if (blocks.size() > 1 && hasProtocolPrefix(blocks.at(0))) { firstOnlyProtocol = true; foreach (const QString &c, blocks.mid(1)) { if (hasProtocolPrefix(c)) { firstOnlyProtocol = false; break; } } } // Type 1 (firstOnlyProtocol = true) // Concatenate all components into one single URL if (firstOnlyProtocol) { addUrlToMenu(blocks.join(""), menu); } // Type 2 (firstOnlyProtocol = false) // Treat each component as an individual URL else { QStringList urls; foreach (const QString &c, blocks) { if (isUrlLike(c)) urls << c; } if (!urls.isEmpty()) { QString title = (urls.size() == 1) ? urls.first() : q->tr("Open as multiple URLs"); QAction *action = menu->addAction(title, q, SLOT(openUrl())); action->setData(urls); } } }
void CLIOptions::parse(const QStringList& cmd_line_args) { qfLogFuncFrame() << cmd_line_args.join(' '); m_isAppBreak = false; m_parsedArgIndex = 0; m_arguments = cmd_line_args.mid(1); m_unusedArguments = QStringList(); m_parseErrors = QStringList(); m_allArgs = cmd_line_args; while(true) { QString arg = takeArg(); if(arg.isEmpty()) break; if(arg == "--help" || arg == "-h") { setHelp(true); printHelp(); m_isAppBreak = true; return; } else { bool found = false; QMutableMapIterator<QString, Option> it(m_options); while(it.hasNext()) { it.next(); Option &opt = it.value(); QStringList names = opt.names(); if(names.contains(arg)) { found = true; if(opt.type() != QVariant::Bool) { arg = takeArg(); opt.setValueString(arg); } else { //LOGDEB() << "setting true"; opt.setValue(true); } break; } } if(!found) { if(arg.startsWith("-")) m_unusedArguments << arg; } } } { QMapIterator<QString, Option> it(m_options); while(it.hasNext()) { it.next(); Option opt = it.value(); //LOGDEB() << "option:" << it.key() << "is mandatory:" << opt.isMandatory() << "is valid:" << opt.value().isValid(); if(opt.isMandatory() && !opt.value().isValid()) { addParseError(QString("Mandatory option '%1' not set.").arg(opt.names().value(0))); } } } qf::core::Exception::setAbortOnException(isAbortOnException()); }
QStringList QScriptScriptData::lines(int startLineNumber, int count) const { Q_D(const QScriptScriptData); if (!d) return QStringList(); QStringList allLines = d->contents.split(QLatin1Char('\n')); return allLines.mid(qMax(0, startLineNumber - d->baseLineNumber), count); }
//Re-indents the code so the leftmost line starts at zero QString zeroIndentation(QString str, int fromLine = 0) { QStringList lines = str.split('\n'); QStringList ret; if(fromLine < lines.size()) { ret = lines.mid(0, fromLine); lines = lines.mid(fromLine); } QRegExp nonWhiteSpace("\\S"); int minLineStart = 10000; foreach(const QString& line, lines) { int lineStart = line.indexOf(nonWhiteSpace); if(lineStart < minLineStart) minLineStart = lineStart; }
void WebSearchBar::addSuggestions(const QStringList &list) { if (qzSettings->showSearchSuggestions) { QStringList list_ = list.mid(0, 6); m_completerModel->setStringList(list_); m_completer->complete(); } }
void NotifyManager::addToRecentList(QStringList& list, const QString &message) { list << message; if (list.size() <= maxRecentMessages) return; list = list.mid(list.length() - maxRecentMessages); }
void Telegram::renameContact(const QString &number, const QString &newName) { QStringList splits = newName.split(" ",QString::SkipEmptyParts); while( splits.count() < 2 ) splits << QString(); addContact( number, splits.first(), QStringList(splits.mid(1)).join(" "), true ); }
void SyncFileStatusTracker::invalidateParentPaths(const QString& path) { QStringList splitPath = path.split('/', QString::SkipEmptyParts); for (int i = 0; i < splitPath.size(); ++i) { QString parentPath = QStringList(splitPath.mid(0, i)).join(QLatin1String("/")); emit fileStatusChanged(getSystemDestination(parentPath), fileStatus(parentPath)); } }