summaryrefslogtreecommitdiffstats
path: root/src/urlnavigatorbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlnavigatorbutton.cpp')
-rw-r--r--src/urlnavigatorbutton.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/urlnavigatorbutton.cpp b/src/urlnavigatorbutton.cpp
index 6262210..165b275 100644
--- a/src/urlnavigatorbutton.cpp
+++ b/src/urlnavigatorbutton.cpp
@@ -19,11 +19,11 @@
***************************************************************************/
#include "urlnavigatorbutton.h"
-#include <qcursor.h>
-#include <qfontmetrics.h>
-#include <qpainter.h>
-#include <qtimer.h>
-#include <qtooltip.h>
+#include <tqcursor.h>
+#include <tqfontmetrics.h>
+#include <tqpainter.h>
+#include <tqtimer.h>
+#include <tqtooltip.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
@@ -38,19 +38,19 @@
#include "dolphinview.h"
#include "dolphin.h"
-URLNavigatorButton::URLNavigatorButton(int index, URLNavigator* parent) :
- URLButton(parent),
+URLNavigatorButton::URLNavigatorButton(int index, URLNavigator* tqparent) :
+ URLButton(tqparent),
m_index(-1),
m_listJob(0)
{
setAcceptDrops(true);
setMinimumWidth(arrowWidth());
setIndex(index);
- connect(this, SIGNAL(clicked()), this, SLOT(updateNavigatorURL()));
+ connect(this, TQT_SIGNAL(clicked()), this, TQT_SLOT(updateNavigatorURL()));
- m_popupDelay = new QTimer(this);
- connect(m_popupDelay, SIGNAL(timeout()), this, SLOT(startListJob()));
- connect(this, SIGNAL(pressed()), this, SLOT(startPopupDelay()));
+ m_popupDelay = new TQTimer(this);
+ connect(m_popupDelay, TQT_SIGNAL(timeout()), this, TQT_SLOT(startListJob()));
+ connect(this, TQT_SIGNAL(pressed()), this, TQT_SLOT(startPopupDelay()));
}
URLNavigatorButton::~URLNavigatorButton()
@@ -64,13 +64,13 @@ void URLNavigatorButton::setIndex(int index)
}
m_index = index;
- QString path(urlNavigator()->url().prettyURL());
+ TQString path(urlNavigator()->url().prettyURL());
setText(path.section('/', index, index));
// Check whether the button indicates the full path of the URL. If
// this is the case, the button is marked as 'active'.
++index;
- QFont adjustedFont(font());
+ TQFont adjustedFont(font());
if (path.section('/', index, index).isEmpty()) {
setDisplayHintEnabled(ActivatedHint, true);
adjustedFont.setBold(true);
@@ -89,13 +89,13 @@ int URLNavigatorButton::index() const
return m_index;
}
-void URLNavigatorButton::drawButton(QPainter* painter)
+void URLNavigatorButton::drawButton(TQPainter* painter)
{
const int buttonWidth = width();
const int buttonHeight = height();
- QColor backgroundColor;
- QColor foregroundColor;
+ TQColor backgroundColor;
+ TQColor foregroundColor;
const bool isHighlighted = isDisplayHintEnabled(EnteredHint) ||
isDisplayHintEnabled(DraggedHint) ||
isDisplayHintEnabled(PopupActiveHint);
@@ -104,17 +104,17 @@ void URLNavigatorButton::drawButton(QPainter* painter)
foregroundColor = KGlobalSettings::highlightedTextColor();
}
else {
- backgroundColor = colorGroup().background();
+ backgroundColor = tqcolorGroup().background();
foregroundColor = KGlobalSettings::buttonTextColor();
}
- // dimm the colors if the parent view does not have the focus
- const DolphinView* parentView = urlNavigator()->dolphinView();
+ // dimm the colors if the tqparent view does not have the focus
+ const DolphinView* tqparentView = urlNavigator()->dolphinView();
const Dolphin& dolphin = Dolphin::mainWin();
- const bool isActive = (dolphin.activeView() == parentView);
+ const bool isActive = (dolphin.activeView() == tqparentView);
if (!isActive) {
- QColor dimmColor(colorGroup().background());
+ TQColor dimmColor(tqcolorGroup().background());
foregroundColor = mixColors(foregroundColor, dimmColor);
if (isHighlighted) {
backgroundColor = mixColors(backgroundColor, dimmColor);
@@ -153,23 +153,23 @@ void URLNavigatorButton::drawButton(QPainter* painter)
}
const bool clipped = isTextClipped();
- const int align = clipped ? Qt::AlignVCenter : Qt::AlignCenter;
- painter->drawText(QRect(0, 0, textWidth, buttonHeight), align, text());
+ const int align = clipped ? TQt::AlignVCenter : TQt::AlignCenter;
+ painter->drawText(TQRect(0, 0, textWidth, buttonHeight), align, text());
if (clipped) {
// Blend the right area of the text with the background, as the
// text is clipped.
- // TODO: use alpha blending in Qt4 instead of drawing the text that often
+ // TODO: use alpha blending in TQt4 instead of drawing the text that often
const int blendSteps = 16;
- QColor blendColor(backgroundColor);
+ TQColor blendColor(backgroundColor);
const int redInc = (foregroundColor.red() - backgroundColor.red()) / blendSteps;
const int greenInc = (foregroundColor.green() - backgroundColor.green()) / blendSteps;
const int blueInc = (foregroundColor.blue() - backgroundColor.blue()) / blendSteps;
for (int i = 0; i < blendSteps; ++i) {
- painter->setClipRect(QRect(textWidth - i, 0, 1, buttonHeight));
+ painter->setClipRect(TQRect(textWidth - i, 0, 1, buttonHeight));
painter->setPen(blendColor);
- painter->drawText(QRect(0, 0, textWidth, buttonHeight), align, text());
+ painter->drawText(TQRect(0, 0, textWidth, buttonHeight), align, text());
blendColor.setRgb(blendColor.red() + redInc,
blendColor.green() + greenInc,
@@ -178,30 +178,30 @@ void URLNavigatorButton::drawButton(QPainter* painter)
}
}
-void URLNavigatorButton::enterEvent(QEvent* event)
+void URLNavigatorButton::enterEvent(TQEvent* event)
{
URLButton::enterEvent(event);
// if the text is clipped due to a small window width, the text should
// be shown as tooltip
if (isTextClipped()) {
- QToolTip::add(this, text());
+ TQToolTip::add(this, text());
}
}
-void URLNavigatorButton::leaveEvent(QEvent* event)
+void URLNavigatorButton::leaveEvent(TQEvent* event)
{
URLButton::leaveEvent(event);
- QToolTip::remove(this);
+ TQToolTip::remove(this);
}
-void URLNavigatorButton::dropEvent(QDropEvent* event)
+void URLNavigatorButton::dropEvent(TQDropEvent* event)
{
KURL::List urls;
if (KURLDrag::decode(event, urls) && !urls.isEmpty()) {
setDisplayHintEnabled(DraggedHint, true);
- QString path(urlNavigator()->url().prettyURL());
+ TQString path(urlNavigator()->url().prettyURL());
path = path.section('/', 0, m_index);
Dolphin::mainWin().dropURLs(urls, KURL(path));
@@ -211,7 +211,7 @@ void URLNavigatorButton::dropEvent(QDropEvent* event)
}
}
-void URLNavigatorButton::dragEnterEvent(QDragEnterEvent* event)
+void URLNavigatorButton::dragEnterEvent(TQDragEnterEvent* event)
{
event->accept(KURLDrag::canDecode(event));
@@ -219,7 +219,7 @@ void URLNavigatorButton::dragEnterEvent(QDragEnterEvent* event)
update();
}
-void URLNavigatorButton::dragLeaveEvent(QDragLeaveEvent* event)
+void URLNavigatorButton::dragLeaveEvent(TQDragLeaveEvent* event)
{
URLButton::dragLeaveEvent(event);
@@ -263,9 +263,9 @@ void URLNavigatorButton::startListJob()
m_listJob = KIO::listDir(url, false, false);
m_subdirs.clear(); // just to be ++safe
- connect(m_listJob, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList &)),
- this, SLOT(entriesList(KIO::Job*, const KIO::UDSEntryList&)));
- connect(m_listJob, SIGNAL(result(KIO::Job*)), this, SLOT(listJobFinished(KIO::Job*)));
+ connect(m_listJob, TQT_SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList &)),
+ this, TQT_SLOT(entriesList(KIO::Job*, const KIO::UDSEntryList&)));
+ connect(m_listJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(listJobFinished(KIO::Job*)));
}
void URLNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& entries)
@@ -277,7 +277,7 @@ void URLNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& ent
KIO::UDSEntryList::const_iterator it = entries.constBegin();
KIO::UDSEntryList::const_iterator itEnd = entries.constEnd();
while (it != itEnd) {
- QString name;
+ TQString name;
bool isDir = false;
KIO::UDSEntry entry = *it;
KIO::UDSEntry::const_iterator atomIt = entry.constBegin();
@@ -320,10 +320,10 @@ void URLNavigatorButton::listJobFinished(KIO::Job* job)
setDisplayHintEnabled(PopupActiveHint, true);
update(); // ensure the button is drawn highlighted
- QPopupMenu* dirsMenu = new QPopupMenu(this);
+ TQPopupMenu* dirsMenu = new TQPopupMenu(this);
//setPopup(dirsMenu);
- QStringList::const_iterator it = m_subdirs.constBegin();
- QStringList::const_iterator itEnd = m_subdirs.constEnd();
+ TQStringList::const_iterator it = m_subdirs.constBegin();
+ TQStringList::const_iterator itEnd = m_subdirs.constEnd();
int i = 0;
while (it != itEnd) {
dirsMenu->insertItem(*it, i);
@@ -331,7 +331,7 @@ void URLNavigatorButton::listJobFinished(KIO::Job* job)
++it;
}
- int result = dirsMenu->exec(urlNavigator()->mapToGlobal(geometry().bottomLeft()));
+ int result = dirsMenu->exec(urlNavigator()->mapToGlobal(tqgeometry().bottomLeft()));
if (result >= 0) {
KURL url = urlNavigator()->url(m_index);
@@ -361,23 +361,23 @@ bool URLNavigatorButton::isTextClipped() const
availableWidth -= arrowWidth() + 1;
}
- QFontMetrics fontMetrics(font());
+ TQFontMetrics fontMetrics(font());
return fontMetrics.width(text()) >= availableWidth;
}
-void URLNavigatorButton::mousePressEvent(QMouseEvent * event)
+void URLNavigatorButton::mousePressEvent(TQMouseEvent * event)
{
- if (event->button() == LeftButton)
+ if (event->button() == Qt::LeftButton)
dragPos = event->pos();
URLButton::mousePressEvent(event);
}
-void URLNavigatorButton::mouseMoveEvent(QMouseEvent * event)
+void URLNavigatorButton::mouseMoveEvent(TQMouseEvent * event)
{
- if (event->state() & LeftButton) {
+ if (event->state() & Qt::LeftButton) {
int distance = (event->pos() - dragPos).manhattanLength();
- if (distance > QApplication::startDragDistance()*2)//don't start on small move (for submenu usability)
+ if (distance > TQApplication::startDragDistance()*2)//don't start on small move (for submenu usability)
startDrag();
}
URLButton::mouseMoveEvent(event);