From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkonq/konq_settings.h | 141 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 libkonq/konq_settings.h (limited to 'libkonq/konq_settings.h') diff --git a/libkonq/konq_settings.h b/libkonq/konq_settings.h new file mode 100644 index 000000000..8f3d981fc --- /dev/null +++ b/libkonq/konq_settings.h @@ -0,0 +1,141 @@ +/* This file is part of the KDE project + Copyright (C) 1999 David Faure + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __konq_settings_h__ +#define __konq_settings_h__ + +class KConfig; +#include +#include +#include +#include + +#include + +/** + * The class KonqFMSettings holds the general settings for the + * icon/tree views in konqueror/kdesktop. + * There is no 'local' (per-URL) instance of it. + * All those settings can only be changed in kcmkonq. + * + * Using this class from konqueror and from kdesktop return + * different settings, since the config file is different. + * konquerorrc, group "FMSettings", and kdesktoprc, group "FMSettings" + * The kcontrol modules handles both files, depending where + * it's called from. + */ + +class LIBKONQ_EXPORT KonqFMSettings +{ +protected: + /** + * @internal + * Constructs a KonqFMSettings instance from a config file. + */ + KonqFMSettings( KConfig * config ); + + /** Destructor. Don't delete any instance by yourself. */ + virtual ~KonqFMSettings(); + +public: + + /** + * The static instance of KonqFMSettings + */ + static KonqFMSettings * settings(); + + /** + * Reparse the configuration to update the already-created instances + * + * Warning : you need to call KGlobal::config()->reparseConfiguration() + * first (This is not done here so that the caller can avoid too much + * reparsing if having several classes from the same config file) + */ + static void reparseConfiguration(); + + // Use settings (and mimetype definition files) + // to find whether to embed a certain service type or not + // Only makes sense in konqueror. + bool shouldEmbed( const QString & serviceType ) const; + + // Behaviour settings + bool wordWrapText() const { return m_bWordWrapText; } + int iconTextHeight() const { return m_iconTextHeight; } + int iconTextWidth() const; + bool underlineLink() const { return m_underlineLink; } + bool fileSizeInBytes() const { return m_fileSizeInBytes; } + bool alwaysNewWin() const { return m_alwaysNewWin; } + const QString & homeURL() const { return m_homeURL; } + + bool showFileTips() const {return m_showFileTips; } + bool showPreviewsInFileTips() const; + int numFileTips() const {return m_numFileTips; } + bool renameIconDirectly() const; + + // Font settings + const QFont& standardFont() const { return m_standardFont; } + + // Color settings + const QColor& normalTextColor() const { return m_normalTextColor; } + const QColor& highlightedTextColor() const { return m_highlightedTextColor; } + const QColor& itemTextBackground() const { return m_itemTextBackground; } + + int textPreviewIconTransparency() const { return m_iconTransparency; } + + int caseSensitiveCompare( const QString& a, const QString& b ) const; + +private: + + static KonqFMSettings * s_pSettings; + + bool m_underlineLink; + bool m_fileSizeInBytes; + bool m_alwaysNewWin; + bool m_bTreeFollow; + + QMap m_embedMap; + + QFont m_standardFont; + + QColor m_normalTextColor; + QColor m_highlightedTextColor; + QColor m_itemTextBackground; + + bool m_bWordWrapText; + int m_iconTextHeight; + + QString m_homeURL; + bool m_showFileTips; + int m_numFileTips; + + // used for the textpreview + int m_iconTransparency; + + /** Called by constructor and reparseConfiguration */ + void init( KConfig * config ); + + struct KonqFMSettingsPrivate * d; + + // There is no default constructor. Use the provided ones. + KonqFMSettings(); + // No copy constructor either. What for ? + KonqFMSettings( const KonqFMSettings &); +}; + +#endif -- cgit v1.2.1