• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

blogilo

  • sources
  • kde-4.14
  • kdepim
  • blogilo
  • src
syncuploader.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Blogilo, A KDE Blogging Client
3 
4  Copyright (C) 2008-2010 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5  Copyright (C) 2008-2010 Golnaz Nilieh <g382nilieh@gmail.com>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License or (at your option) version 3 or any later version
11  accepted by the membership of KDE e.V. (or its successor approved
12  by the membership of KDE e.V.), which shall act as a proxy
13  defined in Section 14 of version 3 of the license.
14 
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, see http://www.gnu.org/licenses/
23 */
24 
25 #include "syncuploader.h"
26 
27 #include <kdebug.h>
28 #include "backend.h"
29 #include "bilbomedia.h"
30 #include <QEventLoop>
31 
32 class SyncUploader::Private
33 {
34 public:
35  Private()
36  :mCurrentMedia(0),
37  loop(0),
38  success(false)
39  {}
40  BilboMedia *mCurrentMedia;
41  QEventLoop *loop;
42  QString error;
43  bool success;
44 };
45 
46 SyncUploader::SyncUploader( QObject *parent )
47  :QObject(parent),d(new Private)
48 {
49 }
50 
51 SyncUploader::~SyncUploader()
52 {
53  delete d;
54 }
55 
56 QString SyncUploader::errorMessage() const
57 {
58  return d->error;
59 }
60 
61 bool SyncUploader::uploadMedia( Backend *backend, BilboMedia *media )
62 {
63  if (!backend || !media){
64  kError()<<"Media or Backend is NULL";
65  return false;
66  }
67  d->loop = new QEventLoop(this);
68  d->mCurrentMedia = media;
69  connect( backend, SIGNAL(sigMediaUploaded(BilboMedia*)), this, SLOT(slotMediaFileUploaded(BilboMedia*)) );
70  connect( backend, SIGNAL(sigMediaError(QString,BilboMedia*)),
71  this, SLOT(slotMediaError(QString,BilboMedia*)) );
72 
73  backend->uploadMedia( media );
74  if ( d->loop->exec()==0 )
75  return true;
76  else
77  return false;
78 }
79 
80 void SyncUploader::slotMediaFileUploaded( BilboMedia *media )
81 {
82  if (media && media == d->mCurrentMedia){
83  kDebug();
84  d->success = true;
85  d->loop->exit();
86  }
87 }
88 
89 void SyncUploader::slotMediaError( const QString &errorMessage, BilboMedia* media )
90 {
91  if (media && media == d->mCurrentMedia){
92  d->success = false;
93  d->error = errorMessage;
94  d->loop->exit(1);
95  }
96 }
97 
SyncUploader::~SyncUploader
~SyncUploader()
Definition: syncuploader.cpp:51
syncuploader.h
QEventLoop
SyncUploader::SyncUploader
SyncUploader(QObject *parent=0)
Definition: syncuploader.cpp:46
SyncUploader::errorMessage
QString errorMessage() const
Definition: syncuploader.cpp:56
QObject
bilbomedia.h
QString
Backend::uploadMedia
void uploadMedia(BilboMedia *media)
Upload a new Media object e.g.
Definition: backend.cpp:191
Backend
Engine of application.
Definition: backend.h:45
BilboMedia
Definition: bilbomedia.h:38
SyncUploader::uploadMedia
bool uploadMedia(Backend *backend, BilboMedia *media)
Synchronous Media file uploader!
Definition: syncuploader.cpp:61
backend.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:16 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

blogilo

Skip menu "blogilo"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal