From 5454283008f26d377a6403861a3cdd7992dbbd38 Mon Sep 17 00:00:00 2001 From: Andreas Krutzler Date: Fri, 27 Oct 2017 07:01:54 -0600 Subject: Two clicks on file/folder to rename Summary: Make renaming of files/folders faster by clicking a second time on the items text to start renaming. BUG: 205157 Test Plan: This feature works as follows: 1. select an item by single-click, or one is already selected 2. wait the "double-click-interval" 3. click on the items text 4. none of the cancellations (see below) happens within the double-click-interval 5. inline-renaming starts Cancellations: * open any file/folder * select different item(s) * start dragging items * Dolphin loses focus This feature is just enabled while "Double-click to open files and folders" in system-settings and "Rename inline" in Dolphin are enabled. Reviewers: #dolphin, #kde_applications, elvisangelaccio, emmanuelp, ngraham, markg, rkflx Reviewed By: #dolphin, #kde_applications, elvisangelaccio, ngraham, rkflx Subscribers: rkflx, markg, funkybomber, sars, elvisangelaccio, ngraham Differential Revision: https://phabricator.kde.org/D7647 --- src/views/dolphinview.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/views/dolphinview.h') diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 911103b5d..2df1cf9e4 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -577,6 +577,7 @@ private slots: void slotModelChanged(KItemModelBase* current, KItemModelBase* previous); void slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons); void slotRenameDialogRenamingFinished(const QList& urls); + void slotSelectedItemTextPressed(int index); /* * Is called when new items get pasted or dropped. @@ -707,6 +708,8 @@ private slots: */ void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const; + void slotTwoClicksRenamingTimerTimeout(); + private: void loadDirectory(const QUrl& url, bool reload = false); @@ -769,6 +772,8 @@ private: */ void forceUrlsSelection(const QUrl& current, const QList& selected); + void abortTwoClicksRenaming(); + private: void updatePalette(); @@ -804,6 +809,9 @@ private: VersionControlObserver* m_versionControlObserver; + QTimer* m_twoClicksRenamingTimer; + QUrl m_twoClicksRenamingItemUrl; + // For unit tests friend class TestBase; friend class DolphinDetailsViewTest; -- cgit v1.3.1