2
* Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser/Library General Public License version 2,
6
* or (at your option) any later version, as published by the Free
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser/Library General Public License for more details
14
* You should have received a copy of the GNU Lesser/Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "BaseMergedModel.h"
21
#include "Serializator.h"
24
#include <KTemporaryFile>
29
class BaseMergedModel::Private {
31
QList < QString > modelIDs;
34
BaseMergedModel::BaseMergedModel()
35
: Lancelot::MergedActionListModel(),
41
BaseMergedModel::~BaseMergedModel()
46
void BaseMergedModel::addModel(const QString & id, ActionListModel * model)
48
addModel(id, model->selfIcon(), model->selfTitle(), model);
51
void BaseMergedModel::addModel(const QString & id, QIcon icon,
52
const QString & title, ActionListModel * model)
54
d->modelIDs.append(id);
55
Lancelot::MergedActionListModel::addModel(icon, title, model);
58
QMimeData * BaseMergedModel::modelMimeData(int index) const
60
if ((index < 0) || (index >= d->modelIDs.size())) {
64
QMap < QString , QString > map;
65
map["version"] = "1.0";
67
map["model"] = d->modelIDs.at(index);
69
QMimeData * data = new QMimeData();
70
data->setData("text/x-lancelotpart", Serializator::serialize(map).toAscii());
74
void BaseMergedModel::setModelDropActions(int index, Qt::DropActions & actions,
75
Qt::DropAction & defaultAction)
78
actions = Qt::CopyAction;
79
defaultAction = Qt::CopyAction;
83
} // namespace Lancelot