mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
GM: port foreach -> range-based for
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
parent
c9a6a51285
commit
9bcfeb3cd7
|
@ -107,7 +107,7 @@ QString GM_Manager::requireScripts(const QStringList &urlList) const
|
|||
|
||||
QString script;
|
||||
|
||||
foreach (const QString &url, urlList) {
|
||||
for (const QString &url : urlList) {
|
||||
if (settings.contains(url)) {
|
||||
QString fileName = settings.value(url).toString();
|
||||
if (!QFileInfo(fileName).isAbsolute()) {
|
||||
|
@ -158,7 +158,7 @@ QList<GM_Script*> GM_Manager::allScripts() const
|
|||
|
||||
bool GM_Manager::containsScript(const QString &fullName) const
|
||||
{
|
||||
foreach (GM_Script* script, m_scripts) {
|
||||
for (GM_Script* script : qAsConst(m_scripts)) {
|
||||
if (fullName == script->fullName()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -248,7 +248,8 @@ void GM_Manager::load()
|
|||
settings.beginGroup("GreaseMonkey");
|
||||
m_disabledScripts = settings.value("disabledScripts", QStringList()).toStringList();
|
||||
|
||||
foreach (const QString &fileName, gmDir.entryList(QStringList("*.js"), QDir::Files)) {
|
||||
const auto fileNames = gmDir.entryList(QStringList("*.js"), QDir::Files);
|
||||
for (const QString &fileName : fileNames) {
|
||||
const QString absolutePath = gmDir.absoluteFilePath(fileName);
|
||||
GM_Script* script = new GM_Script(this, absolutePath);
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ void GM_Plugin::init(InitState state, const QString &settingsPath)
|
|||
|
||||
// Make sure userscripts works also with already created WebPages
|
||||
if (state == LateInitState) {
|
||||
foreach (BrowserWindow *window, mApp->windows()) {
|
||||
const auto windows = mApp->windows();
|
||||
for (BrowserWindow *window : windows) {
|
||||
m_manager->mainWindowCreated(window);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,8 @@ void GM_Settings::loadScripts()
|
|||
|
||||
ui->listWidget->clear();
|
||||
|
||||
foreach (GM_Script* script, m_manager->allScripts()) {
|
||||
const auto allScripts = m_manager->allScripts();
|
||||
for (GM_Script* script : allScripts) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listWidget);
|
||||
item->setText(script->name());
|
||||
item->setIcon(script->icon());
|
||||
|
|
Loading…
Reference in New Issue
Block a user