}
}
-void FoldersPanel::setUrl(const KUrl& url)
+bool FoldersPanel::urlChanged()
{
- if (!url.isValid() || (url == Panel::url())) {
- return;
- }
-
- if (url.protocol().contains("search")) {
+ if (!url().isValid() || url().protocol().contains("search")) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
- return;
+ return false;
}
- Panel::setUrl(url);
if (m_dirLister != 0) {
m_setLeafVisible = true;
- loadTree(url);
+ loadTree(url());
}
+
+ return true;
}
void FoldersPanel::showEvent(QShowEvent* event)
*/
void changeUrl(const KUrl& url, Qt::MouseButtons buttons);
-public slots:
- /**
- * Changes the current selection inside the tree to \a url.
- */
- virtual void setUrl(const KUrl& url);
-
protected:
+ /** @see Panel::urlChanged() */
+ virtual bool urlChanged();
+
/** @see QWidget::showEvent() */
virtual void showEvent(QShowEvent* event);
return size;
}
-void InformationPanel::setUrl(const KUrl& url)
-{
- Panel::setUrl(url);
- if (!url.isValid() || isEqualToShownUrl(url)) {
- return;
- }
-
- m_shownUrl = url;
- if (isVisible()) {
- cancelRequest();
- // Update the content with a delay. This gives
- // the directory lister the chance to show the content
- // before expensive operations are done to show
- // meta information.
- m_urlChangedTimer->start();
- }
-}
-
void InformationPanel::setSelection(const KFileItemList& selection)
{
if (!isVisible()) {
}
}
+bool InformationPanel::urlChanged()
+{
+ if (!url().isValid() || isEqualToShownUrl(url())) {
+ return false;
+ }
+
+ m_shownUrl = url();
+ if (isVisible()) {
+ cancelRequest();
+ // Update the content with a delay. This gives
+ // the directory lister the chance to show the content
+ // before expensive operations are done to show
+ // meta information.
+ m_urlChangedTimer->start();
+ }
+
+ return true;
+}
+
void InformationPanel::showEvent(QShowEvent* event)
{
Panel::showEvent(event);
void urlActivated(const KUrl& url);
public slots:
- /** @see Panel::setUrl() */
- virtual void setUrl(const KUrl& url);
-
/**
* This is invoked to inform the panel that the user has selected a new
* set of items.
void requestDelayedItemInfo(const KFileItem& item);
protected:
+ /** @see Panel::urlChanged() */
+ virtual bool urlChanged();
+
/** @see QWidget::showEvent() */
virtual void showEvent(QShowEvent* event);
#include "pixmapviewer.h"
InformationPanelContent::InformationPanelContent(QWidget* parent) :
- Panel(parent),
+ QWidget(parent),
m_item(),
m_pendingPreview(false),
m_outdatedPreviewTimer(0),
break;
}
- return Panel::eventFilter(obj, event);
+ return QWidget::eventFilter(obj, event);
}
void InformationPanelContent::configureSettings()
/***************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at> *
* *
* 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 *
#ifndef INFORMATIONPANELCONTENT_H
#define INFORMATIONPANELCONTENT_H
-#include <panels/panel.h>
-
#include <kconfig.h>
+#include <kfileitem.h>
#include <kurl.h>
#include <kvbox.h>
-class KFileItem;
+class KFileItemList;
class KFileMetaDataWidget;
class PhononWidget;
class PixmapViewer;
* @brief Manages the widgets that display the meta information
* for file items of the Information Panel.
*/
-class InformationPanelContent : public Panel
+class InformationPanelContent : public QWidget
{
Q_OBJECT
/***************************************************************************
* Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2006-2010 by Peter Penz <peter.penz@gmx.at> *
* *
* 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 *
{
}
-const KUrl& Panel::url() const
+KUrl Panel::url() const
{
return m_url;
}
void Panel::setUrl(const KUrl& url)
{
+ if (url.equals(m_url, KUrl::CompareWithoutTrailingSlash)) {
+ return;
+ }
+
+ const KUrl oldUrl = m_url;
m_url = url;
+ const bool accepted = urlChanged();
+ if (!accepted) {
+ m_url = oldUrl;
+ }
}
#include "panel.moc"
/***************************************************************************
* Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2006-2010 by Peter Penz <peter.penz@gmx.at> *
* *
* 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 *
virtual ~Panel();
/** Returns the current set URL of the active Dolphin view. */
- const KUrl& url() const;
+ KUrl url() const;
public slots:
/**
* This is invoked every time the folder being displayed in the
* active Dolphin view changes.
*/
- virtual void setUrl(const KUrl& url);
+ void setUrl(const KUrl& url);
+
+protected:
+ /**
+ * Must be implemented by derived classes and is invoked when
+ * the URL has been changed (see Panel::setUrl()).
+ * @return True, if the new URL will get accepted by the derived
+ * class. If false is returned,
+ * the URL will be reset to the previous URL.
+ */
+ virtual bool urlChanged() = 0;
private:
KUrl m_url;
return size;
}
-void TerminalPanel::setUrl(const KUrl& url)
+void TerminalPanel::terminalExited()
{
- if (!url.isValid() || (url == Panel::url())) {
- return;
- }
+ emit hideTerminalPanel();
+ m_terminal = 0;
+}
- Panel::setUrl(url);
+bool TerminalPanel::urlChanged()
+{
+ if (!url().isValid()) {
+ return false;
+ }
const bool sendInput = (m_terminal != 0)
&& (m_terminal->foregroundProcessId() == -1)
&& isVisible();
if (sendInput) {
- changeDir(url);
+ changeDir(url());
}
-}
-void TerminalPanel::terminalExited()
-{
- emit hideTerminalPanel();
- m_terminal = 0;
+ return true;
}
void TerminalPanel::showEvent(QShowEvent* event)
virtual QSize sizeHint() const;
public slots:
- /** @see Panel::setUrl(). */
- virtual void setUrl(const KUrl& url);
void terminalExited();
signals:
void hideTerminalPanel();
protected:
+ /** @see Panel::urlChanged() */
+ virtual bool urlChanged();
+
/** @see QWidget::showEvent() */
virtual void showEvent(QShowEvent* event);