vivaldi and opera support for incognito links

This commit is contained in:
fourtf 2018-10-16 16:25:48 +02:00
parent d14a4df9e3
commit db4034d2d9

View file

@ -14,19 +14,18 @@ namespace {
{ {
// list of command line switches to turn on private browsing in browsers // list of command line switches to turn on private browsing in browsers
static auto switches = std::vector<std::pair<QString, QString>>{ static auto switches = std::vector<std::pair<QString, QString>>{
{"firefox", "-private-window"}, {"chrome", "-incognito"}, {"firefox", "-private-window"}, {"chrome", "-incognito"},
{"vivaldi", "--private"}, {"opera", "-newprivatetab"}, {"vivaldi", "-incognito"}, {"opera", "-newprivatetab"},
{"iexplore", "-private"}, {"opera\\\\launcher", "--private"}, {"iexplore", "-private"},
}; };
// transform into regex and replacement string // transform into regex and replacement string
std::vector<std::pair<QRegularExpression, QString>> replacers; std::vector<std::pair<QRegularExpression, QString>> replacers;
for (const auto &switch_ : switches) { for (const auto &switch_ : switches) {
replacers.emplace_back( replacers.emplace_back(
QRegularExpression("(" + switch_.first + "\\.exe\"?).*"), QRegularExpression("(" + switch_.first + "\\.exe\"?).*",
QRegularExpression::CaseInsensitiveOption),
"\\1 " + switch_.second); "\\1 " + switch_.second);
log("(" + switch_.first + "\\.exe\"?).*");
} }
// try to find matching regex and apply it // try to find matching regex and apply it