mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Improved commandline options. Possibility to use more than at once.
- it is also now possible to start in private mode from commandline
This commit is contained in:
parent
6eb4f7bb3b
commit
b8a0b52982
@ -37,7 +37,7 @@ void CommandLineOptions::showHelp()
|
|||||||
" -a or --authors print QupZilla authors \n"
|
" -a or --authors print QupZilla authors \n"
|
||||||
" -v or --version print QupZilla version \n"
|
" -v or --version print QupZilla version \n"
|
||||||
"\n"
|
"\n"
|
||||||
" -p or --profile=PROFILE start with specified profile \n"
|
" -p or --profile=<profile> start with specified profile \n"
|
||||||
" -np or --no-plugins start without plugins \n"
|
" -np or --no-plugins start without plugins \n"
|
||||||
"\n"
|
"\n"
|
||||||
" Options to control running QupZilla:\n"
|
" Options to control running QupZilla:\n"
|
||||||
|
@ -115,15 +115,18 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||||||
break;
|
break;
|
||||||
case CommandLineOptions::NewTab:
|
case CommandLineOptions::NewTab:
|
||||||
messages.append("ACTION:NewTab");
|
messages.append("ACTION:NewTab");
|
||||||
|
m_postLaunchActions.append(OpenNewTab);
|
||||||
break;
|
break;
|
||||||
case CommandLineOptions::NewWindow:
|
case CommandLineOptions::NewWindow:
|
||||||
messages.append("ACTION:NewWindow");
|
messages.append("ACTION:NewWindow");
|
||||||
break;
|
break;
|
||||||
case CommandLineOptions::ShowDownloadManager:
|
case CommandLineOptions::ShowDownloadManager:
|
||||||
messages.append("ACTION:ShowDownloadManager");
|
messages.append("ACTION:ShowDownloadManager");
|
||||||
|
m_postLaunchActions.append(OpenDownloadManager);
|
||||||
break;
|
break;
|
||||||
case CommandLineOptions::StartPrivateBrowsing:
|
case CommandLineOptions::StartPrivateBrowsing:
|
||||||
messages.append("ACTION:StartPrivateBrowsing");
|
messages.append("ACTION:StartPrivateBrowsing");
|
||||||
|
m_postLaunchActions.append(PrivateBrowsing);
|
||||||
break;
|
break;
|
||||||
case CommandLineOptions::OpenUrl:
|
case CommandLineOptions::OpenUrl:
|
||||||
startUrl = pair.text;
|
startUrl = pair.text;
|
||||||
@ -208,8 +211,26 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||||||
plugins()->loadPlugins();
|
plugins()->loadPlugins();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
|
QTimer::singleShot(0, this, SLOT(postLaunch()));
|
||||||
QTimer::singleShot(2000, this, SLOT(restoreCursor()));
|
QTimer::singleShot(2000, this, SLOT(restoreCursor()));
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
QTimer::singleShot(10 * 1000, this, SLOT(setupJumpList()));
|
QTimer::singleShot(10 * 1000, this, SLOT(setupJumpList()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainApplication::postLaunch()
|
||||||
|
{
|
||||||
|
if (m_postLaunchActions.contains(PrivateBrowsing)) {
|
||||||
|
togglePrivateBrowsingMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_postLaunchActions.contains(OpenDownloadManager)) {
|
||||||
|
downManager()->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_postLaunchActions.contains(OpenNewTab)) {
|
||||||
|
getWindow()->tabWidget()->addView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainApplication::loadSettings()
|
void MainApplication::loadSettings()
|
||||||
@ -356,6 +377,15 @@ bool MainApplication::isStateChanged()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainApplication::togglePrivateBrowsingMode(bool state)
|
||||||
|
{
|
||||||
|
webSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, state);
|
||||||
|
history()->setSaving(!state);
|
||||||
|
cookieJar()->turnPrivateJar(state);
|
||||||
|
|
||||||
|
emit message(MainApplication::CheckPrivateBrowsing, state);
|
||||||
|
}
|
||||||
|
|
||||||
void MainApplication::sendMessages(MainApplication::MessageType mes, bool state)
|
void MainApplication::sendMessages(MainApplication::MessageType mes, bool state)
|
||||||
{
|
{
|
||||||
emit message(mes, state);
|
emit message(mes, state);
|
||||||
@ -674,6 +704,10 @@ bool MainApplication::saveStateSlot()
|
|||||||
|
|
||||||
bool MainApplication::restoreStateSlot(QupZilla* window)
|
bool MainApplication::restoreStateSlot(QupZilla* window)
|
||||||
{
|
{
|
||||||
|
if (m_postLaunchActions.contains(PrivateBrowsing)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_isRestoring = true;
|
m_isRestoring = true;
|
||||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||||
int afterStart = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
int afterStart = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
||||||
|
@ -82,9 +82,10 @@ public:
|
|||||||
inline int windowCount() { return m_mainWindows.count(); }
|
inline int windowCount() { return m_mainWindows.count(); }
|
||||||
|
|
||||||
bool checkSettingsDir();
|
bool checkSettingsDir();
|
||||||
|
|
||||||
int defaultZoom() { return m_defaultZoom; }
|
int defaultZoom() { return m_defaultZoom; }
|
||||||
|
|
||||||
|
void togglePrivateBrowsingMode(bool state);
|
||||||
|
|
||||||
QupZilla* getWindow();
|
QupZilla* getWindow();
|
||||||
CookieManager* cookieManager();
|
CookieManager* cookieManager();
|
||||||
BrowsingLibrary* browsingLibrary();
|
BrowsingLibrary* browsingLibrary();
|
||||||
@ -116,10 +117,13 @@ signals:
|
|||||||
void message(MainApplication::MessageType mes, bool state);
|
void message(MainApplication::MessageType mes, bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void postLaunch();
|
||||||
void setupJumpList();
|
void setupJumpList();
|
||||||
void restoreCursor();
|
void restoreCursor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum PostLaunchAction { PrivateBrowsing, OpenDownloadManager, OpenNewTab };
|
||||||
|
|
||||||
void translateApp();
|
void translateApp();
|
||||||
void restoreOtherWindows();
|
void restoreOtherWindows();
|
||||||
|
|
||||||
@ -154,6 +158,7 @@ private:
|
|||||||
bool m_isRestoring;
|
bool m_isRestoring;
|
||||||
|
|
||||||
bool m_databaseConnected;
|
bool m_databaseConnected;
|
||||||
|
QList<PostLaunchAction> m_postLaunchActions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINAPPLICATION_H
|
#endif // MAINAPPLICATION_H
|
||||||
|
@ -1326,10 +1326,7 @@ void QupZilla::startPrivate(bool state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mApp->webSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, state);
|
mApp->togglePrivateBrowsingMode(state);
|
||||||
mApp->history()->setSaving(!state);
|
|
||||||
mApp->cookieJar()->turnPrivateJar(state);
|
|
||||||
emit message(MainApplication::CheckPrivateBrowsing, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::resizeEvent(QResizeEvent *event)
|
void QupZilla::resizeEvent(QResizeEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user