Hi,
> Be careful, you're returning nothing from mount()/umount()/eject() which is
> asking for troubles as soon as a test will use them. I noticed the TODO,
> but you should at least return a job that fails immediately IMHO.
I have written FakeJob. Here is a patch.
Bye,
Davide Bettio
Index: backends/fake/fakevolume.cpp
===================================================================
--- backends/fake/fakevolume.cpp (revisione 526032)
+++ backends/fake/fakevolume.cpp (copia locale)
@@ -19,6 +19,8 @@
#include "fakevolume.h"
+#include "fakejob.h"
+
FakeVolume::FakeVolume( FakeDevice *device )
: FakeBlock( device )
{
@@ -93,17 +95,17 @@
KIO::Job *FakeVolume::mount( bool showProgressInfo )
{
- //TODO
+ return new FakeJob(showProgressInfo);
}
KIO::Job *FakeVolume::unmount( bool showProgressInfo )
{
- //TODO
+ return new FakeJob(showProgressInfo);
}
KIO::Job *FakeVolume::eject( bool showProgressInfo )
{
- //TODO
+ return new FakeJob(showProgressInfo);
}
#include "fakevolume.moc"
Index: backends/fake/fakejob.cpp
===================================================================
--- backends/fake/fakejob.cpp (revisione 0)
+++ backends/fake/fakejob.cpp (revisione 0)
@@ -0,0 +1,39 @@
+/* This file is part of the KDE project
+ Copyright (C) 2006 Davide Bettio <[EMAIL PROTECTED]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "fakejob.h"
+
+#include <QTimer>
+
+FakeJob::FakeJob( bool showProgressInfo )
+ : KIO::Job( showProgressInfo )
+{
+ QTimer::singleShot(0, this, SLOT(Fail()));
+}
+
+FakeJob::~FakeJob()
+{
+
+}
+
+void FakeJob::Fail()
+{
+ kill(false);
+}
+#include "fakejob.moc"
Index: backends/fake/fakejob.h
===================================================================
--- backends/fake/fakejob.h (revisione 0)
+++ backends/fake/fakejob.h (revisione 0)
@@ -0,0 +1,35 @@
+/* This file is part of the KDE project
+ Copyright (C) 2006 Davide Bettio <[EMAIL PROTECTED]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef FAKEJOB_H
+#define FAKEJOB_H
+
+#include <kio/jobclasses.h>
+
+class FakeJob : public KIO::Job
+{
+ Q_OBJECT
+public:
+ FakeJob( bool showProgressInfo );
+ virtual ~FakeJob();
+private slots:
+ void Fail();
+};
+
+#endif
Index: backends/fake/Makefile.am
===================================================================
--- backends/fake/Makefile.am (revisione 526032)
+++ backends/fake/Makefile.am (copia locale)
@@ -6,7 +6,7 @@
kdehw_fake_la_LIBADD = $(LIB_QTCORE) $(LIB_QT) $(LIB_QTXML) $(LIB_KDECORE) $(LIB_KIO) $(top_builddir)/kdehw/ifaces/libkdehwifaces.la
kdehw_fake_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
-kdehw_fake_la_SOURCES = fakemanager.cpp fakedevice.cpp fakecapability.cpp fakeblock.cpp fakestorage.cpp fakecdrom.cpp fakevolume.cpp fakeopticaldisc.cpp fakecamera.cpp fakeportablemediaplayer.cpp fakeprocessor.cpp fakedisplay.cpp
+kdehw_fake_la_SOURCES = fakemanager.cpp fakedevice.cpp fakejob.cpp fakecapability.cpp fakeblock.cpp fakestorage.cpp fakecdrom.cpp fakevolume.cpp fakeopticaldisc.cpp fakecamera.cpp fakeportablemediaplayer.cpp fakeprocessor.cpp fakedisplay.cpp
METASOURCES = AUTO
_______________________________________________
Kde-hardware-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-hardware-devel