File indexing completed on 2025-01-05 03:53:24

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-11-18
0007  * Description : a tool to export images to Dropbox web service
0008  *
0009  * SPDX-FileCopyrightText: 2013      by Pankaj Kumar <me at panks dot me>
0010  * SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 // local includes
0017 
0018 #include "dbmpform.h"
0019 
0020 // Qt includes
0021 
0022 #include <QFile>
0023 
0024 // Local includes
0025 
0026 #include "digikam_debug.h"
0027 
0028 namespace DigikamGenericDropBoxPlugin
0029 {
0030 
0031 DBMPForm::DBMPForm()
0032 {
0033 }
0034 
0035 DBMPForm::~DBMPForm()
0036 {
0037 }
0038 
0039 bool DBMPForm::addFile(const QString& imgPath)
0040 {
0041     QFile file(imgPath);
0042 
0043     if (!file.open(QIODevice::ReadOnly))
0044     {
0045         return false;
0046     }
0047 
0048     m_buffer = file.readAll();
0049     file.close();
0050 
0051     return true;
0052 }
0053 
0054 QByteArray DBMPForm::formData() const
0055 {
0056     return m_buffer;
0057 }
0058 
0059 } // namespace DigikamGenericDropBoxPlugin