}
emit modeChanged();
+
updateZoomLevel(oldZoomLevel);
+ if (m_showPreview) {
+ loadDirectory(viewPropsUrl);
+ }
}
DolphinView::Mode DolphinView::mode() const
}
}
-void DolphinView::calculateItemCount(int& fileCount, int& folderCount) const
+void DolphinView::calculateItemCount(int& fileCount,
+ int& folderCount,
+ KIO::filesize_t& totalFileSize) const
{
foreach (const KFileItem& item, m_dirLister->items()) {
if (item.isDir()) {
++folderCount;
} else {
++fileCount;
+ totalFileSize += item.size();
}
}
}
QString DolphinView::statusBarText() const
-{
+{
+ QString text;
+ int folderCount = 0;
+ int fileCount = 0;
+ KIO::filesize_t totalFileSize = 0;
+
if (hasSelection()) {
// give a summary of the status of the selected files
- QString text;
const KFileItemList list = selectedItems();
if (list.isEmpty()) {
// when an item is triggered, it is temporary selected but selectedItems()
// will return an empty list
- return QString();
+ return text;
}
- int fileCount = 0;
- int folderCount = 0;
- KIO::filesize_t byteSize = 0;
KFileItemList::const_iterator it = list.begin();
const KFileItemList::const_iterator end = list.end();
while (it != end) {
++folderCount;
} else {
++fileCount;
- byteSize += item.size();
+ totalFileSize += item.size();
}
++it;
}
-
- if (folderCount > 0) {
- text = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
- if (fileCount > 0) {
- text += ", ";
- }
- }
-
- if (fileCount > 0) {
- const QString sizeText(KIO::convertSize(byteSize));
- text += i18ncp("@info:status", "1 File selected (%2)", "%1 Files selected (%2)", fileCount, sizeText);
+
+ const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
+ const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount);
+ if ((folderCount > 0) && (fileCount > 0)) {
+ text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
+ foldersText, filesText, KIO::convertSize(totalFileSize));
+ } else if (fileCount > 0) {
+ text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize));
+ } else {
+ Q_ASSERT(folderCount > 0);
+ text = foldersText;
}
- return text;
} else {
- // Give a summary of the status of the current folder.
- int folderCount = 0;
- int fileCount = 0;
- calculateItemCount(fileCount, folderCount);
- return KIO::itemsSummaryString(fileCount + folderCount,
- fileCount,
- folderCount,
- 0, false);
+ calculateItemCount(fileCount, folderCount, totalFileSize);
+ text = KIO::itemsSummaryString(fileCount + folderCount,
+ fileCount, folderCount,
+ totalFileSize, true);
}
+
+ return text;
}
void DolphinView::setUrl(const KUrl& url)
const KUrl& destPath,
QDropEvent* event)
{
- DragAndDropHelper::dropUrls(destItem, destPath, event, this);
+ DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this);
}
void DolphinView::updateSorting(DolphinView::Sorting sorting)
m_topLayout->removeWidget(view);
view->close();
+ disconnect(view);
+ m_controller->disconnect(view);
+ view->disconnect();
+
bool deleteView = true;
foreach (const QAbstractItemView* expandedView, m_expandedViews) {
if (view == expandedView) {