1 /*
2 "Desktop Options" Tab for KDesktop configuration
3
4 SPDX-FileCopyrightText: 1996 Martin R. Jones
5 SPDX-FileCopyrightText: 1998 Bernd Wuebben
6 SPDX-FileCopyrightText: 1998 Christian Tibirna
7 SPDX-FileCopyrightText: 1998-2007 David Faure <faure@kde.org>
8 SPDX-FileCopyrightText: 2010 Matthias Fuchs <mat69@gmx.net>
9
10 SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13 // Own
14 #include "globalpaths.h"
15 #include "desktoppathsdata.h"
16 #include "desktoppathssettings.h"
17 #include "ui_globalpaths.h"
18
19 #include <KLineEdit>
20 #include <KPluginFactory>
21 #include <KUrlRequester>
22
K_PLUGIN_FACTORY(KcmDesktopPathsFactory,registerPlugin<DesktopPathConfig> ();registerPlugin<DesktopPathsData> ();)23 K_PLUGIN_FACTORY(KcmDesktopPathsFactory, registerPlugin<DesktopPathConfig>(); registerPlugin<DesktopPathsData>();)
24
25 DesktopPathConfig::DesktopPathConfig(QWidget *parent, const QVariantList &)
26 : KCModule(parent)
27 , m_ui(new Ui::DesktopPathsView)
28 , m_data(new DesktopPathsData(this))
29 {
30 m_ui->setupUi(this);
31 setQuickHelp(
32 i18n("<h1>Paths</h1>\n"
33 "This module allows you to choose where in the filesystem the "
34 "files on your desktop should be stored.\n"
35 "Use the \"Whats This?\" (Shift+F1) to get help on specific options."));
36 addConfig(m_data->settings(), this);
37
38 connect(this, &DesktopPathConfig::defaultsIndicatorsVisibleChanged, this, &DesktopPathConfig::updateDefaultIndicator);
39 connect(m_data->settings(), &DesktopPathsSettings::widgetChanged, this, &DesktopPathConfig::updateDefaultIndicator);
40 }
41
~DesktopPathConfig()42 DesktopPathConfig::~DesktopPathConfig()
43 {
44 }
45
updateDefaultIndicator()46 void DesktopPathConfig::updateDefaultIndicator()
47 {
48 setDefaultIndicatorVisible(m_ui->kcfg_desktopLocation, m_data->settings()->defaultDesktopLocation());
49 setDefaultIndicatorVisible(m_ui->kcfg_documentsLocation, m_data->settings()->defaultDocumentsLocation());
50 setDefaultIndicatorVisible(m_ui->kcfg_downloadsLocation, m_data->settings()->defaultDownloadsLocation());
51 setDefaultIndicatorVisible(m_ui->kcfg_musicLocation, m_data->settings()->defaultMusicLocation());
52 setDefaultIndicatorVisible(m_ui->kcfg_picturesLocation, m_data->settings()->defaultPicturesLocation());
53 setDefaultIndicatorVisible(m_ui->kcfg_videosLocation, m_data->settings()->defaultVideosLocation());
54 }
55
setDefaultIndicatorVisible(KUrlRequester * widget,const QVariant & defaultValue)56 void DesktopPathConfig::setDefaultIndicatorVisible(KUrlRequester *widget, const QVariant &defaultValue)
57 {
58 bool isDefault = widget->url() == defaultValue.toUrl();
59 widget->lineEdit()->setProperty("_kde_highlight_neutral", defaultsIndicatorsVisible() && !isDefault);
60 widget->update();
61 }
62
63 #include "globalpaths.moc"
64