X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7eef5ebec2ceaebb4088629093ecd3f0c2635816..dc1966aec364ee8d5e960c10356bffe9eae17508:/src/infosidebarpage.cpp
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index b7490625f..b2705ec7f 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -66,8 +66,8 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
// preview
m_preview = new PixmapViewer(this);
- m_preview->setMinimumWidth(K3Icon::SizeEnormous);
- m_preview->setFixedHeight(K3Icon::SizeEnormous);
+ m_preview->setMinimumWidth(KIconLoader::SizeEnormous);
+ m_preview->setFixedHeight(KIconLoader::SizeEnormous);
// name
m_nameLabel = new QLabel(this);
@@ -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)) {
@@ -114,6 +121,12 @@ void InfoSidebarPage::setUrl(const KUrl& url)
void InfoSidebarPage::setSelection(const KFileItemList& selection)
{
SidebarPage::setSelection(selection);
+ if (selection.size() == 1) {
+ const KUrl url = selection.first().url();
+ if (!url.isEmpty()) {
+ m_urlCandidate = url;
+ }
+ }
m_timer->start(TimerDelay);
}
@@ -166,7 +179,7 @@ void InfoSidebarPage::showItemInfo()
if (selectedItems.isEmpty()) {
file = m_shownUrl;
} else {
- file = selectedItems[0]->url();
+ file = selectedItems[0].url();
}
if (!file.isValid()) {
return;
@@ -175,11 +188,11 @@ void InfoSidebarPage::showItemInfo()
if (itemCount > 1) {
KIconLoader iconLoader;
QPixmap icon = iconLoader.loadIcon("exec",
- K3Icon::NoGroup,
- K3Icon::SizeEnormous);
+ KIconLoader::NoGroup,
+ KIconLoader::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);
@@ -189,7 +202,7 @@ void InfoSidebarPage::showItemInfo()
KIO::PreviewJob* job = KIO::filePreview(list,
m_preview->width(),
- K3Icon::SizeEnormous,
+ KIconLoader::SizeEnormous,
0,
0,
true,
@@ -219,8 +232,8 @@ void InfoSidebarPage::slotTimeout()
void InfoSidebarPage::showIcon(const KFileItem& item)
{
m_pendingPreview = false;
- if (!applyBookmark(item.url())) {
- m_preview->setPixmap(item.pixmap(K3Icon::SizeEnormous));
+ if (!applyPlace(item.url())) {
+ m_preview->setPixmap(item.pixmap(KIconLoader::SizeEnormous));
}
}
@@ -234,7 +247,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();
@@ -272,7 +285,7 @@ void InfoSidebarPage::showMetaInfo()
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 +317,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 +339,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);