connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
KFileItemModel* model = fileItemModel();
- connect(model, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
- connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
- connect(model, SIGNAL(dirLoadingProgress(int)), this, SIGNAL(dirLoadingProgress(int)));
- connect(model, SIGNAL(dirSortingProgress(int)), this, SIGNAL(dirSortingProgress(int)));
+ connect(model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
+ connect(model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
+ connect(model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int)));
+ connect(model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int)));
connect(model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
this, SLOT(slotItemsChanged()));
- connect(model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(model, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
+ connect(model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
+ connect(model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
+ connect(model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
KItemListView* view = controller->view();
view->installEventFilter(this);
m_currentItemUrl = url;
}
-void DolphinView::setItemSelectionEnabled(const QRegExp& pattern, bool enabled)
+void DolphinView::selectItems(const QRegExp& pattern, bool enabled)
{
const KItemListSelectionManager::SelectionMode mode = enabled
? KItemListSelectionManager::Select
bool DolphinView::sortFoldersFirst() const
{
KFileItemModel* model = fileItemModel();
- return model->sortFoldersFirst();
+ return model->sortDirectoriesFirst();
}
void DolphinView::setVisibleRoles(const QList<QByteArray>& roles)
void DolphinView::stopLoading()
{
- fileItemModel()->cancelDirLoading();
+ fileItemModel()->cancelDirectoryLoading();
}
void DolphinView::readSettings()
return fileItemModel()->nameFilter();
}
-void DolphinView::calculateItemCount(int& fileCount,
- int& folderCount,
- KIO::filesize_t& totalFileSize) const
-{
- const KFileItemModel* model = fileItemModel();
- const int itemCount = model->count();
- for (int i = 0; i < itemCount; ++i) {
- const KFileItem item = model->fileItem(i);
- if (item.isDir()) {
- ++folderCount;
- } else {
- ++fileCount;
- totalFileSize += item.size();
- }
- }
-}
-
QString DolphinView::statusBarText() const
{
QString summary;
int fileCount = 0;
KIO::filesize_t totalFileSize = 0;
- if (hasSelection()) {
+ if (m_container->controller()->selectionManager()->hasSelection()) {
// Give a summary of the status of the selected files
const KFileItemList list = selectedItems();
foreach (const KFileItem& item, list) {
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
{
if (previous != 0) {
- disconnect(previous, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ disconnect(previous, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
}
Q_ASSERT(qobject_cast<KFileItemModel*>(current));
- connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
m_versionControlObserver->setModel(fileItemModel);
props.setSortFoldersFirst(foldersFirst);
KFileItemModel* model = fileItemModel();
- model->setSortFoldersFirst(foldersFirst);
+ model->setSortDirectoriesFirst(foldersFirst);
emit sortFoldersFirstChanged(foldersFirst);
}
// Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
QSet<KUrl> urls;
stream >> urls;
- fileItemModel()->restoreExpandedUrls(urls);
+ fileItemModel()->restoreExpandedDirectories(urls);
}
void DolphinView::saveState(QDataStream& stream)
stream << QPoint(x, y);
// Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
- stream << fileItemModel()->expandedUrls();
-}
-
-bool DolphinView::hasSelection() const
-{
- return m_container->controller()->selectionManager()->hasSelection();
+ stream << fileItemModel()->expandedDirectories();
}
KFileItem DolphinView::rootItem() const
m_createdItemUrl = KUrl();
}
-void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
{
if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) {
emit redirection(oldUrl, newUrl);
}
}
+void DolphinView::calculateItemCount(int& fileCount,
+ int& folderCount,
+ KIO::filesize_t& totalFileSize) const
+{
+ const KFileItemModel* model = fileItemModel();
+ const int itemCount = model->count();
+ for (int i = 0; i < itemCount; ++i) {
+ const KFileItem item = model->fileItem(i);
+ if (item.isDir()) {
+ ++folderCount;
+ } else {
+ ++fileCount;
+ totalFileSize += item.size();
+ }
+ }
+}
+
void DolphinView::showHoverInformation(const KFileItem& item)
{
emit requestItemInfo(item);
}
}
-void DolphinView::slotDirLoadingStarted()
+void DolphinView::slotDirectoryLoadingStarted()
{
// Disable the writestate temporary until it can be determined in a fast way
// in DolphinView::slotLoadingCompleted()
emit writeStateChanged(m_isFolderWritable);
}
- emit startedDirLoading(url());
+ emit directoryLoadingStarted();
}
-void DolphinView::slotDirLoadingCompleted()
+void DolphinView::slotDirectoryLoadingCompleted()
{
- // Update the view-state. This has to be done using a Qt::QueuedConnection
+ // Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, SLOT(updateViewState()));
- emit finishedDirLoading(url());
+ emit directoryLoadingCompleted();
updateWritableState();
}
KFileItemModel* model = fileItemModel();
if (reload) {
- model->refreshDir(url);
+ model->refreshDirectory(url);
} else {
- model->loadDir(url);
+ model->loadDirectory(url);
}
}
}
const bool sortFoldersFirst = props.sortFoldersFirst();
- if (sortFoldersFirst != model->sortFoldersFirst()) {
- model->setSortFoldersFirst(sortFoldersFirst);
+ if (sortFoldersFirst != model->sortDirectoriesFirst()) {
+ model->setSortDirectoriesFirst(sortFoldersFirst);
emit sortFoldersFirstChanged(sortFoldersFirst);
}