┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-01-26 08:27:42 +0000
committerPeter Penz <[email protected]>2010-01-26 08:27:42 +0000
commite536466ac75e7fa3cfdc18728596beac36996128 (patch)
tree027d1a6fd983efb0870a3ff76f8e33c71a84ad6d /src
parent5accf42fc8695460832eee7c68f577f62c419642 (diff)
* Assure that the URL navigator is synchronized with the active column.
* Removed obsolete triggerUrlChangeRequest() method + signal in the DolphinController. This is not needed anymore because of the refactored column view. svn path=/trunk/KDE/kdebase/apps/; revision=1080351
Diffstat (limited to 'src')
-rw-r--r--src/dolphincolumnview.cpp11
-rw-r--r--src/dolphincolumnviewcontainer.cpp18
-rw-r--r--src/dolphincolumnviewcontainer.h11
-rw-r--r--src/dolphincontroller.cpp7
-rw-r--r--src/dolphincontroller.h20
-rw-r--r--src/dolphinviewcontainer.cpp2
6 files changed, 29 insertions, 40 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index ee3d85278..3437de499 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -334,13 +334,7 @@ void DolphinColumnView::keyPressEvent(QKeyEvent* event)
void DolphinColumnView::contextMenuEvent(QContextMenuEvent* event)
{
- if (!m_active) {
- m_container->requestActivation(this);
- Q_ASSERT(m_container->m_controller->itemView() == this);
- m_container->m_controller->triggerUrlChangeRequest(m_url);
- }
- Q_ASSERT(m_active);
-
+ requestActivation();
QListView::contextMenuEvent(event);
m_container->m_controller->triggerContextMenuRequest(event->pos());
}
@@ -390,11 +384,8 @@ void DolphinColumnView::slotEntered(const QModelIndex& index)
void DolphinColumnView::requestActivation()
{
- m_container->m_controller->setItemView(this);
- m_container->m_controller->requestActivation();
if (!m_active) {
m_container->requestActivation(this);
- m_container->m_controller->triggerUrlChangeRequest(m_url);
selectionModel()->clear();
}
}
diff --git a/src/dolphincolumnviewcontainer.cpp b/src/dolphincolumnviewcontainer.cpp
index 3e067d413..839407117 100644
--- a/src/dolphincolumnviewcontainer.cpp
+++ b/src/dolphincolumnviewcontainer.cpp
@@ -30,6 +30,7 @@
#include <QPoint>
#include <QScrollBar>
#include <QTimeLine>
+#include <QTimer>
DolphinColumnViewContainer::DolphinColumnViewContainer(QWidget* parent,
DolphinController* controller) :
@@ -41,7 +42,8 @@ DolphinColumnViewContainer::DolphinColumnViewContainer(QWidget* parent,
m_columns(),
m_emptyViewport(0),
m_animation(0),
- m_dragSource(0)
+ m_dragSource(0),
+ m_activeUrlTimer(0)
{
Q_ASSERT(controller != 0);
@@ -59,6 +61,12 @@ DolphinColumnViewContainer::DolphinColumnViewContainer(QWidget* parent,
m_animation = new QTimeLine(500, this);
connect(m_animation, SIGNAL(frameChanged(int)), horizontalScrollBar(), SLOT(setValue(int)));
+ m_activeUrlTimer = new QTimer(this);
+ m_activeUrlTimer->setSingleShot(true);
+ m_activeUrlTimer->setInterval(200);
+ connect(m_activeUrlTimer, SIGNAL(timeout()),
+ this, SLOT(updateActiveUrl()));
+
DolphinColumnView* column = new DolphinColumnView(viewport(), this, m_controller->url());
m_columns.append(column);
setActiveColumnIndex(0);
@@ -67,6 +75,7 @@ DolphinColumnViewContainer::DolphinColumnViewContainer(QWidget* parent,
m_emptyViewport->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
updateColumnsBackground(true);
+
}
DolphinColumnViewContainer::~DolphinColumnViewContainer()
@@ -233,6 +242,12 @@ void DolphinColumnViewContainer::updateColumnsBackground(bool active)
}
}
+void DolphinColumnViewContainer::updateActiveUrl()
+{
+ const KUrl activeUrl = m_columns[m_index]->url();
+ m_controller->setUrl(activeUrl);
+}
+
void DolphinColumnViewContainer::setActiveColumnIndex(int index)
{
if ((m_index == index) || (index < 0) || (index >= m_columns.count())) {
@@ -248,6 +263,7 @@ void DolphinColumnViewContainer::setActiveColumnIndex(int index)
m_columns[m_index]->setActive(true);
assureVisibleActiveColumn();
+ m_activeUrlTimer->start(); // calls slot updateActiveUrl()
}
void DolphinColumnViewContainer::layoutColumns()
diff --git a/src/dolphincolumnviewcontainer.h b/src/dolphincolumnviewcontainer.h
index 626cd98a1..c1975ac08 100644
--- a/src/dolphincolumnviewcontainer.h
+++ b/src/dolphincolumnviewcontainer.h
@@ -32,6 +32,7 @@ class DolphinColumnView;
class DolphinController;
class QFrame;
class QTimeLine;
+class QTimer;
/**
* @brief Represents a container for columns represented as instances
@@ -77,6 +78,14 @@ private slots:
*/
void updateColumnsBackground(bool active);
+ /**
+ * Tells the Dolphin controller to update the active URL
+ * to m_activeUrl. The slot is called asynchronously with a
+ * small delay, as this prevents a flickering when a directory
+ * from an inactive column gets selected.
+ */
+ void updateActiveUrl();
+
private:
/**
* Deactivates the currently active column and activates
@@ -127,6 +136,8 @@ private:
QTimeLine* m_animation;
QAbstractItemView* m_dragSource;
+ QTimer* m_activeUrlTimer;
+
friend class DolphinColumnView;
};
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp
index caa0aa74f..b61c126b5 100644
--- a/src/dolphincontroller.cpp
+++ b/src/dolphincontroller.cpp
@@ -75,13 +75,6 @@ void DolphinController::setItemView(QAbstractItemView* view)
}
}
-void DolphinController::triggerUrlChangeRequest(const KUrl& url)
-{
- if (m_url != url) {
- emit requestUrlChange(url);
- }
-}
-
void DolphinController::triggerContextMenuRequest(const QPoint& pos,
const QList<QAction*>& customActions)
{
diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h
index d1eba97a1..397215bfb 100644
--- a/src/dolphincontroller.h
+++ b/src/dolphincontroller.h
@@ -30,9 +30,6 @@ class DolphinView;
class KUrl;
class QPoint;
-// TODO: get rid of all the state duplications in the controller and allow read access
-// to the Dolphin view for all view implementations
-
/**
* @brief Acts as mediator between the abstract Dolphin view and the view
* implementations.
@@ -52,7 +49,6 @@ class QPoint;
* The communication of the view implementations to the abstract view is done by:
* - triggerContextMenuRequest()
* - requestActivation()
- * - triggerUrlChangeRequest()
* - indicateDroppedUrls()
* - indicateSortingChange()
* - indicateSortOrderChanged()
@@ -112,16 +108,6 @@ public:
QAbstractItemView* itemView() const;
/**
- * Allows a view implementation to request an URL change to \a url.
- * The signal requestUrlChange() is emitted and the abstract Dolphin view
- * will assure that the URL of the Dolphin Controller will be updated
- * later. Invoking this method makes only sense if the view implementation
- * shows a hierarchy of URLs and allows to change the URL within
- * the view (e. g. this is the case in the column view).
- */
- void triggerUrlChangeRequest(const KUrl& url);
-
- /**
* Requests a context menu for the position \a pos. This method
* should be invoked by the view implementation when a context
* menu should be opened. The abstract Dolphin view itself
@@ -300,12 +286,6 @@ signals:
void urlChanged(const KUrl& url);
/**
- * Is emitted if the view implementation requests a changing of the current
- * URL to \a url (see triggerUrlChangeRequest()).
- */
- void requestUrlChange(const KUrl& url);
-
- /**
* Is emitted if a context menu should be opened (see triggerContextMenuRequest()).
* The abstract Dolphin view connects to this signal and will open the context menu.
* @param pos Position relative to the view widget where the
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 53b1c7529..8f4427cb9 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -85,8 +85,6 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
this, SLOT(dropUrls(const KUrl&, QDropEvent*)));
connect(m_urlNavigator, SIGNAL(activated()),
this, SLOT(activate()));
- //connect(m_urlNavigator, SIGNAL(tabRequested(const KUrl&)),
- // this,
connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));