┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/infosidebarpage.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-05-19 14:42:11 +0000
committerPeter Penz <[email protected]>2007-05-19 14:42:11 +0000
commit572a5722b06b313a25f2ae8a7f8099a16fadf2e4 (patch)
tree2bafaa569b19cd348ce0db6cb95e5098be1ced68 /src/infosidebarpage.cpp
parent50a7b6fd45d88e61b06961dc9a4e564a13330acc (diff)
performance optimization: don't retrieve the meta information immediately when changing the item selection, wait 300 ms until no selection change has been done
svn path=/trunk/KDE/kdebase/apps/; revision=666342
Diffstat (limited to 'src/infosidebarpage.cpp')
-rw-r--r--src/infosidebarpage.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index 7dfb07c6a..152389411 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -52,7 +52,6 @@
InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
SidebarPage(parent),
- m_multipleSelection(false), //TODO: check if I'm needed
m_pendingPreview(false),
m_timer(0),
m_preview(0),
@@ -63,6 +62,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
const int spacing = KDialog::spacingHint();
m_timer = new QTimer(this);
+ m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()),
this, SLOT(slotTimeout()));
@@ -110,7 +110,7 @@ InfoSidebarPage::~InfoSidebarPage()
void InfoSidebarPage::setUrl(const KUrl& url)
{
- if (!m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) {
+ if (url.isValid() && !m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) {
cancelRequest();
m_shownUrl = url;
showItemInfo();
@@ -119,20 +119,17 @@ void InfoSidebarPage::setUrl(const KUrl& url)
void InfoSidebarPage::setSelection(const KFileItemList& selection)
{
- cancelRequest();
SidebarPage::setSelection(selection);
- m_multipleSelection = (selection.size() > 1);
- showItemInfo();
+ m_timer->start(TimerDelay);
}
void InfoSidebarPage::requestDelayedItemInfo(const KUrl& url)
{
cancelRequest();
- if (!url.isEmpty() && !m_multipleSelection) {
+ if (!url.isEmpty() && (selection().size() <= 1)) {
m_urlCandidate = url;
- m_timer->setSingleShot(true);
- m_timer->start(300);
+ m_timer->start(TimerDelay);
}
}
@@ -166,12 +163,13 @@ void InfoSidebarPage::showItemInfo()
const KFileItemList& selectedItems = selection();
KUrl file;
+ const int itemCount = selectedItems.count();
if (selectedItems.count() == 0) {
file = m_shownUrl;
} else {
file = selectedItems[0]->url();
}
- if (m_multipleSelection) {
+ if (itemCount > 1) {
KIconLoader iconLoader;
QPixmap icon = iconLoader.loadIcon("exec",
K3Icon::NoGroup,