diff options
Diffstat (limited to 'sidebar/dndlistbox.cpp')
-rw-r--r-- | sidebar/dndlistbox.cpp | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/sidebar/dndlistbox.cpp b/sidebar/dndlistbox.cpp index 8fe78cf..4f8928d 100644 --- a/sidebar/dndlistbox.cpp +++ b/sidebar/dndlistbox.cpp @@ -1,9 +1,9 @@ #include <dcopclient.h> -#include <qdragobject.h> +#include <tqdragobject.h> #include <kurl.h> -#include <qstrlist.h> -#include <qtimer.h> +#include <tqstrlist.h> +#include <tqtimer.h> #include <kapplication.h> #include <klocale.h> #include <kfileitem.h> @@ -15,7 +15,7 @@ #include <kurlrequester.h> #include <kstandarddirs.h> #include <kwin.h> -#include <qclipboard.h> +#include <tqclipboard.h> #include "listboxlink.h" #include "linkconfig.h" #include "dndlistbox.h" @@ -37,11 +37,11 @@ #define MEDIA_PROPS 12 #define MEDIALIST_PROPS 13 -ResizingLinkBox::ResizingLinkBox( QWidget * parent, const char * name, WFlags f ) : KListBox( parent, name, f) +ResizingLinkBox::ResizingLinkBox( TQWidget * parent, const char * name, WFlags f ) : KListBox( parent, name, f) { - KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig config(TQDir::homeDirPath() + "/.qt/baghirarc"); config.setGroup("Sidebar"); - size_ = config.readNumEntry (QString(name) + "_IconSize", 48); + size_ = config.readNumEntry (TQString(name) + "_IconSize", 48); popupMenu = new KPopupMenu; popupMenu->insertTitle (i18n("Icon Size"),122,122); popupMenu->insertItem("16x16", this, SLOT(setIconSize(int)),0,16,123); @@ -52,14 +52,14 @@ ResizingLinkBox::ResizingLinkBox( QWidget * parent, const char * name, WFlags f popupMenu->insertItem("128x128", this, SLOT(setIconSize(int)),0,128,128); } -void ResizingLinkBox::insertItem( const QListBoxItem *lbi, int index ) +void ResizingLinkBox::insertItem( const TQListBoxItem *lbi, int index ) { KListBox::insertItem( lbi, index ); if (height() <= numRows()*itemHeight()) emit itemNumberChanged(TRUE); } -void ResizingLinkBox::insertItem( const QListBoxItem *lbi, const QListBoxItem *after ) +void ResizingLinkBox::insertItem( const TQListBoxItem *lbi, const TQListBoxItem *after ) { KListBox::insertItem( lbi, after ); if (height() <= numRows()*itemHeight()) @@ -67,7 +67,7 @@ void ResizingLinkBox::insertItem( const QListBoxItem *lbi, const QListBoxItem *a } -void ResizingLinkBox::insertItem( const QString & icon, const QString & title, const QString & url ) +void ResizingLinkBox::insertItem( const TQString & icon, const TQString & title, const TQString & url ) { insertItem( new ListBoxLink(icon, size_, title, url ) ); } @@ -83,9 +83,9 @@ void ResizingLinkBox::removeItem( int index ) void ResizingLinkBox::setIconSize(int size) { size_ = size; - KConfig *config = new KConfig(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig *config = new KConfig(TQDir::homeDirPath() + "/.qt/baghirarc"); config->setGroup("Sidebar"); - config->writeEntry (QString(name()) + "_IconSize", size); + config->writeEntry (TQString(name()) + "_IconSize", size); config->sync(); ListBoxLink *runner; ListBoxDevice *current; @@ -107,14 +107,14 @@ void ResizingLinkBox::setIconSize(int size) blockSignals ( false ); } -void ResizingLinkBox::mousePressEvent ( QMouseEvent *mpe ) +void ResizingLinkBox::mousePressEvent ( TQMouseEvent *mpe ) { KListBox::mousePressEvent( mpe ); } -void ResizingLinkBox::mouseReleaseEvent ( QMouseEvent *mpe ) +void ResizingLinkBox::mouseReleaseEvent ( TQMouseEvent *mpe ) { - if (mpe->button() == Qt::LeftButton) + if (mpe->button() == TQt::LeftButton) { ListBoxLink *link = (ListBoxLink*)itemAt(mpe->pos()); if (isSelected(link)) emit clicked(link); @@ -124,17 +124,17 @@ void ResizingLinkBox::mouseReleaseEvent ( QMouseEvent *mpe ) KListBox::mouseReleaseEvent( mpe ); } -void ResizingLinkBox::contentsWheelEvent ( QWheelEvent * we ) +void ResizingLinkBox::contentsWheelEvent ( TQWheelEvent * we ) { - if (we->state() == Qt::ControlButton) + if (we->state() == TQt::ControlButton) KListBox::contentsWheelEvent ( we ); else emit scrolled(0, -we->delta()); } -MediaListBox::MediaListBox( QWidget * parent, const char * name, WFlags f ) : ResizingLinkBox(parent, name, f), DCOPObject("BaghiraSidebarIface") +MediaListBox::MediaListBox( TQWidget * parent, const char * name, WFlags f ) : ResizingLinkBox(parent, name, f), DCOPObject("BaghiraSidebarIface") { - KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig config(TQDir::homeDirPath() + "/.qt/baghirarc"); config.setGroup("Sidebar"); hiddenDevices = config.readListEntry("HiddenDevices"); currentFloppy = 0L; @@ -150,24 +150,24 @@ MediaListBox::MediaListBox( QWidget * parent, const char * name, WFlags f ) : Re insertItem(new ListBoxDevice("system", size_, i18n("My Computer"), "media:/", "", "", TRUE, FALSE, FALSE)); insertItem(new ListBoxDevice("network", size_, i18n("Network"), "lan:/localhost", "", "", TRUE, FALSE, FALSE)); #endif - insertItem(new ListBoxDevice("hdd_mount", size_, i18n("Startvolume"), QDir::rootDirPath(), "", "", TRUE, FALSE, FALSE)); + insertItem(new ListBoxDevice("hdd_mount", size_, i18n("Startvolume"), TQDir::rootDirPath(), "", "", TRUE, FALSE, FALSE)); client = KApplication::dcopClient(); - client->connectDCOPSignal("kded", "mediamanager", "mediumAdded(QString)", "BaghiraSidebarIface", "mediumAdded(QString)", FALSE); - client->connectDCOPSignal("kded", "mediamanager", "mediumRemoved(QString)", "BaghiraSidebarIface", "mediumRemoved(const QString)", FALSE); - client->connectDCOPSignal("kded", "mediamanager", "mediumChanged(QString)", "BaghiraSidebarIface", "mediumChanged(QString)", FALSE); + client->connectDCOPSignal("kded", "mediamanager", "mediumAdded(TQString)", "BaghiraSidebarIface", "mediumAdded(TQString)", FALSE); + client->connectDCOPSignal("kded", "mediamanager", "mediumRemoved(TQString)", "BaghiraSidebarIface", "mediumRemoved(const TQString)", FALSE); + client->connectDCOPSignal("kded", "mediamanager", "mediumChanged(TQString)", "BaghiraSidebarIface", "mediumChanged(TQString)", FALSE); /* Get the media info - huhhh ;) */ - QByteArray data, replyData; - QCString replyType; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, replyData; + TQCString replyType; + TQDataStream arg(data, IO_WriteOnly); arg << ""; // ask for the full list if (!client->call("kded", "mediamanager", "fullList()", data, replyType, replyData)) - qDebug("there was some error using DCOP."); + tqDebug("there was some error using DCOP."); else { - QDataStream reply(replyData, IO_ReadOnly); - if (replyType == "QStringList") + TQDataStream reply(replyData, IO_ReadOnly); + if (replyType == "TQStringList") { - QStringList result; + TQStringList result; reply >> result; blockSignals ( true ); for (uint i = 0; i < result.size()/MEDIALIST_PROPS; i++) @@ -195,7 +195,7 @@ MediaListBox::MediaListBox( QWidget * parent, const char * name, WFlags f ) : Re blockSignals ( false ); } else - qWarning("fullList() returned an unexpected type of reply!"); + tqWarning("fullList() returned an unexpected type of reply!"); } // setCurrentItem( 0 ); } @@ -206,7 +206,7 @@ MediaListBox::~MediaListBox() ListBoxDevice *runner; for ( runner = deviceList.first(); runner; runner = deviceList.next() ) hiddenDevices.append(runner->name()); - KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig config(TQDir::homeDirPath() + "/.qt/baghirarc"); config.setGroup("Sidebar"); config.writeEntry("HiddenDevices", hiddenDevices); } @@ -261,9 +261,9 @@ void MediaListBox::toggleDevice(int id) } } -ListBoxDevice *MediaListBox::createListBoxDevice(QStringList & deviceProperties, uint n) +ListBoxDevice *MediaListBox::createListBoxDevice(TQStringList & deviceProperties, uint n) { - QString icon; + TQString icon; icon = deviceProperties[MEDIALIST_PROPS*n+ICON_NAME]; if (icon.isNull()) { @@ -272,7 +272,7 @@ ListBoxDevice *MediaListBox::createListBoxDevice(QStringList & deviceProperties, icon.truncate( icon.length()-2 ); if (icon.contains("floppy")) icon.prepend("3"); } - QString label; + TQString label; label = deviceProperties[MEDIALIST_PROPS*n+USER_LABEL]; if (label.isNull()) { @@ -286,7 +286,7 @@ ListBoxDevice *MediaListBox::createListBoxDevice(QStringList & deviceProperties, #endif } -int MediaListBox::index (const QString & name ) +int MediaListBox::index (const TQString & name ) { ListBoxDevice *device; for (uint i = 0; i < count(); i++) @@ -297,20 +297,20 @@ int MediaListBox::index (const QString & name ) return -1; } -void MediaListBox::mediumAdded(const QString &name) +void MediaListBox::mediumAdded(const TQString &name) { - QByteArray data, replyData; - QCString replyType; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, replyData; + TQCString replyType; + TQDataStream arg(data, IO_WriteOnly); arg << name; // ask for this item only - if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) - qDebug("there was some error using DCOP."); + if (!client->call("kded", "mediamanager", "properties(TQString)", data, replyType, replyData)) + tqDebug("there was some error using DCOP."); else { - QDataStream reply(replyData, IO_ReadOnly); - if (replyType == "QStringList") + TQDataStream reply(replyData, IO_ReadOnly); + if (replyType == "TQStringList") { - QStringList result; + TQStringList result; reply >> result; ListBoxDevice *dev = createListBoxDevice(result); if (hiddenDevices.contains(dev->name())) @@ -325,24 +325,24 @@ void MediaListBox::mediumAdded(const QString &name) } } else - qWarning("properties() returned an unexpected type of reply!"); + tqWarning("properties() returned an unexpected type of reply!"); } } -void MediaListBox::mediumRemoved(const QString &name) +void MediaListBox::mediumRemoved(const TQString &name) { - QByteArray data, replyData; - QCString replyType; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, replyData; + TQCString replyType; + TQDataStream arg(data, IO_WriteOnly); arg << name; // ask for this item only - if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) - qDebug("there was some error using DCOP."); + if (!client->call("kded", "mediamanager", "properties(TQString)", data, replyType, replyData)) + tqDebug("there was some error using DCOP."); else { - QDataStream reply(replyData, IO_ReadOnly); - if (replyType == "QStringList") + TQDataStream reply(replyData, IO_ReadOnly); + if (replyType == "TQStringList") { - QStringList result; + TQStringList result; reply >> result; int i = index(name); if (i<0) @@ -351,24 +351,24 @@ void MediaListBox::mediumRemoved(const QString &name) removeItem(i); } else - qWarning("properties() returned an unexpected type of reply!"); + tqWarning("properties() returned an unexpected type of reply!"); } } -void MediaListBox::mediumChanged(const QString &name) +void MediaListBox::mediumChanged(const TQString &name) { - QByteArray data, replyData; - QCString replyType; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, replyData; + TQCString replyType; + TQDataStream arg(data, IO_WriteOnly); arg << name; // ask for this item only - if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) - qDebug("there was some error using DCOP."); + if (!client->call("kded", "mediamanager", "properties(TQString)", data, replyType, replyData)) + tqDebug("there was some error using DCOP."); else { - QDataStream reply(replyData, IO_ReadOnly); - if (replyType == "QStringList") + TQDataStream reply(replyData, IO_ReadOnly); + if (replyType == "TQStringList") { - QStringList result; + TQStringList result; reply >> result; int i = index(name); if (i<0) @@ -406,16 +406,16 @@ void MediaListBox::mediumChanged(const QString &name) blockSignals(false); } else - qWarning("properties() returned an unexpected type of reply!"); + tqWarning("properties() returned an unexpected type of reply!"); } } #define _FLOPPYID_ 0 #define _FLOPPYINDEX_ 0 -void MediaListBox::mousePressEvent ( QMouseEvent *mpe ) +void MediaListBox::mousePressEvent ( TQMouseEvent *mpe ) { - if (mpe->button() == Qt::RightButton) + if (mpe->button() == TQt::RightButton) { popupMenu->removeItem(_FLOPPYID_); ListBoxDevice *device = (ListBoxDevice*)itemAt(mpe->pos()); @@ -427,7 +427,7 @@ void MediaListBox::mousePressEvent ( QMouseEvent *mpe ) popupMenu->popup(mpe->globalPos()); return; } - if (mpe->button() == Qt::LeftButton && mpe->x() > width()-22) + if (mpe->button() == TQt::LeftButton && mpe->x() > width()-22) { ListBoxDevice *device = (ListBoxDevice*)itemAt(mpe->pos()); int dy = itemRect(device).y(); @@ -445,7 +445,7 @@ void MediaListBox::mousePressEvent ( QMouseEvent *mpe ) ResizingLinkBox::mousePressEvent( mpe ); } -void MediaListBox::resizeEvent ( QResizeEvent * re) +void MediaListBox::resizeEvent ( TQResizeEvent * re) { if (width() != re->oldSize().width()) { @@ -455,13 +455,13 @@ void MediaListBox::resizeEvent ( QResizeEvent * re) ResizingLinkBox::resizeEvent(re); } -DnDListBox::DnDListBox( QWidget * parent, const char * name, WFlags f ): +DnDListBox::DnDListBox( TQWidget * parent, const char * name, WFlags f ): ResizingLinkBox( parent, name, f), _poof(0), _poofIndex(0), _poofAnimPix(0), _poofPix(0) { setAcceptDrops(true); dialog = new LinkConfig(); connect(dialog->buttonOk, SIGNAL(clicked()), this, SLOT(updateLink())); - setCursor(Qt::PointingHandCursor); + setCursor(TQt::PointingHandCursor); } DnDListBox::~DnDListBox() @@ -471,18 +471,18 @@ DnDListBox::~DnDListBox() void DnDListBox::poof(ListBoxLink *link) { _poofIndex = 0; - _poofPix = new QPixmap(locateLocal("data", "baghira/poof.png"), "png"); - _poofAnimPix = new QPixmap(_poofPix->width(), _poofPix->width()); + _poofPix = new TQPixmap(locateLocal("data", "baghira/poof.png"), "png"); + _poofAnimPix = new TQPixmap(_poofPix->width(), _poofPix->width()); if (!_poof) - _poof = new QWidget(0,0, Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM); + _poof = new TQWidget(0,0, TQt::WType_TopLevel | TQt::WStyle_NoBorder | TQt::WStyle_StaysOnTop | TQt::WX11BypassWM); KWin::setShadowSize(_poof->winId(), 0); _poof->setFixedSize(_poofPix->width(), _poofPix->width()); - int x = QCursor::pos().x() - _poof->width()/2; - int y = QCursor::pos().y() - _poof->height()/2; - QPixmap bgPix = QPixmap::grabWindow( qt_xrootwin(), x, y, _poofPix->width(), _poofPix->width()); + int x = TQCursor::pos().x() - _poof->width()/2; + int y = TQCursor::pos().y() - _poof->height()/2; + TQPixmap bgPix = TQPixmap::grabWindow( tqt_xrootwin(), x, y, _poofPix->width(), _poofPix->width()); _poof->move(x,y); _poof->show(); - _poof->setBackgroundOrigin(QWidget::WidgetOrigin); + _poof->setBackgroundOrigin(TQWidget::WidgetOrigin); _poof->setPaletteBackgroundPixmap( bgPix ); runPoof(); removeItem ( index(link) ); @@ -503,30 +503,30 @@ void DnDListBox::runPoof() return; } _poof->erase(); - bitBlt(_poof, 0 ,0, _poofPix, 0, _poofIndex * _poofPix->width(), _poofPix->width(), _poofPix->width(), Qt::AndROP); + bitBlt(_poof, 0 ,0, _poofPix, 0, _poofIndex * _poofPix->width(), _poofPix->width(), _poofPix->width(), TQt::AndROP); ++_poofIndex; - QTimer::singleShot ( 70, this, SLOT(runPoof()) ); // around 15 fps + TQTimer::singleShot ( 70, this, SLOT(runPoof()) ); // around 15 fps } -void DnDListBox::dragEnterEvent ( QDragEnterEvent *dee ) +void DnDListBox::dragEnterEvent ( TQDragEnterEvent *dee ) { // dragging_ = true; - if (QUriDrag::canDecode(dee) || BaghiraLinkDrag::canDecode(dee) || QTextDrag::canDecode(dee)) + if (TQUriDrag::canDecode(dee) || BaghiraLinkDrag::canDecode(dee) || TQTextDrag::canDecode(dee)) dee->accept(true); } -void DnDListBox::dropEvent ( QDropEvent *de ) +void DnDListBox::dropEvent ( TQDropEvent *de ) { - QStrList list; - QString title; - QString command; - QString icon; + TQStrList list; + TQString title; + TQString command; + TQString icon; int oldIndex; - QCString subtype; + TQCString subtype; if (BaghiraLinkDrag::decode(de, &title, &command, &icon, &oldIndex)) // internal move { BaghiraLinkDrag::setAccepted(); - QListBoxItem *after = itemAt(de->pos()); + TQListBoxItem *after = itemAt(de->pos()); int newIndex = index(after); if (!dragging_ || oldIndex < 0 || oldIndex > count()-2) insertItem (new ListBoxLink(icon, size_, title, command), after?newIndex:count()); @@ -536,16 +536,16 @@ void DnDListBox::dropEvent ( QDropEvent *de ) removeItem ( (newIndex < 0 || oldIndex < newIndex) ? oldIndex : oldIndex + 1 ); } } - else if ( QUriDrag::decode(de, list) ) + else if ( TQUriDrag::decode(de, list) ) { char *uri; KURL url; - QListBoxItem *after = itemAt(de->pos()); + TQListBoxItem *after = itemAt(de->pos()); for ( uri = list.first(); uri; uri = list.next() ) { url = KURL(uri); if (url.protocol() == "http") - insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), uri), after?index(after):count()); + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?TQString(""):url.path()), uri), after?index(after):count()); else { KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); @@ -553,14 +553,14 @@ void DnDListBox::dropEvent ( QDropEvent *de ) } } } - else if (QTextDrag::decode(de, command, subtype)) + else if (TQTextDrag::decode(de, command, subtype)) { KURL url(command); if (url.isValid()) { - QListBoxItem *after = itemAt(de->pos()); + TQListBoxItem *after = itemAt(de->pos()); if (url.protocol() == "http") - insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), command), after?index(after):count()); + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?TQString(""):url.path()), command), after?index(after):count()); else { KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); @@ -569,13 +569,13 @@ void DnDListBox::dropEvent ( QDropEvent *de ) } else if (command.contains('@')) { - QListBoxItem *after = itemAt(de->pos()); + TQListBoxItem *after = itemAt(de->pos()); command.replace(" ",""); insertItem(new ListBoxLink("kmail", size_, command, "mailto:"+command), after?index(after):count()); } else if (command.contains("'at'")) //last chance for anti-spam addy { - QListBoxItem *after = itemAt(de->pos()); + TQListBoxItem *after = itemAt(de->pos()); command.replace(" ",""); command.replace("'at'","@"); insertItem(new ListBoxLink("kmail", size_, command, "mailto:"+command), after?index(after):count()); @@ -583,9 +583,9 @@ void DnDListBox::dropEvent ( QDropEvent *de ) } } -void DnDListBox::mousePressEvent ( QMouseEvent *mpe ) +void DnDListBox::mousePressEvent ( TQMouseEvent *mpe ) { - if (mpe->button() == Qt::RightButton) + if (mpe->button() == TQt::RightButton) { currentItem = 0; popupMenu->removeItem(0); @@ -598,22 +598,22 @@ void DnDListBox::mousePressEvent ( QMouseEvent *mpe ) popupMenu->popup(mpe->globalPos()); return; } - if (mpe->button() == Qt::MidButton) + if (mpe->button() == TQt::MidButton) { - pasteURL(QClipboard::Selection, itemAt(mpe->pos())); + pasteURL(TQClipboard::Selection, itemAt(mpe->pos())); return; } ResizingLinkBox::mousePressEvent( mpe ); } -void DnDListBox::mouseReleaseEvent ( QMouseEvent *mre ) +void DnDListBox::mouseReleaseEvent ( TQMouseEvent *mre ) { if (!dragging_) ResizingLinkBox::mouseReleaseEvent( mre ); } -void DnDListBox::mouseMoveEvent ( QMouseEvent * mme ) +void DnDListBox::mouseMoveEvent ( TQMouseEvent * mme ) { - if (mme->state() & Qt::LeftButton) + if (mme->state() & TQt::LeftButton) { if (!dragging_) { @@ -622,9 +622,9 @@ void DnDListBox::mouseMoveEvent ( QMouseEvent * mme ) { dragging_ = true; BaghiraLinkDrag *d = new BaghiraLinkDrag( link->text(), link->URL(), link->icon(), index(link), this ); - d->setPixmap(*link->pixmap(),QPoint(22,22)); + d->setPixmap(*link->pixmap(),TQPoint(22,22)); d->drag(); - if (mme->state() & Qt::ControlButton || BaghiraLinkDrag::accepted()) + if (mme->state() & TQt::ControlButton || BaghiraLinkDrag::accepted()) return; poof(link); // do NOT delete d. @@ -635,14 +635,14 @@ void DnDListBox::mouseMoveEvent ( QMouseEvent * mme ) dragging_ = false; } -void DnDListBox::pasteURL(int mode, QListBoxItem *after) +void DnDListBox::pasteURL(int mode, TQListBoxItem *after) { - QString string = qApp->clipboard()->text( (QClipboard::Mode)mode ); + TQString string = tqApp->clipboard()->text( (TQClipboard::Mode)mode ); KURL url(string); if (url.isValid()) { if (url.protocol() == "http") - insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), string), after?index(after):count()); + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?TQString(""):url.path()), string), after?index(after):count()); else { KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); |