Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

categorymanager.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 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_IOCATEGORYMANAGER_H
00021 #define BLOKKAL_IOCATEGORYMANAGER_H
00022 
00023 #include "../blokkal_export.h"
00024 
00025 #include <QObject>
00026 #include <QList>
00027 
00028 namespace Blokkal {
00029 class Account;
00030 namespace Io {
00031 class Category;
00032 
00036 typedef QList<Blokkal::Io::Category*> CategoryList;
00037 
00044 class BLOKKAL_EXPORT CategoryManager : public QObject
00045 {
00046 Q_OBJECT
00047 public:
00052         CategoryManager( Blokkal::Account * account );
00053 
00057    ~CategoryManager( void );
00058                 
00064         void setValidCategories( const QString & blogId, QStringList categories );
00065 
00072         Blokkal::Io::CategoryList categories( const QString & blogId ) const;
00073 
00082         Blokkal::Io::Category * category( const QString & blogId, const QString & categoryId );
00083 
00088         Blokkal::Account * account( void ) const;
00089 
00090 signals:
00094         void categoryAdded( const QString & blogId,
00095                             Blokkal::Io::Category * category,
00096                             Blokkal::Io::CategoryManager * manager = 0 );
00097 
00101         void categoryRemoved( const QString & blogId,
00102                               Blokkal::Io::Category * category,
00103                               Blokkal::Io::CategoryManager * manager = 0 );
00104         
00105 private:
00106         class Private;
00107         Private * d;
00108 
00109         friend class Category;
00110 };
00111 
00118 class BLOKKAL_EXPORT Category : public QObject {
00119 Q_OBJECT
00120 public:
00125         QString id( void ) const;
00126 
00131         QString name( void ) const;
00132 
00137         void setName( const QString & name );
00138 
00143         QString htmlUrl( void ) const;
00148         void setHtmlUrl( const QString & htmlUrl );
00149         
00154         QString rssUrl( void ) const;
00155 
00160         void setRssUrl( const QString & rssUrl );
00161 
00162 signals:
00166         void updated( Blokkal::Io::Category * category );
00167 
00168 private:
00169         Category( Blokkal::Io::CategoryManager * manager, const QString & blogId, const QString & id, const QString & name = 0, const QString & htmlUrl = 0, const QString &rssUrl = 0 );
00170         ~Category( void );
00171         void destroy( void );
00172         
00173         class Private;
00174         Private * d;
00175 
00176         friend class CategoryManager;
00177 };
00178 
00179 }
00180 
00181 }
00182 
00183 #endif