cosmetic fixes to make it validate more, kmcomposerui.rc and karmui.rc still do not...
[kdepim.git] / libkdepim / categoryhierarchyreader.h
blob0fad878cee644ff9cc3161cb7dee43e9f0fb622d
1 /*
2 This file is part of libkdepim.
4 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
21 #ifndef KDEPIM_CATEGORYHIERARCHYREADER_H
22 #define KDEPIM_CATEGORYHIERARCHYREADER_H
24 #include "kdepim_export.h"
26 class QComboBox;
27 class QStringList;
28 class QString;
29 class Q3ListView;
30 class QTreeWidget;
31 class QTreeWidgetItem;
33 namespace KPIM {
35 class KDEPIM_EXPORT CategoryHierarchyReader
37 public:
38 void read( QStringList categories );
39 virtual ~CategoryHierarchyReader() { }
40 static QStringList path( QString string );
41 protected:
42 CategoryHierarchyReader() { }
43 virtual void clear() = 0;
44 virtual void goUp() = 0;
45 virtual void addChild( const QString &label ) = 0;
46 virtual int depth() const = 0;
49 class KDEPIM_EXPORT CategoryHierarchyReaderQComboBox : public CategoryHierarchyReader
51 public:
52 CategoryHierarchyReaderQComboBox( QComboBox *box )
53 : mBox( box ), mCurrentDepth( 0 ) { }
54 virtual ~CategoryHierarchyReaderQComboBox() { }
56 protected:
57 virtual void clear();
58 virtual void goUp();
59 virtual void addChild( const QString &label );
60 virtual int depth() const;
61 private:
62 QComboBox *mBox;
63 int mCurrentDepth;
66 class CategoryHierarchyReaderQTreeWidget : public CategoryHierarchyReader
68 public:
69 CategoryHierarchyReaderQTreeWidget( QTreeWidget *tree )
70 : mTree( tree ), mItem( 0 ), mCurrentDepth( 0 ) {}
71 virtual ~CategoryHierarchyReaderQTreeWidget() {}
73 protected:
74 virtual void clear();
75 virtual void goUp();
76 virtual void addChild( const QString &label );
77 virtual int depth() const;
79 private:
80 QTreeWidget *mTree;
81 QTreeWidgetItem *mItem;
82 int mCurrentDepth;
87 #endif