~ubuntu-branches/ubuntu/warty/gwenview/warty

« back to all changes in this revision

Viewing changes to gwenview/dirviewitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2004-06-13 18:55:04 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040613185504-net8ekxoswwvyxs9
Tags: 1.1.3-1
New upstream release. Translations now included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Gwenview - A simple image viewer for KDE
3
 
Copyright (C) 2000-2002 Aur�lien G�teau
4
 
 
5
 
This program is free software; you can redistribute it and/or
6
 
modify it under the terms of the GNU General Public License
7
 
as published by the Free Software Foundation; either version 2
8
 
of the License, or (at your option) any later version.
9
 
 
10
 
This program is distributed in the hope that it will be useful,
11
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
GNU General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public License
16
 
along with this program; if not, write to the Free Software
17
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 
19
 
*/
20
 
#ifndef DIRVIEWITEM_H
21
 
#define DIRVIEWITEM_H
22
 
 
23
 
// Qt includes
24
 
#include <qlistview.h>
25
 
 
26
 
// KDE includes
27
 
#include <kfileitem.h>
28
 
#include <kurl.h>
29
 
 
30
 
 
31
 
class DirView;
32
 
 
33
 
 
34
 
class DirViewItem : public QListViewItem {
35
 
public:
36
 
        DirViewItem(DirView* folderWidget, const QString& label);
37
 
        DirViewItem(DirView* folderWidget, QListViewItem* parent, const QString& label);
38
 
 
39
 
        void initExpandable();
40
 
        void setIsDropTarget(bool);
41
 
 
42
 
// Overriden from QListViewItem
43
 
        void setOpen(bool);
44
 
        void paintCell(QPainter *, const QColorGroup &, int column, int width, int align);
45
 
 
46
 
// Accessors
47
 
        DirViewItem* find(const QString& label) const;
48
 
        virtual QString folder() const=0;
49
 
        virtual const KURL& url() const=0;
50
 
 
51
 
protected:
52
 
        bool mIsDropTarget;
53
 
        DirView* mDirView;
54
 
};
55
 
 
56
 
 
57
 
 
58
 
 
59
 
class RootDirViewItem : public DirViewItem {
60
 
public:
61
 
        RootDirViewItem(DirView* folderWidget, const QString& label)
62
 
                : DirViewItem(folderWidget,label) {}
63
 
 
64
 
        QString folder() const { return "/"; }
65
 
        const KURL& url() const;
66
 
};
67
 
 
68
 
 
69
 
 
70
 
 
71
 
class SubDirViewItem : public DirViewItem {
72
 
public:
73
 
        SubDirViewItem(DirView* folderWidget,QListViewItem* parent,const QString& label, KFileItem* item)
74
 
                : DirViewItem(folderWidget, parent, label), mFileItem(item) {}
75
 
 
76
 
// Accessors
77
 
        KFileItem* fileItem() const { return mFileItem; }
78
 
        QString folder() const { return mFileItem->url().path(); }
79
 
        const KURL& url() const { return mFileItem->url(); }
80
 
 
81
 
// Refresh the label according to the url
82
 
        void refreshLabel();
83
 
 
84
 
private:
85
 
        KFileItem* mFileItem;
86
 
};
87
 
 
88
 
 
89
 
#endif