-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup IncognitoBrowser.cpp and support any firefox variant starting with "firefox-" #5788
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
|
||
auto exec = entries.find("Exec"); | ||
if (exec != entries.end()) | ||
return parseDesktopExecProgram(exec->second.trimmed()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
return parseDesktopExecProgram(exec->second.trimmed()); | |
if (exec != entries.end()) { | |
return parseDesktopExecProgram(exec->second.trimmed()); | |
} |
// mozilla distributes many firefox variants with different endings so | ||
// catch them all here, and be future proof at the same time :) | ||
if (exeFilename.startsWith("firefox-")) | ||
return "-private-window"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
return "-private-window"; | |
if (exeFilename.startsWith("firefox-")) { | |
return "-private-window"; | |
} |
if (exeFilename.startsWith("firefox-")) | ||
return "-private-window"; | ||
|
||
for (const auto &pair : argTable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
for (const auto &pair : argTable) | |
for (const auto &pair : argTable) { |
src/util/IncognitoBrowser.cpp:87:
- return pair.second;
+ return pair.second;
+ }
|
||
for (const auto &pair : argTable) | ||
if (exeFilename == pair.first) | ||
return pair.second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
return pair.second; | |
if (exeFilename == pair.first) { | |
return pair.second; | |
} |
getAssociatedExecutable(AssociationQueryType::Protocol, L"http"); | ||
QString browserExe = getExecutable(); | ||
if (browserExe.isNull()) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
return false; | |
if (browserExe.isNull()) { | |
return false; | |
} |
L".htm"); | ||
} | ||
QString browserArg = getPrivateArg(browserExe); | ||
if (browserArg.isNull()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
if (browserArg.isNull())
^
this fix will not be applied because it overlaps with another fix
} | ||
QString browserArg = getPrivateArg(browserExe); | ||
if (browserArg.isNull()) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
src/util/IncognitoBrowser.cpp:101:
- if (browserArg.isNull())
- return false;
-
- return true;
+ return !browserArg.isNull();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
if (exeFilename.startsWith("firefox-")) | ||
return "-private-window"; | ||
|
||
for (const auto &pair : argTable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
for (const auto &pair : argTable) | |
for (const auto &pair : argTable) { |
src/util/IncognitoBrowser.cpp:91:
- return pair.second;
+ return pair.second;
+ }
|
||
QString browserArg = getPrivateArg(browserExe); | ||
if (browserArg.isNull()) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
src/util/IncognitoBrowser.cpp:107:
- if (browserArg.isNull())
- return false;
-
- return true;
+ return !browserArg.isNull();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
if (exeFilename.startsWith("firefox-")) | ||
return "-private-window"; | ||
|
||
for (const auto &pair : argTable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
for (const auto &pair : argTable) | |
for (const auto &pair : argTable) { |
src/util/IncognitoBrowser.cpp:90:
- return pair.second;
+ return pair.second;
+ }
|
||
QString browserArg = getPrivateArg(browserExe); | ||
if (browserArg.isNull()) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
src/util/IncognitoBrowser.cpp:108:
- if (browserArg.isNull())
- return false;
-
- return true;
+ return !browserArg.isNull();
src/util/IncognitoBrowser.cpp
Outdated
return QProcess::startDetached(browserExe, | ||
{getPrivateSwitch(browserExe), link}); | ||
QString exe = getExecutable(); | ||
QString arg = getPrivateArg(browserExe); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use of undeclared identifier 'browserExe' [clang-diagnostic-error]
QString arg = getPrivateArg(browserExe);
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
if (exeFilename.startsWith("firefox-")) | ||
return "-private-window"; | ||
|
||
for (const auto &pair : argTable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
for (const auto &pair : argTable) | |
for (const auto &pair : argTable) { |
src/util/IncognitoBrowser.cpp:89:
- return pair.second;
+ return pair.second;
+ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i disagree with this but can get changed if need be
im apparently very tired. |
discovered mozilla’s firefox nightly apt package .desktop file now points to a ‘firefox-bin’ executable path so thought instead of continually adding variants be ready for it in the code. cleaned up somewhat while i was there.
have not tested if logic is preserved on windows