1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Fixed coding style and added copyright

This commit is contained in:
nowrep 2013-09-10 15:45:51 +02:00
parent 655bb6ffeb
commit 4280dcd9fa
4 changed files with 52 additions and 23 deletions

View File

@ -228,18 +228,18 @@ bool BookmarksImportDialog::exportedOK()
if (html.error()) { if (html.error()) {
QMessageBox::critical(this, tr("Error!"), html.errorString()); QMessageBox::critical(this, tr("Error!"), html.errorString());
return false; return false;
} }
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
else if (m_browser == IE) { else if (m_browser == IE) {
IeImporter ie(this); IeImporter ie(this);
ie.setFile(ui->fileLine->text()); ie.setFile(ui->fileLine->text());
if(ie.openFile()) { if (ie.openFile()) {
m_exportedBookmarks = ie.exportBookmarks(); m_exportedBookmarks = ie.exportBookmarks();
} }
if(ie.error()) { if (ie.error()) {
QMessageBox::critical(this, tr("Error!"), ie.errorString()); QMessageBox::critical(this, tr("Error!"), ie.errorString());
} }
} }

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 Mattias Cibien <mattias@mattiascibien.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "ieimporter.h" #include "ieimporter.h"
#include "bookmarksimportdialog.h" #include "bookmarksimportdialog.h"
@ -5,14 +22,13 @@
#include <QDir> #include <QDir>
#include <QSettings> #include <QSettings>
IeImporter::IeImporter(QObject *parent) : IeImporter::IeImporter(QObject* parent)
QObject(parent) : QObject(parent)
, m_error(false) , m_error(false)
, m_errorString(BookmarksImportDialog::tr("No Error")) , m_errorString(BookmarksImportDialog::tr("No Error"))
{ {
} }
void IeImporter::setFile(const QString &path) void IeImporter::setFile(const QString &path)
{ {
m_path = path; m_path = path;
@ -21,19 +37,18 @@ void IeImporter::setFile(const QString &path)
bool IeImporter::openFile() bool IeImporter::openFile()
{ {
QDir dir(m_path); QDir dir(m_path);
if(!dir.exists()) { if (!dir.exists()) {
m_error = true; m_error = true;
m_errorString = BookmarksImportDialog::tr("Directory does not exists."); m_errorString = BookmarksImportDialog::tr("Directory does not exists.");
return false; return false;
} }
QStringList filters; QStringList filters;
filters << "*.url"; filters << "*.url";
urls = dir.entryInfoList(filters); urls = dir.entryInfoList(filters);
if(urls.isEmpty()) { if (urls.isEmpty()) {
m_error = true; m_error = true;
m_errorString = BookmarksImportDialog::tr("The directory does not contain any bookmarks."); m_errorString = BookmarksImportDialog::tr("The directory does not contain any bookmarks.");
return false; return false;
@ -42,7 +57,6 @@ bool IeImporter::openFile()
return true; return true;
} }
QVector<BookmarksModel::Bookmark> IeImporter::exportBookmarks() QVector<BookmarksModel::Bookmark> IeImporter::exportBookmarks()
{ {
QVector<BookmarksModel::Bookmark> bookmarks; QVector<BookmarksModel::Bookmark> bookmarks;

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 Mattias Cibien <mattias@mattiascibien.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef IEIMPORTER_H #ifndef IEIMPORTER_H
#define IEIMPORTER_H #define IEIMPORTER_H
@ -12,7 +29,7 @@ class IeImporter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit IeImporter(QObject *parent = 0); explicit IeImporter(QObject* parent = 0);
void setFile(const QString &path); void setFile(const QString &path);
bool openFile(); bool openFile();

View File

@ -433,12 +433,11 @@ void NetworkManager::ftpAuthentication(const QUrl &url, QAuthenticator* auth)
void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth) void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth)
{ {
QString userName = ""; QString userName;
QString password = ""; QString password;
QVector<PasswordEntry> psws = MainApplication::getInstance()->autoFill()->getFormData(QUrl(proxy.hostName())); QVector<PasswordEntry> psws = mApp->autoFill()->getFormData(QUrl(proxy.hostName()));
if(psws.isEmpty()) if (psws.isEmpty()) {
{
QDialog* dialog = new QDialog(); QDialog* dialog = new QDialog();
dialog->setWindowTitle(tr("Proxy authorisation required")); dialog->setWindowTitle(tr("Proxy authorisation required"));
@ -460,7 +459,7 @@ void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthentica
connect(box, SIGNAL(rejected()), dialog, SLOT(reject())); connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept())); connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
QCheckBox *rememberCheck = new QCheckBox("Remember username and password for this proxy.", dialog); QCheckBox* rememberCheck = new QCheckBox("Remember username and password for this proxy.", dialog);
label->setText(tr("A username and password are being requested by proxy %1. ").arg(proxy.hostName())); label->setText(tr("A username and password are being requested by proxy %1. ").arg(proxy.hostName()));
formLa->addRow(label); formLa->addRow(label);
@ -473,15 +472,14 @@ void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthentica
return; return;
} }
if(rememberCheck->isChecked()) { if (rememberCheck->isChecked()) {
MainApplication::getInstance()->autoFill()->addEntry(QUrl(proxy.hostName()), user->text(), pass->text()); mApp->autoFill()->addEntry(QUrl(proxy.hostName()), user->text(), pass->text());
} }
userName = user->text(); userName = user->text();
password = pass->text(); password = pass->text();
} }
else else {
{
userName = psws.at(0).username; userName = psws.at(0).username;
password = psws.at(0).password; password = psws.at(0).password;
} }