Rename all the URL navigator related classes to prepare their migration

in kdelibs.

svn path=/trunk/KDE/kdebase/apps/; revision=649514
This commit is contained in:
Kevin Ottens 2007-04-02 19:20:07 +00:00
parent 78c312a0f3
commit 03713b0ab4
14 changed files with 186 additions and 181 deletions

View file

@ -40,7 +40,7 @@ set(dolphin_SRCS
kfileplacesmodel.cpp
kfileplacesitem.cpp
kfileplacesview.cpp
bookmarkselector.cpp
kfileplacesselector.cpp
bookmarkssettingspage.cpp
bookmarkssidebarpage.cpp
columnviewsettingspage.cpp
@ -63,7 +63,7 @@ set(dolphin_SRCS
infosidebarpage.cpp
main.cpp
metadatawidget.cpp
protocolcombo.cpp
kprotocolcombo.cpp
pixmapviewer.cpp
renamedialog.cpp
settingspagebase.cpp
@ -73,9 +73,9 @@ set(dolphin_SRCS
treeviewcontextmenu.cpp
treeviewsidebarpage.cpp
sidebartreeview.cpp
urlbutton.cpp
urlnavigator.cpp
urlnavigatorbutton.cpp
kurlbutton.cpp
kurlnavigator.cpp
kurlnavigatorbutton.cpp
viewpropertiesdialog.cpp
viewsettingspage.cpp
viewpropsprogressinfo.cpp )

View file

@ -32,7 +32,7 @@
#include "metadatawidget.h"
#include "mainwindowadaptor.h"
#include "treeviewsidebarpage.h"
#include "urlnavigator.h"
#include "kurlnavigator.h"
#include "viewpropertiesdialog.h"
#include "viewproperties.h"
#include "kfileplacesmodel.h"
@ -1506,7 +1506,7 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
connect(view, SIGNAL(urlChanged(KUrl)),
this, SLOT(changeUrl(KUrl)));
const UrlNavigator* navigator = view->urlNavigator();
const KUrlNavigator* navigator = view->urlNavigator();
connect(navigator, SIGNAL(urlChanged(const KUrl&)),
this, SLOT(changeUrl(const KUrl&)));
connect(navigator, SIGNAL(historyChanged()),

View file

@ -53,7 +53,7 @@
#include "dolphincontextmenu.h"
#include "filterbar.h"
#include "renamedialog.h"
#include "urlnavigator.h"
#include "kurlnavigator.h"
#include "viewproperties.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
@ -97,7 +97,7 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
connect(clipboard, SIGNAL(dataChanged()),
this, SLOT(updateCutItems()));
m_urlNavigator = new UrlNavigator(new KFilePlacesModel(this), url, this);
m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
m_urlNavigator->setUrlEditable(DolphinSettings::instance().generalSettings()->editableUrl());
m_urlNavigator->setHomeUrl(DolphinSettings::instance().generalSettings()->homeUrl());
m_urlNavigator->setShowHiddenFiles(showHiddenFiles);

View file

@ -27,7 +27,7 @@
#include <kfileitemdelegate.h>
#include <kio/job.h>
#include <urlnavigator.h>
#include <kurlnavigator.h>
#include <QDropEvent>
#include <QLinkedList>
@ -41,7 +41,7 @@ class FilterBar;
class KFileItemDelegate;
class KUrl;
class KDirModel;
class UrlNavigator;
class KUrlNavigator;
class DolphinColumnView;
class DolphinDetailsView;
class DolphinDirLister;
@ -64,7 +64,7 @@ class ViewProperties;
* @see DolphinIconsView
* @see DolphinDetailsView
* @see DolphinColumnView
* @see UrlNavigator
* @see KUrlNavigator
* @see DolphinStatusBar
*/
class DolphinView : public QWidget
@ -121,7 +121,7 @@ public:
/**
* Sets the current active URL.
* The signals UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
* The signals KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are emitted.
*/
void setUrl(const KUrl& url);
@ -185,28 +185,28 @@ public:
/**
* Goes back one step in the URL history. The signals
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goBack();
/**
* Goes forward one step in the Url history. The signals
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goForward();
/**
* Goes up one step of the Url path. The signals
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goUp();
/**
* Goes to the home URL. The signals UrlNavigator::urlChanged()
* and UrlNavigator::historyChanged() are submitted.
* Goes to the home URL. The signals KUrlNavigator::urlChanged()
* and KUrlNavigator::historyChanged() are submitted.
*/
void goHome();
@ -266,7 +266,7 @@ public:
/**
* Returns true, if the URL shown by the navigation bar is editable.
* @see UrlNavigator
* @see KUrlNavigator
*/
bool isUrlEditable() const;
@ -306,8 +306,8 @@ public:
/** Returns the additional information which should be shown for the items. */
KFileItemDelegate::AdditionalInformation additionalInfo() const;
/** Returns the UrlNavigator of the view for read access. */
const UrlNavigator* urlNavigator() const { return m_urlNavigator; }
/** Returns the KUrlNavigator of the view for read access. */
const KUrlNavigator* urlNavigator() const { return m_urlNavigator; }
/**
* Triggers to request user information for the item given
@ -572,7 +572,7 @@ private:
DolphinMainWindow* m_mainWindow;
QVBoxLayout* m_topLayout;
UrlNavigator* m_urlNavigator;
KUrlNavigator* m_urlNavigator;
DolphinController* m_controller;
DolphinIconsView* m_iconsView;

View file

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
* Copyright (C) 2007 by Kevin Ottens (ervin@kde.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -17,9 +18,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "bookmarkselector.h"
#include "kfileplacesselector_p.h"
#include "urlnavigator.h"
#include "kurlnavigator.h"
#include <assert.h>
@ -33,8 +34,8 @@
#include <QPixmap>
#include <kicon.h>
BookmarkSelector::BookmarkSelector(UrlNavigator* parent, KFilePlacesModel* placesModel) :
UrlButton(parent),
KFilePlacesSelector::KFilePlacesSelector(KUrlNavigator* parent, KFilePlacesModel* placesModel) :
KUrlButton(parent),
m_selectedItem(-1),
m_urlNavigator(parent),
m_placesModel(placesModel)
@ -55,11 +56,11 @@ BookmarkSelector::BookmarkSelector(UrlNavigator* parent, KFilePlacesModel* place
setMenu(m_placesMenu);
}
BookmarkSelector::~BookmarkSelector()
KFilePlacesSelector::~KFilePlacesSelector()
{
}
void BookmarkSelector::updateMenu()
void KFilePlacesSelector::updateMenu()
{
m_placesMenu->clear();
@ -81,7 +82,7 @@ void BookmarkSelector::updateMenu()
}
}
void BookmarkSelector::updateSelection(const KUrl& url)
void KFilePlacesSelector::updateSelection(const KUrl& url)
{
QModelIndex index = m_placesModel->closestItem(url);
@ -97,7 +98,7 @@ void BookmarkSelector::updateSelection(const KUrl& url)
}
}
KUrl BookmarkSelector::selectedPlaceUrl() const
KUrl KFilePlacesSelector::selectedPlaceUrl() const
{
QModelIndex index = m_placesModel->index(m_selectedItem, 0);
@ -107,7 +108,7 @@ KUrl BookmarkSelector::selectedPlaceUrl() const
return KUrl();
}
QString BookmarkSelector::selectedPlaceText() const
QString KFilePlacesSelector::selectedPlaceText() const
{
QModelIndex index = m_placesModel->index(m_selectedItem, 0);
@ -117,13 +118,13 @@ QString BookmarkSelector::selectedPlaceText() const
return QString();
}
QSize BookmarkSelector::sizeHint() const
QSize KFilePlacesSelector::sizeHint() const
{
const int height = UrlButton::sizeHint().height();
const int height = KUrlButton::sizeHint().height();
return QSize(height, height);
}
void BookmarkSelector::paintEvent(QPaintEvent* /*event*/)
void KFilePlacesSelector::paintEvent(QPaintEvent* /*event*/)
{
QPainter painter(this);
@ -171,7 +172,7 @@ void BookmarkSelector::paintEvent(QPaintEvent* /*event*/)
painter.drawPixmap(x, y, pixmap);
}
void BookmarkSelector::activatePlace(QAction* action)
void KFilePlacesSelector::activatePlace(QAction* action)
{
assert(action != 0);
m_selectedItem = action->data().toInt();
@ -184,5 +185,5 @@ void BookmarkSelector::activatePlace(QAction* action)
}
}
#include "bookmarkselector.moc"
#include "kfileplacesselector_p.moc"

View file

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
* Copyright (C) 2007 by Kevin Ottens (ervin@kde.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -17,14 +18,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef BOOKMARKSELECTOR_H
#define BOOKMARKSELECTOR_H
#ifndef KFILEPLACESSELECTOR_P_H
#define KFILEPLACESSELECTOR_P_H
#include <urlbutton.h>
#include "kurlbutton_p.h"
#include <kurl.h>
class KFilePlacesModel;
class UrlNavigator;
class KUrlNavigator;
class KMenu;
/**
@ -35,7 +36,7 @@ class KMenu;
*
* @see UrlNavigator
*/
class BookmarkSelector : public UrlButton
class KFilePlacesSelector : public KUrlButton
{
Q_OBJECT
@ -44,9 +45,9 @@ public:
* @param parent Parent widget where the bookmark selector
* is embedded into.
*/
BookmarkSelector(UrlNavigator* parent, KFilePlacesModel* placesModel);
KFilePlacesSelector(KUrlNavigator* parent, KFilePlacesModel* placesModel);
virtual ~BookmarkSelector();
virtual ~KFilePlacesSelector();
/**
* Updates the selection dependent from the given URL \a url. The
@ -90,7 +91,7 @@ private slots:
private:
int m_selectedItem;
UrlNavigator* m_urlNavigator;
KUrlNavigator* m_urlNavigator;
KMenu* m_placesMenu;
KFilePlacesModel* m_placesModel;
};

View file

@ -23,12 +23,12 @@
#include <kprotocolinfo.h>
#include <kprotocolmanager.h>
#include "protocolcombo.h"
#include "kprotocolcombo_p.h"
const static int customProtocolIndex = 0;
ProtocolCombo::ProtocolCombo(const QString& protocol, UrlNavigator* parent)
: UrlNavigatorButton(-1, parent),
KProtocolCombo::KProtocolCombo(const QString& protocol, KUrlNavigator* parent)
: KUrlNavigatorButton(-1, parent),
m_protocols(KProtocolInfo::protocols())
{
qSort(m_protocols);
@ -80,7 +80,7 @@ ProtocolCombo::ProtocolCombo(const QString& protocol, UrlNavigator* parent)
// #include <kurl.h>
// #include "urlnavigator.h"
void ProtocolCombo::setProtocol(const QString& protocol)
void KProtocolCombo::setProtocol(const QString& protocol)
{
setText(protocol);
// if (KProtocolInfo::isKnownProtocol(protocol))
@ -96,7 +96,7 @@ void ProtocolCombo::setProtocol(const QString& protocol)
// }
}
void ProtocolCombo::setProtocol(int index)
void KProtocolCombo::setProtocol(int index)
{
if (index < 0 || index > m_protocols.count())
{
@ -110,9 +110,9 @@ kDebug() << "setProtocol " << index << " " << protocol << endl;
/* */
}
QString ProtocolCombo::currentProtocol() const
QString KProtocolCombo::currentProtocol() const
{
return text(); //currentText();
}
#include "protocolcombo.moc"
#include "kprotocolcombo_p.moc"

View file

@ -16,22 +16,22 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef PROTOCOLCOMBO_H
#define PROTOCOLCOMBO_H
#ifndef KPROTOCOLCOMBO_P_H
#define KPROTOCOLCOMBO_P_H
#include "urlnavigatorbutton.h"
#include "kurlnavigatorbutton_p.h"
class UrlNavigator;
class KUrlNavigator;
/**
* A combobox listing available protocols
*/
class ProtocolCombo : public UrlNavigatorButton
class KProtocolCombo : public KUrlNavigatorButton
{
Q_OBJECT
public:
explicit ProtocolCombo(const QString& protocol, UrlNavigator* parent = 0);
explicit KProtocolCombo(const QString& protocol, KUrlNavigator* parent = 0);
QString currentProtocol() const;

View file

@ -18,10 +18,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "urlnavigatorbutton.h"
#include "urlnavigator.h"
#include "kurlbutton_p.h"
UrlButton::UrlButton(UrlNavigator* parent) :
#include "kurlnavigator.h"
KUrlButton::KUrlButton(KUrlNavigator* parent) :
QPushButton(parent),
m_displayHint(0),
m_urlNavigator(parent)
@ -33,11 +34,11 @@ UrlButton::UrlButton(UrlNavigator* parent) :
connect(this, SIGNAL(clicked()), parent, SLOT(requestActivation()));
}
UrlButton::~UrlButton()
KUrlButton::~KUrlButton()
{
}
void UrlButton::setDisplayHintEnabled(DisplayHint hint,
void KUrlButton::setDisplayHintEnabled(DisplayHint hint,
bool enable)
{
if (enable) {
@ -49,26 +50,26 @@ void UrlButton::setDisplayHintEnabled(DisplayHint hint,
update();
}
bool UrlButton::isDisplayHintEnabled(DisplayHint hint) const
bool KUrlButton::isDisplayHintEnabled(DisplayHint hint) const
{
return (m_displayHint & hint) > 0;
}
void UrlButton::enterEvent(QEvent* event)
void KUrlButton::enterEvent(QEvent* event)
{
QPushButton::enterEvent(event);
setDisplayHintEnabled(EnteredHint, true);
update();
}
void UrlButton::leaveEvent(QEvent* event)
void KUrlButton::leaveEvent(QEvent* event)
{
QPushButton::leaveEvent(event);
setDisplayHintEnabled(EnteredHint, false);
update();
}
QColor UrlButton::mixColors(const QColor& c1,
QColor KUrlButton::mixColors(const QColor& c1,
const QColor& c2) const
{
const int red = (c1.red() + c2.red()) / 2;
@ -77,4 +78,4 @@ QColor UrlButton::mixColors(const QColor& c1,
return QColor(red, green, blue);
}
#include "urlbutton.moc"
#include "kurlbutton_p.moc"

View file

@ -18,14 +18,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef URLBUTTON_H
#define URLBUTTON_H
#ifndef KURLBUTTON_P_H
#define KURLBUTTON_P_H
#include <QPushButton>
class KUrl;
class QEvent;
class UrlNavigator;
class KUrlNavigator;
/**
* @brief Base class for buttons of the URL navigator.
@ -33,15 +33,15 @@ class UrlNavigator;
* Each button of the URL navigator contains an URL, which
* is set as soon as the button has been clicked.
*/
class UrlButton : public QPushButton
class KUrlButton : public QPushButton
{
Q_OBJECT
public:
explicit UrlButton(UrlNavigator* parent);
virtual ~UrlButton();
explicit KUrlButton(KUrlNavigator* parent);
virtual ~KUrlButton();
UrlNavigator* urlNavigator() const { return m_urlNavigator; }
KUrlNavigator* urlNavigator() const { return m_urlNavigator; }
protected:
enum DisplayHint {
@ -61,7 +61,7 @@ protected:
private:
int m_displayHint;
UrlNavigator* m_urlNavigator;
KUrlNavigator* m_urlNavigator;
};
#endif

View file

@ -2,6 +2,7 @@
* Copyright (C) 2006 by Peter Penz (<peter.penz@gmx.at>) *
* Copyright (C) 2006 by Aaron J. Seigo (<aseigo@kde.org>) *
* Copyright (C) 2006 by Patrice Tremblay *
* Copyright (C) 2007 by Kevin Ottens (ervin@kde.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -19,11 +20,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "urlnavigator.h"
#include "kurlnavigator.h"
#include "bookmarkselector.h"
#include "protocolcombo.h"
#include "urlnavigatorbutton.h"
#include "kfileplacesselector_p.h"
#include "kprotocolcombo_p.h"
#include "kurlnavigatorbutton_p.h"
#include <assert.h>
@ -95,10 +96,10 @@ HistoryElem::~HistoryElem()
{
}
class UrlNavigator::Private
class KUrlNavigator::Private
{
public:
Private(UrlNavigator* q, KFilePlacesModel* placesModel);
Private(KUrlNavigator* q, KFilePlacesModel* placesModel);
void slotReturnPressed(const QString&);
void slotRemoteHostActivated();
@ -150,19 +151,19 @@ public:
QList<HistoryElem> m_history;
QToolButton* m_toggleButton;
BookmarkSelector* m_bookmarkSelector;
KFilePlacesSelector* m_placesSelector;
KUrlComboBox* m_pathBox;
ProtocolCombo* m_protocols;
KProtocolCombo* m_protocols;
QLabel* m_protocolSeparator;
QLineEdit* m_host;
QLinkedList<UrlNavigatorButton*> m_navButtons;
QLinkedList<KUrlNavigatorButton*> m_navButtons;
QWidget* m_filler;
QString m_homeUrl;
UrlNavigator* q;
KUrlNavigator* q;
};
UrlNavigator::Private::Private(UrlNavigator* q, KFilePlacesModel* placesModel)
KUrlNavigator::Private::Private(KUrlNavigator* q, KFilePlacesModel* placesModel)
:
m_active(true),
m_showHiddenFiles(false),
@ -188,9 +189,9 @@ UrlNavigator::Private::Private(UrlNavigator* q, KFilePlacesModel* placesModel)
connect(m_toggleButton, SIGNAL(clicked()),
q, SLOT(switchView()));
// initialize the bookmark selector
m_bookmarkSelector = new BookmarkSelector(q, placesModel);
connect(m_bookmarkSelector, SIGNAL(placeActivated(const KUrl&)),
// initialize the places selector
m_placesSelector = new KFilePlacesSelector(q, placesModel);
connect(m_placesSelector, SIGNAL(placeActivated(const KUrl&)),
q, SLOT(setUrl(const KUrl&)));
// initialize the path box of the traditional view
@ -212,17 +213,17 @@ UrlNavigator::Private::Private(UrlNavigator* q, KFilePlacesModel* placesModel)
m_filler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_layout->addWidget(m_toggleButton);
m_layout->addWidget(m_bookmarkSelector);
m_layout->addWidget(m_placesSelector);
m_layout->addWidget(m_pathBox);
m_layout->addWidget(m_filler);
}
void UrlNavigator::Private::appendWidget(QWidget* widget)
void KUrlNavigator::Private::appendWidget(QWidget* widget)
{
m_layout->insertWidget(m_layout->count() - 1, widget);
}
void UrlNavigator::Private::slotReturnPressed(const QString& text)
void KUrlNavigator::Private::slotReturnPressed(const QString& text)
{
// Parts of the following code have been taken
// from the class KateFileSelector located in
@ -242,12 +243,12 @@ void UrlNavigator::Private::slotReturnPressed(const QString& text)
m_pathBox->setUrls(urls, KUrlComboBox::RemoveBottom);
q->setUrl(typedUrl);
// The URL might have been adjusted by UrlNavigator::setUrl(), hence
// The URL might have been adjusted by KUrlNavigator::setUrl(), hence
// synchronize the result in the path box.
m_pathBox->setUrl(q->url());
}
void UrlNavigator::Private::slotRemoteHostActivated()
void KUrlNavigator::Private::slotRemoteHostActivated()
{
KUrl u = q->url();
@ -294,14 +295,14 @@ void UrlNavigator::Private::slotRemoteHostActivated()
}
}
void UrlNavigator::Private::slotProtocolChanged(const QString& protocol)
void KUrlNavigator::Private::slotProtocolChanged(const QString& protocol)
{
KUrl url;
url.setProtocol(protocol);
//url.setPath(KProtocolInfo::protocolClass(protocol) == ":local" ? "/" : "");
url.setPath("/");
QLinkedList<UrlNavigatorButton*>::const_iterator it = m_navButtons.begin();
const QLinkedList<UrlNavigatorButton*>::const_iterator itEnd = m_navButtons.end();
QLinkedList<KUrlNavigatorButton*>::const_iterator it = m_navButtons.begin();
const QLinkedList<KUrlNavigatorButton*>::const_iterator itEnd = m_navButtons.end();
while (it != itEnd) {
(*it)->close();
(*it)->deleteLater();
@ -334,7 +335,7 @@ void UrlNavigator::Private::slotProtocolChanged(const QString& protocol)
}
#if 0
void UrlNavigator::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
void KUrlNavigator::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
{
// kDebug() << "received redirection to " << newUrl << endl;
kDebug() << "received redirection from " << oldUrl << " to " << newUrl << endl;
@ -348,7 +349,7 @@ kDebug() << "received redirection from " << oldUrl << " to " << newUrl << endl;
}
#endif
void UrlNavigator::Private::switchView()
void KUrlNavigator::Private::switchView()
{
updateContent();
if (q->isUrlEditable()) {
@ -359,7 +360,7 @@ void UrlNavigator::Private::switchView()
emit q->requestActivation();
}
void UrlNavigator::Private::updateHistoryElem()
void KUrlNavigator::Private::updateHistoryElem()
{
assert(m_historyIndex >= 0);
const KFileItem* item = 0; // TODO: m_dolphinView->currentFileItem();
@ -369,9 +370,9 @@ void UrlNavigator::Private::updateHistoryElem()
}
}
void UrlNavigator::Private::updateContent()
void KUrlNavigator::Private::updateContent()
{
m_bookmarkSelector->updateSelection(q->url());
m_placesSelector->updateSelection(q->url());
m_toggleButton->setToolTip(QString());
QString path(q->url().pathOrUrl());
@ -402,8 +403,8 @@ void UrlNavigator::Private::updateContent()
m_pathBox->hide();
m_filler->show();
// get the data from the currently selected bookmark
KUrl placeUrl = m_bookmarkSelector->selectedPlaceUrl();
// get the data from the currently selected place
KUrl placeUrl = m_placesSelector->selectedPlaceUrl();
QString placePath;
if (!placeUrl.isValid()) {
@ -439,7 +440,7 @@ void UrlNavigator::Private::updateContent()
QString protocol = currentUrl.protocol();
if (!m_protocols) {
deleteButtons();
m_protocols = new ProtocolCombo(protocol, q);
m_protocols = new KProtocolCombo(protocol, q);
appendWidget(m_protocols);
connect(m_protocols, SIGNAL(activated(QString)),
q, SLOT(slotProtocolChanged(QString)));
@ -492,10 +493,10 @@ void UrlNavigator::Private::updateContent()
}
}
void UrlNavigator::Private::updateButtons(const QString& path, int startIndex)
void KUrlNavigator::Private::updateButtons(const QString& path, int startIndex)
{
QLinkedList<UrlNavigatorButton*>::iterator it = m_navButtons.begin();
const QLinkedList<UrlNavigatorButton*>::const_iterator itEnd = m_navButtons.end();
QLinkedList<KUrlNavigatorButton*>::iterator it = m_navButtons.begin();
const QLinkedList<KUrlNavigatorButton*>::const_iterator itEnd = m_navButtons.end();
bool createButton = false;
const KUrl currentUrl = q->url();
@ -512,8 +513,8 @@ void UrlNavigator::Private::updateButtons(const QString& path, int startIndex)
if (isFirstButton) {
// the first URL navigator button should get the name of the
// place instead of the directory name
const KUrl placeUrl = m_bookmarkSelector->selectedPlaceUrl();
text = m_bookmarkSelector->selectedPlaceText();
const KUrl placeUrl = m_placesSelector->selectedPlaceUrl();
text = m_placesSelector->selectedPlaceText();
if (text.isEmpty()) {
if (currentUrl.isLocalFile()) {
text = i18n("Custom Path");
@ -525,9 +526,9 @@ void UrlNavigator::Private::updateButtons(const QString& path, int startIndex)
}
}
UrlNavigatorButton* button = 0;
KUrlNavigatorButton* button = 0;
if (createButton) {
button = new UrlNavigatorButton(idx, q);
button = new KUrlNavigatorButton(idx, q);
appendWidget(button);
}
else {
@ -551,7 +552,7 @@ void UrlNavigator::Private::updateButtons(const QString& path, int startIndex)
} while (hasNext);
// delete buttons which are not used anymore
QLinkedList<UrlNavigatorButton*>::iterator itBegin = it;
QLinkedList<KUrlNavigatorButton*>::iterator itBegin = it;
while (it != itEnd) {
(*it)->close();
(*it)->deleteLater();
@ -560,11 +561,11 @@ void UrlNavigator::Private::updateButtons(const QString& path, int startIndex)
m_navButtons.erase(itBegin, m_navButtons.end());
}
void UrlNavigator::Private::deleteButtons()
void KUrlNavigator::Private::deleteButtons()
{
QLinkedList<UrlNavigatorButton*>::iterator itBegin = m_navButtons.begin();
QLinkedList<UrlNavigatorButton*>::iterator itEnd = m_navButtons.end();
QLinkedList<UrlNavigatorButton*>::iterator it = itBegin;
QLinkedList<KUrlNavigatorButton*>::iterator itBegin = m_navButtons.begin();
QLinkedList<KUrlNavigatorButton*>::iterator itEnd = m_navButtons.end();
QLinkedList<KUrlNavigatorButton*>::iterator it = itBegin;
while (it != itEnd) {
(*it)->close();
(*it)->deleteLater();
@ -576,7 +577,7 @@ void UrlNavigator::Private::deleteButtons()
////
UrlNavigator::UrlNavigator(KFilePlacesModel* placesModel,
KUrlNavigator::KUrlNavigator(KFilePlacesModel* placesModel,
const KUrl& url,
QWidget* parent) :
QWidget(parent),
@ -592,18 +593,18 @@ UrlNavigator::UrlNavigator(KFilePlacesModel* placesModel,
d->updateContent();
}
UrlNavigator::~UrlNavigator()
KUrlNavigator::~KUrlNavigator()
{
delete d;
}
const KUrl& UrlNavigator::url() const
const KUrl& KUrlNavigator::url() const
{
assert(!d->m_history.empty());
return d->m_history[d->m_historyIndex].url();
}
KUrl UrlNavigator::url(int index) const
KUrl KUrlNavigator::url(int index) const
{
assert(index >= 0);
// keep scheme, hostname etc. maybe we will need this in the future
@ -623,18 +624,18 @@ KUrl UrlNavigator::url(int index) const
return newurl;
}
QPoint UrlNavigator::savedPosition() const
QPoint KUrlNavigator::savedPosition() const
{
const HistoryElem& histElem = d->m_history[d->m_historyIndex];
return QPoint( histElem.contentsX(), histElem.contentsY() );
}
int UrlNavigator::historySize() const
int KUrlNavigator::historySize() const
{
return d->m_history.count();
}
void UrlNavigator::goBack()
void KUrlNavigator::goBack()
{
d->updateHistoryElem();
@ -647,7 +648,7 @@ void UrlNavigator::goBack()
}
}
void UrlNavigator::goForward()
void KUrlNavigator::goForward()
{
if (d->m_historyIndex > 0) {
--d->m_historyIndex;
@ -657,12 +658,12 @@ void UrlNavigator::goForward()
}
}
void UrlNavigator::goUp()
void KUrlNavigator::goUp()
{
setUrl(url().upUrl());
}
void UrlNavigator::goHome()
void KUrlNavigator::goHome()
{
if (d->m_homeUrl.isEmpty())
setUrl(QDir::homePath());
@ -670,12 +671,12 @@ void UrlNavigator::goHome()
setUrl(d->m_homeUrl);
}
bool UrlNavigator::isUrlEditable() const
bool KUrlNavigator::isUrlEditable() const
{
return d->m_toggleButton->isChecked();
}
void UrlNavigator::setUrlEditable(bool editable)
void KUrlNavigator::setUrlEditable(bool editable)
{
if (isUrlEditable() != editable) {
d->m_toggleButton->toggle();
@ -683,7 +684,7 @@ void UrlNavigator::setUrlEditable(bool editable)
}
}
void UrlNavigator::setActive(bool active)
void KUrlNavigator::setActive(bool active)
{
if (active != d->m_active) {
d->m_active = active;
@ -694,18 +695,18 @@ void UrlNavigator::setActive(bool active)
}
}
void UrlNavigator::setShowHiddenFiles( bool show )
void KUrlNavigator::setShowHiddenFiles( bool show )
{
d->m_showHiddenFiles = show;
}
void UrlNavigator::dropUrls(const KUrl::List& urls,
void KUrlNavigator::dropUrls(const KUrl::List& urls,
const KUrl& destination)
{
emit urlsDropped(urls, destination);
}
void UrlNavigator::setUrl(const KUrl& url)
void KUrlNavigator::setUrl(const KUrl& url)
{
QString urlStr(url.pathOrUrl());
@ -760,7 +761,7 @@ void UrlNavigator::setUrl(const KUrl& url)
/* kDebug() << "history starting ====================" << endl;
int i = 0;
for (QValueListIterator<UrlNavigator::HistoryElem> it = d->m_history.begin();
for (QValueListIterator<KUrlNavigator::HistoryElem> it = d->m_history.begin();
it != d->m_history.end();
++it, ++i)
{
@ -771,19 +772,19 @@ void UrlNavigator::setUrl(const KUrl& url)
requestActivation();
}
void UrlNavigator::requestActivation()
void KUrlNavigator::requestActivation()
{
setActive(true);
}
void UrlNavigator::storeContentsPosition(int x, int y)
void KUrlNavigator::storeContentsPosition(int x, int y)
{
HistoryElem& hist = d->m_history[d->m_historyIndex];
hist.setContentsX(x);
hist.setContentsY(y);
}
void UrlNavigator::keyReleaseEvent(QKeyEvent* event)
void KUrlNavigator::keyReleaseEvent(QKeyEvent* event)
{
QWidget::keyReleaseEvent(event);
if (isUrlEditable() && (event->key() == Qt::Key_Escape)) {
@ -791,7 +792,7 @@ void UrlNavigator::keyReleaseEvent(QKeyEvent* event)
}
}
void UrlNavigator::mouseReleaseEvent(QMouseEvent* event)
void KUrlNavigator::mouseReleaseEvent(QMouseEvent* event)
{
if (event->button() == Qt::MidButton) {
QClipboard* clipboard = QApplication::clipboard();
@ -804,19 +805,19 @@ void UrlNavigator::mouseReleaseEvent(QMouseEvent* event)
QWidget::mouseReleaseEvent(event);
}
bool UrlNavigator::isActive() const
bool KUrlNavigator::isActive() const
{
return d->m_active;
}
bool UrlNavigator::showHiddenFiles() const
bool KUrlNavigator::showHiddenFiles() const
{
return d->m_showHiddenFiles;
}
void UrlNavigator::setHomeUrl(const QString& homeUrl)
void KUrlNavigator::setHomeUrl(const QString& homeUrl)
{
d->m_homeUrl = homeUrl;
}
#include "urlnavigator.moc"
#include "kurlnavigator.moc"

View file

@ -2,6 +2,7 @@
* Copyright (C) 2006 by Peter Penz (<peter.penz@gmx.at>) *
* Copyright (C) 2006 by Aaron J. Seigo (<aseigo@kde.org>) *
* Copyright (C) 2006 by Patrice Tremblay *
* Copyright (C) 2007 by Kevin Ottens (ervin@kde.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -19,8 +20,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef URLNAVIGATOR_H
#define URLNAVIGATOR_H
#ifndef KURLNAVIGATOR_H
#define KURLNAVIGATOR_H
#include <kurl.h>
#include <QWidget>
@ -45,13 +46,13 @@ class QMouseEvent;
* The URL navigator also remembers the URL history and allows to go
* back and forward within this history.
*/
class UrlNavigator : public QWidget
class KUrlNavigator : public QWidget
{
Q_OBJECT
public:
UrlNavigator(KFilePlacesModel* placesModel, const KUrl& url, QWidget* parent);
virtual ~UrlNavigator();
KUrlNavigator(KFilePlacesModel* placesModel, const KUrl& url, QWidget* parent);
virtual ~KUrlNavigator();
/** Returns the current active URL. */
const KUrl& url() const;
@ -215,7 +216,7 @@ private:
class Private;
Private* const d;
Q_DISABLE_COPY( UrlNavigator )
Q_DISABLE_COPY( KUrlNavigator )
};
#endif

View file

@ -18,11 +18,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "urlnavigatorbutton.h"
#include "kurlnavigatorbutton_p.h"
#include <assert.h>
#include "urlnavigator.h"
#include "kurlnavigator.h"
#include <kio/job.h>
#include <kio/jobclasses.h>
@ -33,8 +33,8 @@
#include <QPaintEvent>
#include <QTimer>
UrlNavigatorButton::UrlNavigatorButton(int index, UrlNavigator* parent) :
UrlButton(parent),
KUrlNavigatorButton::KUrlNavigatorButton(int index, KUrlNavigator* parent) :
KUrlButton(parent),
m_index(-1),
m_popupDelay(0),
m_listJob(0)
@ -50,11 +50,11 @@ UrlNavigatorButton::UrlNavigatorButton(int index, UrlNavigator* parent) :
connect(this, SIGNAL(pressed()), this, SLOT(startPopupDelay()));
}
UrlNavigatorButton::~UrlNavigatorButton()
KUrlNavigatorButton::~KUrlNavigatorButton()
{
}
void UrlNavigatorButton::setIndex(int index)
void KUrlNavigatorButton::setIndex(int index)
{
m_index = index;
@ -82,13 +82,13 @@ void UrlNavigatorButton::setIndex(int index)
update();
}
QSize UrlNavigatorButton::sizeHint() const
QSize KUrlNavigatorButton::sizeHint() const
{
const int width = fontMetrics().width(text()) + (arrowWidth() * 4);
return QSize(width, UrlButton::sizeHint().height());
return QSize(width, KUrlButton::sizeHint().height());
}
void UrlNavigatorButton::paintEvent(QPaintEvent* event)
void KUrlNavigatorButton::paintEvent(QPaintEvent* event)
{
QPainter painter(this);
painter.setClipRect(event->rect());
@ -168,9 +168,9 @@ void UrlNavigatorButton::paintEvent(QPaintEvent* event)
}
}
void UrlNavigatorButton::enterEvent(QEvent* event)
void KUrlNavigatorButton::enterEvent(QEvent* event)
{
UrlButton::enterEvent(event);
KUrlButton::enterEvent(event);
// if the text is clipped due to a small window width, the text should
// be shown as tooltip
@ -179,13 +179,13 @@ void UrlNavigatorButton::enterEvent(QEvent* event)
}
}
void UrlNavigatorButton::leaveEvent(QEvent* event)
void KUrlNavigatorButton::leaveEvent(QEvent* event)
{
UrlButton::leaveEvent(event);
KUrlButton::leaveEvent(event);
setToolTip(QString());
}
void UrlNavigatorButton::dropEvent(QDropEvent* event)
void KUrlNavigatorButton::dropEvent(QDropEvent* event)
{
if (m_index < 0) {
return;
@ -207,7 +207,7 @@ void UrlNavigatorButton::dropEvent(QDropEvent* event)
}
}
void UrlNavigatorButton::dragEnterEvent(QDragEnterEvent* event)
void KUrlNavigatorButton::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls()) {
setDisplayHintEnabled(DraggedHint, true);
@ -217,16 +217,16 @@ void UrlNavigatorButton::dragEnterEvent(QDragEnterEvent* event)
}
}
void UrlNavigatorButton::dragLeaveEvent(QDragLeaveEvent* event)
void KUrlNavigatorButton::dragLeaveEvent(QDragLeaveEvent* event)
{
UrlButton::dragLeaveEvent(event);
KUrlButton::dragLeaveEvent(event);
setDisplayHintEnabled(DraggedHint, false);
update();
}
void UrlNavigatorButton::updateNavigatorUrl()
void KUrlNavigatorButton::updateNavigatorUrl()
{
stopPopupDelay();
@ -237,7 +237,7 @@ void UrlNavigatorButton::updateNavigatorUrl()
urlNavigator()->setUrl(urlNavigator()->url(m_index));
}
void UrlNavigatorButton::startPopupDelay()
void KUrlNavigatorButton::startPopupDelay()
{
if (m_popupDelay->isActive() || (m_listJob != 0) || (m_index < 0)) {
return;
@ -246,7 +246,7 @@ void UrlNavigatorButton::startPopupDelay()
m_popupDelay->start(300);
}
void UrlNavigatorButton::stopPopupDelay()
void KUrlNavigatorButton::stopPopupDelay()
{
m_popupDelay->stop();
if (m_listJob != 0) {
@ -255,7 +255,7 @@ void UrlNavigatorButton::stopPopupDelay()
}
}
void UrlNavigatorButton::startListJob()
void KUrlNavigatorButton::startListJob()
{
if (m_listJob != 0) {
return;
@ -270,7 +270,7 @@ void UrlNavigatorButton::startListJob()
connect(m_listJob, SIGNAL(result(KJob*)), this, SLOT(listJobFinished(KJob*)));
}
void UrlNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& entries)
void KUrlNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& entries)
{
if (job != m_listJob) {
return;
@ -296,7 +296,7 @@ void UrlNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& ent
m_subdirs.sort();
}
void UrlNavigatorButton::listJobFinished(KJob* job)
void KUrlNavigatorButton::listJobFinished(KJob* job)
{
if (job != m_listJob) {
return;
@ -338,7 +338,7 @@ void UrlNavigatorButton::listJobFinished(KJob* job)
setDisplayHintEnabled(PopupActiveHint, false);
}
int UrlNavigatorButton::arrowWidth() const
int KUrlNavigatorButton::arrowWidth() const
{
int width = (height() / 2) - 7;
if (width < 4) {
@ -347,7 +347,7 @@ int UrlNavigatorButton::arrowWidth() const
return width;
}
bool UrlNavigatorButton::isTextClipped() const
bool KUrlNavigatorButton::isTextClipped() const
{
int availableWidth = width();
if (!isDisplayHintEnabled(ActivatedHint)) {
@ -358,4 +358,4 @@ bool UrlNavigatorButton::isTextClipped() const
return fontMetrics.width(text()) >= availableWidth;
}
#include "urlnavigatorbutton.moc"
#include "kurlnavigatorbutton_p.moc"

View file

@ -18,15 +18,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef URLNAVIGATORBUTTON_H
#define URLNAVIGATORBUTTON_H
#ifndef KURLNAVIGATORBUTTON_P_H
#define KURLNAVIGATORBUTTON_P_H
#include <kio/global.h>
#include "urlbutton.h"
#include "kurlbutton_p.h"
class KJob;
class KUrl;
class UrlNavigator;
class KUrlNavigator;
class QPainter;
class QPaintEvent;
@ -43,13 +43,13 @@ namespace KIO
* to copy, move or link the dropped items to the URL part indicated by
* the button.
*/
class UrlNavigatorButton : public UrlButton
class KUrlNavigatorButton : public KUrlButton
{
Q_OBJECT
public:
explicit UrlNavigatorButton(int index, UrlNavigator* parent);
virtual ~UrlNavigatorButton();
explicit KUrlNavigatorButton(int index, KUrlNavigator* parent);
virtual ~KUrlNavigatorButton();
void setIndex(int index);
int index() const { return m_index; }