mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
CommandLineOptions: Added option to open new window with url
- syntax: -ow=URL or --open-window=URL
This commit is contained in:
parent
a252fe7db0
commit
e4e87b02a5
2
TODO
2
TODO
|
@ -10,8 +10,6 @@ The list is not sorted by priority.
|
|||
* Password Manager: save more than one account for site + input completer
|
||||
* (KDE) Nepomuk integration
|
||||
* Support for remote Web inspector
|
||||
* option to save RSS feeds in external reader
|
||||
* Session manager
|
||||
* Editable toolbar
|
||||
* NoScript plugin
|
||||
* GreaseMonkey plugin (userscripts)
|
||||
|
|
|
@ -51,6 +51,7 @@ void CommandLineOptions::showHelp()
|
|||
" -pb or --private-browsing start private browsing\n"
|
||||
" -dm or --download-manager show download manager\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"
|
||||
" QupZilla is a new, fast and secure web browser\n"
|
||||
" based on WebKit core (http://webkit.org) and\n"
|
||||
|
@ -105,13 +106,15 @@ void CommandLineOptions::parseActions()
|
|||
}
|
||||
|
||||
if (arg.startsWith("-p=") || arg.startsWith("--profile=")) {
|
||||
arg.remove("-p=");
|
||||
arg.remove("--profile=");
|
||||
cout << "QupZilla: Starting with profile " << arg.toUtf8().data() << endl;
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_StartWithProfile;
|
||||
pair.text = arg;
|
||||
m_actions.append(pair);
|
||||
int index = arg.indexOf('=');
|
||||
if (index != -1) {
|
||||
cout << "QupZilla: Starting with profile " << arg.toUtf8().data() << endl;
|
||||
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_StartWithProfile;
|
||||
pair.text = arg.mid(index + 1);
|
||||
m_actions.append(pair);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg.startsWith("-ne") || arg.startsWith("--no-extensions")) {
|
||||
|
@ -150,12 +153,23 @@ void CommandLineOptions::parseActions()
|
|||
}
|
||||
|
||||
if (arg.startsWith("-ct") || arg.startsWith("--current-tab")) {
|
||||
arg.remove("-ct=");
|
||||
arg.remove("--current-tab=");
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrlInCurrentTab;
|
||||
pair.text = arg;
|
||||
m_actions.append(pair);
|
||||
int index = arg.indexOf('=');
|
||||
if (index != -1) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrlInCurrentTab;
|
||||
pair.text = arg.mid(index + 1);
|
||||
m_actions.append(pair);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg.startsWith("-ow") || arg.startsWith("--open-window")) {
|
||||
int index = arg.indexOf('=');
|
||||
if (index != -1) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrlInNewWindow;
|
||||
pair.text = arg.mid(index + 1);
|
||||
m_actions.append(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,10 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||
case Qz::CL_OpenUrlInCurrentTab:
|
||||
startUrl = QUrl::fromUserInput(pair.text);
|
||||
messages.append("ACTION:OpenUrlInCurrentTab" + pair.text);
|
||||
m_postLaunchActions.append(PrivateBrowsing);
|
||||
break;
|
||||
case Qz::CL_OpenUrlInNewWindow:
|
||||
startUrl = QUrl::fromUserInput(pair.text);
|
||||
messages.append("ACTION:OpenUrlInNewWindow" + pair.text);
|
||||
break;
|
||||
case Qz::CL_OpenUrl:
|
||||
startUrl = QUrl::fromUserInput(pair.text);
|
||||
|
@ -459,7 +462,11 @@ void MainApplication::receiveAppMessage(QString message)
|
|||
actWin = downManager();
|
||||
}
|
||||
else if (text.startsWith("OpenUrlInCurrentTab")) {
|
||||
actUrl = QUrl::fromUserInput(text.remove("OpenUrlInCurrentTab"));
|
||||
actUrl = QUrl::fromUserInput(text.mid(19));
|
||||
}
|
||||
else if (text.startsWith("OpenUrlInNewWindow")) {
|
||||
makeNewWindow(Qz::BW_NewWindow, QUrl::fromUserInput(text.mid(18)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ private slots:
|
|||
void saveSettings();
|
||||
|
||||
private:
|
||||
enum PostLaunchAction { PrivateBrowsing, OpenDownloadManager, OpenNewTab };
|
||||
enum PostLaunchAction { OpenDownloadManager, OpenNewTab };
|
||||
|
||||
void translateApp();
|
||||
void restoreOtherWindows();
|
||||
|
|
|
@ -34,7 +34,7 @@ enum AppMessageType {
|
|||
AM_CheckPrivateBrowsing,
|
||||
AM_ReloadSettings,
|
||||
AM_HistoryStateChanged,
|
||||
AM_BookmarksChanged,
|
||||
AM_BookmarksChanged
|
||||
};
|
||||
|
||||
enum BrowserWindow {
|
||||
|
@ -47,6 +47,7 @@ enum CommandLineAction {
|
|||
CL_NoAction,
|
||||
CL_OpenUrl,
|
||||
CL_OpenUrlInCurrentTab,
|
||||
CL_OpenUrlInNewWindow,
|
||||
CL_StartWithProfile,
|
||||
CL_StartWithoutAddons,
|
||||
CL_NewTab,
|
||||
|
|
|
@ -30,7 +30,7 @@ Updater::Updater(QupZilla* mainClass, QObject* parent)
|
|||
: QObject(parent)
|
||||
, p_QupZilla(mainClass)
|
||||
{
|
||||
QTimer::singleShot(60 * 1000, this, SLOT(start())); //Start checking after 1 minute
|
||||
QTimer::singleShot(60 * 1000, this, SLOT(start())); // Start checking after 1 minute
|
||||
}
|
||||
|
||||
Updater::Version Updater::parseVersionFromString(const QString &string)
|
||||
|
@ -106,18 +106,18 @@ void Updater::startDownloadingUpdateInfo(const QUrl &url)
|
|||
|
||||
void Updater::downCompleted(QNetworkReply* reply)
|
||||
{
|
||||
QString html = QString(reply->readAll());
|
||||
QString html = reply->readAll();
|
||||
|
||||
if (html.startsWith("Version:")) {
|
||||
html.remove("Version:");
|
||||
Version current = parseVersionFromString(QupZilla::VERSION);
|
||||
Version updated = parseVersionFromString(html);
|
||||
|
||||
if (current < updated) {
|
||||
mApp->desktopNotifications()->showNotification(QPixmap(":icons/qupzillaupdate.png"), tr("Update available"), tr("New version of QupZilla is ready to download."));
|
||||
// QAction* action = new QAction(QIcon(":icons/qupzillaupdate.png"), "Update", this);
|
||||
// connect(action, SIGNAL(triggered()), this, SLOT(downloadNewVersion()));
|
||||
// p_QupZilla->menuBar()->addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
reply->manager()->deleteLater();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user