┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-03-23 15:52:31 +0000
committerPeter Penz <[email protected]>2008-03-23 15:52:31 +0000
commit71afbc513b7894ca86b89a1a3b3b55ff93d662bd (patch)
tree69748349c460c2f2a944f1dd327036bcfdbd19c4 /src
parent99419d3d74b1aa6667dfb5132d0122779ebdb5aa (diff)
Show hovered items in the Information panel also when items are selected. If the cursor is above the viewport in this case, show the selection information again.
BUG: 154618 svn path=/trunk/KDE/kdebase/apps/; revision=789207
Diffstat (limited to 'src')
-rw-r--r--src/infosidebarpage.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index 11b0e9515..5dafa08b7 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -166,11 +166,8 @@ void InfoSidebarPage::setSelection(const KFileItemList& selection)
m_shownUrl = url();
showItemInfo();
} else {
- if (count == 1) {
- const KUrl url = selection.first().url();
- if (!url.isEmpty()) {
- m_urlCandidate = url;
- }
+ if ((count == 1) && !selection.first().url().isEmpty()) {
+ m_urlCandidate = selection.first().url();
}
m_timer->start(TimerDelay);
}
@@ -178,32 +175,28 @@ void InfoSidebarPage::setSelection(const KFileItemList& selection)
void InfoSidebarPage::requestDelayedItemInfo(const KFileItem& item)
{
- if (!selection().isEmpty()) {
- // if items are selected, no item information may get requested
- return;
- }
-
cancelRequest();
m_fileItem = KFileItem();
-
- if (!item.isNull() && (selection().size() <= 1)) {
- const KUrl url = item.url();
- if (!url.isEmpty()) {
- m_urlCandidate = url;
- m_fileItem = item;
+ if (item.isNull()) {
+ // The cursor is above the viewport. If files are selected,
+ // show information regarding the selection.
+ if (selection().size() > 0) {
m_timer->start(TimerDelay);
}
+ } else if (!item.url().isEmpty()) {
+ m_urlCandidate = item.url();
+ m_fileItem = item;
+ m_timer->start(TimerDelay);
}
}
void InfoSidebarPage::showEvent(QShowEvent* event)
{
SidebarPage::showEvent(event);
- if (event->spontaneous()) {
- return;
+ if (!event->spontaneous()) {
+ showItemInfo();
}
- showItemInfo();
}
void InfoSidebarPage::resizeEvent(QResizeEvent* event)
@@ -233,19 +226,19 @@ void InfoSidebarPage::showItemInfo()
cancelRequest();
const KFileItemList& selectedItems = selection();
- const KUrl file = selectedItems.isEmpty() ? m_shownUrl : selectedItems[0].url();
+ const KUrl file = (!m_fileItem.isNull() || selectedItems.isEmpty()) ? m_shownUrl : selectedItems[0].url();
if (!file.isValid()) {
return;
}
- const int itemCount = selectedItems.count();
- if (itemCount > 1) {
+ const int selectionCount = selectedItems.count();
+ if (m_fileItem.isNull() && (selectionCount > 1)) {
KIconLoader iconLoader;
QPixmap icon = iconLoader.loadIcon("dialog-information",
KIconLoader::NoGroup,
KIconLoader::SizeEnormous);
m_preview->setPixmap(icon);
- m_nameLabel->setText(i18ncp("@info", "%1 item selected", "%1 items selected", selectedItems.count()));
+ m_nameLabel->setText(i18ncp("@info", "%1 item selected", "%1 items selected", selectionCount));
} else if (!applyPlace(file)) {
// try to get a preview pixmap from the item...
KUrl::List list;
@@ -326,7 +319,7 @@ void InfoSidebarPage::showMetaInfo()
m_metaTextLabel->clear();
const KFileItemList& selectedItems = selection();
- if (selectedItems.size() <= 1) {
+ if ((selectedItems.size() <= 1) || !m_fileItem.isNull()) {
KFileItem fileItem;
if (m_fileItem.isNull()) {
// no pending request is ongoing