* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "urlnavigator.h"
#include <kvbox.h>
#include "bookmarkselector.h"
-#include "dolphin.h"
+#include "dolphinmainwindow.h"
#include "dolphinsettings.h"
#include "dolphinstatusbar.h"
#include "dolphinview.h"
{
QString urlStr(url.pathOrUrl());
//kDebug() << "setUrl(" << url << ")" << endl;
- if (urlStr.at(0) == '~') {
+ if ( urlStr.length() > 0 && urlStr.at(0) == '~') {
// replace '~' by the home directory
urlStr.remove(0, 1);
urlStr.insert(0, QDir::home().path());
QString path(url().pathOrUrl());
path = path.section('/', 0, index);
- if (path.at(path.length()-1) != '/')
+ if ( path.length() >= 1 && path.at(path.length()-1) != '/')
{
path.append('/');
}
}
QStringList urls = m_pathBox->urls();
- urls.remove(typedUrl.url());
+ urls.removeAll(typedUrl.url());
urls.prepend(typedUrl.url());
m_pathBox->setUrls(urls, KUrlComboBox::RemoveBottom);
QString host = m_host->text();
QString user;
- int marker = host.find("@");
+ int marker = host.indexOf("@");
if (marker != -1)
{
user = host.left(marker);
host = host.right(host.length() - marker - 1);
}
- marker = host.find("/");
+ marker = host.indexOf("/");
if (marker != -1)
{
u.setPath(host.right(host.length() - marker));
void UrlNavigator::updateHistoryElem()
{
assert(m_historyIndex >= 0);
- const KFileItem* item = m_dolphinView->currentFileItem();
+ const KFileItem* item = 0; // TODO: m_dolphinView->currentFileItem();
if (item != 0) {
m_history[m_historyIndex].setCurrentFileName(item->name());
}
m_bookmarkSelector->updateSelection(url());
- QToolTip::remove(m_toggleButton);
+ m_toggleButton->setToolTip(QString());
QString path(url().pathOrUrl());
- const KAction* action = Dolphin::mainWin().actionCollection()->action("editable_location");
+ const QAction* action = dolphinView()->mainWindow()->actionCollection()->action("editable_location");
// TODO: registry of default shortcuts
- QString shortcut = action? action->shortcutText() : "Ctrl+L";
+ QString shortcut = action? action->shortcut().toString() : "Ctrl+L";
if (m_toggleButton->isChecked()) {
delete m_protocols; m_protocols = 0;
delete m_protocolSeparator; m_protocolSeparator = 0;
delete m_host; m_host = 0;
- QToolTip::add(m_toggleButton, i18n("Browse (%1, Escape)",shortcut));
+ m_toggleButton->setToolTip(i18n("Browse (%1, Escape)",shortcut));
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
m_pathBox->show();
m_pathBox->setUrl(url());
}
else {
- QToolTip::add(m_toggleButton, i18n("Edit location (%1)",shortcut));
+ m_toggleButton->setToolTip(i18n("Edit location (%1)",shortcut));
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_pathBox->hide();
// 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.indexOf(QString("//"));
+ idx = path.indexOf("/", (idx < 0) ? 0 : idx + 2);
bookmarkPath = (idx < 0) ? path : path.left(idx);
}
else {