1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Added option to start new instance of browser with --no-remote option

- however, new instance cannot be started for default profile

closes #541
This commit is contained in:
nowrep 2012-09-01 15:59:27 +02:00
parent 6d52ef3c77
commit 53d4f00c36
4 changed files with 25 additions and 6 deletions

View File

@ -18,6 +18,7 @@ Version 1.3.5
* new scheme handler for file protocol allows browsing through directories * new scheme handler for file protocol allows browsing through directories
* new option to show loading progress in address bar * new option to show loading progress in address bar
* new option to hide close button on tabs * new option to hide close button on tabs
* new option to start new instance with --no-remote option
* fixed visibility of navigation bar in fullscreen * fixed visibility of navigation bar in fullscreen
* fixed bad position of add tab button when there is a lot of tabs * fixed bad position of add tab button when there is a lot of tabs
* fixed gui with RTL languages * fixed gui with RTL languages

View File

@ -50,6 +50,7 @@ void CommandLineOptions::showHelp()
" -nw or --new-window open new window\n" " -nw or --new-window open new window\n"
" -pb or --private-browsing start private browsing\n" " -pb or --private-browsing start private browsing\n"
" -dm or --download-manager show download manager\n" " -dm or --download-manager show download manager\n"
" -nr or --no-remote open new instance\n"
" -ct=URL or --current-tab=URL open URL in current tab\n" " -ct=URL or --current-tab=URL open URL in current tab\n"
" -ow=URL or --open-window=URL open URL in new window\n" " -ow=URL or --open-window=URL open URL in new window\n"
"\n" "\n"
@ -121,35 +122,36 @@ void CommandLineOptions::parseActions()
if (arg.startsWith("-ne") || arg.startsWith("--no-extensions")) { if (arg.startsWith("-ne") || arg.startsWith("--no-extensions")) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_StartWithoutAddons; pair.action = Qz::CL_StartWithoutAddons;
pair.text = "";
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-nt") || arg.startsWith("--new-tab")) { if (arg.startsWith("-nt") || arg.startsWith("--new-tab")) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_NewTab; pair.action = Qz::CL_NewTab;
pair.text = "";
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-nw") || arg.startsWith("--new-window")) { if (arg.startsWith("-nw") || arg.startsWith("--new-window")) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_NewWindow; pair.action = Qz::CL_NewWindow;
pair.text = "";
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-dm") || arg.startsWith("--download-manager")) { if (arg.startsWith("-dm") || arg.startsWith("--download-manager")) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_ShowDownloadManager; pair.action = Qz::CL_ShowDownloadManager;
pair.text = "";
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) { if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_StartPrivateBrowsing; pair.action = Qz::CL_StartPrivateBrowsing;
pair.text = ""; m_actions.append(pair);
}
if (arg.startsWith("-nr") || arg.startsWith("--no-remote")) {
ActionPair pair;
pair.action = Qz::CL_StartNewInstance;
m_actions.append(pair); m_actions.append(pair);
} }

View File

@ -113,6 +113,7 @@ MainApplication::MainApplication(int &argc, char** argv)
setWindowIcon(QIcon(":icons/exeicons/qupzilla-window.png")); setWindowIcon(QIcon(":icons/exeicons/qupzilla-window.png"));
bool noAddons = false; bool noAddons = false;
bool newInstance = false;
QUrl startUrl; QUrl startUrl;
QStringList messages; QStringList messages;
QString startProfile; QString startProfile;
@ -142,6 +143,9 @@ MainApplication::MainApplication(int &argc, char** argv)
case Qz::CL_StartPrivateBrowsing: case Qz::CL_StartPrivateBrowsing:
m_isPrivateSession = true; m_isPrivateSession = true;
break; break;
case Qz::CL_StartNewInstance:
newInstance = true;
break;
case Qz::CL_OpenUrlInCurrentTab: case Qz::CL_OpenUrlInCurrentTab:
startUrl = QUrl::fromUserInput(pair.text); startUrl = QUrl::fromUserInput(pair.text);
messages.append("ACTION:OpenUrlInCurrentTab" + pair.text); messages.append("ACTION:OpenUrlInCurrentTab" + pair.text);
@ -165,7 +169,18 @@ MainApplication::MainApplication(int &argc, char** argv)
// Don't start single application in private browsing // Don't start single application in private browsing
if (!m_isPrivateSession) { if (!m_isPrivateSession) {
setAppId("QupZillaWebBrowser"); QString appId = "QupZillaWebBrowser";
if (newInstance) {
if (startProfile.isEmpty() || startProfile == "default") {
std::cout << "New instance cannot be started with default profile!" << std::endl;
}
else {
appId.append(startProfile);
}
}
setAppId(appId);
} }
if (messages.isEmpty()) { if (messages.isEmpty()) {

View File

@ -54,6 +54,7 @@ enum CommandLineAction {
CL_NewWindow, CL_NewWindow,
CL_ShowDownloadManager, CL_ShowDownloadManager,
CL_StartPrivateBrowsing, CL_StartPrivateBrowsing,
CL_StartNewInstance,
CL_ExitAction CL_ExitAction
}; };