2013-11-23 00:39:10 +00:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2013-11-23 00:39:10 +00:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2013-11-23 00:39:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "share_config.h"
|
|
|
|
|
2014-09-22 00:33:59 +01:00
|
|
|
#include <QStandardPaths>
|
|
|
|
|
2015-03-14 04:19:39 +00:00
|
|
|
#include <KPluginFactory>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KUrlRequester>
|
2013-11-23 00:39:10 +00:00
|
|
|
|
2023-07-21 11:42:38 +01:00
|
|
|
K_PLUGIN_CLASS(ShareConfig)
|
2013-11-23 00:39:10 +00:00
|
|
|
|
2023-07-21 11:26:19 +01:00
|
|
|
ShareConfig::ShareConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
|
|
|
: KdeConnectPluginKcm(parent, data, args)
|
2013-11-23 00:39:10 +00:00
|
|
|
{
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.setupUi(widget());
|
2015-04-15 16:45:16 +01:00
|
|
|
// xgettext:no-c-format
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.commentLabel->setTextFormat(Qt::RichText);
|
|
|
|
m_ui.commentLabel->setText(i18n("%1 in the path will be replaced with the specific device name."));
|
2013-11-23 00:39:10 +00:00
|
|
|
|
2023-07-26 09:40:17 +01:00
|
|
|
connect(m_ui.kurlrequester, &KUrlRequester::textChanged, this, &ShareConfig::markAsChanged);
|
2013-11-23 00:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShareConfig::defaults()
|
|
|
|
{
|
|
|
|
KCModule::defaults();
|
|
|
|
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.kurlrequester->setText(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
2013-11-23 00:39:10 +00:00
|
|
|
|
2023-04-17 18:10:08 +01:00
|
|
|
markAsChanged();
|
2013-11-23 00:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShareConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
|
2017-10-03 20:47:28 +01:00
|
|
|
const auto standardPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.kurlrequester->setText(config()->getString(QStringLiteral("incoming_path"), standardPath));
|
2013-11-23 00:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShareConfig::save()
|
|
|
|
{
|
|
|
|
KCModule::save();
|
2023-07-26 09:40:17 +01:00
|
|
|
config()->set(QStringLiteral("incoming_path"), m_ui.kurlrequester->text());
|
2013-11-23 00:39:10 +00:00
|
|
|
}
|
|
|
|
|
2023-07-26 09:15:11 +01:00
|
|
|
#include "moc_share_config.cpp"
|
2014-06-16 19:02:07 +01:00
|
|
|
#include "share_config.moc"
|