Jump to content

GSoC/2016/StatusReports/ArnavDhamija: Difference between revisions

From KDE Community Wiki
Added a status report (still in progress)
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= GSoC 2016 Project Report - A KIO Slave for making discontinuous file selections =
= A Stash KIO Slave for making discontinuous file selections =


== Introduction ==
== Introduction ==
Line 5: Line 5:
Selecting multiple files in any file manager for copying and pasting has never been a pleasant experience, especially if the files are in a non-continuous order. Often, when selecting files using Ctrl+A or the selection tool, we find that we need to select only a subset of the required files we have selected. This leads to the unwieldy operation of removing files from our selection. Of course, the common workaround is to create a new folder and to put all the items in this folder prior to copying, but this is a very inefficient and very slow process if large files need to be copied. Moreover Ctrl+Click requires fine motor skills to not lose the entire selection of files.
Selecting multiple files in any file manager for copying and pasting has never been a pleasant experience, especially if the files are in a non-continuous order. Often, when selecting files using Ctrl+A or the selection tool, we find that we need to select only a subset of the required files we have selected. This leads to the unwieldy operation of removing files from our selection. Of course, the common workaround is to create a new folder and to put all the items in this folder prior to copying, but this is a very inefficient and very slow process if large files need to be copied. Moreover Ctrl+Click requires fine motor skills to not lose the entire selection of files.


This is an original project with a novel solution to this problem. My solution is to add a virtual folder in Dolphin where the links to files and folders can be temporarily saved for a session. The files and folders are "staged" on this virtual folder. Files can be added to this by using a right-click context menu option, using the mouse scroll click, or by drag and drop. Hence, complex file operations such as moving files across many devices can be made easy by staging the operation before performing it.
This is an original project with a novel solution to this problem. My solution is to add a virtual folder in all KIO applications, where the links to files and folders can be temporarily saved for a session. The files and folders are "staged" on this virtual folder. Files can be added to this by using all the regular file management operations such as Move, Copy and Paste, or by drag and drop. Hence, complex file operations such as moving files across many devices can be made easy by staging the operation before performing it.


== Description ==
This project required an in-depth understanding of the use of KDE I/O (KIO) slaves. However, existing documentation on setting up KF5-type KIO slaves is rather sparse, and as a part of this project, I created a [http://arnavdhamija.blogspot.in/2016/06/gsoc-update-writing-kio-slave-101.html tutorial] on writing a simple KIO slave.


This project consists of the following modules:
== Project Overview ==
 
This project consists of the following modules. As there is no existing implementation in KIO for managing virtual directories, all the following modules were written completely from scratch.


=== KIO Slave ===
=== KIO Slave ===


The KIO slave is the backbone of the project. This KIO slave is resposible for interfacing with the GUI of a KDE application and provides the methods for various operations such as copying, deleting, and renaming files. All operations on the KIO slave are applied on a virtual stash filesystem (explained below). These operations are applied through inter process communication using the Qt's D-Bus API.
The KIO slave is the backbone of the project. This KIO slave is responsible for interfacing with the GUI of a KDE application and provides the methods for various operations such as copying, deleting, and renaming files. All operations on the KIO slave are applied on a virtual stash filesystem (explained below). These operations are applied through inter process communication using the Qt's D-Bus API.


The advantage of the KIO slave is that it provides a consistent experience throughout the entire KDE suite of applications. Hence, this feature would work with all KIO compatible applications.
The advantage of the KIO slave is that it provides a consistent experience throughout the entire KDE suite of applications. Hence, this feature would work with all KIO compatible applications.
Line 21: Line 23:
The Stash File System (SFS) is used for virtually staging all the files and directories added to the ioslave. When a file is copied to the SFS, a new File Node is created to it under the folder to which it is copied. On copying a folder, a new Directory Node is created on the SFS with all the files and directories under it copied recursively as dictated by KIO. The SFS is a very important feature of the project as it allows the user to create folders and move items on the stash ioslave without touching the physical file system at all. Once a selection is curated on the ioslave, it can be seamlessly copied to the physical filesystem.
The Stash File System (SFS) is used for virtually staging all the files and directories added to the ioslave. When a file is copied to the SFS, a new File Node is created to it under the folder to which it is copied. On copying a folder, a new Directory Node is created on the SFS with all the files and directories under it copied recursively as dictated by KIO. The SFS is a very important feature of the project as it allows the user to create folders and move items on the stash ioslave without touching the physical file system at all. Once a selection is curated on the ioslave, it can be seamlessly copied to the physical filesystem.


The SFS is implemented using a QHash pair of a URL containing the location of the file on the SFS and the value containing a StashNodeData object which contains all the properties (such as file name, source, children files for directories) of a given node in SFS.
The SFS is implemented using a QHash pair of the URL as a key, containing the location of the file on the SFS and the value containing a StashNodeData object which contains all the properties (such as file name, source, children files for directories) of a given node in SFS.


Memory use of the SFS is nominal on a per file basis - each file staged on the SFS requires roughly 300 bytes of memory.
Memory use of the SFS is nominal on a per file basis - each file staged on the SFS requires roughly 300 bytes of memory.
Line 29: Line 31:
The Stash File System runs in the KDE Daemon (kded5) container process. An object of the SFS is created on startup when the daemon is initialized. The daemon responds to calls from the ioslave communicated over the session bus and creates and removes nodes in the SFS.
The Stash File System runs in the KDE Daemon (kded5) container process. An object of the SFS is created on startup when the daemon is initialized. The daemon responds to calls from the ioslave communicated over the session bus and creates and removes nodes in the SFS.


== Feature List ==
== Status ==


Through the course of the project, my mentor and I found ways to implement some features much better than had been implemented in the proposal. Therefore, the features in the final release of the project differ considerably from those proposed in the proposal.
Through the course of the project, my mentor and I found ways to implement some features much better than had been implemented in the proposal. Therefore, the features in the final release of the project differ considerably from those proposed in the proposal. The project is fully functional and close to release ready.


=== Implemented Features ===
=== Implemented Features ===


* '''Volatile Staging of Files and Directories''' - This feature was implemented much beyond the scope of the proposed project. In the proposal, I only wanted to store the URLs of files and folders staged on the virtual directory. While this approach would satisfy the basic needs of the project, it would have not been possible to modify the contents of a directory on the virtual folder on the ioslave itself, The final project took the scope of it much further by allowing one to curate selections entirely on the virtual directory. The proposed project planned to use Baloo by tagging xattr attributes, whereas the final project uses a custom SFS instead, which is a far more efficient approach.
* '''Volatile Staging of Files and Directories''' - This feature was implemented much beyond the scope of the proposed project. In the proposal, I only wanted to store the URLs of files and folders staged on the virtual directory. While this approach would satisfy the basic needs of the project, it would have not been possible to modify the contents of a directory on the virtual folder on the ioslave itself, The final project took the scope of it much further by allowing one to curate selections entirely on the virtual directory. The proposed project planned to use Baloo by tagging xattr attributes, whereas the final project uses the custom Stash File System instead. The SFS is a far more efficient approach for this application.
* '''One click opening of Stash ioslave in a separate split view''' - This was implemented as proposed in Dolphin.
* '''KDE Desktop Plasmoid''' - Thanks to the way the ioslave now works, the stash ioslave is fully compatible with the KDE Desktop Folder View Plasmoid and can be used without any modifications.
* '''KDE Desktop Plasmoid''' - Thanks to the way the ioslave now works, the stash ioslave is fully compatible with the KDE Desktop Folder View Plasmoid and can be used without any modifications.


=== Dropped Features ===
=== Dropped Features ===


* '''Saving sessions''' - Files staged on the stash ioslave could be saved to a file which the user could launch later on. Due to the change in the way files are stored in the SFS, there wasn't enough time to test this feature exhaustively.
* '''Saving sessions''' - Files staged on the stash ioslave could be saved to a file which the user could launch later on. Due to the change in the way files are stored in the SFS, there wasn't enough time to test and implement this feature exhaustively.
* '''Different Background Color for the stash ioslave''' - This feature was not implemented as it was later decided it would be jarring for some users and would not work on certain themes.
* '''Different background color for the stash ioslave''' - This feature was not implemented as it was later decided it would be jarring for some users and would not work on certain themes.
* '''Display Source of file on filesystem in tooltip''' - Dolphin already lists the target URL of a KFileItem in the status bar, so this was not required either.
* '''Display source of the file on the filesystem in the tooltip''' - Dolphin already lists the target URL of a KFileItem in the status bar, so this was not required either.
* '''Create a list of symbolic links''' - This feature already exists in Dolphin.
* '''Create a list of symbolic links''' - This feature already exists in Dolphin.


== To Do ==
== Work Report ==
 
The ioslave has been implemented successfuly complete with a unit test suite for fully automatic testing. Hence, the project can be installed as given in the project's README.
 
Things left to do include packaging the project for release with the upcoming version of KDE Applications and introducing the Saving Sessions feature which was dropped from the release for the GSoC.
 
== Relevant Links ==


* [https://github.com/KDE/kio-stash/commits/master?author=shortstheory Project Repository on GitHub (mirrored from KDE)]
* [https://github.com/KDE/kio-stash/commits/master?author=shortstheory Project Repository on GitHub (mirrored from KDE)]
Line 58: Line 53:
* [https://git.reviewboard.kde.org/r/128666/ Patch for making Dolphin compatible with the ioslave]
* [https://git.reviewboard.kde.org/r/128666/ Patch for making Dolphin compatible with the ioslave]
* [http://arnavdhamija.blogspot.in/search/label/GSoC Blogposts related to the project]
* [http://arnavdhamija.blogspot.in/search/label/GSoC Blogposts related to the project]
* [http://arnavdhamija.blogspot.in/2016/06/gsoc-update-writing-kio-slave-101.html KIO Slave tutorial]

Latest revision as of 06:04, 21 August 2016

A Stash KIO Slave for making discontinuous file selections

Introduction

Selecting multiple files in any file manager for copying and pasting has never been a pleasant experience, especially if the files are in a non-continuous order. Often, when selecting files using Ctrl+A or the selection tool, we find that we need to select only a subset of the required files we have selected. This leads to the unwieldy operation of removing files from our selection. Of course, the common workaround is to create a new folder and to put all the items in this folder prior to copying, but this is a very inefficient and very slow process if large files need to be copied. Moreover Ctrl+Click requires fine motor skills to not lose the entire selection of files.

This is an original project with a novel solution to this problem. My solution is to add a virtual folder in all KIO applications, where the links to files and folders can be temporarily saved for a session. The files and folders are "staged" on this virtual folder. Files can be added to this by using all the regular file management operations such as Move, Copy and Paste, or by drag and drop. Hence, complex file operations such as moving files across many devices can be made easy by staging the operation before performing it.

This project required an in-depth understanding of the use of KDE I/O (KIO) slaves. However, existing documentation on setting up KF5-type KIO slaves is rather sparse, and as a part of this project, I created a tutorial on writing a simple KIO slave.

Project Overview

This project consists of the following modules. As there is no existing implementation in KIO for managing virtual directories, all the following modules were written completely from scratch.

KIO Slave

The KIO slave is the backbone of the project. This KIO slave is responsible for interfacing with the GUI of a KDE application and provides the methods for various operations such as copying, deleting, and renaming files. All operations on the KIO slave are applied on a virtual stash filesystem (explained below). These operations are applied through inter process communication using the Qt's D-Bus API.

The advantage of the KIO slave is that it provides a consistent experience throughout the entire KDE suite of applications. Hence, this feature would work with all KIO compatible applications.

Stash File System

The Stash File System (SFS) is used for virtually staging all the files and directories added to the ioslave. When a file is copied to the SFS, a new File Node is created to it under the folder to which it is copied. On copying a folder, a new Directory Node is created on the SFS with all the files and directories under it copied recursively as dictated by KIO. The SFS is a very important feature of the project as it allows the user to create folders and move items on the stash ioslave without touching the physical file system at all. Once a selection is curated on the ioslave, it can be seamlessly copied to the physical filesystem.

The SFS is implemented using a QHash pair of the URL as a key, containing the location of the file on the SFS and the value containing a StashNodeData object which contains all the properties (such as file name, source, children files for directories) of a given node in SFS.

Memory use of the SFS is nominal on a per file basis - each file staged on the SFS requires roughly 300 bytes of memory.

Stash Daemon

The Stash File System runs in the KDE Daemon (kded5) container process. An object of the SFS is created on startup when the daemon is initialized. The daemon responds to calls from the ioslave communicated over the session bus and creates and removes nodes in the SFS.

Status

Through the course of the project, my mentor and I found ways to implement some features much better than had been implemented in the proposal. Therefore, the features in the final release of the project differ considerably from those proposed in the proposal. The project is fully functional and close to release ready.

Implemented Features

  • Volatile Staging of Files and Directories - This feature was implemented much beyond the scope of the proposed project. In the proposal, I only wanted to store the URLs of files and folders staged on the virtual directory. While this approach would satisfy the basic needs of the project, it would have not been possible to modify the contents of a directory on the virtual folder on the ioslave itself, The final project took the scope of it much further by allowing one to curate selections entirely on the virtual directory. The proposed project planned to use Baloo by tagging xattr attributes, whereas the final project uses the custom Stash File System instead. The SFS is a far more efficient approach for this application.
  • KDE Desktop Plasmoid - Thanks to the way the ioslave now works, the stash ioslave is fully compatible with the KDE Desktop Folder View Plasmoid and can be used without any modifications.

Dropped Features

  • Saving sessions - Files staged on the stash ioslave could be saved to a file which the user could launch later on. Due to the change in the way files are stored in the SFS, there wasn't enough time to test and implement this feature exhaustively.
  • Different background color for the stash ioslave - This feature was not implemented as it was later decided it would be jarring for some users and would not work on certain themes.
  • Display source of the file on the filesystem in the tooltip - Dolphin already lists the target URL of a KFileItem in the status bar, so this was not required either.
  • Create a list of symbolic links - This feature already exists in Dolphin.

Work Report