Description: This is a small applet to display the state of your harddisk protected with the hdapsd.
A basic installation tutorial: # wget http://www.hirnfrei.org/~joerg/applet_hdaps/applet_hdaps-0.1.tar.bz2 # tar xjf applet_hdaps-0.1.tar.bz2 # cd applet_hdaps-0.1 # cmake -DCMAKE_INSTALL_PREFIX=/usr/kde/4.0 . # make # make install
I think the following might be better, the only change to above is one line commented out, although I could not yet fully test this.
void AppletHdaps::init()
{
//Plasma::Svg* m_svg;
m_svg = new Plasma::Svg(this);
m_svg->setImagePath("widgets/drive-harddisk-running");
m_svg->setContainsMultipleImages( false );
updateGeometry();
searchDevices();
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething()));
m_pTimer->start(250);
}
This applet has the problem as khdapsmonitor for KDE3:
--- applet_hdaps.cpp~ 2009-02-05 20:37:04.000000000 +0100
+++ applet_hdaps.cpp 2009-02-05 20:37:04.000000000 +0100
@@ -94,7 +94,7 @@
block->setPath("/sys/block");
QFile *file = new QFile();
for(int i = 0; i < (int)block->count(); i++) {
- QString fn = QString("/sys/block/") + (*block)[i] + "/queue/protect";
+ QString fn = QString("/sys/block/") + (*block)[i] + "/device/unload_heads";
file->setFileName(fn);
if ( file->open(QIODevice::ReadOnly | QIODevice::Text) ) {
m_pDevices->append(fn);
As you can see you need to change /queue/protect -> /device/unload_heads
Greetings
m0nk
For 4.2 you also need this patch, because Plasma is part of KDE now:
--- CMakeLists.txt.orig 2009-02-05 20:48:45.000000000 +0100
+++ CMakeLists.txt 2009-02-05 20:45:26.000000000 +0100
@@ -11,7 +11,7 @@
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
-find_package(Plasma REQUIRED)
+#find_package(Plasma REQUIRED)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
@@ -26,7 +26,7 @@
# Now make sure all files get to the right place
kde4_add_plugin(plasma_applet_hdaps ${applet_hdaps_SRCS})
target_link_libraries(plasma_applet_hdaps
- ${PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
+ ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
install(TARGETS plasma_applet_hdaps
DESTINATION ${PLUGIN_INSTALL_DIR})
Unfortunately this applet crashes Plasma, when I try to add it. KDE is 4.1, distro is openSUSE 11.0.
Any suggestions?
Btw. I've applied the patch, suggested here to get it compiled.
Greetings
m0nk
I have done step by step. But with make have a massege:
make: *** No targets specified and no makefile found. Stop.
With last step cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..
was all ok.
oleksiy@oleksiy-laptop:~/applet_hdaps-0.1/build$ cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..
-- Found Qt-Version 4.4.1 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Found Automoc4: /usr/bin/automoc4
-- Found Perl: /usr/bin/perl
-- Found KDE 4.1 include dir: /usr/lib/kde4/include
-- Found KDE 4.1 library dir: /usr/lib/kde4/lib
-- Found KDE4 kconfig_compiler preprocessor: /usr/lib/kde4/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oleksiy/applet_hdaps-0.1
When I have done make in /applet_hdaps-0.1 ordner. I have get that:
oleksiy@oleksiy-laptop:~/applet_hdaps-0.1$ make
[ 50%] Building CXX object CMakeFiles/plasma_applet_hdaps.dir/applet_hdaps.o
/home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp: In member function ‘virtual void AppletHdaps::init()’:
/home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:38: error: no matching function for call to ‘Plasma::Svg::Svg(constchar [31], AppletHdaps* const)’
/usr/lib/kde4/include/KDE/Plasma/../../plasma/svg.h:73: note: candidates are: Plasma::Svg::Svg(QObject*)
/usr/lib/kde4/include/KDE/Plasma/../../plasma/svg.h:51: note: Plasma::Svg::Svg(const Plasma::Svg&)
/home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:39: error: ‘class Plasma::Svg’ has no member named ‘setContentType’
/home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:39: error: ‘SingleImage’ is not a member of ‘Plasma::Svg’
make[2]: *** [CMakeFiles/plasma_applet_hdaps.dir/applet_hdaps.o] Error 1
make[1]: *** [CMakeFiles/plasma_applet_hdaps.dir/all] Error 2
make: *** [all] Error 2
Why? Can you help me?
Thanks.
I had the same problem, just change the function void AppletHdaps::init() with this:
void AppletHdaps::init()
{
m_svg = new Plasma::Svg("widgets/drive-harddisk-running", this);
m_svg->setContentType(Plasma::Svg::SingleImage);
searchDevices();
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething()));
m_pTimer->start(250);
}
Now it should compile. I sent the patch to the developer but he didn't answer.
Good luck :)
I'm sorry, I think I posted the original code :P
This is what I have:
void AppletHdaps::init()
{
Plasma::Svg* m_svg;
m_svg = new Plasma::Svg(this);
m_svg->setImagePath("widgets/drive-harddisk-running");
m_svg->setContainsMultipleImages( false );
updateGeometry();
searchDevices();
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething()));
m_pTimer->start(250);
}
One of those should work :P
BTW, I'm using KDE4.1
Ratings & Comments
15 Comments
Hi I have used all patches above but i can't get it to work. When i add it to the desktop i had only a small black dot. Any ideas? THX Manuel
Try this one: http://kde-look.org/content/show.php?content=103481 It looks way better and it works out of the box. Greetings m0nk
I think the following might be better, the only change to above is one line commented out, although I could not yet fully test this. void AppletHdaps::init() { //Plasma::Svg* m_svg; m_svg = new Plasma::Svg(this); m_svg->setImagePath("widgets/drive-harddisk-running"); m_svg->setContainsMultipleImages( false ); updateGeometry(); searchDevices(); connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething())); m_pTimer->start(250); }
You guys who added the fixes, do you mind if I commit this to KDE's SVN in playground?
I use this fix to run the applet successfully, so as far as I see it works.
This applet has the problem as khdapsmonitor for KDE3: --- applet_hdaps.cpp~ 2009-02-05 20:37:04.000000000 +0100 +++ applet_hdaps.cpp 2009-02-05 20:37:04.000000000 +0100 @@ -94,7 +94,7 @@ block->setPath("/sys/block"); QFile *file = new QFile(); for(int i = 0; i < (int)block->count(); i++) { - QString fn = QString("/sys/block/") + (*block)[i] + "/queue/protect"; + QString fn = QString("/sys/block/") + (*block)[i] + "/device/unload_heads"; file->setFileName(fn); if ( file->open(QIODevice::ReadOnly | QIODevice::Text) ) { m_pDevices->append(fn); As you can see you need to change /queue/protect -> /device/unload_heads Greetings m0nk
I tried all patches here, but it always just shows a green arrow. I have KDE4.2 and kernel-2.6.28.
I try # echo -1 > /sys/block/sda/device/unload_heads and now it works for me.
For 4.2 you also need this patch, because Plasma is part of KDE now: --- CMakeLists.txt.orig 2009-02-05 20:48:45.000000000 +0100 +++ CMakeLists.txt 2009-02-05 20:45:26.000000000 +0100 @@ -11,7 +11,7 @@ find_package(KDE4 REQUIRED) include(KDE4Defaults) -find_package(Plasma REQUIRED) +#find_package(Plasma REQUIRED) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories( @@ -26,7 +26,7 @@ # Now make sure all files get to the right place kde4_add_plugin(plasma_applet_hdaps ${applet_hdaps_SRCS}) target_link_libraries(plasma_applet_hdaps - ${PLASMA_LIBS} ${KDE4_KDEUI_LIBS}) + ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS}) install(TARGETS plasma_applet_hdaps DESTINATION ${PLUGIN_INSTALL_DIR})
Unfortunately this applet crashes Plasma, when I try to add it. KDE is 4.1, distro is openSUSE 11.0. Any suggestions? Btw. I've applied the patch, suggested here to get it compiled. Greetings m0nk
I have done step by step. But with make have a massege: make: *** No targets specified and no makefile found. Stop. With last step cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. was all ok. oleksiy@oleksiy-laptop:~/applet_hdaps-0.1/build$ cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. -- Found Qt-Version 4.4.1 (using /usr/bin/qmake) -- Found X11: /usr/lib/libX11.so -- Found Automoc4: /usr/bin/automoc4 -- Found Perl: /usr/bin/perl -- Found KDE 4.1 include dir: /usr/lib/kde4/include -- Found KDE 4.1 library dir: /usr/lib/kde4/lib -- Found KDE4 kconfig_compiler preprocessor: /usr/lib/kde4/bin/kconfig_compiler -- Found automoc4: /usr/bin/automoc4 -- Configuring done -- Generating done -- Build files have been written to: /home/oleksiy/applet_hdaps-0.1 When I have done make in /applet_hdaps-0.1 ordner. I have get that: oleksiy@oleksiy-laptop:~/applet_hdaps-0.1$ make [ 50%] Building CXX object CMakeFiles/plasma_applet_hdaps.dir/applet_hdaps.o /home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp: In member function ‘virtual void AppletHdaps::init()’: /home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:38: error: no matching function for call to ‘Plasma::Svg::Svg(constchar [31], AppletHdaps* const)’ /usr/lib/kde4/include/KDE/Plasma/../../plasma/svg.h:73: note: candidates are: Plasma::Svg::Svg(QObject*) /usr/lib/kde4/include/KDE/Plasma/../../plasma/svg.h:51: note: Plasma::Svg::Svg(const Plasma::Svg&) /home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:39: error: ‘class Plasma::Svg’ has no member named ‘setContentType’ /home/oleksiy/applet_hdaps-0.1/applet_hdaps.cpp:39: error: ‘SingleImage’ is not a member of ‘Plasma::Svg’ make[2]: *** [CMakeFiles/plasma_applet_hdaps.dir/applet_hdaps.o] Error 1 make[1]: *** [CMakeFiles/plasma_applet_hdaps.dir/all] Error 2 make: *** [all] Error 2 Why? Can you help me? Thanks.
I had the same problem, just change the function void AppletHdaps::init() with this: void AppletHdaps::init() { m_svg = new Plasma::Svg("widgets/drive-harddisk-running", this); m_svg->setContentType(Plasma::Svg::SingleImage); searchDevices(); connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething())); m_pTimer->start(250); } Now it should compile. I sent the patch to the developer but he didn't answer. Good luck :)
I'm sorry, I think I posted the original code :P This is what I have: void AppletHdaps::init() { Plasma::Svg* m_svg; m_svg = new Plasma::Svg(this); m_svg->setImagePath("widgets/drive-harddisk-running"); m_svg->setContainsMultipleImages( false ); updateGeometry(); searchDevices(); connect(m_pTimer, SIGNAL(timeout()), this, SLOT(doSomething())); m_pTimer->start(250); } One of those should work :P BTW, I'm using KDE4.1
Hi mitoyarzun, Thank you for this fix. I try it. Good luck :)
My packages for openSUSE 10.2 and newer can be found here: http://software.opensuse.org/search?baseproject=ALL&p=1&q=kde4-plasmoid-hdaps