From f9ba9a7236a0252a54a51b2f70a04ab13c68f85b Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Tue, 11 Sep 2012 19:25:20 +0200 Subject: Use a better icon for recently accessed items, part 2 I had missed one places where the incorrect icon was used in my previous commit d7e7ca53bb95c7555bbf107d92b47ac25eda1918. BUG: 304323 FIXED-IN: 4.9.2 --- src/panels/places/placesitemmodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/panels') diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 497901345..bd50c9a4b 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -885,8 +885,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 -- cgit v1.3 From 5fbc0101790adf5613e8c686a38bf9d831881a6d Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Tue, 11 Sep 2012 20:17:56 +0200 Subject: Mount unmounted devices, when a file is dropped upon it in places-panel. BUG: 176277 REVIEW: 106072 FIXED-IN: 4.9.2 (cherry picked from commit 824fa6a43734cf9ad2a690778c50bdaf76a1fb0e) --- src/panels/places/placespanel.cpp | 50 ++++++++++++++++++++++++++++++++++++++- src/panels/places/placespanel.h | 5 ++++ 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'src/panels') diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index d4450888e..4b28c8510 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -52,7 +52,10 @@ PlacesPanel::PlacesPanel(QWidget* parent) : m_controller(0), m_model(0), m_storageSetupFailedUrl(), - m_triggerStorageSetupButton() + m_triggerStorageSetupButton(), + m_itemDropEventIndex(-1), + m_itemDropEventMimeData(0), + m_itemDropEvent(0) { } @@ -268,6 +271,30 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even return; } + if (m_model->storageSetupNeeded(index)) { + connect(m_model, SIGNAL(storageSetupDone(int,bool)), + this, SLOT(slotItemDropEventStorageSetupDone(int,bool))); + + m_itemDropEventIndex = index; + + // Make a full copy of the Mime-Data + m_itemDropEventMimeData = new QMimeData; + m_itemDropEventMimeData->setText(event->mimeData()->text()); + m_itemDropEventMimeData->setHtml(event->mimeData()->html()); + m_itemDropEventMimeData->setUrls(event->mimeData()->urls()); + m_itemDropEventMimeData->setImageData(event->mimeData()->imageData()); + m_itemDropEventMimeData->setColorData(event->mimeData()->colorData()); + + m_itemDropEvent = new QDropEvent(event->pos().toPoint(), + event->possibleActions(), + m_itemDropEventMimeData, + event->buttons(), + event->modifiers()); + + m_model->requestStorageSetup(index); + return; + } + KUrl destUrl = m_model->placesItem(index)->url(); QDropEvent dropEvent(event->pos().toPoint(), event->possibleActions(), @@ -278,6 +305,27 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent); } +void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) +{ + disconnect(m_model, SIGNAL(storageSetupDone(int,bool)), + this, SLOT(slotItemDropEventStorageSetupDone(int,bool))); + + if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) { + if (success) { + KUrl destUrl = m_model->placesItem(index)->url(); + + DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent); + } + + delete m_itemDropEventMimeData; + delete m_itemDropEvent; + + m_itemDropEventIndex = -1; + m_itemDropEventMimeData = 0; + m_itemDropEvent = 0; + } +} + void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event) { m_model->dropMimeDataBefore(index, event->mimeData()); diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 8a84e00a0..989a0916b 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -56,6 +56,7 @@ private slots: void slotItemContextMenuRequested(int index, const QPointF& pos); void slotViewContextMenuRequested(const QPointF& pos); void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); + void slotItemDropEventStorageSetupDone(int index, bool success); void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent); void slotTrashUpdated(KJob* job); @@ -80,6 +81,10 @@ private: KUrl m_storageSetupFailedUrl; Qt::MouseButton m_triggerStorageSetupButton; + + int m_itemDropEventIndex; + QMimeData* m_itemDropEventMimeData; + QDropEvent* m_itemDropEvent; }; #endif // PLACESPANEL_H -- cgit v1.3 From 40c513d4774fca0ecfe5141ece642874e2664f89 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 19 Sep 2012 09:28:22 +0200 Subject: Prevent unwanted URL changes when using the Terminal Panel The root cause of the problem was that TerminalPanel's member m_konsolePartCurrentDirectory, which is used to determine in TerminalPanel::sendCdToTerminal(QString& dir) if the Konsole part's directory is aleady 'dir', such that issuing the 'cd' command is not needed, was updated too late, namely when the part's currentDirectoryChanged(QString) signal was received, which may be up to one second after the 'cd' command. When changing the directory from "dir1" to "dir2" and going back to the "dir1" in less than one second (either by using the 'Back' action or by activating a tab which still had "dir1" open), the 'cd dir1' command was therefore suppressed because the Terminal Panel still thought that "dir1" was the current directory in the part. However, the directory of the part was actually "dir2", and when the currentDirectoryChanged(QString) signal was received from the part, the view's URL was set to "dir2" as well. BUG: 306349 BUG: 304838 FIXED-IN: 4.9.2 --- src/panels/terminal/terminalpanel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/panels') 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"); -- cgit v1.3 From 580bcae62c1b0de6b7c6be42f68ead5c6d6c9d19 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 19 Sep 2012 19:00:52 +0200 Subject: Fixes Bug 293200 - Drag&drop files in dolphin doesnt preserve origin Patch 106381 Comment #3: When "Open folders during drag operations" is enabled, two things happen, both in the DolphinView and in the Folders Panel: 1) When hovering a folder that can be expanded (this is the case for folders with sub-folders in the Folders Panel and in the DolphinView if in Details View mode), toggle its "expanded" state. 2) When hovering a folder that can not be expanded (i.e., a folder without sub-folders or any folder in Icons or Compact View), open this folder in the DolphinView via the KItemListController's itemActivated(int) signal. The bug described in bug 293200 comment 3 is that 1) is always wanted, but 2) is not wanted for the Folders Panel. BUG: 293200 FIXED-IN: 4.9.2 --- src/kitemviews/kitemlistcontroller.cpp | 13 ++++++++++++- src/kitemviews/kitemlistcontroller.h | 10 ++++++++++ src/panels/folders/folderspanel.cpp | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/panels') diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 88f5d9f7c..52f8e0078 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -47,6 +47,7 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v m_selectionTogglePressed(false), m_clearSelectionIfItemsAreNotDragged(false), m_selectionBehavior(NoSelection), + m_autoActivationBehavior(ActivationAndExpansion), m_model(0), m_view(0), m_selectionManager(new KItemListSelectionManager(this)), @@ -157,6 +158,16 @@ 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::setAutoActivationDelay(int delay) { m_autoActivationTimer->setInterval(delay); @@ -471,7 +482,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); } } diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index a88152622..1ffd78564 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -64,6 +64,7 @@ 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) public: enum SelectionBehavior { @@ -72,6 +73,11 @@ public: MultiSelection }; + enum AutoActivationBehavior { + ActivationAndExpansion, + ExpansionOnly + }; + /** * @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 +97,9 @@ public: void setSelectionBehavior(SelectionBehavior behavior); SelectionBehavior selectionBehavior() const; + void setAutoActivationBehavior(AutoActivationBehavior behavior); + AutoActivationBehavior autoActivationBehavior() 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 +296,7 @@ private: bool m_selectionTogglePressed; bool m_clearSelectionIfItemsAreNotDragged; SelectionBehavior m_selectionBehavior; + AutoActivationBehavior m_autoActivationBehavior; KItemModelBase* m_model; KItemListView* m_view; KItemListSelectionManager* m_selectionManager; diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 0760200b6..e04842c4c 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -140,6 +140,7 @@ 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->setAutoActivationDelay(750); m_controller->setSingleClickActivation(true); -- cgit v1.3 From 4855b582b48beafd99c13f591bb9c814807c812d Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 20 Sep 2012 17:56:00 +0200 Subject: Fixes Bug 304878 - Dolphin shows "ghost" folders in places after autofs umount nfs shares BUG: 304878 REVIEW: 106456 FIXED-IN: 4.9.2 --- src/panels/places/placesitemmodel.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/panels') diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index bd50c9a4b..706092bc7 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); + } } } } -- cgit v1.3 From 904d7b0701f742328c531d262b345b0b2cba5f5a Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 20 Sep 2012 17:56:32 +0200 Subject: Restore old behavior: Navigating by double-clicking in folder panel (Double-Click - show folder content and expand folder) BUG: 295573 REVIEW: 106497 FIXED-IN: 4.9.2 --- src/kitemviews/kitemlistcontroller.cpp | 19 +++++++++++++++++++ src/kitemviews/kitemlistcontroller.h | 10 ++++++++++ src/panels/folders/folderspanel.cpp | 1 + 3 files changed, 30 insertions(+) (limited to 'src/panels') diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 52f8e0078..41a86324b 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -48,6 +48,7 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v m_clearSelectionIfItemsAreNotDragged(false), m_selectionBehavior(NoSelection), m_autoActivationBehavior(ActivationAndExpansion), + m_mouseDoubleClickAction(ActivateItemOnly), m_model(0), m_view(0), m_selectionManager(new KItemListSelectionManager(this)), @@ -168,6 +169,16 @@ KItemListController::AutoActivationBehavior KItemListController::autoActivationB 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); @@ -755,6 +766,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 1ffd78564..235e4a9eb 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -65,6 +65,7 @@ class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject 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 { @@ -78,6 +79,11 @@ public: 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. @@ -100,6 +106,9 @@ public: 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 @@ -297,6 +306,7 @@ private: 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/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index e04842c4c..13093fff6 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -141,6 +141,7 @@ 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); -- cgit v1.3