diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kuickshow/src/kuickfile.h | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
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
Diffstat (limited to 'kuickshow/src/kuickfile.h')
-rw-r--r-- | kuickshow/src/kuickfile.h | 99 |
1 files changed, 99 insertions, 0 deletions
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 <[email protected]> +** +****************************************************************************/ + +#ifndef KUICKFILE_H +#define KUICKFILE_H + +#include <qobject.h> +#include <qstring.h> + +#include <kurl.h> +#include <kprogress.h> + +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 |