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

Added Unity QuickList actions + new command line option.

- new command line option: turn on private browsing
 - QuickList actions:
     * open new tab
     * open new window
     * start private browsing
This commit is contained in:
nowrep 2011-12-26 20:23:54 +01:00
parent 120b992954
commit f7952267d7
7 changed files with 99 additions and 28 deletions

View File

@ -5,25 +5,69 @@ Type=Application
Icon=qupzilla Icon=qupzilla
Categories=Network;WebBrowser; Categories=Network;WebBrowser;
Comment=A fast and secure web browser Comment=A fast and secure web browser
Comment[es]=Un navegador web rápido y seguro
Comment[cs]=Rychlý a bezpečný webový prohlížeč Comment[cs]=Rychlý a bezpečný webový prohlížeč
Comment[sk]=Rýchly a bezpečný webový prehliadač
Comment[de]=Ein schneller und sicherer Web Browser Comment[de]=Ein schneller und sicherer Web Browser
Comment[nl]=Een snelle en veilige webbrowser
Comment[it]=Un browser web veloce e sicuro
Comment[pl]=Szybka i bezpieczna przeglądarka internetowa
Comment[fr]=Un navigateur Internet rapide et sûr
Comment[el]=Ένας γρήγορος και ασφαλής περιηγητής ιστού Comment[el]=Ένας γρήγορος και ασφαλής περιηγητής ιστού
Comment[es]=Un navegador web rápido y seguro
Comment[fr]=Un navigateur Internet rapide et sûr
Comment[it]=Un browser web veloce e sicuro
Comment[nl]=Een snelle en veilige webbrowser
Comment[pl]=Szybka i bezpieczna przeglądarka internetowa
Comment[sk]=Rýchly a bezpečný webový prehliadač
GenericName=Web Browser GenericName=Web Browser
GenericName[es]=Navegador Web
GenericName[cs]=Webový prohlížeč GenericName[cs]=Webový prohlížeč
GenericName[sk]=Webový prehliadač
GenericName[de]=Web Browser GenericName[de]=Web Browser
GenericName[nl]=Webbrowser
GenericName[it]=Browser Web
GenericName[pl]=Przeglądarka Internetowa
GenericName[fr]=Navigateur Internet
GenericName[el]=Περιηγητής ιστού GenericName[el]=Περιηγητής ιστού
GenericName[es]=Navegador Web
GenericName[fr]=Navigateur Internet
GenericName[it]=Browser Web
GenericName[nl]=Webbrowser
GenericName[pl]=Przeglądarka Internetowa
GenericName[sk]=Webový prehliadač
Exec=qupzilla %u Exec=qupzilla %u
MimeType=text/html;application/xhtml+xml; MimeType=text/html;application/xhtml+xml;
Terminal=false Terminal=false
X-Ayatana-Desktop-Shortcuts=NewTab;NewWindow;PrivateBrowsing;
[NewTab Shortcut Group]
Name=Open new tab
Name[cs]=Otevřít nový panel
Name[de]=Neuen Tab öffnen
Name[el]=Άνοιγμα νέας καρτέλας
Name[es]=Abrir nueva pestaña
Name[fr]=Ouvrir un nouvel onglet
Name[it]=Apri nuova scheda
Name[nl]=Open nieuw tabblad
Name[pl]=Otwórz nowe okno
Name[sk]=Otvoriť novú kartu
Exec=qupzilla --new-tab
TargetEnvironment=Unity
[NewWindow Shortcut Group]
Name=Open new window
Name[cs]=Otevřít nové okno
Name[de]=Neues Fenster öffnen
Name[el]=Άνοιγμα νέου παράθυρου
Name[es]=Abrir una ventana nueva
Name[fr]=Ouvrir une nouvelle fenêtre
Name[it]=Apri una nuova finestra
Name[nl]=Nieuw venster openen
Name[pl]=Otwórz nowe okno
Name[sk]=Otvoriť nové okno
Exec=qupzilla --new-window
TargetEnvironment=Unity
[PrivateBrowsing Shortcut Group]
Name=Start private browsing
Name[cs]=Spustit soukromé prohlížení
Name[de]=Privaten Modus starten
Name[el]=Έναρξη ιδιωτικής περιήγησης
Name[es]=Iniciar navegación privada
Name[fr]=Commencer la navigation privée
Name[it]=Avvia Navigazione Anonima
Name[nl]=Start incognito browsen
Name[pl]=Początek prywatną oglądania
Name[sk]=Spustiť súkromné prehliadanie
Exec=qupzilla --private
TargetEnvironment=Unity

View File

@ -40,8 +40,10 @@ void CommandLineOptions::showHelp()
" -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"
" -nt or --new-tab open new tab\n" " -nt or --new-tab open new tab\n"
" -nw or --new-window open new window\n" " -nw or --new-window open new window\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"
"\n" "\n"
" QupZilla is a new, fast and secure web browser\n" " QupZilla is a new, fast and secure web browser\n"
@ -69,6 +71,7 @@ void CommandLineOptions::parseActions()
m_actions.append(pair); m_actions.append(pair);
break; break;
} }
if (arg == "-a" || arg == "--authors") { if (arg == "-a" || arg == "--authors") {
cout << "QupZilla authors: " << endl; cout << "QupZilla authors: " << endl;
cout << " nowrep <nowrep@gmail.com>" << endl; cout << " nowrep <nowrep@gmail.com>" << endl;
@ -78,6 +81,7 @@ void CommandLineOptions::parseActions()
m_actions.append(pair); m_actions.append(pair);
break; break;
} }
if (arg == "-v" || arg == "--version") { if (arg == "-v" || arg == "--version") {
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data() cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data()
#ifdef GIT_REVISION #ifdef GIT_REVISION
@ -134,6 +138,14 @@ void CommandLineOptions::parseActions()
pair.text = ""; pair.text = "";
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) {
found = true;
ActionPair pair;
pair.action = StartPrivateBrowsing;
pair.text = "";
m_actions.append(pair);
}
} }
QString url(m_argv[m_argc - 1]); QString url(m_argv[m_argc - 1]);

View File

@ -26,7 +26,10 @@ class CommandLineOptions : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum Action {NoAction, OpenUrl, StartWithProfile, StartWithoutAddons, NewTab, NewWindow, ShowDownloadManager, ExitAction}; enum Action { NoAction, OpenUrl, StartWithProfile, StartWithoutAddons,
NewTab, NewWindow, ShowDownloadManager, StartPrivateBrowsing,
ExitAction
};
struct ActionPair { struct ActionPair {
Action action; Action action;

View File

@ -82,7 +82,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
setWindowIcon(QupZilla::qupzillaIcon()); setWindowIcon(QupZilla::qupzillaIcon());
bool noAddons = false; bool noAddons = false;
QUrl startUrl(""); QUrl startUrl("");
QString message; QStringList messages;
QString startProfile; QString startProfile;
if (argc > 1) { if (argc > 1) {
@ -95,17 +95,20 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
startProfile = pair.text; startProfile = pair.text;
break; break;
case CommandLineOptions::NewTab: case CommandLineOptions::NewTab:
message = "ACTION:NewTab"; messages.append("ACTION:NewTab");
break; break;
case CommandLineOptions::NewWindow: case CommandLineOptions::NewWindow:
message = "ACTION:NewWindow"; messages.append("ACTION:NewWindow");
break; break;
case CommandLineOptions::ShowDownloadManager: case CommandLineOptions::ShowDownloadManager:
message = "ACTION:ShowDownloadManager"; messages.append("ACTION:ShowDownloadManager");
break;
case CommandLineOptions::StartPrivateBrowsing:
messages.append("ACTION:StartPrivateBrowsing");
break; break;
case CommandLineOptions::OpenUrl: case CommandLineOptions::OpenUrl:
startUrl = pair.text; startUrl = pair.text;
message = "URL:" + startUrl.toString(); messages.append("URL:" + startUrl.toString());
break; break;
default: default:
break; break;
@ -114,7 +117,9 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
} }
if (isRunning()) { if (isRunning()) {
sendMessage(message); foreach (QString message, messages) {
sendMessage(message);
}
m_isExited = true; m_isExited = true;
return; return;
} }
@ -365,6 +370,9 @@ void MainApplication::receiveAppMessage(QString message)
else if (text == "ShowDownloadManager") { else if (text == "ShowDownloadManager") {
downManager()->show(); downManager()->show();
} }
else if (text == "StartPrivateBrowsing") {
sendMessages(StartPrivateBrowsing, true);
}
} }
QupZilla* actWin = getWindow(); QupZilla* actWin = getWindow();

View File

@ -59,7 +59,8 @@ public:
QString THEMESDIR; QString THEMESDIR;
explicit MainApplication(const QList<CommandLineOptions::ActionPair> &cmdActions, int &argc, char** argv); explicit MainApplication(const QList<CommandLineOptions::ActionPair> &cmdActions, int &argc, char** argv);
enum MessageType { SetAdBlockIconEnabled, CheckPrivateBrowsing, ReloadSettings, HistoryStateChanged, BookmarksChanged }; enum MessageType { SetAdBlockIconEnabled, CheckPrivateBrowsing, ReloadSettings,
HistoryStateChanged, BookmarksChanged, StartPrivateBrowsing };
void connectDatabase(); void connectDatabase();
void loadSettings(); void loadSettings();

View File

@ -521,12 +521,7 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
case MainApplication::CheckPrivateBrowsing: case MainApplication::CheckPrivateBrowsing:
m_privateBrowsing->setVisible(state); m_privateBrowsing->setVisible(state);
m_actionPrivateBrowsing->setChecked(state); m_actionPrivateBrowsing->setChecked(state);
if (state) { weView()->titleChanged();
setWindowTitle(windowTitle());
}
else {
setWindowTitle(windowTitle().remove(tr(" (Private Browsing)")));
}
break; break;
case MainApplication::ReloadSettings: case MainApplication::ReloadSettings:
@ -543,6 +538,10 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
m_bookmarksMenuChanged = true; m_bookmarksMenuChanged = true;
break; break;
case MainApplication::StartPrivateBrowsing:
startPrivate(state);
break;
default: default:
qWarning("Unresolved message sent! This could never happen!"); qWarning("Unresolved message sent! This could never happen!");
break; break;
@ -1289,10 +1288,14 @@ void QupZilla::savePageScreen()
void QupZilla::startPrivate(bool state) void QupZilla::startPrivate(bool state)
{ {
static bool askedThisSession = false;
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat); QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
bool askNow = settings.value("Browser-View-Settings/AskOnPrivate", true).toBool(); bool askNow = settings.value("Browser-View-Settings/AskOnPrivate", true).toBool();
if (state && askNow) { if (state && askNow && !askedThisSession) {
askedThisSession = true;
QString title = tr("Are you sure you want to turn on private browsing?"); QString title = tr("Are you sure you want to turn on private browsing?");
QString text1 = tr("When private browsing is turned on, some actions concerning your privacy will be disabled:"); QString text1 = tr("When private browsing is turned on, some actions concerning your privacy will be disabled:");

View File

@ -80,6 +80,7 @@ signals:
public slots: public slots:
void load(const QUrl &url); void load(const QUrl &url);
void titleChanged();
void stop(); void stop();
void back(); void back();
@ -107,7 +108,6 @@ private slots:
void loadFinished(bool state); void loadFinished(bool state);
void linkClicked(const QUrl &url); void linkClicked(const QUrl &url);
void urlChanged(const QUrl &url); void urlChanged(const QUrl &url);
void titleChanged();
void linkHovered(const QString &link, const QString &title, const QString &content); void linkHovered(const QString &link, const QString &title, const QString &content);
void openUrlInNewWindow(); void openUrlInNewWindow();
void openUrlInNewTab(); void openUrlInNewTab();