Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

categoryview.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 - 2008 by Martin Mueller                           *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKAL_UICATEGORYVIEW_H
00021 #define BLOKKAL_UICATEGORYVIEW_H
00022 
00023 #include "../blokkal_export.h"
00024 
00025 #include "checkboxview.h"
00026 #include "../blokkaltreemodel.h"
00027 
00028 namespace Blokkal {
00029 class Entry;
00030 class Blog;
00031 namespace Io {
00032 class Category;
00033 }
00034 namespace Ui {
00035 
00042 class BLOKKAL_EXPORT CategoryView : public Blokkal::Ui::BlogView
00043 {
00044 Q_OBJECT
00045 public:
00053         CategoryView( Blokkal::Entry * entry, bool exclusive, QWidget * parent = 0 );
00054 
00058         virtual ~CategoryView( void );
00059 
00063         void selectCategories( const QStringList & ids );
00064 
00069         QStringList selectedCategories( void ) const;
00070 
00071 Q_SIGNALS:
00075         void categorySelectionChanged( void );
00076 
00077 private:
00078         class Private;
00079         Private * const d;
00080 };
00081 
00088 class BLOKKAL_EXPORT CategoryModel : public Blokkal::TreeModel {
00089 Q_OBJECT
00090 public:
00094         CategoryModel( Blokkal::Blog * blog, QObject * parent = 0 );
00095         virtual ~CategoryModel( void );
00096 
00100         enum CustomRoles {
00101                 SortRole = Qt::UserRole + 1 
00102         };
00103 
00107         virtual QVariant data( const QModelIndex & index,
00108                                int role = Qt::DisplayRole) const;
00109         
00110 private Q_SLOTS:
00111         void addCategory( const QString & blogId, Blokkal::Io::Category * category );
00112         void removeCategory( const QString & blogId, Blokkal::Io::Category * category );
00113         void emitDataChanged( Blokkal::Io::Category * category );
00114 
00115 private:
00116         class Private;
00117         Private * const d;
00118 };
00119 
00120 }
00121 
00122 }
00123 
00124 #endif