File indexing completed on 2024-12-08 10:56:46
0001 /* 0002 SPDX-FileCopyrightText: 2017 Smith AR <audoban@openmailbox.org> 0003 SPDX-FileCopyrightText: 2017 Michail Vourlakos <mvourlakos@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #include "settingsdialog.h" 0009 0010 // local 0011 #include "ui_settingsdialog.h" 0012 #include "../universalsettings.h" 0013 #include "../generic/generictools.h" 0014 #include "../screensdialog/screensdialog.h" 0015 #include "../../lattecorona.h" 0016 #include "../../screenpool.h" 0017 #include "../../data/layoutdata.h" 0018 #include "../../layout/centrallayout.h" 0019 #include "../../layouts/importer.h" 0020 #include "../../layouts/manager.h" 0021 #include "../../layouts/synchronizer.h" 0022 #include "../../plasma/extended/theme.h" 0023 0024 // Qt 0025 #include <QButtonGroup> 0026 #include <QDir> 0027 #include <QFileDialog> 0028 #include <QMenuBar> 0029 #include <QMessageBox> 0030 #include <QMimeData> 0031 0032 // KDE 0033 #include <KLocalizedString> 0034 #include <KMessageBox> 0035 #include <KWindowSystem> 0036 #include <KIO/OpenFileManagerWindowJob> 0037 0038 0039 namespace Latte { 0040 namespace Settings { 0041 namespace Dialog { 0042 0043 SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona) 0044 : GenericDialog(parent), 0045 m_ui(new Ui::SettingsDialog), 0046 m_corona(corona), 0047 m_storage(KConfigGroup(KSharedConfig::openConfig(),"LatteSettingsDialog")) 0048 { 0049 setAttribute(Qt::WA_DeleteOnClose, true); 0050 setAcceptDrops(true); 0051 m_ui->setupUi(this); 0052 0053 //setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); 0054 0055 //! load window size 0056 loadConfig(); 0057 0058 0059 connect(m_ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, 0060 this, &SettingsDialog::apply); 0061 connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked, 0062 this, &SettingsDialog::reset); 0063 connect(m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, 0064 this, &SettingsDialog::restoreDefaults); 0065 0066 //! Global Menu 0067 initGlobalMenu(); 0068 0069 m_tabLayoutsHandler = new Settings::Handler::TabLayouts(this); 0070 m_tabPreferencesHandler = new Settings::Handler::TabPreferences(this); 0071 0072 //! load settings after handlers in order to make migration process correctly 0073 //! and remove deprecated values totally from universalsettings 0074 loadConfig(); 0075 resize(m_windowSize); 0076 0077 m_ui->buttonBox->button(QDialogButtonBox::Apply)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); 0078 m_ui->buttonBox->button(QDialogButtonBox::Reset)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); 0079 0080 //! SIGNALS 0081 connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SettingsDialog::onCurrentTabChanged); 0082 0083 connect(m_tabLayoutsHandler, &Settings::Handler::TabLayouts::dataChanged, this, &SettingsDialog::updateApplyButtonsState); 0084 0085 connect(m_tabPreferencesHandler, &Settings::Handler::TabPreferences::dataChanged, this, &SettingsDialog::updateApplyButtonsState); 0086 connect(m_tabPreferencesHandler, &Settings::Handler::TabPreferences::borderlessMaximizedChanged, this, [&]() { 0087 bool noBordersForMaximized = m_ui->noBordersForMaximizedChkBox->isChecked(); 0088 0089 if (noBordersForMaximized) { 0090 m_ui->layoutsView->setColumnHidden(Settings::Model::Layouts::BORDERSCOLUMN, false); 0091 } else { 0092 m_ui->layoutsView->setColumnHidden(Settings::Model::Layouts::BORDERSCOLUMN, true); 0093 } 0094 }); 0095 0096 //! timers 0097 m_activitiesTimer.setSingleShot(true); 0098 m_activitiesTimer.setInterval(750); 0099 connect(&m_activitiesTimer, &QTimer::timeout, this, &SettingsDialog::updateWindowActivities); 0100 m_activitiesTimer.start(); 0101 0102 updateApplyButtonsState(); 0103 } 0104 0105 SettingsDialog::~SettingsDialog() 0106 { 0107 qDebug() << Q_FUNC_INFO; 0108 0109 setStoredWindowSize(size()); 0110 saveConfig(); 0111 } 0112 0113 void SettingsDialog::initGlobalMenu() 0114 { 0115 m_globalMenuBar = new QMenuBar(this); 0116 0117 layout()->setMenuBar(m_globalMenuBar); 0118 0119 initFileMenu(); 0120 initHelpMenu(); 0121 } 0122 0123 void SettingsDialog::initFileMenu() 0124 { 0125 if (!m_fileMenu) { 0126 m_fileMenu = new QMenu(i18n("File"), m_globalMenuBar); 0127 m_globalMenuBar->addMenu(m_fileMenu); 0128 } 0129 0130 m_importFullAction = m_fileMenu->addAction(i18n("Import Configuration...")); 0131 m_importFullAction->setIcon(QIcon::fromTheme("document-import")); 0132 m_importFullAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_I)); 0133 m_importFullAction->setToolTip(i18n("Import your full configuration from previous backup")); 0134 connect(m_importFullAction, &QAction::triggered, this, &SettingsDialog::importFullConfiguration); 0135 0136 m_exportFullAction = m_fileMenu->addAction(i18n("Export Configuration...")); 0137 m_exportFullAction->setIcon(QIcon::fromTheme("document-export")); 0138 m_exportFullAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_E)); 0139 m_exportFullAction->setToolTip(i18n("Export your full configuration to create backup")); 0140 connect(m_exportFullAction, &QAction::triggered, this, &SettingsDialog::exportFullConfiguration); 0141 0142 m_fileMenu->addSeparator(); 0143 0144 QAction *screensAction = m_fileMenu->addAction(i18n("&Screens...")); 0145 screensAction->setIcon(QIcon::fromTheme("document-properties")); 0146 screensAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S)); 0147 screensAction->setToolTip(i18n("Examing your screens and remove deprecated references")); 0148 connect(screensAction, &QAction::triggered, this, &SettingsDialog::showScreensDialog); 0149 0150 QAction *quitAction = m_fileMenu->addAction(i18n("&Quit Latte")); 0151 quitAction->setIcon(QIcon::fromTheme("application-exit")); 0152 quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); 0153 0154 0155 //! triggers 0156 connect(quitAction, &QAction::triggered, this, [&]() { 0157 bool accepted = saveChanges(); 0158 0159 if (accepted) { 0160 close(); 0161 m_corona->quitApplication(); 0162 } 0163 }); 0164 0165 } 0166 0167 void SettingsDialog::initHelpMenu() 0168 { 0169 if (!m_helpMenu) { 0170 m_helpMenu = new KHelpMenu(m_globalMenuBar); 0171 m_globalMenuBar->addMenu(m_helpMenu->menu()); 0172 } 0173 0174 //! hide help menu actions that are not used 0175 m_helpMenu->action(KHelpMenu::menuHelpContents)->setVisible(false); 0176 m_helpMenu->action(KHelpMenu::menuWhatsThis)->setVisible(false); 0177 } 0178 0179 Latte::Corona *SettingsDialog::corona() const 0180 { 0181 return m_corona; 0182 } 0183 0184 Ui::SettingsDialog *SettingsDialog::ui() const 0185 { 0186 return m_ui; 0187 } 0188 0189 QSize SettingsDialog::storedWindowSize() const 0190 { 0191 return m_windowSize; 0192 } 0193 0194 void SettingsDialog::setStoredWindowSize(const QSize &size) 0195 { 0196 if (m_windowSize == size) { 0197 return; 0198 } 0199 0200 m_windowSize = size; 0201 } 0202 0203 QSize SettingsDialog::downloadWindowSize() const 0204 { 0205 return m_downloadWindowSize; 0206 } 0207 0208 void SettingsDialog::setDownloadWindowSize(const QSize &size) 0209 { 0210 if (m_downloadWindowSize == size) { 0211 return; 0212 } 0213 0214 m_downloadWindowSize = size; 0215 } 0216 0217 0218 QMenuBar *SettingsDialog::appMenuBar() const 0219 { 0220 return m_globalMenuBar; 0221 } 0222 0223 QMenu *SettingsDialog::fileMenu() const 0224 { 0225 return m_fileMenu; 0226 } 0227 0228 QMenu *SettingsDialog::helpMenu() const 0229 { 0230 return m_helpMenu->menu(); 0231 } 0232 0233 ConfigurationPage SettingsDialog::currentPage() 0234 { 0235 ConfigurationPage cPage= static_cast<ConfigurationPage>(m_ui->tabWidget->currentIndex()); 0236 0237 return cPage; 0238 } 0239 0240 void SettingsDialog::toggleCurrentPage() 0241 { 0242 if (m_ui->tabWidget->currentIndex() == 0) { 0243 m_ui->tabWidget->setCurrentIndex(1); 0244 } else { 0245 m_ui->tabWidget->setCurrentIndex(0); 0246 } 0247 } 0248 0249 void SettingsDialog::setCurrentPage(int page) 0250 { 0251 m_ui->tabWidget->setCurrentIndex(page); 0252 } 0253 0254 void SettingsDialog::importFullConfiguration() 0255 { 0256 qDebug() << Q_FUNC_INFO; 0257 0258 QFileDialog *importFileDialog = new QFileDialog(this, i18nc("import full configuration", "Import Full Configuration") 0259 , QDir::homePath() 0260 , QStringLiteral("latterc")); 0261 0262 importFileDialog->setWindowIcon(QIcon::fromTheme("document-import")); 0263 importFileDialog->setLabelText(QFileDialog::Accept, i18nc("import full configuration","Import")); 0264 importFileDialog->setFileMode(QFileDialog::AnyFile); 0265 importFileDialog->setAcceptMode(QFileDialog::AcceptOpen); 0266 importFileDialog->setDefaultSuffix("latterc"); 0267 0268 QStringList filters; 0269 filters << QString(i18nc("import full configuration", "Latte Dock Full Configuration file") + "(*.latterc)"); 0270 importFileDialog->setNameFilters(filters); 0271 0272 connect(importFileDialog, &QFileDialog::finished, importFileDialog, &QFileDialog::deleteLater); 0273 0274 connect(importFileDialog, &QFileDialog::fileSelected, this, [&](const QString & file) { 0275 Latte::Layouts::Importer::LatteFileVersion version = Latte::Layouts::Importer::fileVersion(file); 0276 qDebug() << "VERSION :::: " << version; 0277 0278 if (version == Latte::Layouts::Importer::ConfigVersion2 0279 || version == Latte::Layouts::Importer::ConfigVersion1) { 0280 auto msg = new QMessageBox(this); 0281 msg->setIcon(QMessageBox::Warning); 0282 msg->setWindowTitle(i18n("Import: Full Configuration File")); 0283 msg->setText(i18n("You are importing full configuration file. Be careful, all <b>current settings and layouts will be lost</b>. It is advised to <b>take backup</b> first!<br>")); 0284 msg->setStandardButtons(QMessageBox::Cancel); 0285 0286 QPushButton *takeBackupBtn = new QPushButton(msg); 0287 takeBackupBtn->setText(i18nc("export full configuration", "Take Backup...")); 0288 takeBackupBtn->setIcon(QIcon::fromTheme("document-export")); 0289 takeBackupBtn->setToolTip(i18n("Export your full configuration in order to take backup")); 0290 0291 QPushButton *importBtn = new QPushButton(msg); 0292 importBtn->setText(i18nc("import full configuration", "Import")); 0293 importBtn->setIcon(QIcon::fromTheme("document-import")); 0294 importBtn->setToolTip(i18n("Import your full configuration and drop all your current settings and layouts")); 0295 0296 msg->addButton(takeBackupBtn, QMessageBox::AcceptRole); 0297 msg->addButton(importBtn, QMessageBox::AcceptRole); 0298 msg->setDefaultButton(takeBackupBtn); 0299 0300 connect(msg, &QFileDialog::finished, msg, &QFileDialog::deleteLater); 0301 0302 connect(importBtn, &QPushButton::clicked, this, [&, file](bool check) { 0303 m_corona->importFullConfiguration(file); 0304 }); 0305 0306 connect(takeBackupBtn, &QPushButton::clicked, this, [&](bool check) { 0307 exportFullConfiguration(); 0308 }); 0309 0310 msg->open(); 0311 } 0312 }); 0313 0314 importFileDialog->open(); 0315 } 0316 0317 void SettingsDialog::exportFullConfiguration() 0318 { 0319 //! Update ALL active original layouts before exporting, 0320 m_corona->layoutsManager()->synchronizer()->syncActiveLayoutsToOriginalFiles(); 0321 0322 QFileDialog *exportFileDialog = new QFileDialog(this, i18n("Export Full Configuration"), 0323 QDir::homePath(), 0324 QStringLiteral("latterc")); 0325 0326 exportFileDialog->setLabelText(QFileDialog::Accept, i18nc("export full configuration","Export")); 0327 exportFileDialog->setFileMode(QFileDialog::AnyFile); 0328 exportFileDialog->setAcceptMode(QFileDialog::AcceptSave); 0329 exportFileDialog->setDefaultSuffix("latterc"); 0330 0331 QStringList filters; 0332 QString filter2(i18nc("export full configuration", "Latte Dock Full Configuration file v0.2") + "(*.latterc)"); 0333 0334 filters << filter2; 0335 0336 exportFileDialog->setNameFilters(filters); 0337 0338 connect(exportFileDialog, &QFileDialog::finished, exportFileDialog, &QFileDialog::deleteLater); 0339 0340 connect(exportFileDialog, &QFileDialog::fileSelected, this, [&](const QString & file) { 0341 auto showExportConfigurationError = [this]() { 0342 showInlineMessage(i18n("Full configuration export <b>failed</b>..."), 0343 KMessageWidget::Error, 0344 true); 0345 }; 0346 0347 if (m_corona->layoutsManager()->importer()->exportFullConfiguration(file)) { 0348 QAction *openUrlAction = new QAction(i18n("Open Location..."), this); 0349 openUrlAction->setIcon(QIcon::fromTheme("document-open")); 0350 openUrlAction->setData(file); 0351 QList<QAction *> actions; 0352 actions << openUrlAction; 0353 0354 connect(openUrlAction, &QAction::triggered, this, [&, openUrlAction]() { 0355 QString file = openUrlAction->data().toString(); 0356 0357 if (!file.isEmpty()) { 0358 KIO::highlightInFileManager({file}); 0359 } 0360 }); 0361 0362 showInlineMessage(i18n("Full configuration export succeeded..."), 0363 KMessageWidget::Positive, 0364 false, 0365 actions); 0366 } else { 0367 showExportConfigurationError(); 0368 } 0369 }); 0370 0371 exportFileDialog->open(); 0372 0373 QDate currentDate = QDate::currentDate(); 0374 QString proposedName = QStringLiteral("Latte Dock (") + currentDate.toString("yyyy-MM-dd")+")"; 0375 0376 exportFileDialog->selectFile(proposedName); 0377 } 0378 0379 void SettingsDialog::showScreensDialog() 0380 { 0381 auto screensDlg = new Settings::Dialog::ScreensDialog(this, m_tabLayoutsHandler->layoutsController()); 0382 screensDlg->exec(); 0383 } 0384 0385 void SettingsDialog::accept() 0386 { 0387 //! disable accept totally in order to avoid closing with ENTER key with no real reason 0388 qDebug() << Q_FUNC_INFO; 0389 } 0390 0391 void SettingsDialog::reject() 0392 { 0393 bool accepted = saveChanges(); 0394 0395 if (accepted) { 0396 QDialog::reject(); 0397 } 0398 } 0399 0400 void SettingsDialog::apply() 0401 { 0402 qDebug() << Q_FUNC_INFO; 0403 0404 if (!m_ui->buttonBox->button(QDialogButtonBox::Apply)->isEnabled()) { 0405 return; 0406 } 0407 0408 save(); 0409 } 0410 0411 void SettingsDialog::reset() 0412 { 0413 qDebug() << Q_FUNC_INFO; 0414 0415 if (!m_ui->buttonBox->button(QDialogButtonBox::Reset)->isEnabled()) { 0416 return; 0417 } 0418 0419 if (m_ui->tabWidget->currentIndex() == LayoutPage) { 0420 m_tabLayoutsHandler->reset(); 0421 } else if (m_ui->tabWidget->currentIndex() == PreferencesPage) { 0422 m_tabPreferencesHandler->reset(); 0423 } 0424 } 0425 0426 void SettingsDialog::restoreDefaults() 0427 { 0428 qDebug() << Q_FUNC_INFO; 0429 0430 if (m_ui->tabWidget->currentIndex() == LayoutPage) { 0431 //! do nothing, should be disabled 0432 } else if (m_ui->tabWidget->currentIndex() == PreferencesPage) { 0433 m_tabPreferencesHandler->resetDefaults(); 0434 } 0435 } 0436 0437 void SettingsDialog::updateApplyButtonsState() 0438 { 0439 bool changed{false}; 0440 0441 //! Ok, Apply Buttons 0442 0443 if ((currentPage() == LayoutPage && m_tabLayoutsHandler->hasChangedData()) 0444 ||(currentPage() == PreferencesPage && m_tabPreferencesHandler->hasChangedData())) { 0445 changed = true; 0446 } 0447 0448 if (changed) { 0449 m_ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true); 0450 m_ui->buttonBox->button(QDialogButtonBox::Reset)->setEnabled(true); 0451 } else { 0452 m_ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); 0453 m_ui->buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false); 0454 } 0455 0456 //! RestoreDefaults Button 0457 if (m_ui->tabWidget->currentIndex() == LayoutPage) { 0458 m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setVisible(false); 0459 } else if (m_ui->tabWidget->currentIndex() == PreferencesPage) { 0460 m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setVisible(true); 0461 0462 //! Defaults for general Latte settings 0463 if (m_tabPreferencesHandler->inDefaultValues() ) { 0464 m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(false); 0465 } else { 0466 m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(true); 0467 } 0468 } 0469 } 0470 0471 bool SettingsDialog::saveChanges() 0472 { 0473 if ((m_acceptedPage == LayoutPage && m_tabLayoutsHandler->hasChangedData()) 0474 || (m_acceptedPage == PreferencesPage && m_tabPreferencesHandler->hasChangedData())) { 0475 0476 QString tabName = m_ui->tabWidget->tabBar()->tabText(m_acceptedPage).remove("&"); 0477 QString saveChangesText = i18n("The settings of <b>%1</b> tab have changed.<br/>Do you want to apply the changes or discard them?", tabName); 0478 0479 KMessageBox::ButtonCode result = saveChangesConfirmation(saveChangesText); 0480 0481 if (result == KMessageBox::Yes) { 0482 save(); 0483 } else if (result == KMessageBox::No) { 0484 reset(); 0485 } else { 0486 return false; 0487 } 0488 } 0489 0490 return true; 0491 } 0492 0493 void SettingsDialog::onCurrentTabChanged(int index) 0494 { 0495 //! Before switching into a new tab the user must confirm first if the data should be saved or not 0496 0497 if ((m_acceptedPage == LayoutPage && m_tabLayoutsHandler->hasChangedData()) 0498 || (m_acceptedPage == PreferencesPage && m_tabPreferencesHandler->hasChangedData())) { 0499 0500 if (index != m_acceptedPage) { 0501 m_nextPage = index; 0502 setCurrentPage(m_acceptedPage); 0503 return; 0504 } 0505 0506 bool approvedNext = saveChanges(); 0507 0508 if (!approvedNext) { 0509 m_nextPage = m_acceptedPage; 0510 return; 0511 } 0512 } else { 0513 m_nextPage = index; 0514 } 0515 0516 m_acceptedPage = m_nextPage >= 0 ? m_nextPage : index/*initialize*/; 0517 m_nextPage = m_acceptedPage; 0518 0519 setCurrentPage(m_acceptedPage); 0520 updateApplyButtonsState(); 0521 } 0522 0523 void SettingsDialog::showLayoutInformation() 0524 { 0525 /* int currentRow = m_ui->layoutsView->currentIndex().row(); 0526 0527 QString id = m_model->data(m_model->index(currentRow, IDCOLUMN), Qt::DisplayRole).toString(); 0528 QString name = m_model->data(m_model->index(currentRow, NAMECOLUMN), Qt::DisplayRole).toString(); 0529 0530 Layout::GenericLayout *genericActive= m_corona->layoutsManager()->synchronizer()->layout(o_layoutsOriginalData[id].originalName()); 0531 Layout::GenericLayout *generic = genericActive ? genericActive : m_layouts[id]; 0532 0533 auto msg = new QMessageBox(this); 0534 msg->setWindowTitle(name); 0535 msg->setText(generic->reportHtml(m_corona->screenPool())); 0536 0537 msg->open();*/ 0538 } 0539 0540 void SettingsDialog::showScreensInformation() 0541 { 0542 /* QList<int> assignedScreens; 0543 0544 for (int i = 0; i < m_model->rowCount(); ++i) { 0545 QString id = m_model->data(m_model->index(i, IDCOLUMN), Qt::DisplayRole).toString(); 0546 QString name = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString(); 0547 0548 Layout::GenericLayout *genericActive= m_corona->layoutsManager()->synchronizer()->layout(o_layoutsOriginalData[id].originalName()); 0549 Layout::GenericLayout *generic = genericActive ? genericActive : m_layouts[id]; 0550 0551 QList<int> vScreens = generic->viewsScreens(); 0552 0553 for (const int scrId : vScreens) { 0554 if (!assignedScreens.contains(scrId)) { 0555 assignedScreens << scrId; 0556 } 0557 } 0558 } 0559 0560 auto msg = new QMessageBox(this); 0561 msg->setWindowTitle(i18n("Screens Information")); 0562 msg->setText(m_corona->screenPool()->reportHtml(assignedScreens)); 0563 0564 msg->open();*/ 0565 } 0566 0567 void SettingsDialog::dragEnterEvent(QDragEnterEvent *event) 0568 { 0569 if (currentPage() == LayoutPage){ 0570 m_tabLayoutsHandler->onDragEnterEvent(event); 0571 } else { 0572 QDialog::dragEnterEvent(event); 0573 } 0574 } 0575 0576 void SettingsDialog::dragLeaveEvent(QDragLeaveEvent *event) 0577 { 0578 if (currentPage() == LayoutPage){ 0579 m_tabLayoutsHandler->onDragLeaveEvent(event); 0580 } else { 0581 QDialog::dragLeaveEvent(event); 0582 } 0583 } 0584 0585 void SettingsDialog::dragMoveEvent(QDragMoveEvent *event) 0586 { 0587 if (currentPage() == LayoutPage){ 0588 m_tabLayoutsHandler->onDragMoveEvent(event); 0589 } else { 0590 QDialog::dragMoveEvent(event); 0591 } 0592 } 0593 0594 void SettingsDialog::dropEvent(QDropEvent *event) 0595 { 0596 if (currentPage() == LayoutPage){ 0597 m_tabLayoutsHandler->onDropEvent(event); 0598 } else { 0599 QDialog::dropEvent(event); 0600 } 0601 } 0602 0603 0604 0605 void SettingsDialog::updateWindowActivities() 0606 { 0607 if (KWindowSystem::isPlatformX11()) { 0608 KWindowSystem::setOnActivities(winId(), QStringList()); 0609 } 0610 } 0611 0612 void SettingsDialog::save() 0613 { 0614 qDebug() << Q_FUNC_INFO; 0615 0616 if (currentPage() == LayoutPage) { 0617 m_tabLayoutsHandler->save(); 0618 } else if (currentPage() == PreferencesPage) { 0619 m_tabPreferencesHandler->save(); 0620 } 0621 } 0622 0623 void SettingsDialog::loadConfig() 0624 { 0625 m_windowSize = m_storage.readEntry("windowSize", QSize(1100, 750)); 0626 m_downloadWindowSize = m_storage.readEntry("downloadWindowSize", QSize(980, 600)); 0627 } 0628 0629 void SettingsDialog::saveConfig() 0630 { 0631 m_storage.writeEntry("windowSize", m_windowSize); 0632 m_storage.writeEntry("downloadWindowSize", m_downloadWindowSize); 0633 } 0634 0635 } 0636 } 0637 }//end of namespace