summaryrefslogtreecommitdiffstats
path: root/src/dndlistview.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-07-27 16:57:53 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-27 18:48:46 +0200
commit7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931 (patch)
tree4655c7263ca5c64d23d10167cb459dd9cb253815 /src/dndlistview.cpp
parent88ea2b6cd4382627fb6efca9cc54825aee881d1e (diff)
downloadtork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.tar.gz
tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.zip
Initial TQt conversion
Diffstat (limited to 'src/dndlistview.cpp')
-rw-r--r--src/dndlistview.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/dndlistview.cpp b/src/dndlistview.cpp
index 5ddfaf7..a218c9e 100644
--- a/src/dndlistview.cpp
+++ b/src/dndlistview.cpp
@@ -21,23 +21,23 @@
#include "dndlistview.h"
#include "torkconfig.h"
#include "kdebug.h"
-#include <qapplication.h>
-#include <qheader.h>
+#include <ntqapplication.h>
+#include <ntqheader.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
-#include <qsimplerichtext.h>
-#include <qpainter.h>
+#include <ntqsimplerichtext.h>
+#include <ntqpainter.h>
-DndListView::DndListView( QWidget * parent, const char * name, WFlags f ) :
- QListView( parent, name, f ), oldCurrent( 0 ),
+DndListView::DndListView( TQWidget * parent, const char * name, WFlags f ) :
+ TQListView( parent, name, f ), oldCurrent( 0 ),
dropItem( 0 ), mousePressed( FALSE ),m_recentDrop( FALSE)
{
setAllColumnsShowFocus( TRUE );
- //setResizeMode( QListView::AllColumns );
- setSelectionMode( QListView::Extended );
+ //setResizeMode( TQListView::AllColumns );
+ setSelectionMode( TQListView::Extended );
setAcceptDrops( TRUE );
viewport()->setAcceptDrops( TRUE );
@@ -48,19 +48,19 @@ DndListView::DndListView( QWidget * parent, const char * name, WFlags f ) :
//static const int autoopenTime = 750;
-void DndListView::contentsDragEnterEvent( QDragEnterEvent *e )
+void DndListView::contentsDragEnterEvent( TQDragEnterEvent *e )
{
- setSelectionMode( QListView::Single );
+ setSelectionMode( TQListView::Single );
- if ( !QTextDrag::canDecode( e ) ) {
+ if ( !TQTextDrag::canDecode( e ) ) {
e->ignore();
return;
}
oldCurrent = currentItem();
- QListViewItem *i = itemAt( contentsToViewport(e->pos()) );
+ TQListViewItem *i = itemAt( contentsToViewport(e->pos()) );
if ( i ) {
dropItem = i;
/* autoopen_timer->start( autoopenTime );*/
@@ -68,19 +68,19 @@ void DndListView::contentsDragEnterEvent( QDragEnterEvent *e )
}
-void DndListView::contentsDragMoveEvent( QDragMoveEvent *e )
+void DndListView::contentsDragMoveEvent( TQDragMoveEvent *e )
{
- if ( !QTextDrag::canDecode( e ) ) {
+ if ( !TQTextDrag::canDecode( e ) ) {
e->ignore();
return;
}
- QPoint vp = contentsToViewport( ( (QDragMoveEvent*)e )->pos() );
- QListViewItem *i = itemAt( vp );
+ TQPoint vp = contentsToViewport( ( (TQDragMoveEvent*)e )->pos() );
+ TQListViewItem *i = itemAt( vp );
//!(e->source() == this) &&
- if ((QString(this->name()).contains("circuitList")) &&
- (QString(e->source()->name()).contains("serverList"))) {
+ if ((TQString(this->name()).contains("circuitList")) &&
+ (TQString(e->source()->name()).contains("serverList"))) {
if ( i ){
setSelected( i, TRUE );
@@ -89,8 +89,8 @@ void DndListView::contentsDragMoveEvent( QDragMoveEvent *e )
}
}
e->accept();
- }else if ((QString(this->name()).contains("circuitList")) &&
- (QString(e->source()->name()).contains("circuitList"))) {
+ }else if ((TQString(this->name()).contains("circuitList")) &&
+ (TQString(e->source()->name()).contains("circuitList"))) {
if ( i ){
setSelected( i, TRUE );
if ( i != dropItem ) {
@@ -98,8 +98,8 @@ void DndListView::contentsDragMoveEvent( QDragMoveEvent *e )
}
}
e->accept();
- }else if ((QString(this->name()).contains("circuitList")) &&
- (QString(e->source()->name()).contains("ORList"))) {
+ }else if ((TQString(this->name()).contains("circuitList")) &&
+ (TQString(e->source()->name()).contains("ORList"))) {
if ( i ){
setSelected( i, TRUE );
if ( i != dropItem ) {
@@ -107,8 +107,8 @@ void DndListView::contentsDragMoveEvent( QDragMoveEvent *e )
}
}
e->accept();
- }else if ((QString(this->name()).contains("circuitList")) &&
- (QString(e->source()->name()).contains("streamList"))) {
+ }else if ((TQString(this->name()).contains("circuitList")) &&
+ (TQString(e->source()->name()).contains("streamList"))) {
if ( i ){
setSelected( i, TRUE );
if ( i != dropItem ) {
@@ -123,7 +123,7 @@ void DndListView::contentsDragMoveEvent( QDragMoveEvent *e )
}
}
-void DndListView::contentsDragLeaveEvent( QDragLeaveEvent * )
+void DndListView::contentsDragLeaveEvent( TQDragLeaveEvent * )
{
/* autoopen_timer->stop();*/
@@ -132,42 +132,42 @@ void DndListView::contentsDragLeaveEvent( QDragLeaveEvent * )
setCurrentItem( oldCurrent );
setSelected( oldCurrent, TRUE );
- setSelectionMode( QListView::Extended );
+ setSelectionMode( TQListView::Extended );
}
-void DndListView::contentsDropEvent( QDropEvent *e )
+void DndListView::contentsDropEvent( TQDropEvent *e )
{
// autoopen_timer->stop();
m_recentDrop = true;
dropTimer = startTimer( 3000 );
- setSelectionMode( QListView::Extended );
+ setSelectionMode( TQListView::Extended );
- QString text;
- if ( !QTextDrag::decode( e, text ) ) {
+ TQString text;
+ if ( !TQTextDrag::decode( e, text ) ) {
e->ignore();
return;
}
m_mousepos = e->pos() ;
- QListViewItem *item = itemAt( contentsToViewport(e->pos()) );
- if (QString(this->name()).contains("circuitList")){
+ TQListViewItem *item = itemAt( contentsToViewport(e->pos()) );
+ if (TQString(this->name()).contains("circuitList")){
e->accept();
if ( item ) {
- if (QString(e->source()->name()).contains("serverList"))
+ if (TQString(e->source()->name()).contains("serverList"))
emit extendCircuit(item->text(0),text,true);
- else if (QString(e->source()->name()).contains("circuitList"))
+ else if (TQString(e->source()->name()).contains("circuitList"))
emit extendCircuit(item->text(0),text, true);
- else if (QString(e->source()->name()).contains("ORList"))
+ else if (TQString(e->source()->name()).contains("ORList"))
emit extendCircuit(item->text(0),text, false);
- else if (QString(e->source()->name()).contains("streamList"))
+ else if (TQString(e->source()->name()).contains("streamList"))
emit attach(item->text(0),text);
} else{
- if (QString(e->source()->name()).contains("serverList"))
+ if (TQString(e->source()->name()).contains("serverList"))
emit createCircuit(text,true);
- else if (QString(e->source()->name()).contains("ORList"))
+ else if (TQString(e->source()->name()).contains("ORList"))
emit createCircuit(text,false);
}
}else
@@ -177,10 +177,10 @@ void DndListView::contentsDropEvent( QDropEvent *e )
-void DndListView::contentsMousePressEvent( QMouseEvent* e )
+void DndListView::contentsMousePressEvent( TQMouseEvent* e )
{
- QPoint p( contentsToViewport( e->pos() ) );
- //QListViewItem *i = itemAt( p );
+ TQPoint p( contentsToViewport( e->pos() ) );
+ //TQListViewItem *i = itemAt( p );
/* if ( i ) {
// if the user clicked into the root decoration of the item, don't try to start a drag!
if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) +
@@ -191,33 +191,33 @@ void DndListView::contentsMousePressEvent( QMouseEvent* e )
}
}*/
- if (e->button() == Qt::LeftButton){
+ if (e->button() == TQt::LeftButton){
presspos = e->pos();
mousePressed = TRUE;
}
- QListView::contentsMousePressEvent( e );
+ TQListView::contentsMousePressEvent( e );
}
-void DndListView::contentsMouseMoveEvent( QMouseEvent* e )
+void DndListView::contentsMouseMoveEvent( TQMouseEvent* e )
{
if ( mousePressed ) {
kdDebug() << "in mouse move drag" << endl;
mousePressed = FALSE;
- //QListViewItem *item = itemAt( contentsToViewport(presspos) );
+ //TQListViewItem *item = itemAt( contentsToViewport(presspos) );
int column;
- if (QString(this->name()).contains("circuitList"))
+ if (TQString(this->name()).contains("circuitList"))
column = 2;
- else if (QString(this->name()).contains("ORList"))
+ else if (TQString(this->name()).contains("ORList"))
column = 1;
- else if (QString(this->name()).contains("streamList"))
+ else if (TQString(this->name()).contains("streamList"))
column = 0;
else
column = 2;
- QString selectedItems;
- QListViewItemIterator it(this, QListViewItemIterator::Selected);
+ TQString selectedItems;
+ TQListViewItemIterator it(this, TQListViewItemIterator::Selected);
while ( it.current() ) {
if (this->isSelected( it.current()))
selectedItems.append(it.current()->text(column)+" ");
@@ -225,36 +225,36 @@ void DndListView::contentsMouseMoveEvent( QMouseEvent* e )
}
if (!selectedItems.isEmpty()){
selectedItems = selectedItems.stripWhiteSpace();
- QDragObject *d = new QTextDrag( selectedItems, this );
+ TQDragObject *d = new TQTextDrag( selectedItems, this );
d->dragCopy(); // do NOT delete d.
}
}else
- QListView::contentsMouseMoveEvent( e );
+ TQListView::contentsMouseMoveEvent( e );
}
-void DndListView::contentsMouseReleaseEvent( QMouseEvent* e)
+void DndListView::contentsMouseReleaseEvent( TQMouseEvent* e)
{
/* kdDebug() << "mouse released" << endl;*/
mousePressed = FALSE;
- QListView::contentsMouseReleaseEvent(e);
+ TQListView::contentsMouseReleaseEvent(e);
}
-void DndListView::mouseReleaseEvent( QMouseEvent* e)
+void DndListView::mouseReleaseEvent( TQMouseEvent* e)
{
/* kdDebug() << "mouse released" << endl;*/
mousePressed = FALSE;
- QListView::mouseReleaseEvent(e);
+ TQListView::mouseReleaseEvent(e);
}
-QPoint DndListView::getMousePos()
+TQPoint DndListView::getMousePos()
{
return m_mousepos;
}
-void DndListView::timerEvent( QTimerEvent * )
+void DndListView::timerEvent( TQTimerEvent * )
{
//if ( e->timerId() == dropTimer ) // stop showing date
m_recentDrop = false;
@@ -265,20 +265,20 @@ void DndListView::timerEvent( QTimerEvent * )
void
-DndListView::viewportPaintEvent( QPaintEvent *e )
+DndListView::viewportPaintEvent( TQPaintEvent *e )
{
- QListView::viewportPaintEvent( e );
+ TQListView::viewportPaintEvent( e );
if (!TorkConfig::displayBubble())
return;
// Superimpose bubble help
// Taken from mediabrowser.cpp in Amarok
- if (( childCount() == 0 ) && (QString(this->name()).contains("streamList")))
+ if (( childCount() == 0 ) && (TQString(this->name()).contains("streamList")))
{
- QPainter p( viewport() );
+ TQPainter p( viewport() );
- QSimpleRichText t( i18n(
+ TQSimpleRichText t( i18n(
"<div align=center>"
"<h4>Almost Everything Is Clickable.</h4>"
"You can drag servers to create circuits. You can drag connections onto circuits "
@@ -286,7 +286,7 @@ DndListView::viewportPaintEvent( QPaintEvent *e )
"You can right-click on servers to include/exclude them or their country from your "
"connections. Remember though: <b> messing with stuff is fun, but generally bad for "
"anonymity.</b>"
- "</div>" ), QApplication::font() );
+ "</div>" ), TQApplication::font() );
t.setWidth( width() - 50 );
@@ -295,49 +295,49 @@ DndListView::viewportPaintEvent( QPaintEvent *e )
p.setBrush( colorGroup().background() );
p.drawRoundRect( 15, 15, w, h, (8*200)/w, (8*200)/h );
- t.draw( &p, 20, 20, QRect(), colorGroup() );
+ t.draw( &p, 20, 20, TQRect(), colorGroup() );
}
}
-// QDragObject *DndListView::dragObject()
+// TQDragObject *DndListView::dragObject()
// {
// kdDebug() << "dragging item" << endl;
-// return new QTextDrag( currentItem()->text(0), this );
+// return new TQTextDrag( currentItem()->text(0), this );
// }
-// void DndListView::dragEnterEvent( QDragEnterEvent *evt )
+// void DndListView::dragEnterEvent( TQDragEnterEvent *evt )
// {
// kdDebug() << "drag enter event" << endl;
-// if ( QTextDrag::canDecode( evt ) )
+// if ( TQTextDrag::canDecode( evt ) )
// evt->accept();
// }
//
//
-// void DndListView::dropEvent( QDropEvent *evt )
+// void DndListView::dropEvent( TQDropEvent *evt )
// {
-// QString text;
+// TQString text;
//
-// if ( QTextDrag::decode( evt, text ) )
+// if ( TQTextDrag::decode( evt, text ) )
// kdDebug() << text << endl;
// }
//
//
-// void DndListView::contentsMousePressEvent( QMouseEvent *evt )
+// void DndListView::contentsMousePressEvent( TQMouseEvent *evt )
// {
// dragging = TRUE;
// kdDebug() << "draggng mouse" << endl;
-// QListView::mousePressEvent( evt );
+// TQListView::mousePressEvent( evt );
//
// }
//
//
-// void DndListView::contentsMouseMoveEvent( QMouseEvent * )
+// void DndListView::contentsMouseMoveEvent( TQMouseEvent * )
// {
// if ( dragging ) {
// kdDebug() << "dragging" << endl;
-// QDragObject *d = new QTextDrag( currentItem()->text(0), this );
+// TQDragObject *d = new TQTextDrag( currentItem()->text(0), this );
// d->dragCopy(); // do NOT delete d.
// dragging = FALSE;
// }