mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Using QString::left instead of QString::mid(0, )
This commit is contained in:
parent
066600ff10
commit
a37b29b275
@ -94,8 +94,9 @@ QString toSecondLevelDomain(const QUrl &url)
|
||||
#endif
|
||||
}
|
||||
|
||||
AdBlockRule::AdBlockRule(const QString &filter)
|
||||
: m_enabled(true)
|
||||
AdBlockRule::AdBlockRule(const QString &filter, AdBlockSubscription* subscription)
|
||||
: m_subscription(subscription)
|
||||
, m_enabled(true)
|
||||
, m_cssRule(false)
|
||||
, m_exception(false)
|
||||
, m_internalDisabled(false)
|
||||
@ -116,6 +117,16 @@ AdBlockRule::AdBlockRule(const QString &filter)
|
||||
setFilter(filter);
|
||||
}
|
||||
|
||||
AdBlockSubscription* AdBlockRule::subscription() const
|
||||
{
|
||||
return m_subscription;
|
||||
}
|
||||
|
||||
void AdBlockRule::setSubscription(AdBlockSubscription* subscription)
|
||||
{
|
||||
m_subscription = subscription;
|
||||
}
|
||||
|
||||
QString AdBlockRule::filter() const
|
||||
{
|
||||
return m_filter;
|
||||
@ -333,7 +344,7 @@ void AdBlockRule::parseFilter()
|
||||
|
||||
// Domain restricted rule
|
||||
if (!parsedLine.startsWith("##")) {
|
||||
QString domains = parsedLine.mid(0, pos);
|
||||
QString domains = parsedLine.left(pos);
|
||||
parseDomains(domains, ',');
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,15 @@
|
||||
class QNetworkRequest;
|
||||
class QUrl;
|
||||
|
||||
class AdBlockSubscription;
|
||||
|
||||
class AdBlockRule
|
||||
{
|
||||
public:
|
||||
AdBlockRule(const QString &filter = QString());
|
||||
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
||||
|
||||
AdBlockSubscription* subscription() const;
|
||||
void setSubscription(AdBlockSubscription* subscription);
|
||||
|
||||
QString filter() const;
|
||||
void setFilter(const QString &filter);
|
||||
@ -87,6 +92,7 @@ private:
|
||||
void parseFilter();
|
||||
void parseDomains(const QString &domains, const QChar &separator);
|
||||
|
||||
AdBlockSubscription* m_subscription;
|
||||
QString m_filter;
|
||||
|
||||
bool m_enabled;
|
||||
|
@ -117,7 +117,7 @@ void AdBlockSubscription::loadSubscription()
|
||||
|
||||
while (!textStream.atEnd()) {
|
||||
const QString &line = textStream.readLine();
|
||||
m_rules.append(AdBlockRule(line));
|
||||
m_rules.append(AdBlockRule(line, this));
|
||||
}
|
||||
|
||||
populateCache();
|
||||
|
@ -82,7 +82,7 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
||||
bookmarks.replace("<H3", "<h3");
|
||||
bookmarks.replace("</H3", "</h3");
|
||||
|
||||
bookmarks = bookmarks.mid(0, bookmarks.lastIndexOf("</dl><p>"));
|
||||
bookmarks = bookmarks.left(bookmarks.lastIndexOf("</dl><p>"));
|
||||
int start = bookmarks.indexOf("<dl><p>");
|
||||
|
||||
QStringList folders("Html Import");
|
||||
|
@ -106,7 +106,7 @@ QUrl LocationBar::createUrl()
|
||||
//Check for Search Engine shortcut
|
||||
int firstSpacePos = text().indexOf(" ");
|
||||
if (firstSpacePos != -1) {
|
||||
QString shortcut = text().mid(0, firstSpacePos);
|
||||
QString shortcut = text().left(firstSpacePos);
|
||||
QString searchedString = QUrl::toPercentEncoding(text().mid(firstSpacePos).trimmed());
|
||||
|
||||
SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
|
||||
|
@ -192,7 +192,7 @@ QString qz_ensureUniqueFilename(const QString &pathToFile)
|
||||
tmpFileName.append("(" + QString::number(i) + ")");
|
||||
}
|
||||
else {
|
||||
tmpFileName = tmpFileName.mid(0, index) + "(" + QString::number(i) + ")" + tmpFileName.mid(index);
|
||||
tmpFileName = tmpFileName.left(index) + "(" + QString::number(i) + ")" + tmpFileName.mid(index);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -248,7 +248,7 @@ QString qz_alignTextToWidth(const QString &string, const QString &text, const QF
|
||||
}
|
||||
|
||||
if (elidedLine.size() != part.size()) {
|
||||
elidedLine = elidedLine.mid(0, elidedLine.size() - 3);
|
||||
elidedLine = elidedLine.left(elidedLine.size() - 3);
|
||||
}
|
||||
|
||||
if (!returnString.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user