1
// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
2
/* This file is part of the KDE project
3
Copyright (C) 2004 Esben Mose Hansen <kde@mosehansen.dk>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; see the file COPYING. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
20
#include "historyurlitem.h"
22
#include <k3multipledrag.h>
23
#include <k3urldrag.h>
24
#include <Qt3Support/Q3CString>
26
HistoryURLItem::HistoryURLItem( const KUrl::List &_urls, KUrl::MetaDataMap _metaData, bool _cut )
27
: urls( _urls ), metaData( _metaData ), cut( _cut )
32
void HistoryURLItem::write( QDataStream& stream ) const
34
stream << QString( "url" ) << urls << metaData << (int)cut;
37
QString HistoryURLItem::text() const {
38
return urls.toStringList().join( " " );
41
QMimeData* HistoryURLItem::mimeData() const {
42
QMimeData *data = new QMimeData();
43
urls.populateMimeData(data, metaData);
44
data->setData("application/x-kde-cutselection", QByteArray(cut ? "1" : "0"));
48
bool HistoryURLItem::operator==( const HistoryItem& rhs) const
50
if ( const HistoryURLItem* casted_rhs = dynamic_cast<const HistoryURLItem*>( &rhs ) ) {
51
return casted_rhs->urls == urls
52
&& casted_rhs->metaData.count() == metaData.count()
53
&& qEqual( casted_rhs->metaData.begin(), casted_rhs->metaData.end(), metaData.begin())
54
&& casted_rhs->cut == cut;