summaryrefslogtreecommitdiffstats
path: root/kview/modules/presenter/imagelistitem.cpp
blob: d002023de52894e687ef47ec2822bf7b650ae055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*  This file is part of the KDE project
    Copyright (C) 2002 Matthias Kretz <kretz@kde.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2
    as published by the Free Software Foundation.

    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.

*/

// $Id$

#include "imagelistitem.h"

#include <tqimage.h>

#include <tdelistview.h>

ImageListItem::ImageListItem( TDEListView * parent, const KURL & url )
	: TDEListViewItem( parent, parent->lastItem(), url.prettyURL() )
	, m_pImage( 0 )
	, m_filename( TQString() )
	, m_url( url )
{
	setDragEnabled( true );
	if( m_url.isLocalFile() )
	{
		m_filename = m_url.path();
	}
	else
	{
		// download file
		/*
		TQString extension;
		TQString fileName = m_url.fileName();
		int extensionPos = fileName.findRev( '.' );
		if ( extensionPos != -1 )
			extension = fileName.mid( extensionPos ); // keep the '.'
		delete m_pTempFile;
		m_pTempFile = new KTempFile( TQString(), extension );
		m_filename = m_pTempFile->name();

		m_pJob = TDEIO::get( m_url, m_pExtension->urlArgs().reload, false );
		*/
	}
}

ImageListItem::~ImageListItem()
{
	if( ! m_url.isLocalFile() )
	{
		// remove downloaded tempfile
		//TDEIO::NetAccess::removeTempFile( m_filename );
	}
}

const TQImage * ImageListItem::image() const
{
	return m_pImage;
}

const TQString & ImageListItem::file() const
{
	if( m_url.isLocalFile() )
		return TQString();
	return m_filename;
}

const KURL & ImageListItem::url() const
{
	return m_url;
}