Changeset View
Changeset View
Standalone View
Standalone View
lib/contextmanager.cpp
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 94 | { | |||
---|---|---|---|---|---|
125 | connect(d->mDirModel->dirLister(), QOverload<>::of(&KDirLister::completed), this, &ContextManager::slotDirListerCompleted); | 125 | connect(d->mDirModel->dirLister(), QOverload<>::of(&KDirLister::completed), this, &ContextManager::slotDirListerCompleted); | ||
126 | 126 | | |||
127 | d->mSelectionModel = new QItemSelectionModel(d->mDirModel); | 127 | d->mSelectionModel = new QItemSelectionModel(d->mDirModel); | ||
128 | 128 | | |||
129 | connect(d->mSelectionModel, &QItemSelectionModel::selectionChanged, this, &ContextManager::slotSelectionChanged); | 129 | connect(d->mSelectionModel, &QItemSelectionModel::selectionChanged, this, &ContextManager::slotSelectionChanged); | ||
130 | connect(d->mSelectionModel, &QItemSelectionModel::currentChanged, this, &ContextManager::slotCurrentChanged); | 130 | connect(d->mSelectionModel, &QItemSelectionModel::currentChanged, this, &ContextManager::slotCurrentChanged); | ||
131 | 131 | | |||
132 | d->mSelectedFileItemListNeedsUpdate = false; | 132 | d->mSelectedFileItemListNeedsUpdate = false; | ||
133 | | ||||
134 | connect(DocumentFactory::instance(), &DocumentFactory::readyForDirListerStart, [this](const QUrl &urlReady) { | ||||
135 | setCurrentDirUrl(urlReady.adjusted(QUrl::RemoveFilename)); | ||||
136 | }); | ||||
133 | } | 137 | } | ||
134 | 138 | | |||
135 | ContextManager::~ContextManager() | 139 | ContextManager::~ContextManager() | ||
136 | { | 140 | { | ||
137 | delete d; | 141 | delete d; | ||
138 | } | 142 | } | ||
139 | 143 | | |||
140 | void ContextManager::loadConfig() | 144 | void ContextManager::loadConfig() | ||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | |||||
295 | { | 299 | { | ||
296 | return d->mUrlToSelect; | 300 | return d->mUrlToSelect; | ||
297 | } | 301 | } | ||
298 | 302 | | |||
299 | void ContextManager::setUrlToSelect(const QUrl &url) | 303 | void ContextManager::setUrlToSelect(const QUrl &url) | ||
300 | { | 304 | { | ||
301 | GV_RETURN_IF_FAIL(url.isValid()); | 305 | GV_RETURN_IF_FAIL(url.isValid()); | ||
302 | d->mUrlToSelect = url; | 306 | d->mUrlToSelect = url; | ||
303 | setCurrentDirUrl(url.adjusted(QUrl::RemoveFilename)); | 307 | | ||
304 | setCurrentUrl(url); | 308 | setCurrentUrl(url); | ||
tommo: This connect should be moved to the constructor. Otherwise every call to `setUrlToSelect()`… | |||||
hoffmannrobert: Yes, right, moved. | |||||
305 | selectUrlToSelect(); | 309 | selectUrlToSelect(); | ||
306 | } | 310 | } | ||
307 | 311 | | |||
308 | QUrl ContextManager::targetDirUrl() const | 312 | QUrl ContextManager::targetDirUrl() const | ||
309 | { | 313 | { | ||
310 | return d->mTargetDirUrl; | 314 | return d->mTargetDirUrl; | ||
311 | } | 315 | } | ||
312 | 316 | | |||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |
This connect should be moved to the constructor. Otherwise every call to setUrlToSelect() will connect the signal again, causing it to be emitted multiple times.