summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-18 11:44:02 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-18 11:44:02 +0200
commit38bca2f01a9bf8663f56b45b2cec2e9cf00ffa85 (patch)
tree3a8c1b0a6da2accb1c0b56a4d4cf9b51ce4f22ae
parentLast fixes for the SSL dialog improvements (diff)
downloadrekonq-38bca2f01a9bf8663f56b45b2cec2e9cf00ffa85.tar.xz
style cleanup
-rw-r--r--scripts/codingstyle.sh2
-rw-r--r--src/history/historymanager.cpp2
-rw-r--r--src/history/historymodels.cpp12
-rw-r--r--src/sslinfodialog.cpp74
-rw-r--r--src/sslinfodialog.h4
-rw-r--r--src/urlbar/sslwidget.cpp72
-rw-r--r--src/urlbar/sslwidget.h2
-rw-r--r--src/urlbar/urlbar.cpp8
-rw-r--r--src/webpage.cpp10
-rw-r--r--src/webpage.h2
10 files changed, 94 insertions, 94 deletions
diff --git a/scripts/codingstyle.sh b/scripts/codingstyle.sh
index c171ea18..6488e077 100644
--- a/scripts/codingstyle.sh
+++ b/scripts/codingstyle.sh
@@ -32,7 +32,7 @@ cd src
echo "Applying astyle rules..."
astyle \
--indent=spaces=4 \
---brackets=break \
+--style=allman \
--indent-labels \
--pad-oper \
--unpad-paren \
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 0b5e9e48..3b765e7d 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -378,7 +378,7 @@ void HistoryManager::load()
continue;
};
- if (!item.lastDateTimeVisit.isValid())
+ if(!item.lastDateTimeVisit.isValid())
continue;
if(item == lastInsertedItem)
diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp
index 0315513b..c43a06d9 100644
--- a/src/history/historymodels.cpp
+++ b/src/history/historymodels.cpp
@@ -438,7 +438,7 @@ QVariant HistoryTreeModel::headerData(int section, Qt::Orientation orientation,
QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
{
- if (role == Qt::EditRole || role == Qt::DisplayRole)
+ if(role == Qt::EditRole || role == Qt::DisplayRole)
{
int start = index.internalId();
if(start == 0)
@@ -458,18 +458,18 @@ QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
}
}
}
-
- if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
+
+ if(role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
return KIcon("view-history");
-
- if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0)
+
+ if(role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0)
{
int offset = sourceDateRow(index.row());
QModelIndex idx = sourceModel()->index(offset, 0);
return idx.data(HistoryModel::DateRole);
}
- if (role == HistoryModel::FirstDateTimeVisitRole && index.column() == 0 && index.internalId() == 0)
+ if(role == HistoryModel::FirstDateTimeVisitRole && index.column() == 0 && index.internalId() == 0)
{
int offset = sourceDateRow(index.row());
QModelIndex idx = sourceModel()->index(offset, 0);
diff --git a/src/sslinfodialog.cpp b/src/sslinfodialog.cpp
index dc55e95a..5bcdd39a 100644
--- a/src/sslinfodialog.cpp
+++ b/src/sslinfodialog.cpp
@@ -54,20 +54,20 @@ SslInfoDialog::SslInfoDialog(const QString &host, const WebSslInfo &info, QWidge
setAttribute(Qt::WA_DeleteOnClose);
setMinimumWidth(300);
-
+
setButtons(KDialog::User1 | KDialog::Close);
-
- setButtonGuiItem(User1, KGuiItem(i18n("Export"), "view-certificate-export") );
+
+ setButtonGuiItem(User1, KGuiItem(i18n("Export"), "view-certificate-export"));
connect(this, SIGNAL(user1Clicked()), this, SLOT(exportCert()));
-
+
ui.setupUi(mainWidget());
// ------------------------------------------------
QList<QSslCertificate> caList = m_info.certificateChain();
-
- Q_FOREACH(const QSslCertificate &cert, caList)
+
+ Q_FOREACH(const QSslCertificate & cert, caList)
{
- ui.comboBox->addItem( cert.subjectInfo(QSslCertificate::CommonName) );
+ ui.comboBox->addItem(cert.subjectInfo(QSslCertificate::CommonName));
}
connect(ui.comboBox, SIGNAL(activated(int)), this, SLOT(displayFromChain(int)));
@@ -80,27 +80,27 @@ void SslInfoDialog::showCertificateInfo(QSslCertificate subjectCert, const QStri
QStringList sl = certErrors;
QString c = sl.takeFirst();
c += QL1S("<ul>");
- Q_FOREACH(const QString &s, sl)
+ Q_FOREACH(const QString & s, sl)
{
c += QL1S("<li>") + s + QL1S("</li>");
}
c += QL1S("</ul>");
ui.certInfoLabel->setText(c);
-
- ui.subjectCN->setText( subjectCert.subjectInfo(QSslCertificate::CommonName) );
- ui.subjectO->setText( subjectCert.subjectInfo(QSslCertificate::Organization) );
- ui.subjectOU->setText( subjectCert.subjectInfo(QSslCertificate::OrganizationalUnitName) );
- ui.subjectSN->setText( subjectCert.serialNumber() );
-
- ui.issuerCN->setText( subjectCert.issuerInfo(QSslCertificate::CommonName) );
- ui.issuerO->setText( subjectCert.issuerInfo(QSslCertificate::Organization) );
- ui.issuerOU->setText( subjectCert.issuerInfo(QSslCertificate::OrganizationalUnitName) );
-
- ui.issuedOn->setText( subjectCert.effectiveDate().date().toString(Qt::SystemLocaleShortDate) );
- ui.expiresOn->setText( subjectCert.expiryDate().date().toString(Qt::SystemLocaleShortDate) );
- ui.sha256->setText( subjectCert.digest(QCryptographicHash::Md5).toHex() );
- ui.sha1->setText( subjectCert.digest(QCryptographicHash::Sha1).toHex() );
-
+
+ ui.subjectCN->setText(subjectCert.subjectInfo(QSslCertificate::CommonName));
+ ui.subjectO->setText(subjectCert.subjectInfo(QSslCertificate::Organization));
+ ui.subjectOU->setText(subjectCert.subjectInfo(QSslCertificate::OrganizationalUnitName));
+ ui.subjectSN->setText(subjectCert.serialNumber());
+
+ ui.issuerCN->setText(subjectCert.issuerInfo(QSslCertificate::CommonName));
+ ui.issuerO->setText(subjectCert.issuerInfo(QSslCertificate::Organization));
+ ui.issuerOU->setText(subjectCert.issuerInfo(QSslCertificate::OrganizationalUnitName));
+
+ ui.issuedOn->setText(subjectCert.effectiveDate().date().toString(Qt::SystemLocaleShortDate));
+ ui.expiresOn->setText(subjectCert.expiryDate().date().toString(Qt::SystemLocaleShortDate));
+ ui.sha256->setText(subjectCert.digest(QCryptographicHash::Md5).toHex());
+ ui.sha1->setText(subjectCert.digest(QCryptographicHash::Sha1).toHex());
+
}
@@ -109,37 +109,37 @@ void SslInfoDialog::displayFromChain(int i)
QList<QSslCertificate> caList = m_info.certificateChain();
QSslCertificate cert = caList.at(i);
- if (cert.isValid())
+ if(cert.isValid())
{
QStringList certInfo;
certInfo << i18n("The Certificate is Valid!");
- showCertificateInfo(cert, certInfo );
+ showCertificateInfo(cert, certInfo);
}
else
{
QStringList errors = SslInfoDialog::errorsFromString(m_info.certificateErrors()).at(i);
- errors.prepend( i18n("The certificate for this site is NOT valid for the following reasons:") );
- showCertificateInfo(cert, errors );
+ errors.prepend(i18n("The certificate for this site is NOT valid for the following reasons:"));
+ showCertificateInfo(cert, errors);
}
}
void SslInfoDialog::exportCert()
{
- QSslCertificate cert = m_info.certificateChain().at( ui.comboBox->currentIndex() );
+ QSslCertificate cert = m_info.certificateChain().at(ui.comboBox->currentIndex());
QString name = cert.subjectInfo(QSslCertificate::CommonName) + QL1S(".pem");
-
+
QString certPath = KFileDialog::getSaveFileName(name, QString(), this);
kDebug() << certPath;
-
+
QFile file(certPath);
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
return;
- QTextStream out(&file);
- out << cert.toPem();
+ QTextStream out(&file);
+ out << cert.toPem();
}
@@ -147,18 +147,18 @@ void SslInfoDialog::exportCert()
QList<QStringList> SslInfoDialog::errorsFromString(const QString &s)
{
QList<QStringList> resultList;
-
+
QStringList sl1 = s.split('\n', QString::KeepEmptyParts);
- Q_FOREACH(const QString &certErrors, sl1)
+ Q_FOREACH(const QString & certErrors, sl1)
{
QStringList errors;
QStringList sl = certErrors.split("\t", QString::SkipEmptyParts);
- Q_FOREACH(const QString &s, sl)
+ Q_FOREACH(const QString & s, sl)
{
bool didConvert;
QSslError::SslError error = static_cast<QSslError::SslError>(s.trimmed().toInt(&didConvert));
- if (didConvert)
+ if(didConvert)
{
errors << QSslError(error).errorString();
}
diff --git a/src/sslinfodialog.h b/src/sslinfodialog.h
index c993e134..b40ce4f0 100644
--- a/src/sslinfodialog.h
+++ b/src/sslinfodialog.h
@@ -60,10 +60,10 @@ public:
private Q_SLOTS:
void displayFromChain(int);
void exportCert();
-
+
private:
void showCertificateInfo(QSslCertificate, const QStringList &certErrors);
-
+
QString m_host;
WebSslInfo m_info;
diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp
index b1819700..fd0b97b8 100644
--- a/src/urlbar/sslwidget.cpp
+++ b/src/urlbar/sslwidget.cpp
@@ -49,7 +49,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
setMinimumWidth(400);
QSslCertificate cert = info.certificateChain().first();
-
+
QGridLayout *layout = new QGridLayout(this);
QLabel *label;
@@ -62,27 +62,27 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("<h4>Identity</h4>") );
+ label->setText(i18n("<h4>Identity</h4>"));
layout->addWidget(label, rows++, 1);
-
- if (cert.isNull())
+
+ if(cert.isNull())
{
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("Warning: this site is carrying a NULL certificate!") );
-
+ label->setText(i18n("Warning: this site is carrying a NULL certificate!"));
+
imageLabel->setPixmap(KIcon("security-low").pixmap(32));
}
else
{
- if (cert.isValid())
+ if(cert.isValid())
{
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("This certificate for this site is valid and has been verified by:\n%1.",
- cert.issuerInfo(QSslCertificate::CommonName)) );
-
-
+ label->setText(i18n("This certificate for this site is valid and has been verified by:\n%1.",
+ cert.issuerInfo(QSslCertificate::CommonName)));
+
+
imageLabel->setPixmap(KIcon("security-high").pixmap(32));
}
else
@@ -91,24 +91,24 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label->setWordWrap(true);
QList<QStringList> errorList = SslInfoDialog::errorsFromString(m_info.certificateErrors());
- if (errorList.at(0).isEmpty())
+ if(errorList.at(0).isEmpty())
{
- label->setText( i18n("The certificate for this site is valid, but some on the certificate chain are not!") );
+ label->setText(i18n("The certificate for this site is valid, but some on the certificate chain are not!"));
imageLabel->setPixmap(KIcon("security-medium").pixmap(32));
}
else
{
QStringList sl = errorList.at(0);
QString c = QL1S("<ul>");
- Q_FOREACH(const QString &s, sl)
+ Q_FOREACH(const QString & s, sl)
{
c += QL1S("<li>") + s + QL1S("</li>");
}
c += QL1S("</ul>");
- label->setText( i18n("The certificate for this site is NOT valid, for the following reasons:\n%1", c) );
+ label->setText(i18n("The certificate for this site is NOT valid, for the following reasons:\n%1", c));
label->setTextFormat(Qt::RichText);
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(32));
}
}
}
@@ -120,32 +120,32 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label->setText("<a href=\"moresslinfos\">Certificate Information</a>");
connect(label, SIGNAL(linkActivated(const QString &)), this, SLOT(showMoreSslInfos(const QString &)));
layout->addWidget(label, rows++, 1);
-
+
// ------------------------------------------------------------------------------------------------------------------
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( QL1S("<h4>Encryption</h4>") ); // ----------------------------------------------- //
+ label->setText(QL1S("<h4>Encryption</h4>")); // ----------------------------------------------- //
layout->addWidget(label, rows, 1);
imageLabel = new QLabel(this);
layout->addWidget(imageLabel, rows++ , 0, Qt::AlignCenter);
- if (cert.isNull())
+ if(cert.isNull())
{
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("Your connection to %1 is NOT encrypted!!\n\n", m_url.host()) );
+ label->setText(i18n("Your connection to %1 is NOT encrypted!!\n\n", m_url.host()));
layout->addWidget(label, rows++ , 1);
-
+
imageLabel->setPixmap(KIcon("security-low").pixmap(32));
}
else
{
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("Your connection to %1 is encrypted with %2-bit encryption.\n\n", m_url.host(), m_info.supportedChiperBits()) );
+ label->setText(i18n("Your connection to %1 is encrypted with %2-bit encryption.\n\n", m_url.host(), m_info.supportedChiperBits()));
layout->addWidget(label, rows++, 1);
-
+
int vers = cert.version().toInt();
QString sslVersion;
switch(vers)
@@ -170,29 +170,29 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("The connection uses %1.\n\n", sslVersion) );
+ label->setText(i18n("The connection uses %1.\n\n", sslVersion));
layout->addWidget(label, rows++, 1);
-
+
const QStringList cipherInfo = m_info.ciphers().split('\n', QString::SkipEmptyParts);
label = new QLabel(this);
label->setWordWrap(true);
- label->setText(
+ label->setText(
i18n("The connection is encrypted using %1 at %2 bits with %3 for message authentication and %4 as the key exchange mechanism.\n\n",
- cipherInfo[0],
- m_info.usedChiperBits(),
- cipherInfo[3],
- cipherInfo[1]) );
+ cipherInfo[0],
+ m_info.usedChiperBits(),
+ cipherInfo[3],
+ cipherInfo[1]));
layout->addWidget(label, rows++, 1);
-
+
}
-
+
// ------------------------------------------------------------------------------------------------------------------
imageLabel = new QLabel(this);
layout->addWidget(imageLabel, rows , 0, Qt::AlignCenter);
label = new QLabel(this);
label->setWordWrap(true);
- label->setText( i18n("<h4>Site Information</h4>") );
+ label->setText(i18n("<h4>Site Information</h4>"));
layout->addWidget(label, rows++, 1);
label = new QLabel(this);
@@ -200,14 +200,14 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
HistoryItem firstVisit = rApp->historyManager()->find(url.toString()).first();
- if (firstVisit.visitCount == 1)
+ if(firstVisit.visitCount == 1)
{
- label->setText( i18n("It's your first time visiting this site!") );
+ label->setText(i18n("It's your first time visiting this site!"));
imageLabel->setPixmap(KIcon("security-medium").pixmap(32));
}
else
{
- label->setText( i18n("You just visited this site!\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString()) );
+ label->setText(i18n("You just visited this site!\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString()));
imageLabel->setPixmap(KIcon("security-high").pixmap(32));
}
layout->addWidget(label, rows++, 1);
diff --git a/src/urlbar/sslwidget.h b/src/urlbar/sslwidget.h
index 00478f59..94f0494a 100644
--- a/src/urlbar/sslwidget.h
+++ b/src/urlbar/sslwidget.h
@@ -48,7 +48,7 @@ public:
private Q_SLOTS:
void showMoreSslInfos(const QString &);
void accept();
-
+
private:
QUrl m_url;
WebSslInfo m_info;
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 8b3dac65..ea60f474 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -183,8 +183,8 @@ void UrlBar::paintEvent(QPaintEvent *event)
if(_tab->url().scheme() == QL1S("https"))
{
backgroundColor = _tab->page()->hasSslValid()
- ? colorScheme.background(KColorScheme::PositiveBackground).color()
- : colorScheme.background(KColorScheme::NegativeBackground).color();
+ ? colorScheme.background(KColorScheme::PositiveBackground).color()
+ : colorScheme.background(KColorScheme::NegativeBackground).color();
foregroundColor = colorScheme.foreground(KColorScheme::NormalText).color();
}
@@ -466,8 +466,8 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
break;
case UrlBar::SSL:
_tab->page()->hasSslValid()
- ? rightIcon->setIcon(KIcon("object-locked"))
- : rightIcon->setIcon(KIcon("object-unlocked"));
+ ? rightIcon->setIcon(KIcon("object-locked"))
+ : rightIcon->setIcon(KIcon("object-unlocked"));
rightIcon->setToolTip(i18n("Show SSL Info"));
break;
case UrlBar::BK:
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 95d7b6ae..35c1eb54 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -557,8 +557,8 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
kDebug() << "IS MAIN FRAME? " << isMainFrameRequest;
kDebug() << "LOADING URL: " << _loadingUrl;
kDebug() << "IS URL FRAME LOADING " << isUrlFrameLoading;
-
- if (isMainFrameRequest
+
+ if(isMainFrameRequest
&& _sslInfo.isValid()
&& !domainSchemeMatch(reply->url(), _sslInfo.url())
)
@@ -731,10 +731,10 @@ void WebPage::downloadAllContentsWithKGet(QPoint)
void WebPage::showSSLInfo(QPoint pos)
{
- if (mainFrame()->url().scheme() == QL1S("https"))
+ if(mainFrame()->url().scheme() == QL1S("https"))
{
SSLWidget *widget = new SSLWidget(mainFrame()->url(), _sslInfo, view());
- widget->showAt(pos);
+ widget->showAt(pos);
}
else
{
@@ -769,7 +769,7 @@ bool WebPage::hasSslValid()
{
bool v = true;
QList<QSslCertificate> certList = _sslInfo.certificateChain();
- Q_FOREACH(const QSslCertificate &cert, certList)
+ Q_FOREACH(const QSslCertificate & cert, certList)
{
v &= cert.isValid();
}
diff --git a/src/webpage.h b/src/webpage.h
index cc407016..b0081e6e 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -79,7 +79,7 @@ public:
{
return _suggestedFileName;
};
-
+
bool hasSslValid();
public Q_SLOTS: