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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 setSortCriterion( const QString &criterion );
00090   const QString& sortCriterion() const;
00091 
00092   void setDirsFirst ( bool first );
00093   bool isDirsFirst() const;
00094 
00095   void setDescending (bool descending);
00096   bool isDescending() const;
00097 
00098   void setShowingDotFiles( bool show );
00099   bool isShowingDotFiles() const { return m_bShowDot; }
00100 
00101   void setCaseInsensitiveSort( bool show );
00102   bool isCaseInsensitiveSort() const;
00103 
00104   void setShowingDirectoryOverlays( bool show );
00105   bool isShowingDirectoryOverlays() const { return m_bShowDirectoryOverlays; }
00106 
00107   void setShowingPreview( const QString &preview, bool show );
00108   void setShowingPreview( bool show );
00109   bool isShowingPreview( const QString &preview ) const { return ! m_dontPreview.contains(preview); }
00110   bool isShowingPreview();
00111   const QStringList &previewSettings();
00112 
00113   void setBgColor( const QColor & color );
00114   const QColor& bgColor(QWidget * widget) const;
00115   void setTextColor( const QColor & color );
00116   const QColor& textColor(QWidget * widget) const;
00117   void setBgPixmapFile( const QString & file );
00118   const QString& bgPixmapFile() const { return m_bgPixmapFile; }
00119 
00120   // Applies bgcolor, textcolor, pixmap to the @p widget
00121   void applyColors( QWidget * widget ) const;
00122 
00123 protected:
00124 
00125   QPixmap loadPixmap() const;
00126 
00127   // Current config object for _saving_
00128   KConfigBase * currentConfig();
00129 
00130   // Current config object for _saving_ settings related to colors
00131   KConfigBase * currentColorConfig();
00132 
00133   QString currentGroup() const {
00134       return isDefaultProperties() ? 
00135           QString::fromLatin1("Settings") : QString::fromLatin1("URL properties");
00136   }
00137 
00138 private:
00139   // The actual properties
00140 
00141   int m_iIconSize;
00142   int m_iItemTextPos;
00143   bool m_bShowDot;
00144   bool m_bShowDirectoryOverlays;
00145   QStringList m_dontPreview;
00146   QColor m_textColor;
00147   QColor m_bgColor;
00148   QString m_bgPixmapFile;
00149 
00150   // Path to .directory file, whether it exists or not
00151   QString dotDirectory;
00152 
00153   bool m_bSaveViewPropertiesLocally;
00154 
00155   // True if we found a .directory file to read
00156   bool m_dotDirExists;
00157 
00158   // Points to the current .directory file if we are in
00159   // save-view-properties-locally mode, otherwise to the global config
00160   // It is set to 0L to mark it as "needs to be constructed".
00161   // This is to be used for SAVING only.
00162   // Can be a KConfig or a KSimpleConfig
00163   KConfigBase * m_currentConfig;
00164 
00165   // If this is not a "default properties" instance (but one used by a view)
00166   // then m_defaultProps points to the "default properties" instance
00167   // Otherwise it's 0L.
00168   KonqPropsView * m_defaultProps;
00169 
00174   struct Private;
00175 
00176   Private *d;
00177 
00178 private:
00179   KonqPropsView( const KonqPropsView & );
00180   KonqPropsView();
00181 };
00182 
00183 
00184 #endif
KDE Logo
This file is part of the documentation for libkonq Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Aug 20 13:39:03 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003