Merge remote-tracking branch 'origin/KDE/4.10'

This commit is contained in:
Frank Reininghaus 2013-02-17 12:17:01 +01:00
commit e6ef1eec3a
2 changed files with 57 additions and 24 deletions

View file

@ -104,17 +104,17 @@ void KStandardItemListView::initializeItemListWidget(KItemListWidget* item)
bool KStandardItemListView::itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const
{
// The only thing that can modify the item's size hint is the amount of space
// needed to display the text for the visible roles.
// Even if the icons have a different size they are always aligned within
// the area defined by KItemStyleOption.iconSize and hence result in no
// change of the item-size.
const bool containsIconName = changedRoles.contains("iconName");
const bool containsIconPixmap = changedRoles.contains("iconPixmap");
const int count = changedRoles.count();
const bool iconChanged = (containsIconName && containsIconPixmap && count == 2) ||
(containsIconName && count == 1) ||
(containsIconPixmap && count == 1);
return !iconChanged;
foreach (const QByteArray& role, visibleRoles()) {
if (changedRoles.contains(role)) {
return true;
}
}
return false;
}
void KStandardItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)

View file

@ -521,11 +521,8 @@ void KItemListControllerTest::testMouseClickActivation()
adjustGeometryForColumnCount(5);
// Make sure that the first item is visible in the view.
QTest::keyClick(m_container, Qt::Key_End, Qt::NoModifier);
QTest::keyClick(m_container, Qt::Key_Home, Qt::NoModifier);
while (m_view->firstVisibleIndex() > 0) {
QTest::qWait(50);
}
m_view->setScrollOffset(0);
QCOMPARE(m_view->firstVisibleIndex(), 0);
const QPointF pos = m_view->itemContextRect(0).center();
@ -551,9 +548,19 @@ void KItemListControllerTest::testMouseClickActivation()
group.writeEntry("SingleClick", true, KConfig::Persistent|KConfig::Global);
config.sync();
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
while (!KGlobalSettings::singleClick()) {
int iterations = 0;
const int maxIterations = 20;
while (!KGlobalSettings::singleClick() && iterations < maxIterations) {
QTest::qWait(50);
++iterations;
}
if (!KGlobalSettings::singleClick()) {
// TODO: Try to find a way to make sure that changing the global setting works.
QSKIP("Failed to change the KGlobalSettings::singleClick() setting!", SkipSingle);
}
m_view->event(&mousePressEvent);
m_view->event(&mouseReleaseEvent);
QCOMPARE(spyItemActivated.count(), 1);
@ -563,9 +570,18 @@ void KItemListControllerTest::testMouseClickActivation()
group.writeEntry("SingleClick", false, KConfig::Persistent|KConfig::Global);
config.sync();
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
while (KGlobalSettings::singleClick()) {
iterations = 0;
while (KGlobalSettings::singleClick() && iterations < maxIterations) {
QTest::qWait(50);
++iterations;
}
if (KGlobalSettings::singleClick()) {
// TODO: Try to find a way to make sure that changing the global setting works.
QSKIP("Failed to change the KGlobalSettings::singleClick() setting!", SkipSingle);
}
m_view->event(&mousePressEvent);
m_view->event(&mouseReleaseEvent);
QCOMPARE(spyItemActivated.count(), 0);
@ -589,9 +605,18 @@ void KItemListControllerTest::testMouseClickActivation()
group.writeEntry("SingleClick", true, KConfig::Persistent|KConfig::Global);
config.sync();
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
while (!KGlobalSettings::singleClick()) {
iterations = 0;
while (!KGlobalSettings::singleClick() && iterations < maxIterations) {
QTest::qWait(50);
++iterations;
}
if (!KGlobalSettings::singleClick()) {
// TODO: Try to find a way to make sure that changing the global setting works.
QSKIP("Failed to change the KGlobalSettings::singleClick() setting!", SkipSingle);
}
m_view->event(&mousePressEvent);
m_view->event(&mouseReleaseEvent);
QCOMPARE(spyItemActivated.count(), 1);
@ -609,8 +634,16 @@ void KItemListControllerTest::testMouseClickActivation()
group.writeEntry("SingleClick", restoreKGlobalSettingsSingleClick, KConfig::Persistent|KConfig::Global);
config.sync();
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
while (KGlobalSettings::singleClick() != restoreKGlobalSettingsSingleClick) {
iterations = 0;
while (KGlobalSettings::singleClick() != restoreKGlobalSettingsSingleClick && iterations < maxIterations) {
QTest::qWait(50);
++iterations;
}
if (KGlobalSettings::singleClick() != restoreKGlobalSettingsSingleClick) {
// TODO: Try to find a way to make sure that changing the global setting works.
QSKIP("Failed to change the KGlobalSettings::singleClick() setting!", SkipSingle);
}
}