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

List:       kopete-devel
Subject:    Re: [kopete-devel] [PATCH] for use KPassivePopup Balloon-Styled
From:       Sascha Cunz <sascha.cunz () tiscali ! de>
Date:       2005-06-10 7:22:27
Message-ID: 200506100922.28070.sascha.cunz () tiscali ! de
[Download RAW message or body]

> Tried the patch here, but didn't like the behavior because you can lose
> mesasages.
>
> Why is that?

Already fixed that. Forgot to set the timeout to 0. Ironically allowing to set 
the Timeout to zero was a bug in KPassivePopup, i fixed about 2 month ago :)

Attached patch won't do that.

Sascha

["kopete.patch" (text/x-diff)]

Index: systemtray.cpp
===================================================================
--- systemtray.cpp	(revision 423175)
+++ systemtray.cpp	(working copy)
@@ -38,6 +38,13 @@
 #include "kopeteaccountmanager.h"
 #include "kopetecontact.h"
 #include "kopetewindow.h"
+#if KDE_IS_VERSION(3,4,89)
+#include <kpassivepopup.h>
+#include <kdialog.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#endif
 
 KopeteSystemTray* KopeteSystemTray::s_systemTray = 0L;
 
@@ -263,6 +270,52 @@
 			else
 				msgFrom = msg.from()->contactId();
 
+#if KDE_IS_VERSION(3,4,89)
+			m_balloon = new KPassivePopup(KPassivePopup::Balloon, (QWidget*)0L, "KopeteBalloon", 0);
+			QVBoxLayout *BalloonLayout = new QVBoxLayout(m_balloon, 22,
+				KDialog::spacingHint(), "BalloonLayout");
+
+			// BEGIN Layout1
+			QHBoxLayout *Layout1 = new QHBoxLayout(BalloonLayout,
+				KDialog::spacingHint(), "Layout1");
+			KopeteActiveLabel *mCaption = new KopeteActiveLabel(
+				i18n( "<qt><nobr><b>New Message from %1:</b></nobr><br><nobr>\"%2\"</nobr></qt>" )
+					.arg( msgFrom, msgText ), m_balloon, "mCaption");
+			mCaption->setPalette(QToolTip::palette());
+			mCaption->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+			Layout1->addWidget(mCaption);
+			// END Layout1
+
+			// BEGIN Layout2
+			QHBoxLayout *Layout2 = new QHBoxLayout(BalloonLayout,
+				KDialog::spacingHint(), "Layout2");
+			QPushButton *mViewButton = new QPushButton(i18n("to view", "View"), m_balloon,
+				"mViewButton");
+			QPushButton *mIgnoreButton = new QPushButton(i18n("Ignore"), m_balloon,
+				"mIgnoreButton");
+
+			Layout2->addStretch();
+			Layout2->addWidget(mViewButton);
+			Layout2->addWidget(mIgnoreButton);
+			Layout2->addStretch();
+			// END Layout2
+
+			connect(mViewButton, SIGNAL(clicked()),
+				mEventList.first(), SLOT(apply()));
+			connect(mViewButton, SIGNAL(clicked()),
+				m_balloon, SLOT(deleteLater()));
+			connect(mIgnoreButton, SIGNAL(clicked()),
+				mEventList.first(), SLOT(ignore()));
+			connect(mIgnoreButton, SIGNAL(clicked()),
+				m_balloon, SLOT(deleteLater()));
+			connect(mCaption, SIGNAL(linkClicked(const QString &)),
+				mEventList.first(), SLOT(ignore()));
+			connect(mCaption, SIGNAL(linkClicked(const QString &)),
+				m_balloon, SLOT(deleteLater()));
+			m_balloon->show();
+			m_balloon->setAnchor(mapToGlobal(pos()));
+			m_balloon->setTimeout(0);
+#else
 			m_balloon = new KopeteBalloon(
 				i18n( "<qt><nobr><b>New Message from %1:</b></nobr><br><nobr>\"%2\"</nobr></qt>" )
 					.arg( msgFrom, msgText ), QString::null );
@@ -271,6 +324,7 @@
 			connect(m_balloon, SIGNAL(signalIgnoreButtonClicked()), mEventList.first() , SLOT(ignore()));
 			m_balloon->setAnchor(mapToGlobal(pos()));
 			m_balloon->show();
+#endif
 			KWin::setOnAllDesktops(m_balloon->winId(), true);
 		}
 	}
Index: systemtray.h
===================================================================
--- systemtray.h	(revision 423175)
+++ systemtray.h	(working copy)
@@ -31,7 +31,8 @@
 class QPoint;
 class KPopupMenu;
 class KActionMenu;
-class KopeteBalloon;
+class KopeteBalloon;	// for KDE < 3.4.89
+class KPassivePopup;	// for KDE >= 3.4.89
 
 /**
  * @author Nick Betcher <nbetcher@kde.org>
@@ -92,7 +93,11 @@
 	static KopeteSystemTray* s_systemTray;
 
 	QPtrList<Kopete::MessageEvent> mEventList;
+#if KDE_IS_VERSION(3,4,89)
+	KPassivePopup *m_balloon;
+#else
 	KopeteBalloon *m_balloon;
+#endif
 };
 
 #endif


_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


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

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