1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +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 option to show loading progress in address bar
* 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 bad position of add tab button when there is a lot of tabs
* fixed gui with RTL languages

View File

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

View File

@ -113,6 +113,7 @@ MainApplication::MainApplication(int &argc, char** argv)
setWindowIcon(QIcon(":icons/exeicons/qupzilla-window.png"));
bool noAddons = false;
bool newInstance = false;
QUrl startUrl;
QStringList messages;
QString startProfile;
@ -142,6 +143,9 @@ MainApplication::MainApplication(int &argc, char** argv)
case Qz::CL_StartPrivateBrowsing:
m_isPrivateSession = true;
break;
case Qz::CL_StartNewInstance:
newInstance = true;
break;
case Qz::CL_OpenUrlInCurrentTab:
startUrl = QUrl::fromUserInput(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
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()) {

View File

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