not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / klipper / historyurlitem.cpp
blobc50e62e7c6bcd129dd7d294c1f7aca3e677dd848
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 : m_urls( _urls ), m_metaData( _metaData ), m_cut( _cut )
29 /* virtual */
30 void HistoryURLItem::write( QDataStream& stream ) const
32 stream << QString( "url" ) << m_urls << m_metaData << (int)m_cut;
35 QString HistoryURLItem::text() const {
36 return m_urls.toStringList().join( " " );
39 QMimeData* HistoryURLItem::mimeData() const {
40 QMimeData *data = new QMimeData();
41 m_urls.populateMimeData(data, m_metaData);
42 data->setData("application/x-kde-cutselection", QByteArray(m_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->m_urls == m_urls
50 && casted_rhs->m_metaData.count() == m_metaData.count()
51 && qEqual( casted_rhs->m_metaData.begin(), casted_rhs->m_metaData.end(), m_metaData.begin())
52 && casted_rhs->m_cut == m_cut;
54 return false;