Example #1
0
QList<BookmarkMatch> Opera::match( const QString& term, bool addEverything )
{
    QList<BookmarkMatch> matches;

    QLatin1String nameStart("\tNAME=");
    QLatin1String urlStart("\tURL=");
    QLatin1String descriptionStart("\tDESCRIPTION=");

    // search
    foreach (const QString & entry, m_operaBookmarkEntries) {
        QStringList entryLines = entry.split(QStringLiteral("\n"));
        if (!entryLines.first().startsWith(QStringLiteral("#URL"))) {
            continue; // skip folder entries
        }
        entryLines.pop_front();

        QString name;
        QString url;
        QString description;

        foreach (const QString & line, entryLines) {
            if (line.startsWith(nameStart)) {
                name = line.mid( QString(nameStart).length() ).simplified();
            } else if (line.startsWith(urlStart)) {
                url = line.mid( QString(urlStart).length() ).simplified();
            } else if (line.startsWith(descriptionStart)) {
                description = line.mid(QString(descriptionStart).length())
                              .simplified();
            }
        }
        
        BookmarkMatch bookmarkMatch(m_favicon, term, name, url, description);
        bookmarkMatch.addTo(matches, addEverything);
    }
Example #2
0
bool CMotdFrame::isURL(const CString& s) const
{
  // Choose the easy path...
  CString urlStart("http://");
  CString smallCaps(s);
  smallCaps.MakeLower();
  return smallCaps.Find(urlStart) == 0;
}