diff options
Diffstat (limited to 'kicker/taskbar/taskcontainer.cpp')
-rw-r--r-- | kicker/taskbar/taskcontainer.cpp | 115 |
1 files changed, 61 insertions, 54 deletions
diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp index 2b497ccd0..8e44f100f 100644 --- a/kicker/taskbar/taskcontainer.cpp +++ b/kicker/taskbar/taskcontainer.cpp @@ -26,6 +26,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <assert.h> +#ifdef Q_OS_SOLARIS +#include <procfs.h> +#endif /* SunOS */ + #include <tqbitmap.h> #include <tqcolor.h> #include <tqcursor.h> @@ -45,7 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kiconloader.h> #include <kimageeffect.h> -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 #include <X11/Xlib.h> #include <netwm.h> #include <fixx11h.h> @@ -96,24 +100,32 @@ static void create_atoms(Display *d) { } bool is_process_resumable(pid_t pid) { +#ifdef Q_OS_SOLARIS + TQFile procStatFile(TQString("/proc/%1/lwp/1/lwpsinfo").arg(pid)); + if (procStatFile.open(IO_ReadOnly)) { + TQByteArray statRaw = procStatFile.readAll(); + lwpsinfo_t *inf = (lwpsinfo_t *)statRaw.data(); + + procStatFile.close(); + if( inf->pr_sname == 'T' ) { + return true; + } + } +#else /* default */ TQFile procStatFile(TQString("/proc/%1/stat").arg(pid)); if (procStatFile.open(IO_ReadOnly)) { TQByteArray statRaw = procStatFile.readAll(); procStatFile.close(); TQString statString(statRaw); - TQStringList statFields = TQStringList::split(" ", statString, TRUE); + TQStringList statFields = TQStringList::split(" ", statString, true); TQString tcomm = statFields[1]; TQString state = statFields[2]; if( state == "T" ) { return true; } - else { - return false; - } - } - else { - return false; } +#endif /* read process status */ + return false; } TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name) @@ -174,7 +186,7 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames, Ta sid = m_startup->bin(); - connect(m_startup, TQT_SIGNAL(changed()), TQT_SLOT(update())); + connect(m_startup, TQ_SIGNAL(changed()), TQ_SLOT(update())); dragSwitchTimer.start(333, true); } @@ -200,10 +212,10 @@ void TaskContainer::init() installEventFilter(KickerTip::the()); - connect(&animationTimer, TQT_SIGNAL(timeout()), TQT_SLOT(animationTimerFired())); - connect(&dragSwitchTimer, TQT_SIGNAL(timeout()), TQT_SLOT(showMe())); - connect(&attentionTimer, TQT_SIGNAL(timeout()), TQT_SLOT(attentionTimerFired())); - connect(&m_paintEventCompressionTimer, TQT_SIGNAL(timeout()), TQT_SLOT(updateNow())); + connect(&animationTimer, TQ_SIGNAL(timeout()), TQ_SLOT(animationTimerFired())); + connect(&dragSwitchTimer, TQ_SIGNAL(timeout()), TQ_SLOT(showMe())); + connect(&attentionTimer, TQ_SIGNAL(timeout()), TQ_SLOT(attentionTimerFired())); + connect(&m_paintEventCompressionTimer, TQ_SIGNAL(timeout()), TQ_SLOT(updateNow())); } TaskContainer::~TaskContainer() @@ -223,8 +235,8 @@ void TaskContainer::showMe() animationTimer.start(100); emit showMe(this); - disconnect(&dragSwitchTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(showMe())); - connect(&dragSwitchTimer, TQT_SIGNAL(timeout()), TQT_SLOT(dragSwitch())); + disconnect(&dragSwitchTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(showMe())); + connect(&dragSwitchTimer, TQ_SIGNAL(timeout()), TQ_SLOT(dragSwitch())); } void TaskContainer::stopTimers() @@ -244,7 +256,7 @@ void TaskContainer::taskChanged(bool geometryOnlyChange) return; } - const TQObject* source = TQT_TQOBJECT_CONST(sender()); + const TQObject* source = sender(); Task::Ptr task = 0; Task::List::const_iterator itEnd = tasks.constEnd(); for (Task::List::const_iterator it = tasks.constBegin(); it != itEnd; ++it) @@ -267,7 +279,7 @@ void TaskContainer::taskChanged(bool geometryOnlyChange) void TaskContainer::iconChanged() { - const TQObject* source = TQT_TQOBJECT_CONST(sender()); + const TQObject* source = sender(); Task::Ptr task = 0; Task::List::const_iterator itEnd = tasks.constEnd(); for (Task::List::const_iterator it = tasks.constBegin(); it != itEnd; ++it) @@ -430,9 +442,9 @@ void TaskContainer::add(Task::Ptr task) KickerTip::Client::updateKickerTip(); update(); - connect(task, TQT_SIGNAL(changed(bool)), TQT_SLOT(taskChanged(bool))); - connect(task, TQT_SIGNAL(iconChanged()), TQT_SLOT(iconChanged())); - connect(task, TQT_SIGNAL(activated()), TQT_SLOT(setLastActivated())); + connect(task, TQ_SIGNAL(changed(bool)), TQ_SLOT(taskChanged(bool))); + connect(task, TQ_SIGNAL(iconChanged()), TQ_SLOT(iconChanged())); + connect(task, TQ_SIGNAL(activated()), TQ_SLOT(setLastActivated())); } void TaskContainer::remove(Task::Ptr task) @@ -654,7 +666,7 @@ void TaskContainer::drawButton(TQPainter *p) for (int i = 0; i < 2; ++i) { line = KickerLib::blendColors(line, colors.background()); - p->setPen(TQPen(line, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + p->setPen(TQPen(line, 1, TQt::SolidLine, TQt::RoundCap, TQt::RoundJoin)); r.addCoords(-1, -1, 1, 1); p->drawRect(r); } @@ -688,12 +700,12 @@ void TaskContainer::drawButton(TQPainter *p) if (drawButton) { if (READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) { - style().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p, + style().drawPrimitive(TQStyle::PE_ButtonBevel, p, TQRect(1, 1, width()-3, height()-2), colors, sunken ? TQStyle::Style_On : TQStyle::Style_Raised); } else { - style().tqdrawPrimitive(TQStyle::PE_ButtonTool, p, + style().drawPrimitive(TQStyle::PE_ButtonTool, p, TQRect(1, 1, width()-2, height()-2), colors, sunken ? TQStyle::Style_Down : TQStyle::Style_Raised); } @@ -712,7 +724,7 @@ void TaskContainer::drawButton(TQPainter *p) if (taskBar->showIcons()) { if (pixmap.isNull() && m_startup) - pixmap = kapp->iconLoader()->loadIcon(m_startup->icon(), TDEIcon::Panel, iconSize); + pixmap = tdeApp->iconLoader()->loadIcon(m_startup->icon(), TDEIcon::Panel, iconSize); if ( !pixmap.isNull() ) { @@ -882,10 +894,10 @@ void TaskContainer::drawButton(TQPainter *p) switch (arrowType) { - case Qt::LeftArrow: e = TQStyle::PE_ArrowLeft; break; - case Qt::RightArrow: e = TQStyle::PE_ArrowRight; break; - case Qt::UpArrow: e = TQStyle::PE_ArrowUp; break; - case Qt::DownArrow: e = TQStyle::PE_ArrowDown; break; + case TQt::LeftArrow: e = TQStyle::PE_ArrowLeft; break; + case TQt::RightArrow: e = TQStyle::PE_ArrowRight; break; + case TQt::UpArrow: e = TQStyle::PE_ArrowUp; break; + case TQt::DownArrow: e = TQStyle::PE_ArrowDown; break; } int flags = TQStyle::Style_Enabled; @@ -896,7 +908,7 @@ void TaskContainer::drawButton(TQPainter *p) flags |= TQStyle::Style_Down; } - style().tqdrawPrimitive(e, p, ar, colors, flags); + style().drawPrimitive(e, p, ar, colors, flags); } // draw mouse over frame in transparent mode @@ -1003,7 +1015,7 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e ) return; } - if (e->button() == Qt::LeftButton) + if (e->button() == TQt::LeftButton) { m_dragStartPos = e->pos(); } @@ -1018,13 +1030,13 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e ) // Other actions will be handled in mouseReleaseEvent switch (e->button()) { - case Qt::LeftButton: + case TQt::LeftButton: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton); break; - case Qt::MidButton: + case TQt::MidButton: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton); break; - case Qt::RightButton: + case TQt::RightButton: default: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton); break; @@ -1049,7 +1061,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e) // This is to avoid the flicker caused by redrawing the // button as unpressed just before it's activated. - if (!TQT_TQRECT_OBJECT(rect()).contains(e->pos())) + if (!rect().contains(e->pos())) { TQToolButton::mouseReleaseEvent(e); return; @@ -1059,13 +1071,13 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e) switch (e->button()) { - case Qt::LeftButton: + case TQt::LeftButton: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton); break; - case Qt::MidButton: + case TQt::MidButton: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton); break; - case Qt::RightButton: + case TQt::RightButton: default: buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton); break; @@ -1085,7 +1097,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e) } performAction( buttonAction ); - TQTimer::singleShot(0, this, TQT_SLOT(update())); + TQTimer::singleShot(0, this, TQ_SLOT(update())); } void TaskContainer::performAction(int action) @@ -1242,7 +1254,7 @@ void TaskContainer::popupMenu(int action) } else if (action == m_settingsObject->ShowOperationsMenu) { - if (!kapp->authorizeTDEAction("twin_rmb")) + if (!tdeApp->authorizeTDEAction("twin_rmb")) { return; } @@ -1298,22 +1310,22 @@ TQPopupMenu* TaskContainer::makeTaskMoveMenu() id = menu->insertItem(SmallIconSet("go-first"), i18n("Move to Beginning"), - this, TQT_SLOT(slotTaskMoveBeginning())); + this, TQ_SLOT(slotTaskMoveBeginning())); menu->setItemEnabled(id, (capabilities & TaskMoveDestination::Left)); id = menu->insertItem(SmallIconSet("back"), i18n("Move Left"), - this, TQT_SLOT(slotTaskMoveLeft())); + this, TQ_SLOT(slotTaskMoveLeft())); menu->setItemEnabled(id, (capabilities & TaskMoveDestination::Left)); id = menu->insertItem(SmallIconSet("forward"), i18n("Move Right"), - this, TQT_SLOT(slotTaskMoveRight())); + this, TQ_SLOT(slotTaskMoveRight())); menu->setItemEnabled(id, (capabilities & TaskMoveDestination::Right)); id = menu->insertItem(SmallIconSet("go-last"), i18n("Move to End"), - this, TQT_SLOT(slotTaskMoveEnd())); + this, TQ_SLOT(slotTaskMoveEnd())); menu->setItemEnabled(id, (capabilities & TaskMoveDestination::Right)); return menu; @@ -1352,11 +1364,6 @@ void TaskContainer::mouseMoveEvent( TQMouseEvent* e ) bool TaskContainer::startDrag(const TQPoint& pos) { - if (m_filteredTasks.count() != 1) - { - return false; - } - int delay = TDEGlobalSettings::dndEventDelay(); if ((m_dragStartPos - pos).manhattanLength() > delay) @@ -1399,7 +1406,7 @@ bool TaskContainer::eventFilter(TQObject *o, TQEvent *e) if ( TQApplication::widgetAt( p, true ) == this ) { if (me->type() == TQEvent::MouseButtonPress && - me->button() == Qt::LeftButton) + me->button() == TQt::LeftButton) { m_dragStartPos = mapFromGlobal(p); } @@ -1417,10 +1424,10 @@ bool TaskContainer::eventFilter(TQObject *o, TQEvent *e) { if (!m_dragStartPos.isNull()) { - TQMouseEvent* me = TQT_TQMOUSEEVENT(e); + TQMouseEvent* me = static_cast<TQMouseEvent*>(e); TQPoint p(me->globalPos()); - if (me->state() & Qt::LeftButton && + if (me->state() & TQt::LeftButton && TQApplication::widgetAt(p, true) == this) { kdDebug() << "event move" << endl; @@ -1658,7 +1665,7 @@ void TaskContainer::updateFilteredTaskList() (!READ_MERGED_TASKBAR_SETTING(showOnlyIconified) || t->isIconified())) { pid_t pid = 0; -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 Atom type_ret; int format_ret; unsigned long nitems_ret = 0, unused = 0; @@ -1719,7 +1726,7 @@ void TaskContainer::updateFilteredTaskList() // sort container list by desktop if (taskBar->sortByDesktop() && m_filteredTasks.count() > 1) { - TQValueVector<QPair<int, Task::Ptr> > sorted; + TQValueVector<TQPair<int, Task::Ptr> > sorted; sorted.resize(m_filteredTasks.count()); int i = 0; @@ -1734,7 +1741,7 @@ void TaskContainer::updateFilteredTaskList() qHeapSort(sorted); m_filteredTasks.clear(); - for (TQValueVector<QPair<int, Task::Ptr> >::iterator it = sorted.begin(); + for (TQValueVector<TQPair<int, Task::Ptr> >::iterator it = sorted.begin(); it != sorted.end(); ++it) { |