2007/10/1, Matt Rogers:
> Please give it a try. Ask on this list for help as you need it.
>
> Thanks!
I've attached patch for 1. But since KSystemTrayIcon isn't a QWidget
anymore and mouse clicks on QSystemTrayIcon are handled via
signal/slot connection, left click on flashing tray icon now do both
actions together: opens message and shows/hide main windows. Points on
correct way to override default left mouse click behavior are welcome.

-- 
Best regards,
Serhiy Kachaniuk
Index: kopete/systemtray.cpp
===================================================================
--- kopete/systemtray.cpp	(revision 720025)
+++ kopete/systemtray.cpp	(working copy)
@@ -76,8 +76,12 @@
 	connect(Kopete::AccountManager::self(),
 		SIGNAL(accountOnlineStatusChanged(Kopete::Account *,
 		const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)),
-	this, SLOT(slotReevaluateAccountStates()));
+		this, SLOT(slotReevaluateAccountStates()));
 
+	connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+		SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)));
+
+
 	// the slot called by default by the quit action, KSystemTray::maybeQuit(),
 	// just closes the parent window, which is hard to distinguish in that window's closeEvent()
 	// from a click on the window's close widget
@@ -106,50 +110,17 @@
 {
 	emit aboutToShowMenu(qobject_cast<KMenu *>(contextMenu()));
 }
-/*
-void KopeteSystemTray::mousePressEvent( QMouseEvent *me )
-{
-#ifdef __GNUC__
-#warning PORT ME
-#endif
-#if 0
-	if (
-		(me->button() == Qt::MidButton ||
-			(me->button() == Qt::LeftButton && Kopete::BehaviorSettings::self()->trayflashNotifyLeftClickOpensMessage())) &&
-		mIsBlinking )
-	{
-		mouseDoubleClickEvent( me );
-		return;
-	}
 
-	KSystemTray::mousePressEvent( me );
-#endif
-}
-
-void KopeteSystemTray::mouseDoubleClickEvent( QMouseEvent *me )
+void KopeteSystemTray::slotTrayActivated(  QSystemTrayIcon::ActivationReason reason )
 {
-#ifdef __GNUC__
-#warning PORT ME
-#endif
-#if 0
-	if ( !mIsBlinking )
+	if (reason == QSystemTrayIcon::Trigger
+		&& Kopete::BehaviorSettings::self()->trayflashNotifyLeftClickOpensMessage()
+		&& mIsBlinking && !mEventList.isEmpty())
 	{
-		KSystemTray::mousePressEvent( me );
+		mEventList.first()->apply();
 	}
-	else
-	{
-		if(!mEventList.isEmpty())
-			mEventList.first()->apply();
-	}
-#endif
 }
 
-void KopeteSystemTray::contextMenuAboutToShow( KMenu *me )
-{
-	//kDebug(14010) << "Called.";
-	emit aboutToShowMenu( me );
-}
-*/
 void KopeteSystemTray::startBlink( const QString &icon )
 {
 	startBlink( loadIcon( icon ) );
@@ -185,6 +156,7 @@
 	if (!movie())
 		setMovie( mMovie );
 	startMovie();
+	mIsBlinking = true;
 }
 
 void KopeteSystemTray::stopBlink()
Index: kopete/systemtray.h
===================================================================
--- kopete/systemtray.h	(revision 720025)
+++ kopete/systemtray.h	(working copy)
@@ -61,6 +61,7 @@
 
 private Q_SLOTS:
 	void slotAboutToShowMenu();
+        void slotTrayActivated(QSystemTrayIcon::ActivationReason);
 
 	void slotBlink();
 	void slotNewEvent(Kopete::MessageEvent*);
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to