X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7eef5ebec2ceaebb4088629093ecd3f0c2635816..ec00f379dc42b00a64ab1af25bb4bb1a06bd7449:/src/infosidebarpage.cpp diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp index b7490625f..ae692fc42 100644 --- a/src/infosidebarpage.cpp +++ b/src/infosidebarpage.cpp @@ -102,6 +102,13 @@ InfoSidebarPage::~InfoSidebarPage() { } +QSize InfoSidebarPage::sizeHint() const +{ + QSize size = SidebarPage::sizeHint(); + size.setWidth(minimumSizeHint().width()); + return size; +} + void InfoSidebarPage::setUrl(const KUrl& url) { if (url.isValid() && !m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) { @@ -111,7 +118,7 @@ void InfoSidebarPage::setUrl(const KUrl& url) } } -void InfoSidebarPage::setSelection(const KFileItemList& selection) +void InfoSidebarPage::setSelection(const QList& selection) { SidebarPage::setSelection(selection); m_timer->start(TimerDelay); @@ -160,13 +167,13 @@ void InfoSidebarPage::showItemInfo() cancelRequest(); - const KFileItemList& selectedItems = selection(); + const QList& selectedItems = selection(); KUrl file; if (selectedItems.isEmpty()) { file = m_shownUrl; } else { - file = selectedItems[0]->url(); + file = selectedItems[0].url(); } if (!file.isValid()) { return; @@ -179,7 +186,7 @@ void InfoSidebarPage::showItemInfo() K3Icon::SizeEnormous); m_preview->setPixmap(icon); m_nameLabel->setText(i18ncp("@info", "%1 item selected", "%1 items selected", selectedItems.count())); - } else if (!applyBookmark(file)) { + } else if (!applyPlace(file)) { // try to get a preview pixmap from the item... KUrl::List list; list.append(file); @@ -219,7 +226,7 @@ void InfoSidebarPage::slotTimeout() void InfoSidebarPage::showIcon(const KFileItem& item) { m_pendingPreview = false; - if (!applyBookmark(item.url())) { + if (!applyPlace(item.url())) { m_preview->setPixmap(item.pixmap(K3Icon::SizeEnormous)); } } @@ -234,7 +241,7 @@ void InfoSidebarPage::showPreview(const KFileItem& item, } } -bool InfoSidebarPage::applyBookmark(const KUrl& url) +bool InfoSidebarPage::applyPlace(const KUrl& url) { KFilePlacesModel* placesModel = DolphinSettings::instance().placesModel(); int count = placesModel->rowCount(); @@ -266,13 +273,13 @@ void InfoSidebarPage::showMetaInfo() { QString text; - const KFileItemList& selectedItems = selection(); + const QList& selectedItems = selection(); if (selectedItems.size() <= 1) { KFileItem fileItem(S_IFDIR, KFileItem::Unknown, m_shownUrl); fileItem.refresh(); if (fileItem.isDir()) { - addInfoLine(text, i18nc("@label", "Type:"), i18nc("@info", "Folder")); + addInfoLine(text, i18nc("@label", "Type:"), i18nc("@label", "Folder")); } else { addInfoLine(text, i18nc("@label", "Type:"), fileItem.mimeComment()); @@ -304,14 +311,18 @@ void InfoSidebarPage::showMetaInfo() } } else { if (MetaDataWidget::metaDataAvailable()) { - m_metadataWidget->setFiles(selectedItems.urlList()); + KUrl::List urls; + foreach (const KFileItem& item, selectedItems) { + urls.append(item.url()); + } + m_metadataWidget->setFiles(urls); } unsigned long int totalSize = 0; - foreach (KFileItem* item, selectedItems) { + foreach (const KFileItem& item, selectedItems) { // TODO: what to do with directories (same with the one-item-selected-code)?, - // item->size() does not return the size of the content : not very instinctive for users - totalSize += item->size(); + // item.size() does not return the size of the content : not very instinctive for users + totalSize += item.size(); } addInfoLine(text, i18nc("@label", "Total size:"), KIO::convertSize(totalSize)); } @@ -322,7 +333,7 @@ void InfoSidebarPage::addInfoLine(QString& text, const QString& labelText, const QString& infoText) { - if (!infoText.isEmpty()) { + if (!text.isEmpty()) { text += "
"; } text += QString("%1 %2").arg(labelText).arg(infoText);