Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/foldermodel.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | |||||
114 | { | 114 | { | ||
115 | //needed to pass the job around with qml | 115 | //needed to pass the job around with qml | ||
116 | qmlRegisterType<KIO::DropJob>(); | 116 | qmlRegisterType<KIO::DropJob>(); | ||
117 | DirLister *dirLister = new DirLister(this); | 117 | DirLister *dirLister = new DirLister(this); | ||
118 | dirLister->setDelayedMimeTypes(true); | 118 | dirLister->setDelayedMimeTypes(true); | ||
119 | dirLister->setAutoErrorHandlingEnabled(false, 0); | 119 | dirLister->setAutoErrorHandlingEnabled(false, 0); | ||
120 | connect(dirLister, &DirLister::error, this, &FolderModel::dirListFailed); | 120 | connect(dirLister, &DirLister::error, this, &FolderModel::dirListFailed); | ||
121 | connect(dirLister, &KCoreDirLister::itemsDeleted, this, &FolderModel::evictFromIsDirCache); | 121 | connect(dirLister, &KCoreDirLister::itemsDeleted, this, &FolderModel::evictFromIsDirCache); | ||
122 | connect(dirLister, &KCoreDirLister::started, this, &FolderModel::listingStarted); | 122 | | ||
123 | connect(dirLister, &KCoreDirLister::started, this, std::bind(&FolderModel::setStatus, this, Status::Listing)); | ||||
124 | | ||||
123 | void (KCoreDirLister::*myCompletedSignal)() = &KCoreDirLister::completed; | 125 | void (KCoreDirLister::*myCompletedSignal)() = &KCoreDirLister::completed; | ||
124 | QObject::connect(dirLister, myCompletedSignal, this, &FolderModel::listingCompleted); | 126 | QObject::connect(dirLister, myCompletedSignal, this, [this] { | ||
127 | setStatus(Status::Ready); | ||||
128 | emit listingCompleted(); | ||||
129 | }); | ||||
130 | | ||||
125 | void (KCoreDirLister::*myCanceledSignal)() = &KCoreDirLister::canceled; | 131 | void (KCoreDirLister::*myCanceledSignal)() = &KCoreDirLister::canceled; | ||
126 | QObject::connect(dirLister, myCanceledSignal, this, &FolderModel::listingCanceled); | 132 | QObject::connect(dirLister, myCanceledSignal, this, [this] { | ||
133 | setStatus(Status::Canceled); | ||||
134 | emit listingCanceled(); | ||||
135 | }); | ||||
127 | 136 | | |||
128 | m_dirModel = new KDirModel(this); | 137 | m_dirModel = new KDirModel(this); | ||
129 | m_dirModel->setDirLister(dirLister); | 138 | m_dirModel->setDirLister(dirLister); | ||
130 | m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory | KDirModel::DropOnLocalExecutable); | 139 | m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory | KDirModel::DropOnLocalExecutable); | ||
131 | 140 | | |||
132 | m_selectionModel = new QItemSelectionModel(this, this); | 141 | m_selectionModel = new QItemSelectionModel(this, this); | ||
133 | connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), | 142 | connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), | ||
134 | this, SLOT(selectionChanged(QItemSelection,QItemSelection))); | 143 | this, SLOT(selectionChanged(QItemSelection,QItemSelection))); | ||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 251 | { | |||
244 | 253 | | |||
245 | if (!rootItem.isFinalIconKnown()) { | 254 | if (!rootItem.isFinalIconKnown()) { | ||
246 | rootItem.determineMimeType(); | 255 | rootItem.determineMimeType(); | ||
247 | } | 256 | } | ||
248 | 257 | | |||
249 | return rootItem.iconName(); | 258 | return rootItem.iconName(); | ||
250 | } | 259 | } | ||
251 | 260 | | |||
261 | FolderModel::Status FolderModel::status() const | ||||
262 | { | ||||
263 | return m_status; | ||||
264 | } | ||||
265 | | ||||
266 | void FolderModel::setStatus(Status status) | ||||
267 | { | ||||
268 | if (m_status != status) { | ||||
269 | m_status = status; | ||||
270 | emit statusChanged(); | ||||
271 | } | ||||
272 | } | ||||
273 | | ||||
252 | QString FolderModel::errorString() const | 274 | QString FolderModel::errorString() const | ||
253 | { | 275 | { | ||
254 | return m_errorString; | 276 | return m_errorString; | ||
255 | } | 277 | } | ||
256 | 278 | | |||
257 | bool FolderModel::dragging() const | 279 | bool FolderModel::dragging() const | ||
258 | { | 280 | { | ||
259 | return m_dragInProgress; | 281 | return m_dragInProgress; | ||
▲ Show 20 Lines • Show All 1417 Lines • Show Last 20 Lines |