From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kuickshow/src/kuickfile.h | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 kuickshow/src/kuickfile.h (limited to 'kuickshow/src/kuickfile.h') diff --git a/kuickshow/src/kuickfile.h b/kuickshow/src/kuickfile.h new file mode 100644 index 00000000..957db6ee --- /dev/null +++ b/kuickshow/src/kuickfile.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** $Id: .emacs,v 1.3 2002/02/20 15:06:53 gis Exp $ +** +** Created : 2006 +** +** Copyright (C) 2006 Carsten Pfeiffer +** +****************************************************************************/ + +#ifndef KUICKFILE_H +#define KUICKFILE_H + +#include +#include + +#include +#include + +namespace KIO { + class Job; + class FileCopyJob; +} + +class KuickFile : public QObject +{ + Q_OBJECT + +public: + enum DownloadStatus + { + OK = 1, + CANCELED, + ERROR + }; + + KuickFile(const KURL& url); + + /** + * Cleans up resources and removes any temporary file, if available. + */ + ~KuickFile(); + + const KURL& url() const { return m_url; } + + + QString localFile() const; + + bool download(); + + /** + * @return true if download is in progress + */ + bool isDownloading() const { return m_job != 0L; } + + /** + * @return true if a local file is available, that is, + * @ref #localFile will return a non-empty name + * ### HERE ADD mostlylocal thing! + */ + bool isAvailable() const { return !localFile().isEmpty(); } + + /** + * @return true if @ref #isAvailable() returns true AND @ref #url() is a remote URL, + * i.e. the file really has been downloaded. + */ + bool hasDownloaded() const; + + /** + * Opens a modal dialog window, blocking user interaction until the download + * has finished. If the file is already available, this function will return true + * immediately. + * @return true when the download has finished or false when the user aborted the dialog + */ + KuickFile::DownloadStatus waitForDownload( QWidget *parent ); + +// bool needsDownload(); + +signals: + /** + * Signals that download has finished for that file. Will only be emitted for non-local files! + */ + void downloaded( KuickFile * ); + +private slots: + void slotResult( KIO::Job *job ); + void slotProgress( KIO::Job *job, unsigned long percent ); + +private: + KURL m_url; + QString m_localFile; + KIO::FileCopyJob *m_job; + KProgress *m_progress; + int m_currentProgress; + +}; + +bool operator==( const KuickFile& first, const KuickFile& second ); + +#endif // KUICKFILE_H -- cgit v1.2.1