Logo Search packages:      
Sourcecode: kblogger-kde4 version File versions  Download package

imagecollection.cpp

/***************************************************************************

   Copyright (C) 2007 Antonio Aloisio <gnuton@gnuton.org>

   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 Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
 ***************************************************************************/

#include "imagecollection.h"

namespace Plugins
{

ImageCollection::ImageCollection( Type tp ): _tp( tp )
{
}

QString ImageCollection::name()
{
    // This doesn't really make much sence for selection and current album.
    return QString();
}

QString ImageCollection::comment()
{
    return QString();
}

KUrl::List ImageCollection::images()
{
    /*
        switch ( _tp ) {
        case CurrentAlbum:
            return stringListToUrlList( DB::ImageDB::instance()->currentScope( false ) );

        case CurrentSelection:
            return stringListToUrlList( MainWindow::Window::theMainWindow()->selected() );

        case SubClass:
            qFatal( "The subclass should implement images()" );
            return KUrl::List();
        }
    */
    return KUrl::List();

}

KUrl::List imageListToUrlList( /*const DB::ImageInfoList& imageList*/ )
{
    KUrl::List urlList;
    /*    for( DB::ImageInfoListConstIterator it = imageList.constBegin(); it != imageList.constEnd(); ++it ) {
            KUrl url;
            url.setPath( (*it)->fileName() );
            urlList.append( url );
        }*/
    return urlList;
}

KUrl::List ImageCollection::stringListToUrlList( const QStringList& list )
{
    KUrl::List urlList;
    /*
        for( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
            KUrl url;
            url.setPath( *it );
            urlList.append( url );
        }
        */
    return urlList;
}

KUrl ImageCollection::path()
{
    return commonRoot();
}

KUrl ImageCollection::commonRoot()
{
    /*
        QString imgRoot = Settings::SettingsData::instance()->imageDirectory();
        const KUrl::List imgs = images();
        if ( imgs.count() == 0 )
            return imgRoot;

        QStringList res = QFileInfo( imgs[0].path() ).absolutePath().split( QLatin1String( "/" ) );

        for( KUrl::List::ConstIterator it = imgs.begin(); it != imgs.end(); ++it ) {
            QStringList newRes;

            QStringList path = QFileInfo( (*it).path() ).absolutePath().split( QLatin1String( "/" ) );
            int i = 0;
            for ( ; i < qMin( path.size(), res.size() ); ++i ) {
                if ( path[i] == res[i] )
                    newRes.append( res[i] );
                else
                    break;
            }
            res = newRes;
        }

        QString result = res.join( QString::fromLatin1( "/" ) );
        if ( result.left( imgRoot.length() ) != imgRoot ) {
            result = imgRoot;
        }
    */
    KUrl url;
    //url.setPath( result );
    return url;

}

KUrl ImageCollection::uploadPath()
{
    return commonRoot();
}

KUrl ImageCollection::uploadRoot()
{
    KUrl url;
    //url.setPath( Settings::SettingsData::instance()->imageDirectory() );
    return url;
}
}

#include "imagecollection.moc"

Generated by  Doxygen 1.6.0   Back to index