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 "restoremanager.h"
|
||||
#include "proxystyle.h"
|
||||
#include "registerqappassociation.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QFileOpenEvent>
|
||||
@ -823,7 +824,7 @@ bool MainApplication::checkDefaultWebBrowser()
|
||||
CheckMessageBox notDefaultDialog(&showAgain, getWindow());
|
||||
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.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."));
|
||||
|
||||
if (notDefaultDialog.exec() == QDialog::Accepted) {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QUrl>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include "registerqappassociation.h"
|
||||
#include "restoremanager.h"
|
||||
#include "qtsingleapplication.h"
|
||||
#include "qz_namespace.h"
|
||||
@ -50,6 +49,7 @@ class SearchEnginesManager;
|
||||
class DatabaseWriter;
|
||||
class UserAgentManager;
|
||||
class ProxyStyle;
|
||||
class RegisterQAppAssociation;
|
||||
|
||||
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
||||
{
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
|
||||
RegisterQAppAssociation::RegisterQAppAssociation(QObject *parent) :
|
||||
RegisterQAppAssociation::RegisterQAppAssociation(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
setPerMachineRegisteration(false);
|
||||
}
|
||||
|
||||
RegisterQAppAssociation::RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath, const QString &appIcon,
|
||||
const QString &appDesc, QObject *parent)
|
||||
const QString &appDesc, QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
setPerMachineRegisteration(false);
|
||||
@ -177,8 +177,7 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
assocName.toStdWString().c_str(),
|
||||
AT_FILEEXTENSION);
|
||||
break;
|
||||
case UrlAssociation:
|
||||
{
|
||||
case UrlAssociation: {
|
||||
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
||||
QString currentUrlDefault =
|
||||
regCurrentUserRoot.value("Software/Microsoft/Windows/Shell/Associations/UrlAssociations/"
|
||||
@ -208,8 +207,7 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
regUserRoot.beginGroup("Software/Classes");
|
||||
QSettings regClassesRoot("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
|
||||
switch (type) {
|
||||
case FileAssociation:
|
||||
{
|
||||
case FileAssociation: {
|
||||
QString progId = _fileAssocHash.value(assocName);
|
||||
createProgId(progId);
|
||||
QString currentDefault = regClassesRoot.value(assocName + "/Default").toString();
|
||||
@ -221,12 +219,11 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
regUserRoot.setValue(assocName + "/.", progId);
|
||||
}
|
||||
break;
|
||||
case UrlAssociation:
|
||||
{
|
||||
case UrlAssociation: {
|
||||
QString progId = _urlAssocHash.value(assocName);
|
||||
createProgId(progId);
|
||||
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
||||
QString command = "\""+_appPath+"\" \"%1\"";
|
||||
QString command = "\"" + _appPath + "\" \"%1\"";
|
||||
if (!currentDefault.isEmpty()
|
||||
&& currentDefault != command
|
||||
&& regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command) {
|
||||
@ -272,7 +269,7 @@ void RegisterQAppAssociation::registerAllAssociation()
|
||||
if (!isVistaOrNewer()) {
|
||||
// On Windows Vista or newer for updating icons 'pAAR->SetAppAsDefault()'
|
||||
// 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
|
||||
}
|
||||
@ -286,7 +283,7 @@ void RegisterQAppAssociation::createProgId(const QString &progId)
|
||||
regUserRoot.setValue(progId + "/.", pair.first);
|
||||
regUserRoot.setValue(progId + "/shell/.", "open");
|
||||
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();
|
||||
#else
|
||||
Q_UNUSED(progId)
|
||||
@ -299,8 +296,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
||||
if (isVistaOrNewer()) {
|
||||
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
|
||||
switch (type) {
|
||||
case FileAssociation:
|
||||
{
|
||||
case FileAssociation: {
|
||||
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts");
|
||||
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
||||
return (_fileAssocHash.value(assocName)
|
||||
@ -312,8 +308,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UrlAssociation:
|
||||
{
|
||||
case UrlAssociation: {
|
||||
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/Shell/Associations/UrlAssociations");
|
||||
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
|
||||
return (_urlAssocHash.value(assocName)
|
||||
@ -338,14 +333,12 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case FileAssociation:
|
||||
{
|
||||
case FileAssociation: {
|
||||
return (_fileAssocHash.value(assocName)
|
||||
== regClassesRoot.value(assocName + "/Default"));
|
||||
}
|
||||
break;
|
||||
case UrlAssociation:
|
||||
{
|
||||
case UrlAssociation: {
|
||||
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
||||
currentDefault.remove("\"");
|
||||
currentDefault.remove("%1");
|
||||
@ -388,7 +381,7 @@ bool RegisterQAppAssociation::isDefaultForAllCapabilities()
|
||||
/******** 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),
|
||||
_showAgainState(defaultShowAgainState)
|
||||
{
|
||||
@ -403,8 +396,8 @@ CheckMessageBox::CheckMessageBox(bool *defaultShowAgainState, QWidget *parent, Q
|
||||
}
|
||||
|
||||
CheckMessageBox::CheckMessageBox(const QString &msg, const QPixmap &pixmap,
|
||||
const QString &str, bool *defaultShowAgainState,
|
||||
QWidget *parent, Qt::WindowFlags f)
|
||||
const QString &str, bool* defaultShowAgainState,
|
||||
QWidget* parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f | Qt::MSWindowsFixedSizeDialogHint),
|
||||
_showAgainState(defaultShowAgainState)
|
||||
{
|
||||
@ -482,7 +475,7 @@ void CheckMessageBox::setupUi()
|
||||
buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::No|QDialogButtonBox::Yes);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::No | QDialogButtonBox::Yes);
|
||||
|
||||
gridLayout->addWidget(buttonBox, 1, 0, 1, 1);
|
||||
|
||||
|
@ -84,10 +84,10 @@ class QT_QUPZILLA_EXPORT CheckMessageBox : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
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,
|
||||
const QString &str, bool *defaultShowAgainState,
|
||||
QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
const QString &str, bool* defaultShowAgainState,
|
||||
QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
~CheckMessageBox();
|
||||
|
||||
void setMessage(const QString &msg);
|
||||
@ -97,17 +97,17 @@ public:
|
||||
private:
|
||||
void setupUi();
|
||||
|
||||
bool *_showAgainState;
|
||||
QGridLayout *gridLayout;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QVBoxLayout *verticalLayout_2;
|
||||
QLabel *pixmapLabel;
|
||||
QSpacerItem *verticalSpacer;
|
||||
QVBoxLayout *verticalLayout;
|
||||
QLabel *messageLabel;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QCheckBox *showAgainCheckBox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
bool* _showAgainState;
|
||||
QGridLayout* gridLayout;
|
||||
QHBoxLayout* horizontalLayout;
|
||||
QVBoxLayout* verticalLayout_2;
|
||||
QLabel* pixmapLabel;
|
||||
QSpacerItem* verticalSpacer;
|
||||
QVBoxLayout* verticalLayout;
|
||||
QLabel* messageLabel;
|
||||
QSpacerItem* horizontalSpacer;
|
||||
QCheckBox* showAgainCheckBox;
|
||||
QDialogButtonBox* buttonBox;
|
||||
|
||||
private slots:
|
||||
void showAgainStateChanged(bool checked);
|
||||
|
Loading…
Reference in New Issue
Block a user