summaryrefslogtreecommitdiffstats
path: root/src/k3bemptydiscwaiter.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
commit50b48aec6ddd451a6d1709c0942477b503457663 (patch)
treea9ece53ec06fd0a2819de7a2a6de997193566626 /src/k3bemptydiscwaiter.h
downloadk3b-50b48aec6ddd451a6d1709c0942477b503457663.tar.gz
k3b-50b48aec6ddd451a6d1709c0942477b503457663.zip
Added abandoned KDE3 version of K3B
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/k3bemptydiscwaiter.h')
-rw-r--r--src/k3bemptydiscwaiter.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/src/k3bemptydiscwaiter.h b/src/k3bemptydiscwaiter.h
new file mode 100644
index 0000000..ce3bced
--- /dev/null
+++ b/src/k3bemptydiscwaiter.h
@@ -0,0 +1,139 @@
+/*
+ *
+ * $Id: k3bemptydiscwaiter.h 619556 2007-01-03 17:38:12Z trueg $
+ * Copyright (C) 2003-2007 Sebastian Trueg <trueg@k3b.org>
+ *
+ * This file is part of the K3b project.
+ * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * See the file "COPYING" for the exact licensing terms.
+ */
+
+
+#ifndef K3BEMPTYDISCWAITER_H
+#define K3BEMPTYDISCWAITER_H
+
+#include <kdialogbase.h>
+#include <k3bjobhandler.h>
+
+#include <k3bdiskinfo.h>
+
+namespace K3bDevice {
+ class Device;
+ class DeviceHandler;
+}
+
+
+/**
+ * Tests for an empty cd in a given device.
+ *
+ * Use the static wait methods.
+ *
+ * @author Sebastian Trueg
+ */
+class K3bEmptyDiscWaiter : public KDialogBase, public K3bJobHandler
+{
+ Q_OBJECT
+
+ public:
+ ~K3bEmptyDiscWaiter();
+
+ /**
+ * This should be replaced by the mediaType that was found or -1 for forced.
+ * MEDIA_NONE if canceled.
+ */
+ enum returnValue { DISK_READY = 0,
+ CANCELED = -1 };
+
+ /**
+ * the same as waitForEmptyDisc( false );
+ */
+ int exec();
+
+ /**
+ * @reimplemented from K3bJobHandler
+ * \internal do not use!
+ */
+ int waitForMedia( K3bDevice::Device*,
+ int mediaState = K3bDevice::STATE_EMPTY,
+ int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
+ const QString& message = QString::null );
+
+ /**
+ * @reimplemented from K3bJobHandler
+ */
+ bool questionYesNo( const QString& text,
+ const QString& caption = QString::null,
+ const QString& yesText = QString::null,
+ const QString& noText = QString::null );
+
+ /**
+ * reimplemented from K3bJobHandler
+ */
+ void blockingInformation( const QString& text,
+ const QString& caption = QString::null );
+
+ /**
+ * This only openes a dialog if the first check failed.
+ */
+ static int wait( K3bDevice::Device* device,
+ bool appendable = false,
+ int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
+ QWidget* parent = 0 );
+
+ /**
+ * Starts the emptydiskwaiter.
+ *
+ * \param mediaState a bitwise combination of the K3bDevice::State enum
+ * \param mediaType a bitwise combination of the K3bDevice::MediaType enum
+ * \return the found MediaType on success, 0 if forced and -1 if canceled
+ */
+ static int wait( K3bDevice::Device*,
+ int mediaState,
+ int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
+ const QString& message = QString::null,
+ QWidget* parent = 0 );
+
+ protected slots:
+ void slotCancel();
+ void slotUser1();
+ void slotUser2();
+ void slotUser3();
+ void slotMediumChanged( K3bDevice::Device* );
+ void showDialog();
+ void continueWaiting();
+ void slotErasingFinished( bool );
+ void slotReloadingAfterErasingFinished( K3bDevice::DeviceHandler* );
+
+ protected:
+ /**
+ * Use the static wait methods.
+ */
+ explicit K3bEmptyDiscWaiter( K3bDevice::Device* device, QWidget* parent = 0, const char* name = 0 );
+
+ int waitForDisc( int mediaState = K3bDevice::STATE_EMPTY,
+ int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
+ const QString& message = QString::null );
+
+
+ /**
+ * Nobody closes this dialog but itself!
+ */
+ void closeEvent( QCloseEvent* ) {}
+
+ private:
+ void finishWaiting( int );
+ void prepareErasingDialog();
+
+ QWidget* parentWidgetToUse();
+
+ class Private;
+ Private* d;
+};
+
+
+#endif