Warning, file /pim/kdepim-runtime/resources/shared/singlefileresource/singlefileresourceconfigwidget.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2008 Bertjan Broeksema <b.broeksema@kdemail.org>
0003     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "akonadi-singlefileresource_export.h"
0011 #include "singlefileresourceconfigwidgetbase.h"
0012 
0013 #include <KConfigDialogManager>
0014 
0015 namespace Akonadi
0016 {
0017 /**
0018  * Configuration widget for single file resources.
0019  */
0020 template<typename Settings>
0021 class SingleFileResourceConfigWidget : public SingleFileResourceConfigWidgetBase
0022 {
0023     Settings *mSettings = nullptr;
0024 
0025 public:
0026     explicit SingleFileResourceConfigWidget(QWidget *parent, Settings *settings)
0027         : SingleFileResourceConfigWidgetBase(parent)
0028         , mSettings(settings)
0029     {
0030         mManager = new KConfigDialogManager(this, mSettings);
0031     }
0032 
0033     bool save() const override
0034     {
0035         mManager->updateSettings();
0036         mSettings->setPath(ui.kcfg_Path->url().toString());
0037         mSettings->save();
0038         return true;
0039     }
0040 
0041     void load() override
0042     {
0043         ui.kcfg_Path->setUrl(QUrl::fromUserInput(mSettings->path()));
0044         mManager = new KConfigDialogManager(this, mSettings);
0045         mManager->updateWidgets();
0046     }
0047 };
0048 }