1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

[AdBlockDialog] Change AdBlockDialog to QWidget

Closes #1169
This commit is contained in:
nowrep 2014-01-25 20:06:08 +01:00
parent d5ea5342cf
commit 4a7423b02f
4 changed files with 13 additions and 38 deletions

View File

@ -21,6 +21,7 @@
#include "adblocktreewidget.h" #include "adblocktreewidget.h"
#include "adblockaddsubscriptiondialog.h" #include "adblockaddsubscriptiondialog.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qztools.h"
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
@ -28,7 +29,7 @@
#include <QInputDialog> #include <QInputDialog>
AdBlockDialog::AdBlockDialog(QWidget* parent) AdBlockDialog::AdBlockDialog(QWidget* parent)
: QDialog(parent) : QWidget(parent)
, m_manager(AdBlockManager::instance()) , m_manager(AdBlockManager::instance())
, m_currentTreeWidget(0) , m_currentTreeWidget(0)
, m_currentSubscription(0) , m_currentSubscription(0)
@ -37,6 +38,9 @@ AdBlockDialog::AdBlockDialog(QWidget* parent)
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setupUi(this); setupUi(this);
QzTools::centerWidgetOnScreen(this);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
tabWidget->setDocumentMode(false); tabWidget->setDocumentMode(false);
#endif #endif
@ -193,5 +197,5 @@ void AdBlockDialog::closeEvent(QCloseEvent* ev)
m_manager->setUseLimitedEasyList(useLimitedEasyList->isChecked()); m_manager->setUseLimitedEasyList(useLimitedEasyList->isChecked());
} }
QDialog::closeEvent(ev); QWidget::closeEvent(ev);
} }

View File

@ -18,7 +18,7 @@
#ifndef ADBLOCKDIALOG_H #ifndef ADBLOCKDIALOG_H
#define ADBLOCKDIALOG_H #define ADBLOCKDIALOG_H
#include <QDialog> #include <QWidget>
#include "qz_namespace.h" #include "qz_namespace.h"
#include "ui_adblockdialog.h" #include "ui_adblockdialog.h"
@ -28,7 +28,7 @@ class AdBlockTreeWidget;
class AdBlockManager; class AdBlockManager;
class AdBlockRule; class AdBlockRule;
class QT_QUPZILLA_EXPORT AdBlockDialog : public QDialog, public Ui_AdBlockDialog class QT_QUPZILLA_EXPORT AdBlockDialog : public QWidget, public Ui_AdBlockDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AdBlockDialog</class> <class>AdBlockDialog</class>
<widget class="QDialog" name="AdBlockDialog"> <widget class="QWidget" name="AdBlockDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -141,38 +141,6 @@
<include location="../data/icons.qrc"/> <include location="../data/icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AdBlockDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>75</x>
<y>495</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AdBlockDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>75</x>
<y>495</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>adblockCheckBox</sender> <sender>adblockCheckBox</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>

View File

@ -413,10 +413,13 @@ AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) con
AdBlockDialog* AdBlockManager::showDialog() AdBlockDialog* AdBlockManager::showDialog()
{ {
if (!m_adBlockDialog) { if (!m_adBlockDialog) {
m_adBlockDialog = new AdBlockDialog(mApp->getWindow()); m_adBlockDialog = new AdBlockDialog;
} }
m_adBlockDialog.data()->show(); m_adBlockDialog.data()->show();
m_adBlockDialog.data()->raise();
m_adBlockDialog.data()->activateWindow();
return m_adBlockDialog.data(); return m_adBlockDialog.data();
} }