Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show First 20 Lines • Show All 240 Lines • ▼ Show 20 Line(s) | 238 | { | |||
---|---|---|---|---|---|
241 | } else { | 241 | } else { | ||
242 | m_openArgs.metaData().remove(QStringLiteral("showExtractDialog")); | 242 | m_openArgs.metaData().remove(QStringLiteral("showExtractDialog")); | ||
243 | } | 243 | } | ||
244 | } | 244 | } | ||
245 | 245 | | |||
246 | void MainWindow::closeEvent(QCloseEvent *event) | 246 | void MainWindow::closeEvent(QCloseEvent *event) | ||
247 | { | 247 | { | ||
248 | // Preview windows don't have a parent, so we need to manually close them. | 248 | // Preview windows don't have a parent, so we need to manually close them. | ||
249 | foreach (QWidget *widget, qApp->topLevelWidgets()) { | 249 | const auto topLevelWidgets = qApp->topLevelWidgets(); | ||
250 | for (QWidget *widget : topLevelWidgets) { | ||||
250 | if (widget->isVisible()) { | 251 | if (widget->isVisible()) { | ||
251 | widget->close(); | 252 | widget->close(); | ||
252 | } | 253 | } | ||
253 | } | 254 | } | ||
254 | 255 | | |||
255 | KParts::MainWindow::closeEvent(event); | 256 | KParts::MainWindow::closeEvent(event); | ||
256 | } | 257 | } | ||
257 | 258 | | |||
258 | void MainWindow::quit() | 259 | void MainWindow::quit() | ||
259 | { | 260 | { | ||
260 | close(); | 261 | close(); | ||
261 | } | 262 | } | ||
262 | 263 | | |||
263 | void MainWindow::showSettings() | 264 | void MainWindow::showSettings() | ||
264 | { | 265 | { | ||
265 | if (KConfigDialog::showDialog(QStringLiteral("settings"))) { | 266 | if (KConfigDialog::showDialog(QStringLiteral("settings"))) { | ||
266 | return; | 267 | return; | ||
267 | } | 268 | } | ||
268 | 269 | | |||
269 | Interface *iface = qobject_cast<Interface*>(m_part); | 270 | Interface *iface = qobject_cast<Interface*>(m_part); | ||
270 | Q_ASSERT(iface); | 271 | Q_ASSERT(iface); | ||
271 | 272 | | |||
272 | auto dialog = new Kerfuffle::SettingsDialog(this, QStringLiteral("settings"), iface->config()); | 273 | auto dialog = new Kerfuffle::SettingsDialog(this, QStringLiteral("settings"), iface->config()); | ||
273 | 274 | | |||
274 | foreach (Kerfuffle::SettingsPage *page, iface->settingsPages(this)) { | 275 | const auto pages = iface->settingsPages(this); | ||
276 | for (Kerfuffle::SettingsPage *page : pages) { | ||||
275 | dialog->addPage(page, page->name(), page->iconName()); | 277 | dialog->addPage(page, page->name(), page->iconName()); | ||
276 | connect(dialog, &KConfigDialog::settingsChanged, page, &Kerfuffle::SettingsPage::slotSettingsChanged); | 278 | connect(dialog, &KConfigDialog::settingsChanged, page, &Kerfuffle::SettingsPage::slotSettingsChanged); | ||
277 | connect(dialog, &Kerfuffle::SettingsDialog::defaultsButtonClicked, page, &Kerfuffle::SettingsPage::slotDefaultsButtonClicked); | 279 | connect(dialog, &Kerfuffle::SettingsDialog::defaultsButtonClicked, page, &Kerfuffle::SettingsPage::slotDefaultsButtonClicked); | ||
278 | } | 280 | } | ||
279 | // Hide the icons list if only one page has been added. | 281 | // Hide the icons list if only one page has been added. | ||
280 | dialog->setFaceType(KPageDialog::Auto); | 282 | dialog->setFaceType(KPageDialog::Auto); | ||
281 | dialog->setModal(true); | 283 | dialog->setModal(true); | ||
282 | 284 | | |||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |