mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
Added processing multiple commandline arguments + implemented -p= (-
This commit is contained in:
parent
54c05b91f8
commit
aedfdd3309
2
src/3rdparty/ecwin7.cpp
vendored
2
src/3rdparty/ecwin7.cpp
vendored
|
@ -20,7 +20,7 @@
|
|||
#include "ecwin7.h"
|
||||
|
||||
// Windows only definitions
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
DEFINE_GUID(CLSID_TaskbarList,0x56fdf344,0xfd6d,0x11d0,0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90);
|
||||
DEFINE_GUID(IID_ITaskbarList3,0xea1afb91,0x9e28,0x4b86,0x90,0xE9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf);
|
||||
|
||||
|
|
2
src/3rdparty/ecwin7.h
vendored
2
src/3rdparty/ecwin7.h
vendored
|
@ -24,7 +24,7 @@
|
|||
#include <QWidget>
|
||||
|
||||
// Windows only data definitions
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
|
||||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
|
|
|
@ -210,4 +210,5 @@ OTHER_FILES += \
|
|||
include(3rdparty/qtsingleapplication.pri)
|
||||
|
||||
win32:RC_FILE = appicon.rc
|
||||
#win32:LIBS += libole32
|
||||
win32:LIBS += User32.lib
|
||||
win32:LIBS += Ole32.lib
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
|
||||
CommandLineOptions::CommandLineOptions(int &argc, char **argv) :
|
||||
QObject(0)
|
||||
,m_actionString("")
|
||||
,m_argc(argc)
|
||||
,m_argv(argv)
|
||||
,m_action(NoAction)
|
||||
{
|
||||
parseActions();
|
||||
}
|
||||
|
@ -43,9 +41,11 @@ void CommandLineOptions::showHelp()
|
|||
"\n"
|
||||
" QupZilla is a new, fast and secure web browser\n"
|
||||
" based on WebKit core (http://webkit.org) and\n"
|
||||
" written in Qt Framework (http://qt.nokia.com) \n"
|
||||
" written in Qt Framework (http://qt.nokia.com) \n\n"
|
||||
" For more informations please visit wiki at \n"
|
||||
" https://github.com/nowrep/QupZilla/wiki \n"
|
||||
;
|
||||
cout << help << " " << QupZilla::WWWADDRESS.toAscii().data() << endl;
|
||||
cout << help << " > " << QupZilla::WWWADDRESS.toAscii().data() << endl;
|
||||
}
|
||||
|
||||
void CommandLineOptions::parseActions()
|
||||
|
@ -80,13 +80,18 @@ void CommandLineOptions::parseActions()
|
|||
arg.remove("-profile=");
|
||||
found = true;
|
||||
cout << "starting with profile " << arg.toAscii().data() << endl;
|
||||
m_actionString = arg;
|
||||
m_action = StartWithProfile;
|
||||
QPair<int, QString> pair;
|
||||
pair.first = StartWithProfile;
|
||||
pair.second = arg;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-np") || arg.startsWith("-no-plugins")) {
|
||||
found = true;
|
||||
m_action = StartWithoutAddons;
|
||||
QPair<int, QString> pair;
|
||||
pair.first = StartWithoutAddons;
|
||||
pair.second = "";
|
||||
m_actions.append(pair);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +99,10 @@ void CommandLineOptions::parseActions()
|
|||
if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-")) {
|
||||
found = true;
|
||||
cout << "starting with url " << url.toAscii().data() << endl;
|
||||
m_actionString = url;
|
||||
m_action = OpenUrl;
|
||||
QPair<int, QString> pair;
|
||||
pair.first = OpenUrl;
|
||||
pair.second = url;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (m_argc > 1 && !found) {
|
||||
|
@ -104,14 +111,3 @@ void CommandLineOptions::parseActions()
|
|||
}
|
||||
|
||||
}
|
||||
CommandLineOptions::Action CommandLineOptions::getAction()
|
||||
{
|
||||
return m_action;
|
||||
}
|
||||
|
||||
QString CommandLineOptions::getActionString()
|
||||
{
|
||||
return m_actionString;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define COMMANDLINEOPTIONS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QPair>
|
||||
#include <iostream>
|
||||
|
||||
class CommandLineOptions : public QObject
|
||||
|
@ -28,17 +28,15 @@ class CommandLineOptions : public QObject
|
|||
public:
|
||||
enum Action {NoAction, OpenUrl, StartWithProfile, StartWithoutAddons};
|
||||
explicit CommandLineOptions(int &argc, char **argv);
|
||||
Action getAction();
|
||||
QString getActionString();
|
||||
QList<QPair<int, QString> > getActions() { return m_actions; }
|
||||
|
||||
private:
|
||||
void showHelp();
|
||||
void parseActions();
|
||||
|
||||
QString m_actionString;
|
||||
int m_argc;
|
||||
char **m_argv;
|
||||
Action m_action;
|
||||
QList<QPair<int, QString> > m_actions;
|
||||
};
|
||||
|
||||
#endif // COMMANDLINEOPTIONS_H
|
||||
|
|
|
@ -64,22 +64,30 @@ MainApplication::MainApplication(int &argc, char **argv)
|
|||
bool noAddons = false;
|
||||
QUrl startUrl("");
|
||||
QString message;
|
||||
QString startProfile;
|
||||
if (argc > 1) {
|
||||
CommandLineOptions cmd(argc, argv);
|
||||
switch (cmd.getAction()) {
|
||||
QList<QPair<int, QString> > cmdActions = cmd.getActions();
|
||||
for (int i = 0; i < cmdActions.count(); i++) {
|
||||
QPair<int, QString> act = cmdActions.at(i);
|
||||
switch (act.first) {
|
||||
case CommandLineOptions::StartWithoutAddons:
|
||||
noAddons = true;
|
||||
break;
|
||||
case CommandLineOptions::OpenUrl:
|
||||
startUrl = QUrl(cmd.getActionString());
|
||||
startUrl = act.second;
|
||||
message = "URL:"+startUrl.toString();
|
||||
break;
|
||||
case CommandLineOptions::StartWithProfile:
|
||||
startProfile = act.second;
|
||||
break;
|
||||
default:
|
||||
m_isExited = true;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isRunning()) {
|
||||
sendMessage(message);
|
||||
|
@ -100,11 +108,15 @@ MainApplication::MainApplication(int &argc, char **argv)
|
|||
checkProfileDir();
|
||||
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
if (startProfile.isEmpty()) {
|
||||
QSettings settings(homePath+"profiles/profiles.ini", QSettings::IniFormat);
|
||||
if (settings.value("Profiles/startProfile","default").toString().contains("/"))
|
||||
m_activeProfil=homePath+"profiles/default/";
|
||||
else
|
||||
m_activeProfil=homePath+"profiles/"+settings.value("Profiles/startProfile","default").toString()+"/";
|
||||
} else
|
||||
m_activeProfil = homePath+"profiles/"+startProfile+"/";
|
||||
|
||||
if (!QDir(m_activeProfil).exists())
|
||||
m_activeProfil=homePath+"profiles/default/";
|
||||
|
||||
|
|
|
@ -48,7 +48,11 @@
|
|||
#include "clickablelabel.h"
|
||||
|
||||
const QString QupZilla::VERSION = "0.9.9";
|
||||
#ifdef Q_WS_X11
|
||||
const QString QupZilla::BUILDTIME = QLocale(QLocale::English).toDateTime(__DATE__" "__TIME__, "MMM dd yyyy hh:mm:ss").toString("MM/dd/yyyy hh:ss");
|
||||
#else
|
||||
const QString QupZilla::BUILDTIME = __DATE__" "__TIME__;
|
||||
#endif
|
||||
const QString QupZilla::AUTHOR = "nowrep";
|
||||
const QString QupZilla::COPYRIGHT = "2010-2011";
|
||||
const QString QupZilla::WWWADDRESS = "http://qupzilla.ic.cz";
|
||||
|
|
|
@ -46,12 +46,12 @@ DownloadManager::DownloadManager(QWidget* parent) :
|
|||
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList()));
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
win7.init(this->winId());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
bool DownloadManager::winEvent(MSG* message, long* result)
|
||||
{
|
||||
return win7.winEvent(message, result);
|
||||
|
@ -107,7 +107,7 @@ void DownloadManager::timerEvent(QTimerEvent* event)
|
|||
DownloadItem::currentSpeedToString(speed),
|
||||
DownloadItem::remaingTimeToString(remaining)));
|
||||
setWindowTitle(QString::number(progress) + tr("% - Download Manager"));
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
win7.setProgressValue(progress, 100);
|
||||
win7.setProgressState(win7.Normal);
|
||||
#endif
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
void show() { m_timer.start(1000*2, this); QWidget::show(); }
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
protected:
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#endif
|
||||
|
@ -69,7 +69,7 @@ private slots:
|
|||
void deleteItem(DownloadItem* item);
|
||||
|
||||
private:
|
||||
#ifdef W7TASKBAR
|
||||
#ifdef W7API
|
||||
EcWin7 win7;
|
||||
#endif
|
||||
void timerEvent(QTimerEvent* event);
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>0</number>
|
||||
|
|
|
@ -35,7 +35,11 @@ public:
|
|||
QSize sizeHint() const
|
||||
{
|
||||
QSize siz = QToolButton::sizeHint();
|
||||
#ifdef Q_WS_X11
|
||||
siz.setWidth(25);
|
||||
#else
|
||||
siz.setWidth(26);
|
||||
#endif
|
||||
return siz;
|
||||
}
|
||||
|
||||
|
@ -50,7 +54,11 @@ private:
|
|||
QPixmap pix(":/icons/other/list-add.png");
|
||||
QRect r = this->rect();
|
||||
r.setHeight(r.height()+3);
|
||||
#ifdef Q_WS_X11
|
||||
r.setWidth(r.width()-1);
|
||||
#else
|
||||
r.setWidth(r.width()+3);
|
||||
#endif
|
||||
style()->drawItemPixmap(&p, r, Qt::AlignCenter, pix);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user