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

Use open() instead of exec() in all dialogs

Avoid blocking exec().

Closes #1515
This commit is contained in:
David Rosca 2014-11-07 18:08:12 +01:00
parent 05c1fec5c6
commit 478b5ddb84
24 changed files with 71 additions and 50 deletions

View File

@ -1180,6 +1180,7 @@ bool BrowserWindow::event(QEvent* event)
void BrowserWindow::printPage(QWebFrame* frame)
{
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->resize(800, 750);
dialog->printer()->setCreator(tr("QupZilla %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
@ -1194,15 +1195,13 @@ void BrowserWindow::printPage(QWebFrame* frame)
connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*)));
}
dialog->exec();
dialog->deleteLater();
dialog->open();
}
void BrowserWindow::savePageScreen()
{
PageScreen* p = new PageScreen(weView(), this);
p->show();
PageScreen* dialog = new PageScreen(weView(), this);
dialog->show();
}
void BrowserWindow::resizeEvent(QResizeEvent* event)

View File

@ -112,8 +112,8 @@ QAction* MainMenu::action(const QString &name) const
void MainMenu::showAboutDialog()
{
AboutDialog about(m_window);
about.exec();
AboutDialog* dialog = new AboutDialog(m_window);
dialog->open();
}
void MainMenu::showPreferences()
@ -320,7 +320,6 @@ void MainMenu::showDownloadManager()
void MainMenu::showCookieManager()
{
CookieManager* m = new CookieManager(0);
m->setAttribute(Qt::WA_DeleteOnClose);
m->show();
m->raise();
}
@ -344,8 +343,8 @@ void MainMenu::showWebInspector()
void MainMenu::showClearRecentHistoryDialog()
{
ClearPrivateData clear(m_window);
clear.exec();
ClearPrivateData* dialog = new ClearPrivateData(m_window);
dialog->open();
}
void MainMenu::aboutQt()

View File

@ -37,8 +37,12 @@ CookieManager::CookieManager(QWidget* parent)
, ui(new Ui::CookieManager)
, m_refreshCookieJar(true)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
QzTools::centerWidgetOnScreen(this);
if (!parent)
QzTools::centerWidgetOnScreen(this);
if (isRightToLeft()) {
ui->cookieTree->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter);

View File

@ -247,7 +247,7 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
#endif
dialog->setSidebarUrls(urls);
dialog->show();
dialog->open();
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(fileNameChoosed(QString)));
}
}

View File

@ -123,14 +123,12 @@ void WebSearchBar::addSuggestions(const QStringList &list)
void WebSearchBar::openSearchEnginesDialog()
{
if (m_searchDialog) {
m_searchDialog.data()->raise();
m_searchDialog.data()->activateWindow();
return;
}
if (!m_searchDialog)
m_searchDialog = new SearchEnginesDialog(this);
m_searchDialog = new SearchEnginesDialog(this);
m_searchDialog.data()->show();
m_searchDialog->open();
m_searchDialog->raise();
m_searchDialog->activateWindow();
}
void WebSearchBar::enableSearchSuggestions(bool enable)

View File

@ -27,6 +27,7 @@ SearchEnginesDialog::SearchEnginesDialog(QWidget* parent)
, m_manager(mApp->searchEnginesManager())
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
connect(ui->add, SIGNAL(clicked()), this, SLOT(addEngine()));

View File

@ -33,6 +33,8 @@ AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent),
ui(new Ui::AboutDialog)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
#ifdef Q_OS_WIN
if (QtWin::isCompositionEnabled()) {

View File

@ -103,13 +103,13 @@ void BrowsingLibrary::search()
void BrowsingLibrary::importBookmarks()
{
BookmarksImportDialog* d = new BookmarksImportDialog(this);
d->show();
d->open();
}
void BrowsingLibrary::exportBookmarks()
{
BookmarksExportDialog* d = new BookmarksExportDialog(this);
d->show();
d->open();
}
void BrowsingLibrary::showHistory(BrowserWindow* window)

View File

@ -45,6 +45,8 @@ ClearPrivateData::ClearPrivateData(QWidget* parent)
: QDialog(parent)
, ui(new Ui::ClearPrivateData)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->buttonBox->setFocus();
connect(ui->history, SIGNAL(clicked(bool)), this, SLOT(historyClicked(bool)));
@ -194,21 +196,21 @@ void ClearPrivateData::optimizeDb()
void ClearPrivateData::showCookieManager()
{
CookieManager m(this);
m.exec();
CookieManager* dialog = new CookieManager(this);
dialog->open();
}
void ClearPrivateData::showNotifsPerms()
{
HTML5PermissionsDialog dialog(this);
dialog.exec();
HTML5PermissionsDialog* dialog = new HTML5PermissionsDialog(this);
dialog->open();
}
void ClearPrivateData::showGeolocPerms()
{
HTML5PermissionsDialog dialog(this);
dialog.setCurrentTab(1);
dialog.exec();
HTML5PermissionsDialog* dialog = new HTML5PermissionsDialog(this);
dialog->setCurrentTab(1);
dialog->open();
}
static const int stateDataVersion = 0x0001;

View File

@ -46,6 +46,7 @@ PageScreen::PageScreen(WebView* view, QWidget* parent)
, m_imageScaling(0)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
m_formats.append(QSL("PNG"));

View File

@ -79,6 +79,8 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
: QDialog(parent)
, ui(new Ui::AcceptLanguage)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->listWidget->setLayoutDirection(Qt::LeftToRight);

View File

@ -28,6 +28,8 @@ JsOptions::JsOptions(QWidget* parent)
: QDialog(parent)
, ui(new Ui::JsOptions)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
Settings settings;

View File

@ -649,8 +649,8 @@ void Preferences::chooseExternalDownloadManager()
void Preferences::openUserAgentManager()
{
UserAgentDialog dialog(this);
dialog.exec();
UserAgentDialog* dialog = new UserAgentDialog(this);
dialog->open();
}
void Preferences::downLocChanged(bool state)
@ -690,38 +690,38 @@ void Preferences::allowHtml5storageChanged(bool stat)
void Preferences::showCookieManager()
{
CookieManager m(this);
m.exec();
CookieManager* dialog = new CookieManager(this);
dialog->open();
}
void Preferences::showHtml5Permissions()
{
HTML5PermissionsDialog dialog(this);
dialog.exec();
HTML5PermissionsDialog* dialog = new HTML5PermissionsDialog(this);
dialog->open();
}
void Preferences::openSslManager()
{
SSLManager* m = new SSLManager(this);
m->show();
m->open();
}
void Preferences::openJsOptions()
{
JsOptions options(this);
options.exec();
JsOptions* dialog = new JsOptions(this);
dialog->open();
}
void Preferences::openSearchEnginesManager()
{
SearchEnginesDialog* dialog = new SearchEnginesDialog(this);
dialog->exec();
dialog->open();
}
void Preferences::showAcceptLanguage()
{
AcceptLanguage a(this);
a.exec();
AcceptLanguage* dialog = new AcceptLanguage(this);
dialog->open();
}
void Preferences::newTabChanged(int value)

View File

@ -30,6 +30,7 @@ SSLManager::SSLManager(QWidget* parent)
, ui(new Ui::SSLManager)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->caList->setLayoutDirection(Qt::LeftToRight);
ui->localList->setLayoutDirection(Qt::LeftToRight);

View File

@ -31,6 +31,8 @@ UserAgentDialog::UserAgentDialog(QWidget* parent)
, ui(new Ui::UserAgentDialog)
, m_manager(mApp->userAgentManager())
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->globalComboBox->setLayoutDirection(Qt::LeftToRight);
ui->table->setLayoutDirection(Qt::LeftToRight);

View File

@ -25,6 +25,8 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::HTML5PermissionsDialog)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
loadSettings();

View File

@ -806,6 +806,7 @@ void WebView::showClickedFrameSource()
void WebView::printPage(QWebFrame* frame)
{
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->resize(800, 750);
if (!frame) {
@ -815,8 +816,7 @@ void WebView::printPage(QWebFrame* frame)
connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*)));
}
dialog->exec();
dialog->deleteLater();
dialog->open();
}
QUrl WebView::lastUrl()

View File

@ -61,8 +61,8 @@ void GM_Settings::showItemInfo(QListWidgetItem* item)
return;
}
GM_SettingsScriptInfo info(script, this);
info.exec();
GM_SettingsScriptInfo* dialog = new GM_SettingsScriptInfo(script, this);
dialog->open();
}
void GM_Settings::removeItem(QListWidgetItem* item)

View File

@ -26,6 +26,8 @@ GM_SettingsScriptInfo::GM_SettingsScriptInfo(GM_Script* script, QWidget* parent)
, ui(new Ui::GM_SettingsScriptInfo)
, m_script(script)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
loadScript();

View File

@ -96,6 +96,6 @@ void SBI_JavaScriptIcon::toggleJavaScript()
void SBI_JavaScriptIcon::openJavaScriptSettings()
{
JsOptions dialog(m_window);
dialog.exec();
JsOptions* dialog = new JsOptions(m_window);
dialog->open();
}

View File

@ -53,8 +53,8 @@ void SBI_NetworkIcon::onlineStateChanged(bool online)
void SBI_NetworkIcon::showDialog()
{
SBI_NetworkIconDialog dialog(m_window);
dialog.exec();
SBI_NetworkIconDialog* dialog = new SBI_NetworkIconDialog(m_window);
dialog->open();
}
void SBI_NetworkIcon::showMenu(const QPoint &pos)

View File

@ -27,6 +27,8 @@ SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SBI_NetworkIconDialog)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->addButton->setIcon(QIcon::fromTheme("document-new", QIcon(":sbi/data/add.png")));

View File

@ -24,6 +24,8 @@ SBI_SettingsDialog::SBI_SettingsDialog(SBI_IconsManager* manager, QWidget* paren
, ui(new Ui::SBI_SettingsDialog)
, m_manager(manager)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->showImagesIcon->setChecked(m_manager->showImagesIcon());

View File

@ -85,8 +85,8 @@ QTranslator* StatusBarIconsPlugin::getTranslator(const QString &locale)
void StatusBarIconsPlugin::showSettings(QWidget* parent)
{
SBI_SettingsDialog dialog(m_manager, parent);
dialog.exec();
SBI_SettingsDialog* dialog = new SBI_SettingsDialog(m_manager, parent);
dialog->open();
}
#if QT_VERSION < 0x050000