Bug 100494

Summary: No notifications when running inside Kontact
Product: [Applications] akregator Reporter: Sebastian Strand <sebstrand>
Component: kontact pluginAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: vivo75+kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Sebastian Strand 2005-02-28 23:00:27 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)
OS:                Linux (x86_64) release 2.6.10-ck6

When I run Akregator inside Kontact I do not get any notifications (neither sound nor popup) when new articles are available or feeds are added. If I run Akregator separately the notifications work fine, with the same settings.
Comment 1 Frank Osterfeld 2005-03-02 12:34:04 UTC
Confirmed. The problem is that knotify looks for kontact's eventrc instead of akregator's. So it can't find the event and thus doesn't execute it.
Apparently there is no way to tell the KnotifyClient to use a specific eventrc...
Comment 2 Frank Osterfeld 2005-03-04 12:29:18 UTC
CVS commit by osterfeld: 

fix notifications when running in kontact.
BUG: 100494


  M +3 -3      akregator_part.cpp   1.153
  M +6 -1      notificationmanager.cpp   1.4
  M +3 -2      notificationmanager.h   1.3


--- kdepim/akregator/src/akregator_part.cpp  #1.152:1.153
@@ -203,8 +203,8 @@ Part::Part( QWidget *parentWidget, const
     {
         m_trayIcon->show();
-        NotificationManager::self()->setWidget(m_trayIcon);
+        NotificationManager::self()->setWidget(m_trayIcon, instance());
     }
     else
-        NotificationManager::self()->setWidget(getMainWindow());
+        NotificationManager::self()->setWidget(getMainWindow(), instance());
 
     connect( m_trayIcon, SIGNAL(quitSelected()),
@@ -241,5 +241,5 @@ void Part::slotOnShutdown()
 void Part::slotSettingsChanged()
 {
-    NotificationManager::self()->setWidget(isTrayIconEnabled() ? m_trayIcon : getMainWindow());
+    NotificationManager::self()->setWidget(isTrayIconEnabled() ? m_trayIcon : getMainWindow(), instance());
 
     RSS::FileRetriever::setUseCache(Settings::useHTMLCache());

--- kdepim/akregator/src/notificationmanager.cpp  #1.3:1.4
@@ -45,4 +45,5 @@ NotificationManager::NotificationManager
     m_maxArticles = 20;
     m_widget = NULL;
+    m_instance = NULL;
 }
 
@@ -52,7 +53,8 @@ NotificationManager::~NotificationManage
 }
 
-void NotificationManager::setWidget(QWidget* widget)
+void NotificationManager::setWidget(QWidget* widget, KInstance* inst)
 {
     m_widget = widget;
+    m_instance = inst != NULL ? inst : KGlobal::instance();
 }
 
@@ -74,4 +76,5 @@ void NotificationManager::slotNotifyFeed
     if (feeds.count() == 1)
     {
+        KNotifyClient::Instance inst(m_instance);
         KNotifyClient::event(m_widget->winId(), "feed_added", i18n("Feed added:\n %1").arg(feeds[0]));
     }
@@ -81,4 +84,5 @@ void NotificationManager::slotNotifyFeed
         for (QStringList::ConstIterator it = feeds.begin(); it != feeds.end(); ++it)
             message += *it + "\n";
+        KNotifyClient::Instance inst(m_instance);
         KNotifyClient::event(m_widget->winId(), "feed_added", i18n("Feeds added:\n %1").arg(message));
     }
@@ -101,4 +105,5 @@ void NotificationManager::doNotify()
     }
     message += "</body></html>";
+    KNotifyClient::Instance inst(m_instance);
     KNotifyClient::event(m_widget->winId(), "new_articles", message);
 

--- kdepim/akregator/src/notificationmanager.h  #1.2:1.3
@@ -44,5 +44,5 @@ class NotificationManager : public QObje
 
         /** the widget used for notification, normally either the mainwindow or the tray icon */
-        void setWidget(QWidget* widget);
+        void setWidget(QWidget* widget, KInstance* inst=0);
         
     public slots:
@@ -74,4 +74,5 @@ class NotificationManager : public QObje
         bool m_addedInLastInterval;
         QWidget* m_widget;
+        KInstance* m_instance;
         
         QValueList<MyArticle> m_articles;


Comment 3 Peter Penz 2010-08-15 14:24:09 UTC
*** Bug 234651 has been marked as a duplicate of this bug. ***