Changeset View
Changeset View
Standalone View
Standalone View
lib/contextmanager.cpp
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 92 | { | |||
---|---|---|---|---|---|
120 | connect(d->mDirModel->dirLister(), SIGNAL(redirection(QUrl)), | 120 | connect(d->mDirModel->dirLister(), SIGNAL(redirection(QUrl)), | ||
121 | SLOT(slotDirListerRedirection(QUrl))); | 121 | SLOT(slotDirListerRedirection(QUrl))); | ||
122 | 122 | | |||
123 | connect(d->mDirModel->dirLister(), static_cast<void (KDirLister::*)()>(&KDirLister::completed), this, &ContextManager::slotDirListerCompleted); | 123 | connect(d->mDirModel->dirLister(), static_cast<void (KDirLister::*)()>(&KDirLister::completed), this, &ContextManager::slotDirListerCompleted); | ||
124 | 124 | | |||
125 | d->mSelectionModel = new QItemSelectionModel(d->mDirModel); | 125 | d->mSelectionModel = new QItemSelectionModel(d->mDirModel); | ||
126 | 126 | | |||
127 | connect(d->mSelectionModel, &QItemSelectionModel::selectionChanged, this, &ContextManager::slotSelectionChanged); | 127 | connect(d->mSelectionModel, &QItemSelectionModel::selectionChanged, this, &ContextManager::slotSelectionChanged); | ||
128 | connect(d->mSelectionModel, &QItemSelectionModel::currentChanged, this, &ContextManager::slotCurrentChanged); | | |||
129 | 128 | | |||
130 | d->mSelectedFileItemListNeedsUpdate = false; | 129 | d->mSelectedFileItemListNeedsUpdate = false; | ||
131 | } | 130 | } | ||
132 | 131 | | |||
133 | ContextManager::~ContextManager() | 132 | ContextManager::~ContextManager() | ||
134 | { | 133 | { | ||
135 | delete d; | 134 | delete d; | ||
136 | } | 135 | } | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 210 | { | |||
241 | } | 240 | } | ||
242 | } | 241 | } | ||
243 | 242 | | |||
244 | void ContextManager::slotSelectionChanged() | 243 | void ContextManager::slotSelectionChanged() | ||
245 | { | 244 | { | ||
246 | d->mSelectedFileItemListNeedsUpdate = true; | 245 | d->mSelectedFileItemListNeedsUpdate = true; | ||
247 | if (!d->mSelectionModel->hasSelection()) { | 246 | if (!d->mSelectionModel->hasSelection()) { | ||
248 | setCurrentUrl(QUrl()); | 247 | setCurrentUrl(QUrl()); | ||
249 | } | 248 | } else { | ||
250 | d->queueSignal("selectionChanged"); | 249 | QUrl url = d->mDirModel->urlForIndex(d->mSelectionModel->currentIndex()); | ||
huoni: Problem 2 fix - since we removed `slotCurrentChanged`, we need to set the URL here. | |||||
251 | } | | |||
252 | | ||||
253 | void Gwenview::ContextManager::slotCurrentChanged(const QModelIndex& index) | | |||
254 | { | | |||
255 | QUrl url = d->mDirModel->urlForIndex(index); | | |||
256 | setCurrentUrl(url); | 250 | setCurrentUrl(url); | ||
257 | } | 251 | } | ||
252 | emit selectionChanged(); | ||||
huoni: Problem 1 fix | |||||
253 | } | ||||
258 | 254 | | |||
259 | void ContextManager::emitQueuedSignals() | 255 | void ContextManager::emitQueuedSignals() | ||
260 | { | 256 | { | ||
261 | Q_FOREACH(const QByteArray & signal, d->mQueuedSignals) { | 257 | Q_FOREACH(const QByteArray & signal, d->mQueuedSignals) { | ||
262 | QMetaObject::invokeMethod(this, signal.data()); | 258 | QMetaObject::invokeMethod(this, signal.data()); | ||
263 | } | 259 | } | ||
264 | d->mQueuedSignals.clear(); | 260 | d->mQueuedSignals.clear(); | ||
265 | } | 261 | } | ||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
Problem 2 fix - since we removed slotCurrentChanged, we need to set the URL here.