diff options
Diffstat (limited to 'ksysv/ksvdraglist.cpp')
-rw-r--r-- | ksysv/ksvdraglist.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/ksysv/ksvdraglist.cpp b/ksysv/ksvdraglist.cpp index b0bd9bd..ea2e264 100644 --- a/ksysv/ksvdraglist.cpp +++ b/ksysv/ksvdraglist.cpp @@ -33,16 +33,16 @@ #include <stdlib.h> -#include <qpainter.h> -#include <qdragobject.h> -#include <qdatastream.h> -#include <qheader.h> -#include <qpixmapcache.h> -#include <qbitmap.h> -#include <qcursor.h> -#include <qcolor.h> -#include <qcstring.h> -#include <qlabel.h> +#include <tqpainter.h> +#include <tqdragobject.h> +#include <tqdatastream.h> +#include <tqheader.h> +#include <tqpixmapcache.h> +#include <tqbitmap.h> +#include <tqcursor.h> +#include <tqcolor.h> +#include <tqcstring.h> +#include <tqlabel.h> #include <kapplication.h> #include <kpopupmenu.h> @@ -58,7 +58,7 @@ #include "ActionList.h" KSVItem::KSVItem (KListView* view) - : QListViewItem (view), + : TQListViewItem (view), mData (new KSVData()), mConfig (KSVConfig::self()), mNewNormalColor (mConfig->newNormalColor()), @@ -69,7 +69,7 @@ KSVItem::KSVItem (KListView* view) } KSVItem::KSVItem (const KSVItem& item) - : QListViewItem (item.listView()), + : TQListViewItem (item.listView()), mData (new KSVData(*item.mData)), mConfig (KSVConfig::self()), mNewNormalColor (mConfig->newNormalColor()), @@ -84,7 +84,7 @@ KSVItem::KSVItem (const KSVItem& item) } KSVItem::KSVItem (KSVDragList* view, const KSVData& data) - : QListViewItem (view), + : TQListViewItem (view), mData (new KSVData (data)), mConfig (KSVConfig::self()), mNewNormalColor (mConfig->newNormalColor()), @@ -105,13 +105,13 @@ void KSVItem::copy (const KSVData& item) setText (ServiceName, mData->label()); } -QString KSVItem::key (int, bool) const +TQString KSVItem::key (int, bool) const { return mData->numberString() + mData->label(); } -KSVItem::KSVItem (KListView* view, QString file, QString path, QString label, Q_INT8 nr ) - : QListViewItem (view), +KSVItem::KSVItem (KListView* view, TQString file, TQString path, TQString label, Q_INT8 nr ) + : TQListViewItem (view), mData (new KSVData (file, path, label, nr)), mConfig (KSVConfig::self()), mNewNormalColor (mConfig->newNormalColor()), @@ -128,7 +128,7 @@ KSVItem::~KSVItem() delete mData; } -void KSVItem::paintCell (QPainter* p, const QColorGroup& cg, int column, int width, int align) +void KSVItem::paintCell (TQPainter* p, const TQColorGroup& cg, int column, int width, int align) { switch (column) { @@ -141,30 +141,30 @@ void KSVItem::paintCell (QPainter* p, const QColorGroup& cg, int column, int wid break; } - QColorGroup colors = cg; + TQColorGroup colors = cg; if (mData->newEntry()) { - colors.setColor (QColorGroup::Text, mNewNormalColor); - colors.setColor (QColorGroup::HighlightedText, mNewSelectedColor); + colors.setColor (TQColorGroup::Text, mNewNormalColor); + colors.setColor (TQColorGroup::HighlightedText, mNewSelectedColor); } else if (mData->changed()) { - colors.setColor (QColorGroup::Text, mChangedNormalColor); - colors.setColor (QColorGroup::HighlightedText, mChangedSelectedColor); + colors.setColor (TQColorGroup::Text, mChangedNormalColor); + colors.setColor (TQColorGroup::HighlightedText, mChangedSelectedColor); } - QListViewItem::paintCell (p, colors, column, width, align); + TQListViewItem::paintCell (p, colors, column, width, align); } -QString KSVItem::toString() const +TQString KSVItem::toString() const { return filenameAndPath(); } -QString KSVItem::tooltip () const +TQString KSVItem::tooltip () const { - QString result; + TQString result; if (mConfig->showDescription()) { @@ -191,20 +191,20 @@ void KSVItem::setNew ( bool val ) } -QPixmap KSVItem::paintDragIcon (const QFont& font, const QColorGroup&) const +TQPixmap KSVItem::paintDragIcon (const TQFont& font, const TQColorGroup&) const { - QFontMetrics metric (font); - QRect textRect = metric.boundingRect (label()); - const QPixmap& icon = *pixmap (Icon); + TQFontMetrics metric (font); + TQRect textRect = metric.boundingRect (label()); + const TQPixmap& icon = *pixmap (Icon); const int margin = listView()->itemMargin(); const int width = icon.width() + margin * 2 + textRect.width(); const int height = kMax (icon.height(), textRect.height()); - QPixmap result (width, height); + TQPixmap result (width, height); result.fill (white); - QPainter p (&result); + TQPainter p (&result); p.drawPixmap (0, 0, icon); p.setFont (font); @@ -214,7 +214,7 @@ QPixmap KSVItem::paintDragIcon (const QFont& font, const QColorGroup&) const label()); p.end(); - QBitmap mask (width, height); + TQBitmap mask (width, height); p.begin (&mask); p.setFont (font); @@ -228,35 +228,35 @@ QPixmap KSVItem::paintDragIcon (const QFont& font, const QColorGroup&) const AlignLeft | AlignVCenter, label()); - QBrush brush (color0); + TQBrush brush (color0); brush.setStyle(Dense5Pattern); p.fillRect (0, 0, width, height, brush); p.end(); result.setMask(mask); - result.setOptimization(QPixmap::BestOptim); + result.setOptimization(TQPixmap::BestOptim); return result; } -void KSVItem::setIcon (const QPixmap& icon) +void KSVItem::setIcon (const TQPixmap& icon) { setPixmap (Icon, icon); } -void KSVItem::setLabel (const QString& label) +void KSVItem::setLabel (const TQString& label) { mData->setLabel (label); setText (ServiceName, label); } -void KSVItem::setRunlevel (const QString& runlevel) +void KSVItem::setRunlevel (const TQString& runlevel) { mData->setRunlevel (runlevel); } -void KSVItem::setFilename (const QString& file) +void KSVItem::setFilename (const TQString& file) { mData->setFilename (file); } @@ -268,27 +268,27 @@ void KSVItem::setNumber (Q_INT8 nr) setText(SortNumber, mData->numberString()); } -void KSVItem::setPath (const QString& path) +void KSVItem::setPath (const TQString& path) { mData->setPath (path); } -void KSVItem::setNewNormalColor (const QColor& col) +void KSVItem::setNewNormalColor (const TQColor& col) { mNewNormalColor = col; } -void KSVItem::setNewSelectedColor (const QColor& col) +void KSVItem::setNewSelectedColor (const TQColor& col) { mNewSelectedColor = col; } -void KSVItem::setChangedNormalColor (const QColor& col) +void KSVItem::setChangedNormalColor (const TQColor& col) { mChangedNormalColor = col; } -void KSVItem::setChangedSelectedColor (const QColor& col) +void KSVItem::setChangedSelectedColor (const TQColor& col) { mChangedSelectedColor = col; } @@ -298,7 +298,7 @@ void KSVItem::setChanged (bool val) mData->setChanged (val); } -void KSVItem::setOriginalRunlevel (const QString& rl) +void KSVItem::setOriginalRunlevel (const TQString& rl) { mData->setOriginalRunlevel (rl); } @@ -309,7 +309,7 @@ void KSVItem::setOriginalRunlevel (const QString& rl) // KSVDragList //----------------------- -KSVDragList::KSVDragList ( QWidget* parent, const char* name ) +KSVDragList::KSVDragList ( TQWidget* parent, const char* name ) : KListView (parent, name), mItemToDrag (0L), mDragMenu (new KPopupMenu (this)), @@ -326,7 +326,7 @@ KSVDragList::KSVDragList ( QWidget* parent, const char* name ) setAcceptDrops(true); setDropVisualizer (true); - QHeader* h = header(); + TQHeader* h = header(); h->setClickEnabled (false); addColumn (i18n("No.")); // SortNumber @@ -358,8 +358,8 @@ KSVDragList::KSVDragList ( QWidget* parent, const char* name ) mRMList.setAutoDelete(true); // catch drops - connect (this, SIGNAL (dropped (QDropEvent*, QListViewItem*)), - this, SLOT (drop (QDropEvent*, QListViewItem*))); + connect (this, TQT_SIGNAL (dropped (TQDropEvent*, TQListViewItem*)), + this, TQT_SLOT (drop (TQDropEvent*, TQListViewItem*))); } KSVDragList::~KSVDragList() @@ -370,11 +370,11 @@ KSVDragList::~KSVDragList() delete toolTip; } -void KSVDragList::initItem (QString file, QString path, QString name, Q_INT8 nr) +void KSVDragList::initItem (TQString file, TQString path, TQString name, Q_INT8 nr) { KSVItem* tmp = new KSVItem(this, file, path, name, nr); - tmp->setRunlevel(QObject::name()); - tmp->setOriginalRunlevel(QObject::name()); + tmp->setRunlevel(TQObject::name()); + tmp->setOriginalRunlevel(TQObject::name()); tmp->setIcon (mIcon); @@ -388,11 +388,11 @@ void KSVDragList::initItem (QString file, QString path, QString name, Q_INT8 nr) repaint(false); } -void KSVDragList::setDefaultIcon (const QPixmap& icon) +void KSVDragList::setDefaultIcon (const TQPixmap& icon) { mIcon = icon; - for (QListViewItemIterator it (firstChild()); it.current(); ++it) + for (TQListViewItemIterator it (firstChild()); it.current(); ++it) { static_cast <KSVItem*> (it.current())->setIcon (mIcon); } @@ -405,12 +405,12 @@ void KSVDragList::clear () clearRMList(); } -void KSVDragList::setNewNormalColor ( const QColor& col ) +void KSVDragList::setNewNormalColor ( const TQColor& col ) { mNewNormalColor = col; KSVItem* item; - for (QListViewItemIterator it (firstChild()); + for (TQListViewItemIterator it (firstChild()); (item = static_cast<KSVItem*>(it.current())); ++it) { @@ -418,12 +418,12 @@ void KSVDragList::setNewNormalColor ( const QColor& col ) } } -void KSVDragList::setNewSelectedColor (const QColor& col) +void KSVDragList::setNewSelectedColor (const TQColor& col) { mNewSelectedColor = col; KSVItem* item; - for (QListViewItemIterator it (firstChild()); + for (TQListViewItemIterator it (firstChild()); (item = static_cast<KSVItem*>(it.current())); ++it) { @@ -431,7 +431,7 @@ void KSVDragList::setNewSelectedColor (const QColor& col) } } -Q_INT8 KSVDragList::generateNumber (const QString& label, +Q_INT8 KSVDragList::generateNumber (const TQString& label, const KSVData* itemBelow, const KSVData* itemAbove) const { Q_INT8 high = itemBelow ? itemBelow->number() : -1; @@ -468,12 +468,12 @@ Q_INT8 KSVDragList::generateNumber (Q_INT8 high, Q_INT8 low) const return result; } -void KSVDragList::setChangedNormalColor (const QColor& col) +void KSVDragList::setChangedNormalColor (const TQColor& col) { mChangedNormalColor = col; KSVItem* item; - for (QListViewItemIterator it (firstChild()); + for (TQListViewItemIterator it (firstChild()); (item = static_cast<KSVItem*> (it.current())); ++it) { @@ -481,12 +481,12 @@ void KSVDragList::setChangedNormalColor (const QColor& col) } } -void KSVDragList::setChangedSelectedColor (const QColor& col) +void KSVDragList::setChangedSelectedColor (const TQColor& col) { mChangedSelectedColor = col; KSVItem* item; - for (QListViewItemIterator it (firstChild()); + for (TQListViewItemIterator it (firstChild()); (item = static_cast<KSVItem*> (it.current())); ++it) { @@ -498,7 +498,7 @@ KSVItem* KSVDragList::match (const KSVData& data) { KSVItem* res = 0L; - for (QListViewItemIterator it (this); + for (TQListViewItemIterator it (this); (res = static_cast<KSVItem*> (it.current())); ++it) { @@ -539,7 +539,7 @@ void KSVDragList::startDrag () } //KSVDrag* KSVDragList::dragObject () -QDragObject* KSVDragList::dragObject () +TQDragObject* KSVDragList::dragObject () { if (mItemToDrag) { @@ -549,14 +549,14 @@ QDragObject* KSVDragList::dragObject () return 0L; } -bool KSVDragList::acceptDrag (QDropEvent* e) const +bool KSVDragList::acceptDrag (TQDropEvent* e) const { e->acceptAction (); return acceptDrops() && e->provides ("application/x-ksysv"); } -void KSVDragList::focusInEvent (QFocusEvent* e) +void KSVDragList::focusInEvent (TQFocusEvent* e) { KListView::focusInEvent(e); @@ -575,7 +575,7 @@ bool KSVDragList::removeFromRMList (const KSVData& item) { KSVData* res = 0L; - for (QPtrListIterator<KSVData> it (mRMList); + for (TQPtrListIterator<KSVData> it (mRMList); it.current(); ++it) { @@ -666,15 +666,15 @@ bool KSVDragList::insert (const KSVData& data, const KSVItem* where, KSVAction*& return success; } -void KSVDragList::drop (QDropEvent* e, QListViewItem* after) +void KSVDragList::drop (TQDropEvent* e, TQListViewItem* after) { KSVData data; KSVDragList* source = static_cast<KSVDragList*> (e->source()); - QPopupMenu* menu = 0L; + TQPopupMenu* menu = 0L; // hack to empty the cursor stack after DND - QApplication::restoreOverrideCursor(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if ((!source) || (!strcmp(source->name(), "Scripts"))) menu = mDragCopyMenu; @@ -687,10 +687,10 @@ void KSVDragList::drop (QDropEvent* e, QListViewItem* after) { int res = -1; - if (e->action() == QDropEvent::Copy && source != this) + if (e->action() == TQDropEvent::Copy && source != this) res = Copy; else - res = menu->exec (QCursor::pos(), 1); + res = menu->exec (TQCursor::pos(), 1); if (res == -1) // operation cancelled return; @@ -720,7 +720,7 @@ bool KSVDragList::addToRMList (const KSVData& item) { KSVData* res = 0L; - for (QPtrListIterator<KSVData> it (mRMList); + for (TQPtrListIterator<KSVData> it (mRMList); it.current(); ++it) { @@ -753,7 +753,7 @@ void KSVDragList::setEnabled (bool enable) if (testWState (WState_Disabled)) { clearWState (WState_Disabled); - // setBackgroundFromMode(); // this is private in QWidget... + // setBackgroundFromMode(); // this is private in TQWidget... // well it doesn't really matter in this case enabledChange( TRUE ); } @@ -765,7 +765,7 @@ void KSVDragList::setEnabled (bool enable) if (focusWidget() == this) focusNextPrevChild (TRUE); setWState (WState_Disabled); - // setBackgroundFromMode(); // this is private in QWidget... + // setBackgroundFromMode(); // this is private in TQWidget... // well it doesn't really matter in this case enabledChange (FALSE); } @@ -776,7 +776,7 @@ void KSVDragList::setEnabled (bool enable) // KServiceDragList -KServiceDragList::KServiceDragList (QWidget* parent, const char* name) +KServiceDragList::KServiceDragList (TQWidget* parent, const char* name) : KSVDragList (parent, name) { } |