[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] akregator: fix notifications when running in kontact
From:       Frank Osterfeld <frank.osterfeld () gmx ! de>
Date:       2005-03-04 11:50:46
Message-ID: 200503041250.47239.frank.osterfeld () gmx ! de
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hello,

I'd like to backport the attached bug fix. 

Akregator's notifications don't work when running as kontact plugin, because 
KNotify uses kontact's eventrc instead of akregator's.
The patch fixes this.

See bug 100494.

Regards,

Frank

["akregator-notifications_in_kontact-fix.diff" (text/x-diff)]

? Doxyfile
? akregator.kdevelop
? akregator.kdevelop.filelist
? akregator.kdevelop.pcs
? akregator.kdevses
? kontact-notification.diff
? src/akregator-htmlwidget-cleanup.diff
Index: src/akregator_part.cpp
===================================================================
RCS file: /home/kde/kdepim/akregator/src/akregator_part.cpp,v
retrieving revision 1.151.6.1
diff -u -p -r1.151.6.1 akregator_part.cpp
--- src/akregator_part.cpp	2 Mar 2005 21:27:31 -0000	1.151.6.1
+++ src/akregator_part.cpp	4 Mar 2005 11:23:31 -0000
@@ -202,10 +202,10 @@ Part::Part( QWidget *parentWidget, const
     if ( isTrayIconEnabled() )
     {
         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()),
             kapp, SLOT(quit())) ;
@@ -240,7 +240,7 @@ 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());
     
Index: src/notificationmanager.cpp
===================================================================
RCS file: /home/kde/kdepim/akregator/src/notificationmanager.cpp,v
retrieving revision 1.2.6.1
diff -u -p -r1.2.6.1 notificationmanager.cpp
--- src/notificationmanager.cpp	2 Mar 2005 21:27:31 -0000	1.2.6.1
+++ src/notificationmanager.cpp	4 Mar 2005 11:23:31 -0000
@@ -44,6 +44,7 @@ NotificationManager::NotificationManager
     m_addedInLastInterval = false;
     m_maxArticles = 20;
     m_widget = NULL;
+    m_instance = NULL;
 }
 
 NotificationManager::~NotificationManager()
@@ -51,9 +52,10 @@ NotificationManager::~NotificationManage
     m_self = 0;
 }
 
-void NotificationManager::setWidget(QWidget* widget)
+void NotificationManager::setWidget(QWidget* widget, KInstance* inst)
 {
     m_widget = widget;
+    m_instance = inst != NULL ? inst : KGlobal::instance();
 }
 
 void NotificationManager::slotNotifyArticle(const MyArticle& article)
@@ -73,6 +75,7 @@ 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]));  }
     else if (feeds.count() > 1)
@@ -80,6 +83,7 @@ void NotificationManager::slotNotifyFeed
         QString message;
         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));  }
 }
@@ -100,6 +104,7 @@ void NotificationManager::doNotify()
         message += (*it).title() + "<br>";
     }
     message += "</body></html>";
+    KNotifyClient::Instance inst(m_instance);
     KNotifyClient::event(m_widget->winId(), "new_articles", message);
 
     m_articles.clear();
Index: src/notificationmanager.h
===================================================================
RCS file: /home/kde/kdepim/akregator/src/notificationmanager.h,v
retrieving revision 1.1.6.1
diff -u -p -r1.1.6.1 notificationmanager.h
--- src/notificationmanager.h	2 Mar 2005 21:27:31 -0000	1.1.6.1
+++ src/notificationmanager.h	4 Mar 2005 11:23:31 -0000
@@ -43,7 +43,7 @@ class NotificationManager : public QObje
         ~NotificationManager();
 
         /** 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:
 
@@ -73,7 +73,8 @@ class NotificationManager : public QObje
         bool m_running;
         bool m_addedInLastInterval;
         QWidget* m_widget;
-        
+        KInstance* m_instance;
+
         QValueList<MyArticle> m_articles;
 
         static NotificationManager* m_self;


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic