mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Coding style
This commit is contained in:
parent
82faa94de3
commit
60792f3762
@ -50,6 +50,7 @@
|
|||||||
#include "useragentmanager.h"
|
#include "useragentmanager.h"
|
||||||
#include "restoremanager.h"
|
#include "restoremanager.h"
|
||||||
#include "proxystyle.h"
|
#include "proxystyle.h"
|
||||||
|
#include "registerqappassociation.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
@ -823,7 +824,7 @@ bool MainApplication::checkDefaultWebBrowser()
|
|||||||
CheckMessageBox notDefaultDialog(&showAgain, getWindow());
|
CheckMessageBox notDefaultDialog(&showAgain, getWindow());
|
||||||
notDefaultDialog.setWindowTitle(tr("Default Browser"));
|
notDefaultDialog.setWindowTitle(tr("Default Browser"));
|
||||||
notDefaultDialog.setMessage(tr("QupZilla is not currently your default browser. Would you like to make it your default browser?"));
|
notDefaultDialog.setMessage(tr("QupZilla is not currently your default browser. Would you like to make it your default browser?"));
|
||||||
notDefaultDialog.setPixmap(style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(32,32));
|
notDefaultDialog.setPixmap(style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(32, 32));
|
||||||
notDefaultDialog.setShowAgainText(tr("Always perform this check when starting QupZilla."));
|
notDefaultDialog.setShowAgainText(tr("Always perform this check when starting QupZilla."));
|
||||||
|
|
||||||
if (notDefaultDialog.exec() == QDialog::Accepted) {
|
if (notDefaultDialog.exec() == QDialog::Accepted) {
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
|
||||||
#include "registerqappassociation.h"
|
|
||||||
#include "restoremanager.h"
|
#include "restoremanager.h"
|
||||||
#include "qtsingleapplication.h"
|
#include "qtsingleapplication.h"
|
||||||
#include "qz_namespace.h"
|
#include "qz_namespace.h"
|
||||||
@ -50,6 +49,7 @@ class SearchEnginesManager;
|
|||||||
class DatabaseWriter;
|
class DatabaseWriter;
|
||||||
class UserAgentManager;
|
class UserAgentManager;
|
||||||
class ProxyStyle;
|
class ProxyStyle;
|
||||||
|
class RegisterQAppAssociation;
|
||||||
|
|
||||||
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
||||||
{
|
{
|
||||||
|
@ -28,14 +28,14 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
RegisterQAppAssociation::RegisterQAppAssociation(QObject *parent) :
|
RegisterQAppAssociation::RegisterQAppAssociation(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
setPerMachineRegisteration(false);
|
setPerMachineRegisteration(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterQAppAssociation::RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath, const QString &appIcon,
|
RegisterQAppAssociation::RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath, const QString &appIcon,
|
||||||
const QString &appDesc, QObject *parent)
|
const QString &appDesc, QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
setPerMachineRegisteration(false);
|
setPerMachineRegisteration(false);
|
||||||
@ -47,12 +47,12 @@ RegisterQAppAssociation::~RegisterQAppAssociation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterQAppAssociation::addCapability(const QString &assocName, const QString &progId,
|
void RegisterQAppAssociation::addCapability(const QString &assocName, const QString &progId,
|
||||||
const QString &desc, const QString &iconPath, AssociationType type)
|
const QString &desc, const QString &iconPath, AssociationType type)
|
||||||
{
|
{
|
||||||
_assocDescHash.insert(progId, QPair<QString, QString>(desc, QDir::toNativeSeparators(iconPath)));
|
_assocDescHash.insert(progId, QPair<QString, QString>(desc, QDir::toNativeSeparators(iconPath)));
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FileAssociation:
|
case FileAssociation:
|
||||||
_fileAssocHash.insert(assocName, progId);
|
_fileAssocHash.insert(assocName, progId);
|
||||||
break;
|
break;
|
||||||
case UrlAssociation:
|
case UrlAssociation:
|
||||||
_urlAssocHash.insert(assocName, progId);
|
_urlAssocHash.insert(assocName, progId);
|
||||||
@ -70,7 +70,7 @@ void RegisterQAppAssociation::removeCapability(const QString &assocName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterQAppAssociation::setAppInfo(const QString &appRegisteredName, const QString &appPath,
|
void RegisterQAppAssociation::setAppInfo(const QString &appRegisteredName, const QString &appPath,
|
||||||
const QString &appIcon, const QString &appDesc)
|
const QString &appIcon, const QString &appDesc)
|
||||||
{
|
{
|
||||||
_appRegisteredName = appRegisteredName;
|
_appRegisteredName = appRegisteredName;
|
||||||
_appPath = QDir::toNativeSeparators(appPath);
|
_appPath = QDir::toNativeSeparators(appPath);
|
||||||
@ -177,12 +177,11 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
|||||||
assocName.toStdWString().c_str(),
|
assocName.toStdWString().c_str(),
|
||||||
AT_FILEEXTENSION);
|
AT_FILEEXTENSION);
|
||||||
break;
|
break;
|
||||||
case UrlAssociation:
|
case UrlAssociation: {
|
||||||
{
|
|
||||||
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
||||||
QString currentUrlDefault =
|
QString currentUrlDefault =
|
||||||
regCurrentUserRoot.value("Software/Microsoft/Windows/Shell/Associations/UrlAssociations/"
|
regCurrentUserRoot.value("Software/Microsoft/Windows/Shell/Associations/UrlAssociations/"
|
||||||
+ assocName + "/UserChoice/Progid").toString();
|
+ assocName + "/UserChoice/Progid").toString();
|
||||||
hr = pAAR->SetAppAsDefault(_appRegisteredName.toStdWString().c_str(),
|
hr = pAAR->SetAppAsDefault(_appRegisteredName.toStdWString().c_str(),
|
||||||
assocName.toStdWString().c_str(),
|
assocName.toStdWString().c_str(),
|
||||||
AT_URLPROTOCOL);
|
AT_URLPROTOCOL);
|
||||||
@ -194,7 +193,7 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
|||||||
+ "/shell/open/command/backup_progid", currentUrlDefault);
|
+ "/shell/open/command/backup_progid", currentUrlDefault);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -208,8 +207,7 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
|||||||
regUserRoot.beginGroup("Software/Classes");
|
regUserRoot.beginGroup("Software/Classes");
|
||||||
QSettings regClassesRoot("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
|
QSettings regClassesRoot("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FileAssociation:
|
case FileAssociation: {
|
||||||
{
|
|
||||||
QString progId = _fileAssocHash.value(assocName);
|
QString progId = _fileAssocHash.value(assocName);
|
||||||
createProgId(progId);
|
createProgId(progId);
|
||||||
QString currentDefault = regClassesRoot.value(assocName + "/Default").toString();
|
QString currentDefault = regClassesRoot.value(assocName + "/Default").toString();
|
||||||
@ -220,13 +218,12 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
|||||||
}
|
}
|
||||||
regUserRoot.setValue(assocName + "/.", progId);
|
regUserRoot.setValue(assocName + "/.", progId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UrlAssociation:
|
case UrlAssociation: {
|
||||||
{
|
|
||||||
QString progId = _urlAssocHash.value(assocName);
|
QString progId = _urlAssocHash.value(assocName);
|
||||||
createProgId(progId);
|
createProgId(progId);
|
||||||
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
||||||
QString command = "\""+_appPath+"\" \"%1\"";
|
QString command = "\"" + _appPath + "\" \"%1\"";
|
||||||
if (!currentDefault.isEmpty()
|
if (!currentDefault.isEmpty()
|
||||||
&& currentDefault != command
|
&& currentDefault != command
|
||||||
&& regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command) {
|
&& regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command) {
|
||||||
@ -272,7 +269,7 @@ void RegisterQAppAssociation::registerAllAssociation()
|
|||||||
if (!isVistaOrNewer()) {
|
if (!isVistaOrNewer()) {
|
||||||
// On Windows Vista or newer for updating icons 'pAAR->SetAppAsDefault()'
|
// On Windows Vista or newer for updating icons 'pAAR->SetAppAsDefault()'
|
||||||
// calls 'SHChangeNotify()'. Thus, we just need care about older Windows.
|
// calls 'SHChangeNotify()'. Thus, we just need care about older Windows.
|
||||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, 0 ,0);
|
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, 0 , 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -286,7 +283,7 @@ void RegisterQAppAssociation::createProgId(const QString &progId)
|
|||||||
regUserRoot.setValue(progId + "/.", pair.first);
|
regUserRoot.setValue(progId + "/.", pair.first);
|
||||||
regUserRoot.setValue(progId + "/shell/.", "open");
|
regUserRoot.setValue(progId + "/shell/.", "open");
|
||||||
regUserRoot.setValue(progId + "/DefaultIcon/.", pair.second);
|
regUserRoot.setValue(progId + "/DefaultIcon/.", pair.second);
|
||||||
regUserRoot.setValue(progId + "/shell/open/command/.", QString("\""+_appPath+"\" \"%1\""));
|
regUserRoot.setValue(progId + "/shell/open/command/.", QString("\"" + _appPath + "\" \"%1\""));
|
||||||
regUserRoot.endGroup();
|
regUserRoot.endGroup();
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(progId)
|
Q_UNUSED(progId)
|
||||||
@ -299,8 +296,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
|||||||
if (isVistaOrNewer()) {
|
if (isVistaOrNewer()) {
|
||||||
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FileAssociation:
|
case FileAssociation: {
|
||||||
{
|
|
||||||
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts");
|
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts");
|
||||||
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
||||||
return (_fileAssocHash.value(assocName)
|
return (_fileAssocHash.value(assocName)
|
||||||
@ -312,8 +308,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UrlAssociation:
|
case UrlAssociation: {
|
||||||
{
|
|
||||||
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/Shell/Associations/UrlAssociations");
|
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/Shell/Associations/UrlAssociations");
|
||||||
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
||||||
return (_urlAssocHash.value(assocName)
|
return (_urlAssocHash.value(assocName)
|
||||||
@ -324,7 +319,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -338,21 +333,19 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FileAssociation:
|
case FileAssociation: {
|
||||||
{
|
|
||||||
return (_fileAssocHash.value(assocName)
|
return (_fileAssocHash.value(assocName)
|
||||||
== regClassesRoot.value(assocName + "/Default"));
|
== regClassesRoot.value(assocName + "/Default"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UrlAssociation:
|
case UrlAssociation: {
|
||||||
{
|
|
||||||
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
||||||
currentDefault.remove("\"");
|
currentDefault.remove("\"");
|
||||||
currentDefault.remove("%1");
|
currentDefault.remove("%1");
|
||||||
currentDefault = currentDefault.trimmed();
|
currentDefault = currentDefault.trimmed();
|
||||||
return (_appPath == currentDefault);
|
return (_appPath == currentDefault);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -388,9 +381,9 @@ bool RegisterQAppAssociation::isDefaultForAllCapabilities()
|
|||||||
/******** CheckMessageBox Class ********/
|
/******** CheckMessageBox Class ********/
|
||||||
/***************************************/
|
/***************************************/
|
||||||
|
|
||||||
CheckMessageBox::CheckMessageBox(bool *defaultShowAgainState, QWidget *parent, Qt::WindowFlags f)
|
CheckMessageBox::CheckMessageBox(bool* defaultShowAgainState, QWidget* parent, Qt::WindowFlags f)
|
||||||
: QDialog(parent, f | Qt::MSWindowsFixedSizeDialogHint),
|
: QDialog(parent, f | Qt::MSWindowsFixedSizeDialogHint),
|
||||||
_showAgainState(defaultShowAgainState)
|
_showAgainState(defaultShowAgainState)
|
||||||
{
|
{
|
||||||
setupUi();
|
setupUi();
|
||||||
if (defaultShowAgainState) {
|
if (defaultShowAgainState) {
|
||||||
@ -403,8 +396,8 @@ CheckMessageBox::CheckMessageBox(bool *defaultShowAgainState, QWidget *parent, Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
CheckMessageBox::CheckMessageBox(const QString &msg, const QPixmap &pixmap,
|
CheckMessageBox::CheckMessageBox(const QString &msg, const QPixmap &pixmap,
|
||||||
const QString &str, bool *defaultShowAgainState,
|
const QString &str, bool* defaultShowAgainState,
|
||||||
QWidget *parent, Qt::WindowFlags f)
|
QWidget* parent, Qt::WindowFlags f)
|
||||||
: QDialog(parent, f | Qt::MSWindowsFixedSizeDialogHint),
|
: QDialog(parent, f | Qt::MSWindowsFixedSizeDialogHint),
|
||||||
_showAgainState(defaultShowAgainState)
|
_showAgainState(defaultShowAgainState)
|
||||||
{
|
{
|
||||||
@ -482,7 +475,7 @@ void CheckMessageBox::setupUi()
|
|||||||
buttonBox = new QDialogButtonBox(this);
|
buttonBox = new QDialogButtonBox(this);
|
||||||
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
|
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
|
||||||
buttonBox->setOrientation(Qt::Horizontal);
|
buttonBox->setOrientation(Qt::Horizontal);
|
||||||
buttonBox->setStandardButtons(QDialogButtonBox::No|QDialogButtonBox::Yes);
|
buttonBox->setStandardButtons(QDialogButtonBox::No | QDialogButtonBox::Yes);
|
||||||
|
|
||||||
gridLayout->addWidget(buttonBox, 1, 0, 1, 1);
|
gridLayout->addWidget(buttonBox, 1, 0, 1, 1);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class QT_QUPZILLA_EXPORT RegisterQAppAssociation : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit RegisterQAppAssociation(QObject* parent = 0);
|
explicit RegisterQAppAssociation(QObject* parent = 0);
|
||||||
explicit RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath,
|
explicit RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath,
|
||||||
const QString &appIcon = "", const QString &appDesc = "", QObject* parent = 0);
|
const QString &appIcon = "", const QString &appDesc = "", QObject* parent = 0);
|
||||||
~RegisterQAppAssociation();
|
~RegisterQAppAssociation();
|
||||||
|
|
||||||
enum AssociationType {
|
enum AssociationType {
|
||||||
@ -84,10 +84,10 @@ class QT_QUPZILLA_EXPORT CheckMessageBox : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CheckMessageBox(bool *defaultShowAgainState = 0, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
CheckMessageBox(bool* defaultShowAgainState = 0, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||||
CheckMessageBox(const QString &msg, const QPixmap &pixmap,
|
CheckMessageBox(const QString &msg, const QPixmap &pixmap,
|
||||||
const QString &str, bool *defaultShowAgainState,
|
const QString &str, bool* defaultShowAgainState,
|
||||||
QWidget *parent = 0, Qt::WindowFlags f = 0);
|
QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||||
~CheckMessageBox();
|
~CheckMessageBox();
|
||||||
|
|
||||||
void setMessage(const QString &msg);
|
void setMessage(const QString &msg);
|
||||||
@ -97,17 +97,17 @@ public:
|
|||||||
private:
|
private:
|
||||||
void setupUi();
|
void setupUi();
|
||||||
|
|
||||||
bool *_showAgainState;
|
bool* _showAgainState;
|
||||||
QGridLayout *gridLayout;
|
QGridLayout* gridLayout;
|
||||||
QHBoxLayout *horizontalLayout;
|
QHBoxLayout* horizontalLayout;
|
||||||
QVBoxLayout *verticalLayout_2;
|
QVBoxLayout* verticalLayout_2;
|
||||||
QLabel *pixmapLabel;
|
QLabel* pixmapLabel;
|
||||||
QSpacerItem *verticalSpacer;
|
QSpacerItem* verticalSpacer;
|
||||||
QVBoxLayout *verticalLayout;
|
QVBoxLayout* verticalLayout;
|
||||||
QLabel *messageLabel;
|
QLabel* messageLabel;
|
||||||
QSpacerItem *horizontalSpacer;
|
QSpacerItem* horizontalSpacer;
|
||||||
QCheckBox *showAgainCheckBox;
|
QCheckBox* showAgainCheckBox;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox* buttonBox;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showAgainStateChanged(bool checked);
|
void showAgainStateChanged(bool checked);
|
||||||
|
Loading…
Reference in New Issue
Block a user