~ubuntu-branches/ubuntu/warty/kdebase/warty

« back to all changes in this revision

Viewing changes to konqueror/listview/konq_listviewitems.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-16 04:51:45 UTC
  • Revision ID: james.westby@ubuntu.com-20040916045145-9vr63kith3k1cpza
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
 
3
 
 
4
   This program is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
    General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU General Public License
 
15
   along with this program; see the file COPYING.  If not, write to
 
16
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
#ifndef __konq_listviewitems_h__
 
21
#define __konq_listviewitems_h__
 
22
 
 
23
#include <klistview.h>
 
24
#include <qstring.h>
 
25
#include <kicontheme.h>
 
26
 
 
27
#include <qvaluevector.h>
 
28
 
 
29
// for mode_t
 
30
#include <sys/types.h>
 
31
#include <sys/stat.h>
 
32
#include <unistd.h>
 
33
 
 
34
class QPainter;
 
35
class KFileItem;
 
36
class KonqBaseListViewWidget;
 
37
 
 
38
 
 
39
class KonqBaseListViewItem : public KListViewItem
 
40
{
 
41
   public:
 
42
      KonqBaseListViewItem(KonqBaseListViewWidget *_listViewWidget, KFileItem* _fileitem);
 
43
      KonqBaseListViewItem(KonqBaseListViewWidget *_listViewWidget, KonqBaseListViewItem *_parent, KFileItem* _fileitem);
 
44
      virtual ~KonqBaseListViewItem();
 
45
      /** @return the file item held by this instance */
 
46
      KFileItem * item() { return m_fileitem; }
 
47
      void mimetypeFound();
 
48
      virtual void updateContents() = 0;
 
49
      virtual void setDisabled( bool disabled ) { m_bDisabled = disabled; }
 
50
      virtual void setActive  ( bool active   ) { m_bActive   = active;   }
 
51
      virtual int compare( QListViewItem* i, int col, bool ascending ) const;
 
52
      
 
53
      int state() const 
 
54
      {
 
55
         if (m_bDisabled)
 
56
            return KIcon::DisabledState;
 
57
         if (m_bActive)
 
58
            return KIcon::ActiveState; 
 
59
         return KIcon::DefaultState;
 
60
      }
 
61
 
 
62
      /** For KonqMimeTypeResolver */
 
63
      QRect rect() const;
 
64
      
 
65
   protected:
 
66
      QChar sortChar;
 
67
      bool m_bDisabled;
 
68
      bool m_bActive; 
 
69
      
 
70
      /** Pointer to the file item in KDirLister's list */
 
71
      KFileItem* m_fileitem;
 
72
      /** Parent tree view */
 
73
      KonqBaseListViewWidget* m_pListViewWidget;
 
74
 
 
75
      static const char* makeAccessString( const mode_t mode );
 
76
};
 
77
 
 
78
/**
 
79
 * One item in the detailed list or in the tree (not text)
 
80
 */
 
81
class KonqListViewItem : public KonqBaseListViewItem
 
82
{
 
83
   public:
 
84
      /**
 
85
       * Create an item in the tree toplevel representing a file
 
86
       * @param _parent the parent widget, the tree view
 
87
       * @param _fileitem the file item created by KDirLister
 
88
       */
 
89
      KonqListViewItem( KonqBaseListViewWidget *_listViewWidget, KFileItem* _fileitem );
 
90
      /**
 
91
       * Create an item representing a file, inside a directory
 
92
       * @param _treeview the parent tree view  - now unused
 
93
       * @param _parent the parent widget, a directory item in the tree view
 
94
       * @param _fileitem the file item created by KDirLister
 
95
       */
 
96
      KonqListViewItem( KonqBaseListViewWidget *, KonqListViewItem *_parent, KFileItem* _fileitem );
 
97
 
 
98
      virtual ~KonqListViewItem() {}
 
99
 
 
100
      virtual void paintCell( QPainter *_painter, const QColorGroup & cg,
 
101
                              int column, int width, int alignment );
 
102
      virtual void updateContents();
 
103
      virtual void setDisabled( bool disabled );
 
104
      virtual void setActive  ( bool active   );
 
105
 
 
106
      virtual void setPixmap( int column, const QPixmap & pm );
 
107
      virtual const QPixmap * pixmap( int column ) const;
 
108
 
 
109
private:
 
110
      QValueVector<QPixmap *> m_pixmaps;
 
111
};
 
112
 
 
113
#endif