/***************************************************************************
 *   Copyright (C) 2005 by xavier helluy                                   *
 *   xavier.helluy@web.de                                                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#ifndef URLDISPATCHER_H
#define URLDISPATCHER_H

#include <qstring.h>
#include <qmap.h>
// #include <qmapiterator.h>


/**
@author xavier helluy
*/

/*
Goal of this class is to decide what to do whith specials protocols or filearchives
 */

//adapted from  /kdeutils-3.3.92/ark/arch.h
enum CLuceneArchType      { UNKNOWN_FORMAT, ZIP_FORMAT, TAR_FORMAT };

//special protocols
enum CLuceneProtocolTypes { UNKNOWN_PROTOCOL, ARCHIVE, DIGIKAMTAGS };

class URLDispatcher 
{
public:
    URLDispatcher();

    ~URLDispatcher();
    
    ///* Basic archive support using kde-ioslaves only and MimeTypes only///
   //TODO: ark supports many archives-type kde-ioslave can't. Why is part of ark not a 
   //ioslave ? Why doesn't ark supports arj-archives ?
   //what about rpm-archives and deb-archives ? wHAT ABOUT ISO files ???

    void buildSupportedArchivesByMimeTypes( );
    void buildSupportedArchivesProtocols( );

    CLuceneArchType URLDispatcher::findArchiveType(QString mimeType);
    QString archiveFactory(  CLuceneArchType aType , QString path );
    bool isArchiveProtocol(QString protocol);
    
    
    bool isSupportedLocalCopyProtocol();

	private:
		//Map of supported archives: key: mimetype , value: enum CLuceneArchType
		QMap<QString , CLuceneArchType> m_supportedMimeArchives;  
		
		//Map of supported archives protocols: key: archive type , value: protocol string
		QMap<  CLuceneArchType , QString> m_ArchivesProtocols;
		
};

#endif
