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

KNewStuff

  • sources
  • kde-4.12
  • kdelibs
  • knewstuff
  • knewstuff3
  • core
upload.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2007 Josef Spillner <spillner@kde.org>
3  Copyright (C) 2007-2009 Frederik Gladhorn <gladhorn@kde.org>
4  Copyright (c) 2009 Jeremy Whiting <jpwhiting@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library 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  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "upload.h"
22 
23 /*
24 bool Engine::uploadEntry(Provider *provider, const Entry& entry)
25 {
26  //kDebug() << "Uploading " << entry.name().representation() << "...";
27 
28  //if (d->uploadedentry) {
29  // kError() << "Another upload is in progress!" << endl;
30  // return false;
31  //}
32 
33  //if (!provider->uploadUrl().isValid()) {
34  // kError() << "The provider doesn't support uploads." << endl;
35  // return false;
36 
37  // // FIXME: support for <noupload> will go here (file bundle creation etc.)
38  //}
39 
41  //d->uploadprovider = provider;
42  //d->uploadedentry = entry;
43 
44  //KUrl sourcepayload = KUrl(entry.payload().representation());
45  //KUrl destfolder = provider->uploadUrl();
46 
47  //destfolder.setFileName(sourcepayload.fileName());
48 
49  //KIO::FileCopyJob *fcjob = KIO::file_copy(sourcepayload, destfolder, -1, KIO::Overwrite | KIO::HideProgressInfo);
50  //connect(fcjob,
51  // SIGNAL(result(KJob*)),
52  // SLOT(slotUploadPayloadResult(KJob*)));
53 
54  return true;
55 }
56 */
57 /*
58 void Engine::slotUploadPayloadResult(KJob *job)
59 {
60  //if (job->error()) {
61  // kError() << "Cannot upload payload file." << endl;
62  // kError() << job->errorString() << endl;
63 
64  // d->uploadedentry = NULL;
65  // d->uploadprovider = NULL;
66 
67  // emit signalEntryFailed();
68  // return;
69  //}
70 
71  //if (d->uploadedentry.preview().representation().isEmpty()) {
72  // // FIXME: we abuse 'job' here for the shortcut if there's no preview
73  // slotUploadPreviewResult(job);
74  // return;
75  //}
76 
77  //KUrl sourcepreview = KUrl(d->uploadedentry.preview().representation());
78  //KUrl destfolder = d->uploadprovider->uploadUrl();
79 
80  //destfolder.setFileName(sourcepreview.fileName());
81 
82  //KIO::FileCopyJob *fcjob = KIO::file_copy(sourcepreview, destfolder, -1, KIO::Overwrite | KIO::HideProgressInfo);
83  //connect(fcjob,
84  // SIGNAL(result(KJob*)),
85  // SLOT(slotUploadPreviewResult(KJob*)));
86 }
87 
88 void Engine::slotUploadPreviewResult(KJob *job)
89 {
90  //if (job->error()) {
91  // kError() << "Cannot upload preview file." << endl;
92  // kError() << job->errorString() << endl;
93 
94  // d->uploadedentry = NULL;
95  // d->uploadprovider = NULL;
96 
97  // emit signalEntryFailed();
98  // return;
99  //}
100 
103 
105  //KUrl sourcemeta = QString(KGlobal::dirs()->saveLocation("tmp") + KRandom::randomString(10) + ".meta");
106  //KUrl destfolder = d->uploadprovider->uploadUrl();
107 
108  //destfolder.setFileName(sourcemeta.fileName());
109 
110  //EntryHandler eh(*d->uploadedentry);
111  //QDomElement exml = eh.entryXML();
112 
113  //QDomDocument doc;
114  //QDomElement root = doc.createElement("ghnsupload");
115  //root.appendChild(exml);
116 
117  //QFile f(sourcemeta.path());
118  //if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
119  // kError() << "Cannot write meta information to '" << sourcemeta << "'." << endl;
120 
121  // d->uploadedentry = NULL;
122  // d->uploadprovider = NULL;
123 
124  // emit signalEntryFailed();
125  // return;
126  //}
127  //QTextStream metastream(&f);
128  //metastream << root;
129  //f.close();
130 
131  //KIO::FileCopyJob *fcjob = KIO::file_copy(sourcemeta, destfolder, -1, KIO::Overwrite | KIO::HideProgressInfo);
132  //connect(fcjob,
133  // SIGNAL(result(KJob*)),
134  // SLOT(slotUploadMetaResult(KJob*)));
135 }
136 */
137 
138 /*
139 void Engine::slotUploadMetaResult(KJob *job)
140 {
141  if (job->error()) {
142  kError() << "Cannot upload meta file." << endl;
143  kError() << job->errorString() << endl;
144 
145  d->uploadedentry = Entry();
146  d->uploadprovider = NULL;
147 
148  emit signalEntryFailed();
149  return;
150  } else {
151  d->uploadedentry = Entry();
152  d->uploadprovider = NULL;
153 
154  //KIO::FileCopyJob *fcjob = static_cast<KIO::FileCopyJob*>(job);
155  emit signalEntryUploaded();
156  }
157 }
158 */
159 
160 
upload.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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