Skip to content

Commit

Permalink
core/ui: use 'mid' instead if 'midRef'
Browse files Browse the repository at this point in the history
Required for Qt 6, where 'midRef' has been removed from QString, and
'mid' can already be used with Qt 5.

Picked from: OtterBrowser#1770
  • Loading branch information
Chiitoo committed Aug 7, 2024
1 parent dccada6 commit 27e93b7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/core/BookmarksManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ BookmarksModel::Bookmark* BookmarksManager::getBookmark(const QString &text)

if (text.startsWith(QLatin1Char('#')))
{
return m_model->getBookmark(text.midRef(1).toULongLong());
return m_model->getBookmark(text.mid(1).toULongLong());
}

if (text.startsWith(QLatin1String("bookmarks:")))
{
return (text.startsWith(QLatin1String("bookmarks:/")) ? m_model->getBookmarkByPath(text.mid(11)) : getBookmark(text.midRef(10).toULongLong()));
return (text.startsWith(QLatin1String("bookmarks:/")) ? m_model->getBookmarkByPath(text.mid(11)) : getBookmark(text.mid(10).toULongLong()));
}

return m_model->getBookmarkByKeyword(text);
Expand Down
2 changes: 1 addition & 1 deletion src/core/BookmarksModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ BookmarksModel::Bookmark* BookmarksModel::getBookmarkByPath(const QString &path,

if (path.startsWith(QLatin1Char('#')))
{
return getBookmark(path.midRef(1).toULongLong());
return getBookmark(path.mid(1).toULongLong());
}

Bookmark *bookmark(m_rootItem);
Expand Down
2 changes: 1 addition & 1 deletion src/core/InputInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ InputInterpreter::InterpreterResult InputInterpreter::interpret(const QString &t

if (text.startsWith(QLatin1String("bookmarks:")))
{
BookmarksModel::Bookmark *bookmark(text.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(text.mid(11)) : BookmarksManager::getBookmark(text.midRef(10).toULongLong()));
BookmarksModel::Bookmark *bookmark(text.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(text.mid(11)) : BookmarksManager::getBookmark(text.mid(10).toULongLong()));

if (bookmark)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/NetworkAutomaticProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int PacUtils::dnsDomainLevels(const QString &host) const
{
if (host.startsWith(QLatin1String("www."), Qt::CaseInsensitive))
{
return host.midRef(4).count(QLatin1Char('.'));
return host.mid(4).count(QLatin1Char('.'));
}

return host.count(QLatin1Char('.'));
Expand Down
4 changes: 2 additions & 2 deletions src/ui/ToolBarDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ void ToolBarDialog::editEntry()
}
else if (identifier.startsWith(QLatin1String("bookmarks:")))
{
const BookmarksModel::Bookmark *bookmark(identifier.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(identifier.mid(11)) : BookmarksManager::getBookmark(identifier.midRef(10).toULongLong()));
const BookmarksModel::Bookmark *bookmark(identifier.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(identifier.mid(11)) : BookmarksManager::getBookmark(identifier.mid(10).toULongLong()));

if (bookmark)
{
Expand Down Expand Up @@ -791,7 +791,7 @@ QMap<int, QVariant> ToolBarDialog::createEntryData(const QString &identifier, co
}
else if (identifier.startsWith(QLatin1String("bookmarks:")))
{
const BookmarksModel::Bookmark *bookmark(identifier.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(identifier.mid(11)) : BookmarksManager::getBookmark(identifier.midRef(10).toULongLong()));
const BookmarksModel::Bookmark *bookmark(identifier.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(identifier.mid(11)) : BookmarksManager::getBookmark(identifier.mid(10).toULongLong()));

if (bookmark)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/WidgetFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ QWidget* createToolBarItem(const ToolBarsManager::ToolBarDefinition::Entry &defi

if (definition.action.startsWith(QLatin1String("bookmarks:")))
{
BookmarksModel::Bookmark *bookmark(definition.action.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(definition.action.mid(11)) : BookmarksManager::getBookmark(definition.action.midRef(10).toULongLong()));
BookmarksModel::Bookmark *bookmark(definition.action.startsWith(QLatin1String("bookmarks:/")) ? BookmarksManager::getModel()->getBookmarkByPath(definition.action.mid(11)) : BookmarksManager::getBookmark(definition.action.mid(10).toULongLong()));

if (bookmark)
{
Expand Down

0 comments on commit 27e93b7

Please sign in to comment.