summaryrefslogtreecommitdiffstats
path: root/src/urlnavigator.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-27 00:40:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-27 00:40:29 +0000
commit7a741e43ff09e70396a918956219b8316c48e522 (patch)
tree3d0f60eccd59786cea7236db2d5c4c1f25874515 /src/urlnavigator.cpp
parenta48487ef0c329434b58b6f920111bb0999f1109e (diff)
downloaddolphin-7a741e43ff09e70396a918956219b8316c48e522.tar.gz
dolphin-7a741e43ff09e70396a918956219b8316c48e522.zip
TQt4 port Dolphin
This enables compilation under Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/dolphin@1229359 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/urlnavigator.cpp')
-rw-r--r--src/urlnavigator.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp
index 3f0d278..3f01e1b 100644
--- a/src/urlnavigator.cpp
+++ b/src/urlnavigator.cpp
@@ -23,17 +23,17 @@
#include <assert.h>
#include <kurl.h>
-#include <qobjectlist.h>
-#include <qcombobox.h>
+#include <tqobjectlist.h>
+#include <tqcombobox.h>
#include <klocale.h>
#include <kiconloader.h>
-#include <qpopupmenu.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qsizepolicy.h>
-#include <qtooltip.h>
-#include <qfont.h>
-#include <qlistbox.h>
+#include <tqpopupmenu.h>
+#include <tqlineedit.h>
+#include <tqpushbutton.h>
+#include <tqsizepolicy.h>
+#include <tqtooltip.h>
+#include <tqfont.h>
+#include <tqlistbox.h>
#include <kio/job.h>
#include <kurlcombobox.h>
@@ -69,29 +69,29 @@ URLNavigator::HistoryElem::~HistoryElem()
URLNavigator::URLNavigator(const KURL& url,
DolphinView* dolphinView) :
- QHBox(dolphinView),
+ TQHBox(dolphinView),
m_historyIndex(0),
m_dolphinView(dolphinView)
{
m_history.prepend(HistoryElem(url));
- QFontMetrics fontMetrics(font());
+ TQFontMetrics fontMetrics(font());
setMinimumHeight(fontMetrics.height() + 8);
- m_toggleButton = new QPushButton(SmallIcon("editurl"), 0, this);
+ m_toggleButton = new TQPushButton(SmallIcon("editurl"), 0, this);
m_toggleButton->setFlat(true);
m_toggleButton->setToggleButton(true);
- m_toggleButton->setFocusPolicy(QWidget::NoFocus);
+ m_toggleButton->setFocusPolicy(TQ_NoFocus);
m_toggleButton->setMinimumHeight(minimumHeight());
- connect(m_toggleButton, SIGNAL(clicked()),
- this, SLOT(slotClicked()));
+ connect(m_toggleButton, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(slotClicked()));
if (DolphinSettings::instance().isURLEditable()) {
m_toggleButton->toggle();
}
m_bookmarkSelector = new BookmarkSelector(this);
- connect(m_bookmarkSelector, SIGNAL(bookmarkActivated(int)),
- this, SLOT(slotBookmarkActivated(int)));
+ connect(m_bookmarkSelector, TQT_SIGNAL(bookmarkActivated(int)),
+ this, TQT_SLOT(slotBookmarkActivated(int)));
m_pathBox = new KURLComboBox(KURLComboBox::Directories, true, this);
@@ -99,13 +99,13 @@ URLNavigator::URLNavigator(const KURL& url,
m_pathBox->setCompletionObject(kurlCompletion);
m_pathBox->setAutoDeleteCompletionObject(true);
- connect(m_pathBox, SIGNAL(returnPressed(const QString&)),
- this, SLOT(slotReturnPressed(const QString&)));
- connect(m_pathBox, SIGNAL(urlActivated(const KURL&)),
- this, SLOT(slotURLActivated(const KURL&)));
+ connect(m_pathBox, TQT_SIGNAL(returnPressed(const TQString&)),
+ this, TQT_SLOT(slotReturnPressed(const TQString&)));
+ connect(m_pathBox, TQT_SIGNAL(urlActivated(const KURL&)),
+ this, TQT_SLOT(slotURLActivated(const KURL&)));
- connect(dolphinView, SIGNAL(contentsMoved(int, int)),
- this, SLOT(slotContentsMoved(int, int)));
+ connect(dolphinView, TQT_SIGNAL(contentsMoved(int, int)),
+ this, TQT_SLOT(slotContentsMoved(int, int)));
updateContent();
}
@@ -115,7 +115,7 @@ URLNavigator::~URLNavigator()
void URLNavigator::setURL(const KURL& url)
{
- QString urlStr(url.prettyURL());
+ TQString urlStr(url.prettyURL());
if (url.protocol() == "zip") {
bool stillInside = false;
@@ -179,9 +179,9 @@ void URLNavigator::setURL(const KURL& url)
if (urlStr.at(0) == '~') {
- // replace '~' by the home directory
+ // tqreplace '~' by the home directory
urlStr.remove(0, 1);
- urlStr.insert(0, QDir::home().path());
+ urlStr.insert(0, TQDir::home().path());
}
const KURL transformedURL(urlStr);
@@ -205,7 +205,7 @@ void URLNavigator::setURL(const KURL& url)
updateHistoryElem();
- const QValueListIterator<URLNavigator::HistoryElem> it = m_history.at(m_historyIndex);
+ const TQValueListIterator<URLNavigator::HistoryElem> it = m_history.at(m_historyIndex);
m_history.insert(it, HistoryElem(transformedURL));
updateContent();
emit urlChanged(transformedURL);
@@ -228,7 +228,7 @@ const KURL& URLNavigator::url() const
KURL URLNavigator::url(int index) const
{
assert(index >= 0);
- QString path(url().prettyURL());
+ TQString path(url().prettyURL());
path = path.section('/', 0, index);
if (path.at(path.length()) != '/')
@@ -239,7 +239,7 @@ KURL URLNavigator::url(int index) const
return path;
}
-const QValueList<URLNavigator::HistoryElem>& URLNavigator::history(int& index) const
+const TQValueList<URLNavigator::HistoryElem>& URLNavigator::history(int& index) const
{
index = m_historyIndex;
return m_history;
@@ -288,7 +288,7 @@ void URLNavigator::setURLEditable(bool editable)
bool URLNavigator::isURLEditable() const
{
- return m_toggleButton->state() == QButton::On;
+ return m_toggleButton->state() == TQButton::On;
}
void URLNavigator::editURL()
@@ -302,15 +302,15 @@ DolphinView* URLNavigator::dolphinView() const
return m_dolphinView;
}
-void URLNavigator::keyReleaseEvent(QKeyEvent* event)
+void URLNavigator::keyReleaseEvent(TQKeyEvent* event)
{
- QHBox::keyReleaseEvent(event);
- if (isURLEditable() && (event->key() == Qt::Key_Escape)) {
+ TQHBox::keyReleaseEvent(event);
+ if (isURLEditable() && (event->key() == TQt::Key_Escape)) {
setURLEditable(false);
}
}
-void URLNavigator::slotReturnPressed(const QString& text)
+void URLNavigator::slotReturnPressed(const TQString& text)
{
// Parts of the following code have been taken
// from the class KateFileSelector located in
@@ -321,10 +321,10 @@ void URLNavigator::slotReturnPressed(const QString& text)
KURL typedURL(text);
if (typedURL.hasPass()) {
- typedURL.setPass(QString::null);
+ typedURL.setPass(TQString());
}
- QStringList urls = m_pathBox->urls();
+ TQStringList urls = m_pathBox->urls();
urls.remove(typedURL.url());
urls.prepend(typedURL.url());
m_pathBox->setURLs(urls, KURLComboBox::RemoveBottom);
@@ -384,14 +384,14 @@ void URLNavigator::updateHistoryElem()
void URLNavigator::updateContent()
{
- const QObjectList* list = children();
- if (list == 0) {
+ const TQObjectList list = childrenListObject();
+ if (list.isEmpty()) {
return;
}
// set the iterator to the first URL navigator button
- QObjectListIterator it(*list);
- QObject* object = 0;
+ TQObjectListIterator it(list);
+ TQObject* object = 0;
while ((object = it.current()) != 0) {
if (object->inherits("URLNavigatorButton")) {
break;
@@ -400,20 +400,20 @@ void URLNavigator::updateContent()
}
// delete all existing URL navigator buttons
- QPtrList<QWidget> deleteList;
+ TQPtrList<TQWidget> deleteList;
while ((object = it.current()) != 0) {
if (object->inherits("URLNavigatorButton")) {
// Don't close and delete the navigator button immediatly, otherwise
// the iterator won't work anymore and an object would get deleted more
// than once (-> crash).
- deleteList.append(static_cast<QWidget*>(object));
+ deleteList.append(TQT_TQWIDGET(object));
}
++it;
}
// now close and delete all unused navigator buttons
- QPtrListIterator<QWidget> deleteIter(deleteList);
- QWidget* widget = 0;
+ TQPtrListIterator<TQWidget> deleteIter(deleteList);
+ TQWidget* widget = 0;
while ((widget = deleteIter.current()) != 0) {
widget->close();
widget->deleteLater();
@@ -422,37 +422,37 @@ void URLNavigator::updateContent()
m_bookmarkSelector->updateSelection(url());
- QToolTip::remove(m_toggleButton);
- QString path(url().prettyURL());
- if (m_toggleButton->state() == QButton::On) {
+ TQToolTip::remove(m_toggleButton);
+ TQString path(url().prettyURL());
+ if (m_toggleButton->state() == TQButton::On) {
// TODO: don't hardcode the shortcut as part of the text
- QToolTip::add(m_toggleButton, i18n("Browse (Ctrl+B, Escape)"));
+ TQToolTip::add(m_toggleButton, i18n("Browse (Ctrl+B, Escape)"));
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Fixed);
m_pathBox->show();
m_pathBox->setURL(url());
}
else {
// TODO: don't hardcode the shortcut as part of the text
- QToolTip::add(m_toggleButton, i18n("Edit location (Ctrl+L)"));
+ TQToolTip::add(m_toggleButton, i18n("Edit location (Ctrl+L)"));
- setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ tqsetSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed);
m_pathBox->hide();
- QString dir_name;
+ TQString dir_name;
// get the data from the currently selected bookmark
KBookmark bookmark = m_bookmarkSelector->selectedBookmark();
//int bookmarkIndex = m_bookmarkSelector->selectedIndex();
- QString bookmarkPath;
+ TQString bookmarkPath;
if (bookmark.isNull()) {
// No bookmark is a part of the current URL.
// The following code tries to guess the bookmark
// path. E. g. "fish://root@192.168.0.2/var/lib" writes
// "fish://root@192.168.0.2" to 'bookmarkPath', which leads to the
// navigation indication 'Custom Path > var > lib".
- int idx = path.find(QString("//"));
- idx = path.find("/", (idx < 0) ? 0 : idx + 2);
+ int idx = path.tqfind(TQString("//"));
+ idx = path.tqfind("/", (idx < 0) ? 0 : idx + 2);
bookmarkPath = (idx < 0) ? path : path.left(idx);
}
else {
@@ -464,11 +464,11 @@ void URLNavigator::updateContent()
// the slashs inside the bookmark URL
int slashCount = 0;
for (uint i = 0; i < len; ++i) {
- if (bookmarkPath.at(i) == QChar('/')) {
+ if (bookmarkPath.at(i) == TQChar('/')) {
++slashCount;
}
}
- if ((len > 0) && bookmarkPath.at(len - 1) == QChar('/')) {
+ if ((len > 0) && bookmarkPath.at(len - 1) == TQChar('/')) {
assert(slashCount > 0);
--slashCount;
}
@@ -485,7 +485,7 @@ void URLNavigator::updateContent()
if (isFirstButton) {
// the first URL navigator button should get the name of the bookmark
// instead of the directory name
- QString text = bookmark.text();
+ TQString text = bookmark.text();
if (text.isEmpty()) {
text = bookmarkPath;
}