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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/kopete/chatwindow
From:       Bruno Bigras <bigras.bruno () gmail ! com>
Date:       2009-07-10 19:01:44
Message-ID: 1247252504.816314.7739.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 994578 by bbigras:

Implement the "Drag and hover focus for tabs" junior job for Kopete
When links or files are dragged and hovered over the taskbar they pop up the \
associated window. For other tabbed applications when there is a drag and hoverover a \
tab that tab is given focus. Kopete should do the same.

 M  +1 -1      chatview.cpp  
 M  +3 -3      chatview.h  
 M  +18 -0     kopetechatwindow.cpp  
 M  +2 -0      kopetechatwindow.h  


--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/chatview.cpp #994577:994578
@@ -860,7 +860,7 @@
 	QWidget::dragMoveEvent( event );
 }
 
-bool ChatView::isDragEventAccepted( QDragMoveEvent * event ) const
+bool ChatView::isDragEventAccepted( const QDragMoveEvent * event ) const
 {
 	if( event->provides( "kopete/x-contact" ) )
 	{
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/chatview.h #994577:994578
@@ -227,6 +227,9 @@
 
 	virtual bool closeView( bool force = false );
 	
+	virtual void dropEvent ( QDropEvent * );
+	bool isDragEventAccepted( const QDragMoveEvent * ) const;
+
 	/** Retrieves the tab state. */
 	KopeteTabState tabState() const;
 
@@ -331,7 +334,6 @@
 protected:
 	virtual void dragEnterEvent ( QDragEnterEvent * );
 	virtual void dragMoveEvent ( QDragMoveEvent * );
-	virtual void dropEvent ( QDropEvent * );
 
 private:
 	// widget stuff
@@ -361,8 +363,6 @@
 	
 	KopeteTabState currentState() const;
 
-	bool isDragEventAccepted( QDragMoveEvent * ) const;
-
 	KopeteChatViewPrivate *d;
 };
 
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp #994577:994578
@@ -84,6 +84,7 @@
 
 #include <qtoolbutton.h>
 #include <kxmlguifactory.h>
+#include <KTabBar>
 
 typedef QMap<Kopete::Account*,KopeteChatWindow*> AccountMap;
 typedef QMap<Kopete::Group*,KopeteChatWindow*> GroupMap;
@@ -618,6 +619,21 @@
 	m_status_text->setText(text);
 }
 
+void KopeteChatWindow::testCanDecode(const QDragMoveEvent *event, bool &accept)
+{
+	if (chatViewList[static_cast<KTabBar*>(m_tabBar->childAt( \
event->pos()))->selectTab( event->pos() )]->isDragEventAccepted( event )) { +		accept \
= true; +	} else {
+		accept = false;
+	}
+}
+
+void KopeteChatWindow::receivedDropEvent( QWidget *w, QDropEvent *e )
+{
+	m_tabBar->setCurrentWidget( w );
+	activeView()->dropEvent( e );
+}
+
 void KopeteChatWindow::createTabBar()
 {
 	if( !m_tabBar )
@@ -644,6 +660,8 @@
 		for( ChatViewList::iterator it = chatViewList.begin(); it != chatViewList.end(); \
++it )  addTab( *it );
 
+		connect ( m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent *, bool &)), this, \
SLOT(testCanDecode(const QDragMoveEvent *, bool &)) ); +		connect ( m_tabBar, \
SIGNAL(receivedDropEvent( QWidget *, QDropEvent * )), this, SLOT(receivedDropEvent( \
QWidget *, QDropEvent * )) );  connect ( m_tabBar, SIGNAL(currentChanged(QWidget *)), \
this, SLOT(setActiveView(QWidget *)) );  connect ( m_tabBar, \
SIGNAL(contextMenu(QWidget *, const QPoint & )), this, SLOT(slotTabContextMenu( \
QWidget *, const QPoint & )) );  
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.h #994577:994578
@@ -187,6 +187,8 @@
 
 private slots:
 //	void slotPrepareSmileyMenu();
+	void testCanDecode(const QDragMoveEvent *, bool &);
+	void receivedDropEvent( QWidget *, QDropEvent * );
 	void slotPrepareContactMenu();
 	void slotPrepareDetachMenu();
 	void slotPreparePlacementMenu();


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

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