[Pkg-owncloud-commits] [owncloud-client] 311/498: Sharedialog show thumbnail of file (if available)
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit b686a3dbdb76eef5ee12990a619f1fe819e4a236
Author: Roeland Jago Douma <roeland at famdouma.nl>
Date: Thu Jul 9 09:19:04 2015 +0200
Sharedialog show thumbnail of file (if available)
---
src/gui/sharedialog.cpp | 27 +++++++++++++++++++++++++++
src/gui/sharedialog.h | 15 +++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index 2bcb126..de6b9ce 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -275,6 +275,12 @@ void ShareDialog::getShares()
job->addPassStatusCode(404); // don't report error if share doesn't exist yet
connect(job, SIGNAL(jobFinished(QVariantMap)), this, SLOT(slotSharesFetched(QVariantMap)));
job->start();
+
+ if (QFileInfo(_localPath).isFile()) {
+ ThumbnailJob *job2 = new ThumbnailJob(_sharePath, _account, this);
+ connect(job2, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray)));
+ job2->start();
+ }
}
void ShareDialog::slotSharesFetched(const QVariantMap &reply)
@@ -723,4 +729,25 @@ bool OcsShareJob::finished()
return true;
}
+ThumbnailJob::ThumbnailJob(const QString &path, AccountPtr account, QObject* parent)
+: AbstractNetworkJob(account, "", parent)
+{
+ _url = Account::concatUrlPath(account->url(), QLatin1String("index.php/apps/files/api/v1/thumbnail/150/150/") + path);
+ setIgnoreCredentialFailure(true);
+}
+
+void ThumbnailJob::start()
+{
+ qDebug() << Q_FUNC_INFO;
+ setReply(getRequest(_url));
+ setupConnections(reply());
+ AbstractNetworkJob::start();
+}
+
+bool ThumbnailJob::finished()
+{
+ emit jobFinished(reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), reply()->readAll());
+ return true;
+}
+
}
diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h
index c07d0c3..980e38d 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharedialog.h
@@ -49,6 +49,21 @@ private:
};
+class ThumbnailJob : public AbstractNetworkJob {
+ Q_OBJECT
+public:
+ explicit ThumbnailJob(const QString& path, AccountPtr account, QObject* parent = 0);
+public slots:
+ void start() Q_DECL_OVERRIDE;
+signals:
+ void jobFinished(int statusCode, QByteArray reply);
+private slots:
+ virtual bool finished() Q_DECL_OVERRIDE;
+private:
+ QUrl _url;
+};
+
+
namespace Ui {
class ShareDialog;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list