1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : drag and drop camera management
9
* Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
10
* Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
* This program is free software; you can redistribute it
13
* and/or modify it under the terms of the GNU General
14
* Public License as published by the Free Software Foundation;
15
* either version 2, or (at your option)
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* ============================================================ */
29
#include <qdatetime.h>
32
#include <qdatastream.h>
36
#include "cameratype.h"
37
#include "cameradragobject.h"
42
CameraDragObject::CameraDragObject(const CameraType& ctype, QWidget *dragSource)
43
: QStoredDrag("camera/unknown", dragSource)
48
CameraDragObject::~CameraDragObject()
52
void CameraDragObject::setCameraType(const CameraType& ctype)
55
QDataStream ds(byteArray, IO_WriteOnly);
61
ds << ctype.lastAccess();
63
setEncodedData(byteArray);
66
bool CameraDragObject::canDecode(const QMimeSource* e)
68
return e->provides("camera/unknown");
71
bool CameraDragObject::decode(const QMimeSource* e, CameraType& ctype)
73
QByteArray payload = e->encodedData("camera/unknown");
76
QString title, model, port, path;
79
QDataStream ds(payload, IO_ReadOnly);
86
ctype = CameraType(title, model, port, path, lastAccess);
94
} // namespace Digikam