1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02: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
Categories=Network;WebBrowser;
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[sk]=Rýchly a bezpečný webový prehliadač
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[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[es]=Navegador Web
GenericName[cs]=Webový prohlížeč
GenericName[sk]=Webový prehliadač
GenericName[de]=Web Browser
GenericName[nl]=Webbrowser
GenericName[it]=Browser Web
GenericName[pl]=Przeglądarka Internetowa
GenericName[fr]=Navigateur Internet
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
MimeType=text/html;application/xhtml+xml;
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"
" -np or --no-plugins start without plugins \n"
"\n"
" Options to control running QupZilla:\n"
" -nt or --new-tab open new tab\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"
"\n"
" QupZilla is a new, fast and secure web browser\n"
@ -69,6 +71,7 @@ void CommandLineOptions::parseActions()
m_actions.append(pair);
break;
}
if (arg == "-a" || arg == "--authors") {
cout << "QupZilla authors: " << endl;
cout << " nowrep <nowrep@gmail.com>" << endl;
@ -78,6 +81,7 @@ void CommandLineOptions::parseActions()
m_actions.append(pair);
break;
}
if (arg == "-v" || arg == "--version") {
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data()
#ifdef GIT_REVISION
@ -134,6 +138,14 @@ void CommandLineOptions::parseActions()
pair.text = "";
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]);

View File

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

View File

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

View File

@ -59,7 +59,8 @@ public:
QString THEMESDIR;
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 loadSettings();

View File

@ -521,12 +521,7 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
case MainApplication::CheckPrivateBrowsing:
m_privateBrowsing->setVisible(state);
m_actionPrivateBrowsing->setChecked(state);
if (state) {
setWindowTitle(windowTitle());
}
else {
setWindowTitle(windowTitle().remove(tr(" (Private Browsing)")));
}
weView()->titleChanged();
break;
case MainApplication::ReloadSettings:
@ -543,6 +538,10 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
m_bookmarksMenuChanged = true;
break;
case MainApplication::StartPrivateBrowsing:
startPrivate(state);
break;
default:
qWarning("Unresolved message sent! This could never happen!");
break;
@ -1289,10 +1288,14 @@ void QupZilla::savePageScreen()
void QupZilla::startPrivate(bool state)
{
static bool askedThisSession = false;
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
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 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:
void load(const QUrl &url);
void titleChanged();
void stop();
void back();
@ -107,7 +108,6 @@ private slots:
void loadFinished(bool state);
void linkClicked(const QUrl &url);
void urlChanged(const QUrl &url);
void titleChanged();
void linkHovered(const QString &link, const QString &title, const QString &content);
void openUrlInNewWindow();
void openUrlInNewTab();