File indexing completed on 2024-04-14 04:53:14

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 1999-2007 David Faure <faure@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef __konq_settings_h__
0008 #define __konq_settings_h__
0009 
0010 #include <ksharedconfig.h>
0011 #include <QMap>
0012 #include <QString>
0013 #include <kconfig.h>
0014 
0015 #include <libkonq_export.h>
0016 
0017 // TODO rename this file to konqfmsettings.h, or rename the class to KonqEmbedSettings in a konqembedsettings.h header
0018 
0019 /**
0020  * Konqueror settings coming from KControl modules.
0021  *
0022  * (konquerorrc, group "FMSettings")
0023  */
0024 class LIBKONQ_EXPORT KonqFMSettings
0025 {
0026 public:
0027 
0028     /**
0029      * The static instance of KonqFMSettings
0030      */
0031     static KonqFMSettings *settings();
0032 
0033     /**
0034      * Reparse the configuration to update the already-created instances
0035      *
0036      * Warning : you need to call KSharedConfig::openConfig()->reparseConfiguration()
0037      * first (This is not done here so that the caller can avoid too much
0038      * reparsing if having several classes from the same config file)
0039      */
0040     static void reparseConfiguration();
0041 
0042     KSharedConfig::Ptr fileTypesConfig();
0043 
0044     // Use settings (and mimetype definition files)
0045     // to find whether to embed a certain service type or not
0046     // Only makes sense in konqueror.
0047     bool shouldEmbed(const QString &serviceType) const;
0048 
0049 private:
0050     /** Destructor. Don't delete any instance by yourself. */
0051     virtual ~KonqFMSettings();
0052 
0053 private:
0054     QMap<QString, QString> m_embedMap;
0055 
0056     KSharedConfig::Ptr m_fileTypesConfig;
0057 
0058     /** Called by constructor and reparseConfiguration */
0059     void init(bool reparse);
0060 
0061     // There is no default constructor. Use the provided ones.
0062     KonqFMSettings();
0063     // No copy constructor either. What for ?
0064     KonqFMSettings(const KonqFMSettings &);
0065 
0066     friend class KonqEmbedSettingsSingleton;
0067 };
0068 
0069 #endif