[SCM] Kingston update notifier (update-notifier-kde) branch, master, updated. 0977ca081b68996535808afb035c8279895cba51

Pino Toscano pino-guest at alioth.debian.org
Wed May 12 22:06:36 UTC 2010


The following commit has been merged in the master branch:
commit 0977ca081b68996535808afb035c8279895cba51
Author: Pino Toscano <pino at kde.org>
Date:   Thu May 13 00:05:32 2010 +0200

    reuse the same component data of the module factory
    
    as it is available already, there's no need to construct a new one
    
    in the test(s), just create manually the component data needed
---
 src/kingston_update_notifier_module.cpp |    2 +-
 src/notifier.cpp                        |    8 ++++----
 src/notifier.h                          |    7 ++++---
 src/testapp_main.cpp                    |    3 ++-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/kingston_update_notifier_module.cpp b/src/kingston_update_notifier_module.cpp
index bcd7700..effeaba 100644
--- a/src/kingston_update_notifier_module.cpp
+++ b/src/kingston_update_notifier_module.cpp
@@ -40,7 +40,7 @@ K_PLUGIN_FACTORY(kingston_update_notifier_factory,
                 );
 K_EXPORT_PLUGIN(kingston_update_notifier_factory("kingston_update_notifier"))
 kingston_update_notifier_module_t::kingston_update_notifier_module_t(QObject* parent, const QList< QVariant >& ): KDEDModule(parent),
-    m_update_worker(new update_worker_t(this)), m_update_listener(new update_listener_t(this)), m_notifier(new notifier_t(this)),
+    m_update_worker(new update_worker_t(this)), m_update_listener(new update_listener_t(this)), m_notifier(new notifier_t(kingston_update_notifier_factory::componentData(), this)),
     m_reboot_listener(new reboot_listener_t(this)){
   connect(m_update_listener,SIGNAL(please_check_for_updates()),m_update_worker,SLOT(check_for_updates()));
   connect(m_update_worker,SIGNAL(updates_available(int,int)),m_notifier,SLOT(notify_new_updates(int,int)));
diff --git a/src/notifier.cpp b/src/notifier.cpp
index d9bd4ca..a3e457e 100644
--- a/src/notifier.cpp
+++ b/src/notifier.cpp
@@ -35,8 +35,8 @@
 #include <QDebug>
 
 
-notifier_t::notifier_t(QObject* parent): QObject(parent) {
-  m_component_data= new KComponentData("kingston_update_notifier");
+notifier_t::notifier_t(const KComponentData& component_data, QObject* parent): QObject(parent),
+  m_component_data(component_data) {
   m_reboot_nagger = new QTimer(this);
   m_reboot_nagger->setSingleShot(true);
   m_reboot_nagger->setInterval(60/*minutes*/ * 60/*seconds*/ * 1000/*msec*/);
@@ -67,7 +67,7 @@ void notifier_t::show_update_notification(const QString& title, const QString& m
   note->setTitle(title);
   note->setText(message);
   note->setPixmap(KIcon(iconname).pixmap(QSize(32,32)));
-  note->setComponentData(*m_component_data);
+  note->setComponentData(m_component_data);
   note->setActions(QStringList() << i18nc("Do the proposed action (upgrade, reboot, etc) later", "Later"));
   connect(note,SIGNAL(activated()),note,SLOT(close()));
   note->sendEvent();
@@ -79,7 +79,7 @@ void notifier_t::notify_reboot() {
   note->setTitle(i18n("Please reboot your system"));
   note->setText(i18n("In order to complete this upgrade, you need to reboot your system"));
   note->setPixmap(KIcon("system-reboot").pixmap(QSize(32,32)));
-  note->setComponentData(*m_component_data);
+  note->setComponentData(m_component_data);
   note->setActions(QStringList() << i18nc("Do the proposed action (upgrade, reboot, etc) later", "Later"));
   connect(note,SIGNAL(closed()),m_reboot_nagger,SLOT(start()));
   connect(note,SIGNAL(action1Activated()),m_reboot_nagger,SLOT(start()));
diff --git a/src/notifier.h b/src/notifier.h
index 6952ccb..f3aad97 100644
--- a/src/notifier.h
+++ b/src/notifier.h
@@ -29,19 +29,20 @@
 
 #include <QObject>
 
-class KComponentData;
+#include <KComponentData>
+
 class QTimer;
 class notifier_t : public QObject{
   Q_OBJECT
   public:
-    notifier_t(QObject* parent=0);
+    notifier_t(const KComponentData& component_data, QObject* parent=0);
   public Q_SLOTS:
     void notify_new_updates(int updates, int security_updates);
     void notify_reboot();
   private:
     void show_update_notification(const QString& title, const QString& message, const QString& iconname);
+    const KComponentData& m_component_data;
     QTimer* m_reboot_nagger;
-    KComponentData* m_component_data;
 };
 
 #endif // NOTIFIER_H
diff --git a/src/testapp_main.cpp b/src/testapp_main.cpp
index 079f379..c51fd9b 100644
--- a/src/testapp_main.cpp
+++ b/src/testapp_main.cpp
@@ -33,6 +33,7 @@
 
 int main(int argc, char **argv) {
   QApplication app(argc, argv);
+  KComponentData cd("kingston_update_notifier");
   test_window_t* test_window = new test_window_t();
   update_worker_t* update_worker = new update_worker_t();
   QObject::connect(test_window,SIGNAL(check_for_updates_requested()),update_worker,SLOT(check_for_updates()));
@@ -40,7 +41,7 @@ int main(int argc, char **argv) {
   QObject::connect(update_worker,SIGNAL(error(QString,update_worker_t::error_code_t)),test_window,SLOT(show_error_message(QString,update_worker_t::error_code_t)));
   update_listener_t* update_listener = new update_listener_t();
   QObject::connect(update_listener,SIGNAL(please_check_for_updates()),update_worker,SLOT(check_for_updates()));
-  notifier_t* notifier = new notifier_t();
+  notifier_t* notifier = new notifier_t(cd);
   QObject::connect(update_worker,SIGNAL(updates_available(int,int)),notifier,SLOT(notify_new_updates(int,int)));
   test_window->show();
   update_worker->check_for_updates();

-- 
Kingston update notifier (update-notifier-kde)



More information about the pkg-kde-commits mailing list