Add (and install) svg for the new krunner interface.
[kdebase/uwolfer.git] / workspace / klipper / historyurlitem.cpp
blob8c2ff06628198cfda1f7e7d1d9b2733977a2daf4
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 <QMimeData>
24 HistoryURLItem::HistoryURLItem( const KUrl::List &_urls, KUrl::MetaDataMap _metaData, bool _cut )
25 : urls( _urls ), metaData( _metaData ), cut( _cut )
29 /* virtual */
30 void HistoryURLItem::write( QDataStream& stream ) const
32 stream << QString( "url" ) << urls << metaData << (int)cut;
35 QString HistoryURLItem::text() const {
36 return urls.toStringList().join( " " );
39 QMimeData* HistoryURLItem::mimeData() const {
40 QMimeData *data = new QMimeData();
41 urls.populateMimeData(data, metaData);
42 data->setData("application/x-kde-cutselection", QByteArray(cut ? "1" : "0"));
43 return data;
46 bool HistoryURLItem::operator==( const HistoryItem& rhs) const
48 if ( const HistoryURLItem* casted_rhs = dynamic_cast<const HistoryURLItem*>( &rhs ) ) {
49 return casted_rhs->urls == urls
50 && casted_rhs->metaData.count() == metaData.count()
51 && qEqual( casted_rhs->metaData.begin(), casted_rhs->metaData.end(), metaData.begin())
52 && casted_rhs->cut == cut;
54 return false;