From b4998a7cd4d5a09ca5ccf15c99bd642ae6bb8571 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Tue, 30 Oct 2012 23:10:43 +0100 Subject: Fix Bug 279333 - Panels can be moved even if locked BUG: 279333 FIXED-IN: 4.9.3 REVIEW: 107135 --- src/dolphindockwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/dolphindockwidget.cpp b/src/dolphindockwidget.cpp index 72e06a656..0d8aea7bd 100644 --- a/src/dolphindockwidget.cpp +++ b/src/dolphindockwidget.cpp @@ -68,8 +68,12 @@ void DolphinDockWidget::setLocked(bool lock) m_dockTitleBar = new DolphinDockTitleBar(this); } setTitleBarWidget(m_dockTitleBar); + setFeatures(QDockWidget::NoDockWidgetFeatures); } else { setTitleBarWidget(0); + setFeatures(QDockWidget::DockWidgetMovable | + QDockWidget::DockWidgetFloatable | + QDockWidget::DockWidgetClosable); } } } -- cgit v1.3 From 32569ebedfaa70f8deb0714936792af9bce8a82b Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 31 Oct 2012 22:43:21 +0100 Subject: Fix Bug 309338 - flood of error boxes while renaming a folder in the folder panel BUG: 309338 FIXED-IN: 4.9.3 REVIEW: 107070 --- src/kitemviews/kitemlistview.cpp | 15 +++++++++++++++ src/kitemviews/kitemlistview.h | 7 +++++++ 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 72b3fd8fc..ef6dfc833 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1429,12 +1429,16 @@ void KItemListView::slotGeometryOfGroupHeaderParentChanged() void KItemListView::slotRoleEditingCanceled(int index, const QByteArray& role, const QVariant& value) { + disconnectRoleEditingSignals(index); + emit roleEditingCanceled(index, role, value); m_editingRole = false; } void KItemListView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value) { + disconnectRoleEditingSignals(index); + emit roleEditingFinished(index, role, value); m_editingRole = false; } @@ -2505,6 +2509,17 @@ bool KItemListView::hasSiblingSuccessor(int index) const return hasSuccessor; } +void KItemListView::disconnectRoleEditingSignals(int index) +{ + KItemListWidget* widget = m_visibleItems.value(index); + if (!widget) { + return; + } + + widget->disconnect(SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), this); + widget->disconnect(SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this); +} + int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc) { int inc = 0; diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 5723b9aaa..984781569 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -662,6 +662,13 @@ private: */ bool hasSiblingSuccessor(int index) const; + /** + * Helper method for slotRoleEditingCanceled() and slotRoleEditingFinished(). + * Disconnects the two Signals "roleEditingCanceled" and + * "roleEditingFinished" + */ + void disconnectRoleEditingSignals(int index); + /** * Helper function for triggerAutoScrolling(). * @param pos Logical position of the mouse relative to the range. -- cgit v1.3 From bc72aeeb8f47b94f30e6226169d2d5602433ac57 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 31 Oct 2012 22:43:40 +0100 Subject: Only store the HomeUrl in dolphinrc if it is not the user's home folder This fixes the problem that copying the dolphinrc from another user results in Dolphin starting up in a folder that might wither not be accessible or not exist at all. BUG: 308569 FIXED-IN: 4.9.3 --- src/settings/dolphin_generalsettings.kcfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 050750199..849a9c75c 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -5,6 +5,7 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> QDir + KUrl kglobalsettings.h @@ -30,7 +31,7 @@ - QDir::homePath() + KUrl(QDir::homePath()).prettyUrl() -- cgit v1.3 From 9d6feb556dbdca54ad9c0a5edc32f53840a88a0f Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 31 Oct 2012 23:06:39 +0100 Subject: Do not show an incorrect file name after a failed rename operation BUG: 303742 FIXED-IN: 4.9.3 --- src/views/dolphinview.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 624aa185d..8e1a19108 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1348,9 +1348,18 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) { const KUrl oldUrl = oldItem.url(); - QHash data; - data.insert(role, value); - m_model->setData(index, data); + const KUrl newUrl(url().path(KUrl::AddTrailingSlash) + newName); + const bool newNameExistsAlready = (m_model->index(newUrl) >= 0); + if (!newNameExistsAlready) { + // Only change the data in the model if no item with the new name + // is in the model yet. If there is an item with the new name + // already, calling KonqOperations::rename() will open a dialog + // asking for a new name, and KFileItemModel will update the + // data when the dir lister signals that the file name has changed. + QHash data; + data.insert(role, value); + m_model->setData(index, data); + } KonqOperations::rename(this, oldUrl, newName); } -- cgit v1.3 From 951dbd6d67d885d9583e8ce45635a4ae086445fb Mon Sep 17 00:00:00 2001 From: Alex Fiestas Date: Thu, 1 Nov 2012 00:25:36 +0100 Subject: Removed customm setText for mtp devices and check for kio_mtp We are already checking if kio_mtp is installed when we build the predicate so we don't need to check if it is installed again. Also, the fix for "Showing the product as a name for some kind of massive storage" will have to be delayed to 4.9.4, so removing this. --- src/panels/places/placesitem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index f78c98b76..75e14d0fb 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -268,8 +268,7 @@ void PlacesItem::initializeDevice(const QString& udi) } else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) { const QString device = m_device.as()->device(); setUrl(QString("audiocd:/?device=%1").arg(device)); - } else if (m_mtp && m_mtp->supportedProtocols().contains("mtp")) { - setText(m_device.product()); + } else if (m_mtp) { setUrl(QString("mtp:udi=%1").arg(m_device.udi())); } } -- cgit v1.3 From 07721cf76459d8fff9b96ffe3dde83bc418bed31 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Sun, 4 Nov 2012 14:39:49 +0100 Subject: Do not use a hardcoded size for the buttons in the Information panel Thanks to Kai Uwe Broulok and Jekyll Wu for the investigation! BUG: 309498 FIXED-IN: 4.9.4 --- src/panels/information/phononwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index f0c030ed6..a36ada180 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -123,14 +123,17 @@ void PhononWidget::showEvent(QShowEvent *event) m_topLayout->addLayout(controlsLayout); + const int smallIconSize = IconSize(KIconLoader::Small); + const QSize buttonSize(smallIconSize, smallIconSize); + m_playButton->setToolTip(i18n("play")); - m_playButton->setIconSize(QSize(16, 16)); + m_playButton->setIconSize(buttonSize); m_playButton->setIcon(KIcon("media-playback-start")); m_playButton->setAutoRaise(true); connect(m_playButton, SIGNAL(clicked()), this, SLOT(play())); m_stopButton->setToolTip(i18n("stop")); - m_stopButton->setIconSize(QSize(16, 16)); + m_stopButton->setIconSize(buttonSize); m_stopButton->setIcon(KIcon("media-playback-stop")); m_stopButton->setAutoRaise(true); m_stopButton->hide(); -- cgit v1.3 From c0559a2a1d7d66b26e1d00b4ff59c7fce8848566 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Mon, 5 Nov 2012 22:03:52 +0100 Subject: Prevent crashes caused by nested event loops run when renaming inline When renaming inline and starting a drag or invoking the context menu, a nested event loop will be run. If the role editor loses focus and emits roleEditingFinished(), we must prevent that deleteLater() is called because this would delete the role editor inside a nested event loop which is run from one of its own functions. We would get a crash when returning from that event loop otherwise. BUG: 308018 BUG: 309421 FIXED-IN: 4.9.4 --- src/kitemviews/kstandarditemlistwidget.cpp | 11 ++++-- src/kitemviews/private/kitemlistroleeditor.cpp | 49 ++++++++++++++++++++++++-- src/kitemviews/private/kitemlistroleeditor.h | 12 +++++++ 3 files changed, 68 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index bdc2859c0..f92cab50f 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -609,7 +609,10 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant))); disconnect(m_roleEditor, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); - m_roleEditor->deleteLater(); + // Do not delete the role editor using deleteLater() because we might be + // inside a nested event loop which has been started by one of its event + // handlers (contextMenuEvent() or drag&drop inside mouseMoveEvent()). + m_roleEditor->deleteWhenIdle(); m_roleEditor = 0; } return; @@ -1274,7 +1277,11 @@ void KStandardItemListWidget::closeRoleEditor() this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant))); disconnect(m_roleEditor, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); - m_roleEditor->deleteLater(); + + // Do not delete the role editor using deleteLater() because we might be + // inside a nested event loop which has been started by one of its event + // handlers (contextMenuEvent() or drag&drop inside mouseMoveEvent()). + m_roleEditor->deleteWhenIdle(); m_roleEditor = 0; } diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index 1e4b5fd4e..ead5b298e 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -26,7 +26,9 @@ KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) : KTextEdit(parent), m_index(0), m_role(), - m_blockFinishedSignal(false) + m_blockFinishedSignal(false), + m_eventHandlingLevel(0), + m_deleteAfterEventHandling(false) { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -64,6 +66,20 @@ QByteArray KItemListRoleEditor::role() const return m_role; } +void KItemListRoleEditor::deleteWhenIdle() +{ + if (m_eventHandlingLevel > 0) { + // We are handling an event at the moment. It could be that we + // are in a nested event loop run by contextMenuEvent() or a + // call of mousePressEvent() which results in drag&drop. + // -> do not call deleteLater() to prevent a crash when we + // return from the nested event loop. + m_deleteAfterEventHandling = true; + } else { + deleteLater(); + } +} + bool KItemListRoleEditor::eventFilter(QObject* watched, QEvent* event) { if (watched == parentWidget() && event->type() == QEvent::Resize) { @@ -75,13 +91,42 @@ bool KItemListRoleEditor::eventFilter(QObject* watched, QEvent* event) bool KItemListRoleEditor::event(QEvent* event) { + ++m_eventHandlingLevel; + if (event->type() == QEvent::FocusOut) { QFocusEvent* focusEvent = static_cast(event); if (focusEvent->reason() != Qt::PopupFocusReason) { emitRoleEditingFinished(); } } - return KTextEdit::event(event); + + const int result = KTextEdit::event(event); + --m_eventHandlingLevel; + + if (m_deleteAfterEventHandling && m_eventHandlingLevel == 0) { + // Schedule this object for deletion and make sure that we do not try + // to deleteLater() again when the DeferredDelete event is received. + deleteLater(); + m_deleteAfterEventHandling = false; + } + + return result; +} + +bool KItemListRoleEditor::viewportEvent(QEvent* event) +{ + ++m_eventHandlingLevel; + const bool result = KTextEdit::viewportEvent(event); + --m_eventHandlingLevel; + + if (m_deleteAfterEventHandling && m_eventHandlingLevel == 0) { + // Schedule this object for deletion and make sure that we do not try + // to deleteLater() again when the DeferredDelete event is received. + deleteLater(); + m_deleteAfterEventHandling = false; + } + + return result; } void KItemListRoleEditor::keyPressEvent(QKeyEvent* event) diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h index aa2c97754..a2f705808 100644 --- a/src/kitemviews/private/kitemlistroleeditor.h +++ b/src/kitemviews/private/kitemlistroleeditor.h @@ -47,6 +47,15 @@ public: void setRole(const QByteArray& role); QByteArray role() const; + /** + * Calls deleteLater() if no event is being handled at the moment. + * Otherwise, the deletion is deferred until the event handling is + * finished. This prevents that the deletion happens inside a nested + * event loop which might be run in contextMenuEvent() or + * mouseMoveEvent() because this would probably cause a crash. + */ + void deleteWhenIdle(); + virtual bool eventFilter(QObject* watched, QEvent* event); signals: @@ -55,6 +64,7 @@ signals: protected: virtual bool event(QEvent* event); + virtual bool viewportEvent(QEvent* event); virtual void keyPressEvent(QKeyEvent* event); private slots: @@ -75,6 +85,8 @@ private: int m_index; QByteArray m_role; bool m_blockFinishedSignal; + int m_eventHandlingLevel; + bool m_deleteAfterEventHandling; }; #endif -- cgit v1.3