1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fixed fetching of AdBlock EasyList

- also fixed showing 1*1px widget when clicking on site info icon on
empty or qupzilla: page
 - added global Ctrl (+ Shift) + Tab for navigating through tabs
This commit is contained in:
nowrep 2011-11-07 19:56:53 +01:00
parent 8e8e884968
commit f8feb86351
7 changed files with 36 additions and 13 deletions

View File

@ -20,3 +20,4 @@ Francesco Marinucci <framarinucci@gmail.com> (Italy)
Special thanks: Special thanks:
Jonathan Hooverman <jonathan.hooverman@gmail.com> (language consultations) Jonathan Hooverman <jonathan.hooverman@gmail.com> (language consultations)
Peter Vacula <pvacula1989@gmail.com> (for a big support in the beginnigs)

View File

@ -117,12 +117,12 @@ void AdBlockSubscription::rulesDownloaded()
QString fileName = mApp->getActiveProfilPath() + "adblocklist.txt"; QString fileName = mApp->getActiveProfilPath() + "adblocklist.txt";
QFile file(fileName); QFile file(fileName);
if (!file.open(QFile::WriteOnly)) { if (!file.open(QFile::ReadWrite | QFile::Truncate)) {
qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for writing:" << fileName; qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for writing:" << fileName;
return; return;
} }
response = response.left(response.indexOf("!-----------------General element hiding rules-----------------!")); response = response.left(response.indexOf("General element hiding rules"));
bool customRules = false; bool customRules = false;
foreach(const AdBlockRule & rule, allRules()) { foreach(const AdBlockRule & rule, allRules()) {
@ -149,15 +149,17 @@ void AdBlockSubscription::saveRules()
QString fileName = mApp->getActiveProfilPath() + "adblocklist.txt"; QString fileName = mApp->getActiveProfilPath() + "adblocklist.txt";
QFile file(fileName); QFile file(fileName);
if (!file.open(QFile::ReadWrite | QIODevice::Truncate)) { if (!file.open(QFile::ReadWrite | QFile::Truncate)) {
qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for writing:" << fileName; qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for writing:" << fileName;
return; return;
} }
QTextStream textStream(&file); QTextStream textStream(&file);
textStream << "[Adblock Plus 1.1.1]" << endl; textStream << "[Adblock Plus 1.1.1]" << endl;
foreach(const AdBlockRule & rule, m_rules)
textStream << rule.filter() << endl; foreach(const AdBlockRule & rule, m_rules) {
textStream << rule.filter() << endl;
}
} }
const AdBlockRule* AdBlockSubscription::allow(const QString &urlString) const const AdBlockRule* AdBlockSubscription::allow(const QString &urlString) const

View File

@ -1248,6 +1248,16 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
showPreferences(); showPreferences();
event->accept(); event->accept();
break; break;
case Qt::Key_Tab:
if (event->modifiers() == Qt::ControlModifier) {
m_tabWidget->createKeyPressEvent(event);
}
break;
case Qt::Key_Backtab:
if (event->modifiers() == (Qt::ControlModifier + Qt::ShiftModifier)) {
m_tabWidget->createKeyPressEvent(event);
}
break;
default: default:
QMainWindow::keyPressEvent(event); QMainWindow::keyPressEvent(event);

View File

@ -158,7 +158,8 @@ void LocationBar::hideGoButton()
void LocationBar::showPopup() void LocationBar::showPopup()
{ {
//TODO: Fix to next version // TODO: Fix to next version
// return; // return;
// emit textEdited(""); // emit textEdited("");
// m_locationCompleter->popup()->showNormal(); // m_locationCompleter->popup()->showNormal();
@ -166,6 +167,12 @@ void LocationBar::showPopup()
void LocationBar::showSiteInfo() void LocationBar::showSiteInfo()
{ {
QUrl url = p_QupZilla->weView()->url();
if (url.isEmpty() || url.scheme() == "qupzilla") {
return;
}
SiteInfoWidget* info = new SiteInfoWidget(p_QupZilla); SiteInfoWidget* info = new SiteInfoWidget(p_QupZilla);
info->showAt(this); info->showAt(this);
} }

View File

@ -25,15 +25,12 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) :
, ui(new Ui::SiteInfoWidget) , ui(new Ui::SiteInfoWidget)
, p_QupZilla(mainClass) , p_QupZilla(mainClass)
{ {
WebView* view = p_QupZilla->weView();
QUrl url = view->url();
if (url.isEmpty() || url.scheme() == "qupzilla") {
return;
}
this->setAttribute(Qt::WA_DeleteOnClose); this->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this); ui->setupUi(this);
WebView* view = p_QupZilla->weView();
QUrl url = view->url();
if (view->webPage()->sslCertificate().isValid()) { if (view->webPage()->sslCertificate().isValid()) {
ui->secureLabel->setText(tr("Your connection to this site is <b>secured</b>.")); ui->secureLabel->setText(tr("Your connection to this site is <b>secured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png")); ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png"));

View File

@ -166,6 +166,11 @@ void TabWidget::resizeEvent(QResizeEvent* e)
QTabWidget::resizeEvent(e); QTabWidget::resizeEvent(e);
} }
void TabWidget::createKeyPressEvent(QKeyEvent *event)
{
QTabWidget::keyPressEvent(event);
}
void TabWidget::showButtons() void TabWidget::showButtons()
{ {
m_buttonListTabs->show(); m_buttonListTabs->show();

View File

@ -37,7 +37,6 @@ class TabListButton;
class NewTabButton; class NewTabButton;
class ClosedTabsManager; class ClosedTabsManager;
class ToolButton; class ToolButton;
class TabWidget : public QTabWidget class TabWidget : public QTabWidget
{ {
Q_OBJECT Q_OBJECT
@ -62,6 +61,8 @@ public:
ToolButton* buttonListTabs() { return m_buttonListTabs; } ToolButton* buttonListTabs() { return m_buttonListTabs; }
ToolButton* buttonAddTab() { return m_buttonAddTab; } ToolButton* buttonAddTab() { return m_buttonAddTab; }
void createKeyPressEvent(QKeyEvent* event);
signals: signals:
void pinnedTabClosed(); void pinnedTabClosed();
void pinnedTabAdded(); void pinnedTabAdded();