libkonq Library API Documentation

konq_propsview.h

00001 /*  This file is part of the KDE project
00002     Copyright (C) 1997 David Faure <faure@kde.org>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #ifndef __konq_viewprops_h__
00021 #define __konq_viewprops_h__
00022 
00023 #include <qpixmap.h>
00024 #include <qstringlist.h>
00025 
00026 #include <kurl.h>
00027 
00028 class KInstance;
00029 class KConfigBase;
00030 class KConfig;
00031 
00043 class KonqPropsView
00044 {
00045 public:
00046 
00053   KonqPropsView( KInstance * instance, KonqPropsView * defaultProps /*= 0L*/ );
00054 
00056   virtual ~KonqPropsView();
00057 
00061   bool isDefaultProperties() const {
00062       // No parent -> we are the default properties
00063       return m_defaultProps == 0L;
00064   }
00065 
00073   bool enterDir( const KURL & dir );
00074 
00079   void setSaveViewPropertiesLocally( bool value );
00080 
00082 
00083   void setIconSize( int size ); // in pixel, 0 for default
00084   int iconSize() const { return m_iIconSize; }
00085 
00086   void setItemTextPos( int pos ); // QIconView::Bottom or QIconView::Right, currently
00087   int itemTextPos() const { return m_iItemTextPos; }
00088 
00089   void setShowingDotFiles( bool show );
00090   bool isShowingDotFiles() const { return m_bShowDot; }
00091 
00092   void setCaseInsensitiveSort( bool show );
00093   bool isCaseInsensitiveSort() const;
00094 
00095   void setShowingDirectoryOverlays( bool show );
00096   bool isShowingDirectoryOverlays() const { return m_bShowDirectoryOverlays; }
00097 
00098   void setShowingPreview( const QString &preview, bool show );
00099   void setShowingPreview( bool show );
00100   bool isShowingPreview( const QString &preview ) const { return ! m_dontPreview.contains(preview); }
00101   bool isShowingPreview();
00102   const QStringList &previewSettings();
00103 
00104   void setBgColor( const QColor & color );
00105   const QColor& bgColor(QWidget * widget) const;
00106   void setTextColor( const QColor & color );
00107   const QColor& textColor(QWidget * widget) const;
00108   void setBgPixmapFile( const QString & file );
00109   const QString& bgPixmapFile() const { return m_bgPixmapFile; }
00110 
00111   // Applies bgcolor, textcolor, pixmap to the @p widget
00112   void applyColors( QWidget * widget ) const;
00113 
00114 protected:
00115 
00116   QPixmap loadPixmap() const;
00117 
00118   // Current config object for _saving_
00119   KConfigBase * currentConfig();
00120 
00121   // Current config object for _saving_ settings related to colors
00122   KConfigBase * currentColorConfig();
00123 
00124   QString currentGroup() const {
00125       return isDefaultProperties() ? "Settings" : "URL properties";
00126   }
00127 
00128 private:
00129   // The actual properties
00130 
00131   int m_iIconSize;
00132   int m_iItemTextPos;
00133   bool m_bShowDot;
00134   bool m_bShowDirectoryOverlays;
00135   QStringList m_dontPreview;
00136   QColor m_textColor;
00137   QColor m_bgColor;
00138   QString m_bgPixmapFile;
00139 
00140   // Path to .directory file, whether it exists or not
00141   QString dotDirectory;
00142 
00143   bool m_bSaveViewPropertiesLocally;
00144 
00145   // True if we found a .directory file to read
00146   bool m_dotDirExists;
00147 
00148   // Points to the current .directory file if we are in
00149   // save-view-properties-locally mode, otherwise to the global config
00150   // It is set to 0L to mark it as "needs to be constructed".
00151   // This is to be used for SAVING only.
00152   // Can be a KConfig or a KSimpleConfig
00153   KConfigBase * m_currentConfig;
00154 
00155   // If this is not a "default properties" instance (but one used by a view)
00156   // then m_defaultProps points to the "default properties" instance
00157   // Otherwise it's 0L.
00158   KonqPropsView * m_defaultProps;
00159 
00164   struct Private;
00165 
00166   Private *d;
00167 
00168 private:
00169   KonqPropsView( const KonqPropsView & );
00170   KonqPropsView();
00171 };
00172 
00173 
00174 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Thu Jan 29 23:03:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001