Commit ec29cfff authored by Anthony Fieroni's avatar Anthony Fieroni
Browse files

[versioncontrolobserver] Update working directory on tab activation

Differential Revision: https://phabricator.kde.org/D18605

Signed-off-by: Anthony Fieroni's avatarAnthony Fieroni <bvbfan@abv.bg>
parent d7288530
......@@ -182,6 +182,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
#endif
m_versionControlObserver = new VersionControlObserver(this);
m_versionControlObserver->setView(this);
m_versionControlObserver->setModel(m_model);
connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
......
......@@ -21,6 +21,7 @@
#include "dolphin_versioncontrolsettings.h"
#include "dolphindebug.h"
#include "views/dolphinview.h"
#include "kitemviews/kfileitemmodel.h"
#include "updateitemstatesthread.h"
......@@ -85,6 +86,26 @@ KFileItemModel* VersionControlObserver::model() const
return m_model;
}
void VersionControlObserver::setView(DolphinView* view)
{
if (m_view) {
disconnect(m_view, &DolphinView::activated,
this, &VersionControlObserver::delayedDirectoryVerification);
}
m_view = view;
if (m_view) {
connect(m_view, &DolphinView::activated,
this, &VersionControlObserver::delayedDirectoryVerification);
}
}
DolphinView* VersionControlObserver::view() const
{
return m_view;
}
QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) const
{
bool hasNullItems = false;
......
......@@ -37,6 +37,8 @@ class QAction;
class QTimer;
class UpdateItemStatesThread;
class DolphinView;
/**
* @brief Observes all version control plugins.
*
......@@ -55,6 +57,8 @@ public:
void setModel(KFileItemModel* model);
KFileItemModel* model() const;
void setView(DolphinView* view);
DolphinView* view() const;
QList<QAction*> actions(const KFileItemList& items) const;
......@@ -139,6 +143,7 @@ private:
bool m_silentUpdate; // if true, no messages will be send during the update
// of version states
DolphinView* m_view;
KFileItemModel* m_model;
QTimer* m_dirVerificationTimer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment