┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Beltrame <[email protected]>2012-09-21 10:55:08 +0200
committerLuca Beltrame <[email protected]>2012-09-21 10:55:08 +0200
commitf1b822d926316d739ec10d8b05917b6b0c2d92b5 (patch)
tree20e52bfd70694a34f86fa650d3797be67bda8f67
parent399c4b22ea9947047c7d2777d7f361df6b5e9636 (diff)
parentc8243401470156d9ee76e2015a23741570d3dba1 (diff)
Merge branch 'KDE/4.9'
Conflicts: konq-plugins/dirfilter/dirfilterplugin.cpp konq-plugins/dirfilter/dirfilterplugin.h
-rw-r--r--src/kitemviews/kitemlistcontroller.cpp32
-rw-r--r--src/kitemviews/kitemlistcontroller.h20
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp10
-rw-r--r--src/panels/folders/folderspanel.cpp2
-rw-r--r--src/panels/places/placesitemmodel.cpp24
-rw-r--r--src/panels/terminal/terminalpanel.cpp1
-rw-r--r--src/settings/dolphin_generalsettings.kcfg4
-rw-r--r--src/views/dolphinview.cpp20
-rw-r--r--src/views/dolphinview.h1
9 files changed, 105 insertions, 9 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index 879548100..5a7175e4c 100644
--- a/src/kitemviews/kitemlistcontroller.cpp
+++ b/src/kitemviews/kitemlistcontroller.cpp
@@ -47,6 +47,8 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v
m_selectionTogglePressed(false),
m_clearSelectionIfItemsAreNotDragged(false),
m_selectionBehavior(NoSelection),
+ m_autoActivationBehavior(ActivationAndExpansion),
+ m_mouseDoubleClickAction(ActivateItemOnly),
m_model(0),
m_view(0),
m_selectionManager(new KItemListSelectionManager(this)),
@@ -157,6 +159,26 @@ KItemListController::SelectionBehavior KItemListController::selectionBehavior()
return m_selectionBehavior;
}
+void KItemListController::setAutoActivationBehavior(AutoActivationBehavior behavior)
+{
+ m_autoActivationBehavior = behavior;
+}
+
+KItemListController::AutoActivationBehavior KItemListController::autoActivationBehavior() const
+{
+ return m_autoActivationBehavior;
+}
+
+void KItemListController::setMouseDoubleClickAction(MouseDoubleClickAction action)
+{
+ m_mouseDoubleClickAction = action;
+}
+
+KItemListController::MouseDoubleClickAction KItemListController::mouseDoubleClickAction() const
+{
+ return m_mouseDoubleClickAction;
+}
+
void KItemListController::setAutoActivationDelay(int delay)
{
m_autoActivationTimer->setInterval(delay);
@@ -480,7 +502,7 @@ void KItemListController::slotAutoActivationTimeout()
if (m_view->supportsItemExpanding() && m_model->isExpandable(index)) {
const bool expanded = m_model->isExpanded(index);
m_model->setExpanded(index, !expanded);
- } else {
+ } else if (m_autoActivationBehavior != ExpansionOnly) {
emit itemActivated(index);
}
}
@@ -753,6 +775,14 @@ bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event,
const QPointF pos = transform.map(event->pos());
const int index = m_view->itemAt(pos);
+ // Expand item if desired - See Bug 295573
+ if (m_mouseDoubleClickAction != ActivateItemOnly) {
+ if (m_view && m_model && m_view->supportsItemExpanding() && m_model->isExpandable(index)) {
+ const bool expanded = m_model->isExpanded(index);
+ m_model->setExpanded(index, !expanded);
+ }
+ }
+
bool emitItemActivated = !m_singleClickActivation &&
(event->button() & Qt::LeftButton) &&
index >= 0 && index < m_model->count();
diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h
index a88152622..235e4a9eb 100644
--- a/src/kitemviews/kitemlistcontroller.h
+++ b/src/kitemviews/kitemlistcontroller.h
@@ -64,6 +64,8 @@ class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject
Q_PROPERTY(KItemModelBase* model READ model WRITE setModel)
Q_PROPERTY(KItemListView *view READ view WRITE setView)
Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior)
+ Q_PROPERTY(AutoActivationBehavior autoActivationBehavior READ autoActivationBehavior WRITE setAutoActivationBehavior)
+ Q_PROPERTY(MouseDoubleClickAction mouseDoubleClickAction READ mouseDoubleClickAction WRITE setMouseDoubleClickAction)
public:
enum SelectionBehavior {
@@ -72,6 +74,16 @@ public:
MultiSelection
};
+ enum AutoActivationBehavior {
+ ActivationAndExpansion,
+ ExpansionOnly
+ };
+
+ enum MouseDoubleClickAction {
+ ActivateAndExpandItem,
+ ActivateItemOnly
+ };
+
/**
* @param model Model of the controller. The ownership is passed to the controller.
* @param view View of the controller. The ownership is passed to the controller.
@@ -91,6 +103,12 @@ public:
void setSelectionBehavior(SelectionBehavior behavior);
SelectionBehavior selectionBehavior() const;
+ void setAutoActivationBehavior(AutoActivationBehavior behavior);
+ AutoActivationBehavior autoActivationBehavior() const;
+
+ void setMouseDoubleClickAction(MouseDoubleClickAction action);
+ MouseDoubleClickAction mouseDoubleClickAction() const;
+
/**
* Sets the delay in milliseconds when dragging an object above an item
* until the item gets activated automatically. A value of -1 indicates
@@ -287,6 +305,8 @@ private:
bool m_selectionTogglePressed;
bool m_clearSelectionIfItemsAreNotDragged;
SelectionBehavior m_selectionBehavior;
+ AutoActivationBehavior m_autoActivationBehavior;
+ MouseDoubleClickAction m_mouseDoubleClickAction;
KItemModelBase* m_model;
KItemListView* m_view;
KItemListSelectionManager* m_selectionManager;
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index be4fd68cb..97c8a038b 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -271,6 +271,16 @@ void KStandardItemListWidget::paint(QPainter* painter, const QStyleOptionGraphic
painter->setFont(m_customizedFont);
painter->setPen(m_isHidden ? m_additionalInfoTextColor : textColor());
const TextInfo* textInfo = m_textInfo.value("text");
+
+ if (!textInfo) {
+ // It seems that we can end up here even if m_textInfo does not contain
+ // the key "text", see bug 306167. According to triggerCacheRefreshing(),
+ // this can only happen if the index is negative. This can happen when
+ // the item is about to be removed, see KItemListView::slotItemsRemoved().
+ // TODO: try to reproduce the crash and find a better fix.
+ return;
+ }
+
painter->drawStaticText(textInfo->pos, textInfo->staticText);
bool clipAdditionalInfoBounds = false;
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp
index 0760200b6..13093fff6 100644
--- a/src/panels/folders/folderspanel.cpp
+++ b/src/panels/folders/folderspanel.cpp
@@ -140,6 +140,8 @@ void FoldersPanel::showEvent(QShowEvent* event)
m_controller = new KItemListController(m_model, view, this);
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
+ m_controller->setAutoActivationBehavior(KItemListController::ExpansionOnly);
+ m_controller->setMouseDoubleClickAction(KItemListController::ActivateAndExpandItem);
m_controller->setAutoActivationDelay(750);
m_controller->setSingleClickActivation(true);
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 5eb1c35ea..4770c6b10 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -659,11 +659,22 @@ void PlacesItemModel::updateBookmarks()
}
if (!found) {
- PlacesItem* item = new PlacesItem(newBookmark);
- if (item->isHidden() && !m_hiddenItemsShown) {
- m_bookmarkedItems.append(item);
- } else {
- appendItemToGroup(item);
+ const QString udi = newBookmark.metaDataItem("UDI");
+
+ /*
+ * See Bug 304878
+ * Only add a new places item, if the item text is not empty
+ * and if the device is available. Fixes the strange behaviour -
+ * add a places item without text in the Places section - when you
+ * remove a device (e.g. a usb stick) without unmounting.
+ */
+ if (udi.isEmpty() || Solid::Device(udi).isValid()) {
+ PlacesItem* item = new PlacesItem(newBookmark);
+ if (item->isHidden() && !m_hiddenItemsShown) {
+ m_bookmarkedItems.append(item);
+ } else {
+ appendItemToGroup(item);
+ }
}
}
}
@@ -885,8 +896,7 @@ void PlacesItemModel::createSystemBookmarks()
Q_ASSERT(m_systemBookmarks.isEmpty());
Q_ASSERT(m_systemBookmarksIndexes.isEmpty());
- const QString timeLineIcon = "package_utility_time"; // TODO: Ask the Oxygen team to create
- // a custom icon for the timeline-protocol
+ const QString timeLineIcon = "chronometer";
// Note: The context of the I18N_NOOP2 must be "KFile System Bookmarks". The real
// i18nc call is done after reading the bookmark. The reason why the i18nc call is not
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index 889c07e45..f6d3a5981 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -159,6 +159,7 @@ void TerminalPanel::sendCdToTerminal(const QString& dir)
}
m_terminal->sendInput(" cd " + KShell::quoteArg(dir) + '\n');
+ m_konsolePartCurrentDirectory = dir;
if (m_clearTerminal) {
m_terminal->sendInput(" clear\n");
diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg
index 9f261dc5f..050750199 100644
--- a/src/settings/dolphin_generalsettings.kcfg
+++ b/src/settings/dolphin_generalsettings.kcfg
@@ -52,6 +52,10 @@
<label>Ask for confirmation when closing windows with multiple tabs.</label>
<default>true</default>
</entry>
+ <entry name="RenameInline" type="Bool">
+ <label>Rename inline</label>
+ <default>true</default>
+ </entry>
<entry name="ShowSelectionToggle" type="Bool">
<label>Show selection toggle</label>
<default>true</default>
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 20edd6110..05849729f 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -635,7 +635,7 @@ void DolphinView::renameSelectedItems()
return;
}
- if (items.count() == 1) {
+ if (items.count() == 1 && GeneralSettings::renameInline()) {
const int index = m_model->index(items.first());
m_view->editRole(index, "text");
} else {
@@ -753,6 +753,20 @@ void DolphinView::hideEvent(QHideEvent* event)
QWidget::hideEvent(event);
}
+bool DolphinView::event(QEvent* event)
+{
+ /* See Bug 297355
+ * Dolphin leaves file preview tooltips open even when is not visible.
+ *
+ * Hide tool-tip when Dolphin loses focus.
+ */
+ if (event->type() == QEvent::WindowDeactivate) {
+ hideToolTip();
+ }
+
+ return QWidget::event(event);
+}
+
void DolphinView::activate()
{
setActive(true);
@@ -1329,6 +1343,10 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
{
+ if (index < 0 || index >= m_model->count()) {
+ return;
+ }
+
if (role == "text") {
const KFileItem oldItem = m_model->fileItem(index);
const QString newName = value.toString();
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index 3f71fdc54..7d8e8b76a 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -532,6 +532,7 @@ protected:
/** @reimp */
virtual void hideEvent(QHideEvent* event);
+ virtual bool event(QEvent* event);
private slots:
/**