SVN: toys/kernelupdatenotifier: . Makefile kernelupdatenotifier.cpp kernelupdatenotifier.h kernelupd...
shadzik
shadzik at pld-linux.org
Wed Mar 18 16:07:47 CET 2009
Author: shadzik
Date: Wed Mar 18 16:07:46 2009
New Revision: 10216
Added:
toys/kernelupdatenotifier/
toys/kernelupdatenotifier/Makefile
toys/kernelupdatenotifier/kernelupdatenotifier.cpp
toys/kernelupdatenotifier/kernelupdatenotifier.h
toys/kernelupdatenotifier/kernelupdatenotifier.notifyrc
toys/kernelupdatenotifier/kernelupdatenotifier.pro
toys/kernelupdatenotifier/main.cpp
Log:
- init
Added: toys/kernelupdatenotifier/Makefile
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/Makefile Wed Mar 18 16:07:46 2009
@@ -0,0 +1,206 @@
+#############################################################################
+# Makefile for building: kernelupdatenotifier
+# Generated by qmake (2.01a) (Qt 4.4.3) on: czw. mar 12 23:52:48 2009
+# Project: kernelupdatenotifier.pro
+# Template: app
+# Command: /usr/bin/qmake-qt4 -unix -o Makefile kernelupdatenotifier.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = i686-pld-linux-gcc
+CXX = i686-pld-linux-g++
+DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS = -pipe -O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -fno-strict-aliasing -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS = -pipe -O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -fno-strict-aliasing -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/KDE -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
+LINK = i686-pld-linux-g++
+LFLAGS =
+LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -L/usr/lib -L/usr/glib -pthread -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes -lXcursor -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread -lknotifyconfig -lkworkspace -lkdeui
+AR = ar cqs
+RANLIB =
+QMAKE = /usr/bin/qmake-qt4
+TAR = tar -cf
+COMPRESS = gzip -9f
+COPY = cp -f
+SED = sed
+COPY_FILE = $(COPY)
+COPY_DIR = $(COPY) -r
+INSTALL_FILE = install -m 644 -p
+INSTALL_DIR = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = kernelupdatenotifier.cpp \
+ main.cpp moc_kernelupdatenotifier.cpp
+OBJECTS = kernelupdatenotifier.o \
+ main.o \
+ moc_kernelupdatenotifier.o
+DIST = /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/release.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ kernelupdatenotifier.pro
+QMAKE_TARGET = kernelupdatenotifier
+DESTDIR =
+TARGET = kernelupdatenotifier
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: kernelupdatenotifier.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/release.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ /usr/lib/libQtGui.prl \
+ /usr/lib/libQtCore.prl
+ $(QMAKE) -unix -o Makefile kernelupdatenotifier.pro
+/usr/share/qt4/mkspecs/common/g++.conf:
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/release.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtCore.prl:
+qmake: FORCE
+ @$(QMAKE) -unix -o Makefile kernelupdatenotifier.pro
+
+dist:
+ @$(CHK_DIR_EXISTS) .tmp/kernelupdatenotifier1.0.0 || $(MKDIR) .tmp/kernelupdatenotifier1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/kernelupdatenotifier1.0.0/ && $(COPY_FILE) --parents kernelupdatenotifier.h .tmp/kernelupdatenotifier1.0.0/ && $(COPY_FILE) --parents kernelupdatenotifier.cpp main.cpp .tmp/kernelupdatenotifier1.0.0/ && (cd `dirname .tmp/kernelupdatenotifier1.0.0` && $(TAR) kernelupdatenotifier1.0.0.tar kernelupdatenotifier1.0.0 && $(COMPRESS) kernelupdatenotifier1.0.0.tar) && $(MOVE) `dirname .tmp/kernelupdatenotifier1.0.0`/kernelupdatenotifier1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/kernelupdatenotifier1.0.0
+
+
+clean:compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_kernelupdatenotifier.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_kernelupdatenotifier.cpp
+moc_kernelupdatenotifier.cpp: kernelupdatenotifier.h
+ /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) kernelupdatenotifier.h -o moc_kernelupdatenotifier.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean
+
+####### Compile
+
+kernelupdatenotifier.o: kernelupdatenotifier.cpp kernelupdatenotifier.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kernelupdatenotifier.o kernelupdatenotifier.cpp
+
+main.o: main.cpp kernelupdatenotifier.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+moc_kernelupdatenotifier.o: moc_kernelupdatenotifier.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kernelupdatenotifier.o moc_kernelupdatenotifier.cpp
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
Added: toys/kernelupdatenotifier/kernelupdatenotifier.cpp
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/kernelupdatenotifier.cpp Wed Mar 18 16:07:46 2009
@@ -0,0 +1,65 @@
+/* PLD Linux Kernel Update Notifier
+ * author: Bartosz 'shadzik' ¦wi±tek (shadzik at pld-linux.org)
+ * license: GPLv2+
+ * (c) 2009
+ *
+ * Thanks to Piotr 'vip' Budny for a Qt4 crash course ;)
+ *
+ */
+
+#include <QObject>
+#include <QProcess>
+#include <QCoreApplication>
+#include <knotification.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <qdebug.h>
+#include <kapplication.h>
+#include <kworkspace/kworkspace.h>
+
+#include "kernelupdatenotifier.h"
+
+void KernelUpdateNotifier::handleRebootAction(uint action){
+ KNotification *notify = (KNotification *) sender();
+ qDebug()<<"Reboot"<<action;
+ switch(action) {
+ case 1:
+ KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmYes;
+ KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeReboot;
+ qDebug()<<confirm<<type;
+ KWorkSpace::requestShutDown(confirm, type);
+ break;
+ }
+ qDebug()<<"Seems to be done";
+ //QProcess *reboot = new QProcess;
+ //reboot->start("sudo reboot");
+ notify->close();
+}
+
+void KernelUpdateNotifier::handleRebootActionClosed(){
+ kDebug("Don't Reboot");
+}
+
+void KernelUpdateNotifier::sendNotify(const QString &version) {
+
+ //KNotification::Persistent - still doesn't work in 4.2
+ KNotification *notify = new KNotification("KernelWasUpgraded", 0, KNotification::CloseOnTimeout);
+
+ QString text;
+ text = i18n("The Kernel was upgraded to version:") + "<br/>";
+ text += "<b>" + version + "</b><br/>";
+ text += i18n("Please reboot the machine.");
+ notify->setText(text);
+
+ QStringList actions;
+ actions << i18n("Reboot Now!");
+ notify->setActions(actions);
+ connect(notify, SIGNAL(activated(uint)),
+ this, SLOT(handleRebootAction(uint)));
+ connect(notify, SIGNAL(closed()),
+ this , SLOT(handleRebootActionClosed()));
+ notify->sendEvent();
+
+}
+
+
Added: toys/kernelupdatenotifier/kernelupdatenotifier.h
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/kernelupdatenotifier.h Wed Mar 18 16:07:46 2009
@@ -0,0 +1,35 @@
+/* PLD Linux Kernel Update Notifier
+ * author: Bartosz 'shadzik' ¦wi±tek (shadzik at pld-linux.org)
+ * license: GPLv2+
+ * (c) 2009
+ *
+ * Thanks to Piotr 'vip' Budny for a Qt4 crash course ;)
+ *
+ */
+
+#include <QObject>
+#include <QCoreApplication>
+#include <knotification.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#ifndef KERNELUPDATENOTIFIER_H
+#define KERNELUPDATENOTIFIER_H
+
+class KernelUpdateNotifier: public QObject {
+ Q_OBJECT
+
+private slots:
+ void handleRebootAction(uint action);
+ void handleRebootActionClosed();
+
+public:
+ void sendNotify(const QString &version);
+
+//private:
+// KNotification *notify;
+
+};
+
+#endif
+
Added: toys/kernelupdatenotifier/kernelupdatenotifier.notifyrc
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/kernelupdatenotifier.notifyrc Wed Mar 18 16:07:46 2009
@@ -0,0 +1,9 @@
+[Global]
+IconName=help-hint
+Name=kernelupdatenotifier
+Comment=KernelUpdateNotifier
+
+
+[Event/KernelWasUpgraded]
+Name=Kernel was upgraded
+Action=Sound|Popup
Added: toys/kernelupdatenotifier/kernelupdatenotifier.pro
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/kernelupdatenotifier.pro Wed Mar 18 16:07:46 2009
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Thu Mar 12 21:14:55 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += kernelupdatenotifier.h
+SOURCES += kernelupdatenotifier.cpp main.cpp
Added: toys/kernelupdatenotifier/main.cpp
==============================================================================
--- (empty file)
+++ toys/kernelupdatenotifier/main.cpp Wed Mar 18 16:07:46 2009
@@ -0,0 +1,23 @@
+/* PLD Linux Kernel Update Notifier
+ * author: Bartosz 'shadzik' ¦wi±tek (shadzik at pld-linux.org)
+ * license: GPLv2+
+ * (c) 2009
+ *
+ * Thanks to Piotr 'vip' Budny for a Qt4 crash course ;)
+ *
+ */
+
+#include <QObject>
+#include <QCoreApplication>
+
+#include "kernelupdatenotifier.h"
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+ KernelUpdateNotifier *aps = new KernelUpdateNotifier();
+ aps->sendNotify(argv[1]);
+ return app.exec();
+ //return 0;
+}
+
More information about the pld-cvs-commit
mailing list