Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/foldermodel.cpp
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Line(s) | 289 | { | |||
---|---|---|---|---|---|
310 | m_errorString.clear(); | 310 | m_errorString.clear(); | ||
311 | emit errorStringChanged(); | 311 | emit errorStringChanged(); | ||
312 | 312 | | |||
313 | if (m_dirWatch) { | 313 | if (m_dirWatch) { | ||
314 | delete m_dirWatch; | 314 | delete m_dirWatch; | ||
315 | m_dirWatch = nullptr; | 315 | m_dirWatch = nullptr; | ||
316 | } | 316 | } | ||
317 | 317 | | |||
318 | if (resolvedNewUrl.isValid()) { | | |||
319 | m_dirWatch = new KDirWatch(this); | | |||
320 | connect(m_dirWatch, &KDirWatch::created, this, &FolderModel::iconNameChanged); | | |||
321 | connect(m_dirWatch, &KDirWatch::dirty, this, &FolderModel::iconNameChanged); | | |||
322 | m_dirWatch->addFile(resolvedNewUrl.toLocalFile() + QLatin1String("/.directory")); | | |||
323 | } | | |||
324 | | ||||
325 | if (m_dragInProgress) { | 318 | if (m_dragInProgress) { | ||
326 | m_urlChangedWhileDragging = true; | 319 | m_urlChangedWhileDragging = true; | ||
327 | } | 320 | } | ||
328 | 321 | | |||
329 | emit iconNameChanged(); | 322 | emit iconNameChanged(); | ||
330 | 323 | | |||
331 | if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { | 324 | if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { | ||
332 | m_screenMapper->removeScreen(m_screen, oldUrl); | 325 | m_screenMapper->removeScreen(m_screen, oldUrl); | ||
Show All 14 Lines | 339 | if (url.startsWith(QLatin1Char('~'))) { | |||
347 | resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(url)); | 340 | resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(url)); | ||
348 | } else { | 341 | } else { | ||
349 | resolvedUrl = QUrl::fromUserInput(url); | 342 | resolvedUrl = QUrl::fromUserInput(url); | ||
350 | } | 343 | } | ||
351 | 344 | | |||
352 | return resolvedUrl; | 345 | return resolvedUrl; | ||
353 | } | 346 | } | ||
354 | 347 | | |||
355 | QString FolderModel::iconName() const | 348 | QString FolderModel::iconName() | ||
356 | { | 349 | { | ||
357 | const KFileItem rootItem(m_dirModel->dirLister()->url()); | 350 | const KFileItem rootItem(m_dirModel->dirLister()->url()); | ||
358 | 351 | | |||
352 | if (!m_dirWatch) { | ||||
353 | const QString localPath = rootItem.localPath(); | ||||
354 | if (!localPath.isEmpty()) { | ||||
355 | m_dirWatch = new KDirWatch(this); | ||||
356 | connect(m_dirWatch, &KDirWatch::created, this, &FolderModel::iconNameChanged); | ||||
357 | connect(m_dirWatch, &KDirWatch::dirty, this, &FolderModel::iconNameChanged); | ||||
358 | m_dirWatch->addFile(localPath + QLatin1String("/.directory")); | ||||
359 | } | ||||
360 | } | ||||
361 | | ||||
359 | if (!rootItem.isFinalIconKnown()) { | 362 | if (!rootItem.isFinalIconKnown()) { | ||
360 | rootItem.determineMimeType(); | 363 | rootItem.determineMimeType(); | ||
361 | } | 364 | } | ||
362 | 365 | | |||
363 | return rootItem.iconName(); | 366 | return rootItem.iconName(); | ||
364 | } | 367 | } | ||
365 | 368 | | |||
366 | FolderModel::Status FolderModel::status() const | 369 | FolderModel::Status FolderModel::status() const | ||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |