[bt-devel] patch for mag delay, KDE3/4 compatible

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Sun May 6 02:31:20 MST 2007


Here is a diff output for my mag delay code. This should be both KDE 3
and 4 compatible and is a cleaner way to handle the timer anyways (the
previous one was easier and working but a bit "dirty"). This changes
about 5 code lines in two files.

  Yours,
	Eeli Kaikkonen (Mr.), Oulu, Finland
	e-mail: eekaikko at mailx.studentx.oulux.fix (with no x)
-------------- next part --------------
Index: bibletime/frontend/display/chtmlreaddisplay.cpp
===================================================================
RCS file: /cvsroot/bibletime/bibletime/bibletime/frontend/display/chtmlreaddisplay.cpp,v
retrieving revision 1.81
diff -U3 -r1.81 chtmlreaddisplay.cpp
--- bibletime/frontend/display/chtmlreaddisplay.cpp	22 Mar 2007 23:02:37 -0000	1.81
+++ bibletime/frontend/display/chtmlreaddisplay.cpp	6 May 2007 09:15:07 -0000
@@ -55,7 +55,8 @@
 CHTMLReadDisplay::CHTMLReadDisplay(CReadWindow* readWindow, QWidget* parentWidget)
 : KHTMLPart((m_view = new CHTMLReadDisplayView(this, parentWidget ? parentWidget : readWindow)), readWindow ? readWindow : parentWidget),
 CReadDisplay(readWindow),
-m_currentAnchorCache(QString::null) {
+m_currentAnchorCache(QString::null),
+m_magTimerId(0) {
 	setDNDEnabled(false);
 	setJavaEnabled(false);
 	setJScriptEnabled(false);
@@ -328,8 +329,8 @@
 			// SHIFT key not pressed, so we start timer
 			if ( !(e->qmouseEvent()->state() & Qt::ShiftButton)) { 
 				// QObject has simple timer
-				killTimers(); 
-				startTimer( CBTConfig::get(CBTConfig::magDelay) );
+				killTimer(m_magTimerId); 
+				m_magTimerId = startTimer( CBTConfig::get(CBTConfig::magDelay) );
 			}
 	
 			m_previousEventNode = node;
@@ -341,7 +342,7 @@
 
 /** The Mag window update happens here if the mouse has not moved to another node after starting the timer.*/
 void CHTMLReadDisplay::timerEvent( QTimerEvent *e ) {
-	killTimers();
+	killTimer(m_magTimerId);
 	DOM::Node currentNode = nodeUnderMouse();
 	CInfoDisplay::ListInfoData infoList;
 	
Index: bibletime/frontend/display/chtmlreaddisplay.h
===================================================================
RCS file: /cvsroot/bibletime/bibletime/bibletime/frontend/display/chtmlreaddisplay.h,v
retrieving revision 1.15
diff -U3 -r1.15 chtmlreaddisplay.h
--- bibletime/frontend/display/chtmlreaddisplay.h	22 Mar 2007 23:02:37 -0000	1.15
+++ bibletime/frontend/display/chtmlreaddisplay.h	6 May 2007 09:15:07 -0000
@@ -88,6 +88,7 @@
 	m_dndData;
 
 	QMap<NodeInfoType, QString> m_nodeInfo;
+	int m_magTimerId;
 		
 private:
 	CHTMLReadDisplayView* m_view;


More information about the bt-devel mailing list