Commit 51a29231 authored by David Barchiesi's avatar David Barchiesi

Merge branch 'master' into drives

parents 23d663af f4d72327
install(FILES gdrive-network.desktop
DESTINATION ${KDE_INSTALL_DATADIR}/remoteview)
install(FILES org.kde.kio_gdrive.appdata.xml
install(FILES org.kde.kio_gdrive.metainfo.xml
DESTINATION ${KDE_INSTALL_METAINFODIR})
......@@ -109,6 +109,7 @@
<caption xml:lang="it">Dolphin che mostra KIO GDrive nella parte inferiore destra, e Falkon che sfoglia Google Drive nella parte superiore sinistra.</caption>
<caption xml:lang="ko">오른쪽 아래: Dolphin으로 연 KIO GDrive, 왼쪽 위: Falkon으로 연 Google 드라이브.</caption>
<caption xml:lang="nl">Dolphin die KIO-GDrive rechtsonder toont en Falkon browsing Google Drive linksboven.</caption>
<caption xml:lang="nn">Dolphin-vindauge med KIO GDrive nede til høgre, samt Falkon som viser Google Drive oppe til venstre.</caption>
<caption xml:lang="pl">Dolphin pokazujący KIO GDrive w dolnym, prawym narożniku i Falkon przeglądający Dysk Google w górnym, lewym narożniku.</caption>
<caption xml:lang="pt">O Dolphin a mostrar o KIO GDrive em baixo e à direita, assim como o Falkon a navegar pelo Google Drive em cima e à esquerda.</caption>
<caption xml:lang="pt-BR">O Dolphin mostrando o KIO GDrive abaixo à direita, assim como o Falkon navegando pelo Google Drive acima à esquerda.</caption>
......
......@@ -57,6 +57,7 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QMimeDatabase>
using namespace KGAPI2;
using namespace Drive;
......@@ -843,7 +844,7 @@ void KIOGDrive::get(const QUrl &url)
finished();
}
bool KIOGDrive::readPutData(QTemporaryFile &tempFile)
bool KIOGDrive::readPutData(QTemporaryFile &tempFile, FilePtr &fileMetaData)
{
// TODO: Instead of using a temp file, upload directly the raw data (requires
// support in LibKGAPI)
......@@ -871,6 +872,10 @@ bool KIOGDrive::readPutData(QTemporaryFile &tempFile)
}
}
} while (result > 0);
const QMimeType mime = QMimeDatabase().mimeTypeForFileNameAndData(fileMetaData->title(), &tempFile);
fileMetaData->setMimeType(mime.name());
tempFile.close();
if (result == -1) {
......@@ -923,9 +928,10 @@ bool KIOGDrive::putUpdate(const QUrl &url)
return false;
}
const FilePtr file = objects[0].dynamicCast<File>();
FilePtr file = objects[0].dynamicCast<File>();
QTemporaryFile tmpFile;
if (!readPutData(tmpFile)) {
if (!readPutData(tmpFile, file)) {
error(KIO::ERR_CANNOT_READ, url.path());
return false;
}
......@@ -972,7 +978,7 @@ bool KIOGDrive::putCreate(const QUrl &url)
*/
QTemporaryFile tmpFile;
if (!readPutData(tmpFile)) {
if (!readPutData(tmpFile, file)) {
error(KIO::ERR_CANNOT_READ, url.path());
return false;
}
......
......@@ -103,7 +103,7 @@ private:
bool putUpdate(const QUrl &url);
bool putCreate(const QUrl &url);
bool readPutData(QTemporaryFile &tmpFile);
bool readPutData(QTemporaryFile &tmpFile, KGAPI2::Drive::FilePtr &file);
/**
* Executes a KGAPI2::Job in an event loop, retrying the job until success or failure.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment