| 1 |
/* This file is part of the KDE project |
| 2 |
* SPDX-FileCopyrightText: 2019 Dag Andersen <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
#include "ConfigDialog.h" |
| 8 |
|
| 9 |
#include <portfoliosettings.h> |
| 10 |
#include "Part.h" |
| 11 |
|
| 12 |
#include <Help.h> |
| 13 |
#include <KoIcon.h> |
| 14 |
#include <config/KoConfigDocumentPage.h> |
| 15 |
#include <config/ConfigDocumentationPanel.h> |
| 16 |
#include <Help.h> |
| 17 |
|
| 18 |
#include <KConfigSkeleton> |
| 19 |
#include <KLocalizedString> |
| 20 |
|
| 21 |
#include <QDebug> |
| 22 |
|
| 23 |
|
| 24 |
ConfigDialog::ConfigDialog(Part *part, const QString& name, KConfigSkeleton *config) |
| 25 |
: KConfigDialog(part->currentMainwindow(), name, config) |
| 26 |
{ |
| 27 |
auto docPage = new KoConfigDocumentPage(part); |
| 28 |
m_pages << addPage(docPage, i18nc("@title:tab Document settings page", "Document")); |
| 29 |
m_pages.last()->setIcon(koIcon("document-properties")); |
| 30 |
|
| 31 |
// m_pages << addPage(new KPlato::ConfigDocumentationPanel(), i18n("Documentation"), koIconName("documents")); |
| 32 |
} |
| 33 |
|
| 34 |
void ConfigDialog::updateSettings() |
| 35 |
{ |
| 36 |
Q_EMIT updateWidgetsSettings(); |
| 37 |
PortfolioSettings::self()->save(); |
| 38 |
Q_EMIT settingsUpdated(); |
| 39 |
} |
| 40 |
|
| 41 |
void ConfigDialog::updateWidgets() |
| 42 |
{ |
| 43 |
Q_EMIT updateWidgetsData(); |
| 44 |
} |
| 45 |
|
| 46 |
bool ConfigDialog::hasChanged() |
| 47 |
{ |
| 48 |
QWidget *w = currentPage()->widget()->findChild<QWidget*>(QStringLiteral("ConfigWidget")); |
| 49 |
return w ? w->property("hasChanged").toBool() : false; |
| 50 |
} |
| 51 |
|
| 52 |
void ConfigDialog::showHelp() |
| 53 |
{ |
| 54 |
KPlato::Help::instance()->invokeContext(QUrl(QStringLiteral("portfolio:configure-portfolio-dialog"))); |
| 55 |
} |
| 56 |
|