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

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2000 Carsten Pfeiffer <pfeiffer@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KONQ_HISTORYSETTINGS_H
0008 #define KONQ_HISTORYSETTINGS_H
0009 
0010 #include <konqprivate_export.h>
0011 
0012 #include <QFont>
0013 #include <QObject>
0014 #include <QDBusAbstractAdaptor>
0015 #include <QDBusConnection>
0016 
0017 /**
0018  * Object containing the settings used by the history views
0019  * (both the sidebar module and the history dialog)
0020  *
0021  * The instances of KonqHistorySettings in all konqueror processes
0022  * synchronize themselves using DBus.
0023  */
0024 class KONQUERORPRIVATE_EXPORT KonqHistorySettings : public QObject
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     enum { MINUTES, DAYS };
0030 
0031     enum class Action {Auto = 0, OpenNewTab = 1, OpenCurrentTab = 2 , OpenNewWindow = 3};
0032 
0033     static KonqHistorySettings *self();
0034     ~KonqHistorySettings() override;
0035 
0036     void applySettings();
0037 
0038     Action m_defaultAction;
0039 
0040     uint m_valueYoungerThan;
0041     uint m_valueOlderThan;
0042 
0043     int m_metricYoungerThan;
0044     int m_metricOlderThan;
0045 
0046     QFont m_fontYoungerThan;
0047     QFont m_fontOlderThan;
0048 
0049     bool m_detailedTips;
0050     bool m_sortsByName;
0051 
0052 Q_SIGNALS:
0053     void settingsChanged();
0054 
0055 private Q_SLOTS:
0056     void slotSettingsChanged();
0057 
0058 protected:
0059     Q_DISABLE_COPY(KonqHistorySettings)
0060 
0061 Q_SIGNALS:
0062     // DBus signals
0063     void notifySettingsChanged();
0064 
0065 private:
0066     void readSettings(bool reparse);
0067 
0068     friend class KonqHistorySettingsSingleton;
0069     KonqHistorySettings();
0070 };
0071 
0072 class KonqHistorySettingsAdaptor : public QDBusAbstractAdaptor
0073 {
0074     Q_OBJECT
0075     Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror.SidebarHistorySettings")
0076 public:
0077     KonqHistorySettingsAdaptor(KonqHistorySettings *parent)
0078         : QDBusAbstractAdaptor(parent)
0079     {
0080         setAutoRelaySignals(true);
0081     }
0082 
0083 Q_SIGNALS:
0084     void notifySettingsChanged();
0085 };
0086 
0087 #endif // KONQ_HISTORYSETTINGS_H